Skip to content

Commit

Permalink
Add delay_span_bug to no longer ICE
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianKnodt committed Nov 1, 2020
1 parent b202532 commit ab946dd
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion compiler/rustc_typeck/src/collect/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
let _tables = tcx.typeck(body_owner);
&*path
}
_ => span_bug!(DUMMY_SP, "unexpected const parent path {:?}", parent_node),
_ => {
tcx.sess.delay_span_bug(
tcx.def_span(def_id),
&format!("unexpected const parent path {:?}", parent_node),
);
return None;
}
};

// We've encountered an `AnonConst` in some path, so we need to
Expand Down
7 changes: 7 additions & 0 deletions src/test/ui/issues/issue-78622.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#![crate_type = "lib"]

struct S;
fn f() {
S::A::<f> {}
//~^ ERROR ambiguous associated type
}
9 changes: 9 additions & 0 deletions src/test/ui/issues/issue-78622.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0223]: ambiguous associated type
--> $DIR/issue-78622.rs:5:5
|
LL | S::A::<f> {}
| ^^^^^^^^^ help: use fully-qualified syntax: `<S as Trait>::A`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0223`.

0 comments on commit ab946dd

Please sign in to comment.