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

ICE broken MIR in DefID #58396

Closed
hellow554 opened this issue Feb 12, 2019 · 2 comments
Closed

ICE broken MIR in DefID #58396

hellow554 opened this issue Feb 12, 2019 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@hellow554
Copy link
Contributor

hellow554 commented Feb 12, 2019

While trying to minimize #58344 I found a possible other ICE. If this is the same, please feel free to close this issue and I will add it as a simpler example to that issue.

use std::ops::Add;

fn add_generic<A>() -> impl IntoIterator<Item = A> {
    vec![]
}

pub fn add_one() -> impl IntoIterator<Item = <u32 as Add<u32>>::Output> {
    add_generic()
}

(Playground)

Errors:

   Compiling playground v0.0.1 (/playground)
error: internal compiler error: broken MIR in DefId(0/0:5 ~ playground[9fb9]::add_one[0]) (Terminator { source_info: SourceInfo { span: src/lib.rs:8:5: 8:18, scope: scope[0] }, kind: _0 = const add_generic() -> [return: bb2, unwind: bb1] }): call dest mismatch (impl std::iter::IntoIterator <- impl std::iter::IntoIterator): NoSolution
 --> src/lib.rs:7:1
  |
7 | / pub fn add_one() -> impl IntoIterator<Item = <u32 as Add<u32>>::Output> {
8 | |     add_generic()
9 | | }
  | |_^

error: internal compiler error: errors selecting obligation during MIR typeck: [FulfillmentError(Obligation(predicate=Binder(ProjectionPredicate(ProjectionTy { substs: [impl std::iter::IntoIterator], item_def_id: DefId(2/0:2219 ~ core[4904]::iter[0]::traits[0]::collect[0]::IntoIterator[0]::Item[0]) }, <u32 as std::ops::Add>::Output)),depth=0),MismatchedProjectionTypes(Sorts(ExpectedFound { expected: u32, found: <u32 as std::ops::Add>::Output })))]

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:329:17
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:70
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:58
             at src/libstd/panicking.rs:200
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:215
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:482
   6: std::panicking::begin_panic
   7: <rustc_errors::Handler as core::ops::drop::Drop>::drop
   8: core::ptr::real_drop_in_place
   9: core::ptr::real_drop_in_place
  10: core::ptr::real_drop_in_place
  11: syntax::with_globals
  12: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:90
  13: <F as alloc::boxed::FnBox<A>>::call_box
  14: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/57d7cfc3cf50f0c427ad3043ff09eaef20671320/src/liballoc/boxed.rs:744
             at src/libstd/sys_common/thread.rs:14
             at src/libstd/sys/unix/thread.rs:81
  15: start_thread
  16: __clone
query stack during panic:
end of query stack

error: internal compiler error: unexpected panic
note: rustc 1.34.0-nightly (57d7cfc3c 2019-02-11) running on x86_64-unknown-linux-gnu

note: compiler flags: -C opt-level=3 -C codegen-units=1 --crate-type lib

Happens on stable, beta and nightly

@matthewjasper matthewjasper added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html labels Feb 12, 2019
@hellow554
Copy link
Contributor Author

Okay. After some investigation this seems like a dupe of the references issue. Only difference between them is, that the original issue has to ICE

error: internal compiler error: broken MIR in DefId(0/0:14 ~ bar[7a72]::main[0]) (NoSolution): could not prove Binder(TraitPredicate(<impl Trait<<u32 as std::ops::Add>::Output> as Trait<u32>>))

error: internal compiler error: broken MIR in DefId(0/0:14 ~ bar[7a72]::main[0]) (Terminator { source_info: SourceInfo { span: src/lib.rs:47:5: 47:26, scope: scope[0] }, kind: _1 = const <Either<L, R>>::converge(move _2) -> [return: bb3, unwind: bb4] }): call dest mismatch (<u32 as std::ops::Add>::Output <- u32): NoSolution

and mine one has the later one. Maybe one would like to have tests for both? If somebody decides the original one is enough, then I he/she can close this :)

@estebank estebank added the A-diagnostics Area: Messages for errors, warnings, and lints label Feb 12, 2019
@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 19, 2019
@jonas-schievink
Copy link
Contributor

Closing as a duplicate of #58344, but that reproduction is very good, so I left a comment there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints A-MIR Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants