Skip to content

Commit ab946dd

Browse files
committed
Add delay_span_bug to no longer ICE
1 parent b202532 commit ab946dd

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

compiler/rustc_typeck/src/collect/type_of.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,13 @@ pub(super) fn opt_const_param_of(tcx: TyCtxt<'_>, def_id: LocalDefId) -> Option<
7979
let _tables = tcx.typeck(body_owner);
8080
&*path
8181
}
82-
_ => span_bug!(DUMMY_SP, "unexpected const parent path {:?}", parent_node),
82+
_ => {
83+
tcx.sess.delay_span_bug(
84+
tcx.def_span(def_id),
85+
&format!("unexpected const parent path {:?}", parent_node),
86+
);
87+
return None;
88+
}
8389
};
8490

8591
// We've encountered an `AnonConst` in some path, so we need to

src/test/ui/issues/issue-78622.rs

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_type = "lib"]
2+
3+
struct S;
4+
fn f() {
5+
S::A::<f> {}
6+
//~^ ERROR ambiguous associated type
7+
}

src/test/ui/issues/issue-78622.stderr

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0223]: ambiguous associated type
2+
--> $DIR/issue-78622.rs:5:5
3+
|
4+
LL | S::A::<f> {}
5+
| ^^^^^^^^^ help: use fully-qualified syntax: `<S as Trait>::A`
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0223`.

0 commit comments

Comments
 (0)