Check the invariant for principal inside the method

This commit is contained in:
Oliver Scherer 2018-10-13 11:32:49 +02:00
parent 849a0e9c40
commit 78aaa3e546
25 changed files with 111 additions and 150 deletions

View file

@ -435,12 +435,7 @@ fn trait_pointer_metadata(
// But it does not describe the trait's methods.
let containing_scope = match trait_type.sty {
ty::Dynamic(ref data, ..) => if let Some(principal) = data.principal() {
let def_id = principal.def_id();
Some(get_namespace_for_item(cx, def_id))
} else {
NO_SCOPE_METADATA
},
ty::Dynamic(ref data, ..) => Some(get_namespace_for_item(cx, data.principal().def_id())),
_ => {
bug!("debuginfo: Unexpected trait-object type in \
trait_pointer_metadata(): {:?}",