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

Rustc panics (NoSolution): could not prove Binder(projection soup) #65581

Closed
tage64 opened this issue Oct 19, 2019 · 2 comments · Fixed by #77741
Closed

Rustc panics (NoSolution): could not prove Binder(projection soup) #65581

tage64 opened this issue Oct 19, 2019 · 2 comments · Fixed by #77741
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-trait-system Area: Trait system C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@tage64
Copy link

tage64 commented Oct 19, 2019

I tried this code:

#![allow(dead_code)]
trait Trait1<T, U> {
    fn f1(self) -> U;
}

trait Trait2 {
    type T;
    type U: Trait2<T = Self::T>;
    fn f2(f: impl FnOnce(&Self::U));
}

fn f3<T: Trait2>() -> impl Trait1<T, T::T> {
    Struct1
}

struct Struct1;

impl<T: Trait2> Trait1<T, T::T> for Struct1 {
    fn f1(self) -> T::T {
        unimplemented!()
    }
}

fn f4<T: Trait2>() {
    T::f2(|_| {
        f3::<T::U>().f1();
    });
}

I expected to see this happen: Rustc should either print an error message or compile my code.

Instead, this happened: Rustc panics.

Meta

rustc --version --verbose:
rustc 1.38.0 (625451e 2019-09-23)
binary: rustc
commit-hash: 625451e
commit-date: 2019-09-23
host: x86_64-unknown-linux-gnu
release: 1.38.0
LLVM version: 9.0

Backtrace:
Put the above code in myfile.rs and execute:
RUST_BACKTRACE=1 rustc myfile.rs --crate-type=lib:

error: internal compiler error: broken MIR in DefId(0:31 ~ lib[8787]::f4[0]::{{closure}}[0]) (NoSolution): could not prove Binder(TraitPredicate(<impl Trait1<<T as Trait2>::U, <<T as Trait2>::U as Trait2>::T> as Trait1<<T as Trait2>::U, <T as Trait2>::T>>))

error: internal compiler error: broken MIR in DefId(0:31 ~ lib[8787]::f4[0]::{{closure}}[0]) (Terminator { source_info: SourceInfo { span: src/lib.rs:26:9: 26:26, scope: scope[0] }, kind: _3 = const <impl Trait1<<T as Trait2>::U, <<T as Trait2>::U as Trait2>::T> as Trait1<<T as Trait2>::U, <<T as Trait2>::U as Trait2>::T>>::f1(move _4) -> [return: bb3, unwind: bb4] }): call dest mismatch (<<T as Trait2>::U as Trait2>::T <- <T as Trait2>::T): NoSolution
  --> src/lib.rs:25:11
   |
25 |       T::f2(|_| {
   |  ___________^
26 | |         f3::<T::U>().f1();
27 | |     });
   | |_____^

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:361:17
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.aaakk.us.kg-1ecc6299db9ec823/backtrace-0.3.34/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::begin_panic
   9: <rustc_errors::Handler as core::ops::drop::Drop>::drop
  10: core::ptr::real_drop_in_place
  11: <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop
  12: core::ptr::real_drop_in_place
  13: rustc_interface::interface::run_compiler_in_existing_thread_pool
  14: std::thread::local::LocalKey<T>::with
  15: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports

note: rustc 1.38.0 (625451e37 2019-09-23) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type lib
@JohnTitor JohnTitor added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ labels Oct 19, 2019
@Centril Centril added I-nominated T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-trait-system Area: Trait system labels Oct 19, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 19, 2019
@pnkfelix
Copy link
Member

triage: P-high. Removing nomination label.

reasoning: ICE is pretty inscrutable, and there's no other error diagnostic, so this is a frustrating scenario for the end user. But removing nomination because there isn't really anything to discuss amongst team beyond the prioritization.

@pnkfelix pnkfelix added P-high High priority and removed I-nominated labels Oct 24, 2019
@pnkfelix pnkfelix changed the title Rustc panics when compiling some code Rustc panics (NoSolution): could not prove Binder(projection soup) Oct 24, 2019
@JohnTitor
Copy link
Member

Triage: This is no longer ICE with the latest nightly, marking as E-needs-test.

@JohnTitor JohnTitor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Oct 7, 2020
@bors bors closed this as completed in 5565241 Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-impl-trait Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch. A-trait-system Area: Trait system C-bug Category: This is a bug. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-high High priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants