Closed
Description
rustc
ICEes when trying to compile the following code. As far as I can tell, the issue is due to the HRTB. All other issues I found mentioning broken MIR in DefId
where either using unstable features and/or related to impl Trait
which seems to be unrelated to this issue.
use std::sync::mpsc::channel;
pub struct S<T> {
pub thing: T,
}
#[derive(Debug)]
struct E;
impl std::fmt::Display for E {
fn fmt(&self, _f: &mut std::fmt::Formatter) -> std::fmt::Result {
unimplemented!()
}
}
impl std::error::Error for E {}
impl<T> S<T> {
pub fn do_thing()
where
for<'a> &'a T: 'static,
{
let (_sender, rx) = channel::<T>();
let _ = rx.recv().map_err(|_| E);
}
}
Meta
On the playground, I am able to reproduce the ICE on stable (1.33), beta, and nightly. Locally I have the following setup:
rustc --version --verbose
:
rustc 1.33.0 (2aa4c46cf 2019-02-28)
binary: rustc
commit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858
commit-date: 2019-02-28
host: x86_64-unknown-linux-gnu
release: 1.33.0
LLVM version: 8.0
Backtrace:
error: internal compiler error: broken MIR in DefId(0/0:9 ~ playground[59ee]::{{impl}}[2]::do_thing[0]) (NoSolution): could not prove Binder(OutlivesPredicate(&'a T, ReStatic))
--> src/lib.rs:24:35
|
24 | let _ = rx.recv().map_err(|_| E);
| ^^^^^
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', src/librustc_errors/lib.rs:322:17
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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: <scoped_tls::ScopedKey<T>>::set
Metadata
Metadata
Assignees
Labels
Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.htmlCategory: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Relevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.