Skip to content

Commit 7519eac

Browse files
committed
Auto merge of #60721 - estebank:ice-ice-baby, r=varkor
Avoid ICE by using delay_span_bug Fix #59406, fix #53498.
2 parents acc7e65 + adc18eb commit 7519eac

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
@@ -5474,10 +5474,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
54745474
match self.at(&self.misc(span), self.param_env).sup(impl_ty, self_ty) {
54755475
Ok(ok) => self.register_infer_ok_obligations(ok),
54765476
Err(_) => {
5477-
span_bug!(span,
5477+
self.tcx.sess.delay_span_bug(span, &format!(
54785478
"instantiate_value_path: (UFCS) {:?} was a subtype of {:?} but now is not?",
54795479
self_ty,
5480-
impl_ty);
5480+
impl_ty,
5481+
));
54815482
}
54825483
}
54835484
}

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)