Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid ICE by using delay_span_bug #60721

Merged
merged 1 commit into from
May 11, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/librustc_typeck/check/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5653,10 +5653,11 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
match self.at(&self.misc(span), self.param_env).sup(impl_ty, self_ty) {
Ok(ok) => self.register_infer_ok_obligations(ok),
Err(_) => {
span_bug!(span,
self.tcx.sess.delay_span_bug(span, &format!(
"instantiate_value_path: (UFCS) {:?} was a subtype of {:?} but now is not?",
self_ty,
impl_ty);
impl_ty,
));
}
}
}
Expand Down
17 changes: 17 additions & 0 deletions src/test/ui/issues/issue-53498.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
pub mod test {
pub struct A;
pub struct B;
pub struct Foo<T>(T);

impl Foo<A> {
fn foo() {}
}

impl Foo<B> {
fn foo() {}
}
}

fn main() {
test::Foo::<test::B>::foo(); //~ ERROR method `foo` is private
}
9 changes: 9 additions & 0 deletions src/test/ui/issues/issue-53498.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0624]: method `foo` is private
--> $DIR/issue-53498.rs:16:5
|
LL | test::Foo::<test::B>::foo();
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

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