Skip to content

Commit adc18eb

Browse files
committed
Avoid ICE by using delay_span_bug
1 parent 33cde4a commit adc18eb

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

src/librustc_typeck/check/mod.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -5653,10 +5653,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
56535653
match self.at(&self.misc(span), self.param_env).sup(impl_ty, self_ty) {
56545654
Ok(ok) => self.register_infer_ok_obligations(ok),
56555655
Err(_) => {
5656-
span_bug!(span,
5656+
self.tcx.sess.delay_span_bug(span, &format!(
56575657
"instantiate_value_path: (UFCS) {:?} was a subtype of {:?} but now is not?",
56585658
self_ty,
5659-
impl_ty);
5659+
impl_ty,
5660+
));
56605661
}
56615662
}
56625663
}

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

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
pub mod test {
2+
pub struct A;
3+
pub struct B;
4+
pub struct Foo<T>(T);
5+
6+
impl Foo<A> {
7+
fn foo() {}
8+
}
9+
10+
impl Foo<B> {
11+
fn foo() {}
12+
}
13+
}
14+
15+
fn main() {
16+
test::Foo::<test::B>::foo(); //~ ERROR method `foo` is private
17+
}

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

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0624]: method `foo` is private
2+
--> $DIR/issue-53498.rs:16:5
3+
|
4+
LL | test::Foo::<test::B>::foo();
5+
| ^^^^^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0624`.

0 commit comments

Comments
 (0)