Closed
Description
Code
trait Foo<'a> {}
fn or<'a>(first: &'static dyn Foo<'a>) -> dyn Foo<'a> {
return Box::new(panic!());
}
Happens on stable, beta, and nightly.
Error output
Compiling playground v0.0.1 (/playground)
warning: unreachable call
--> src/lib.rs:4:12
|
4 | return Box::new(panic!());
| ^^^^^^^^ -------- any code following this expression is unreachable
| |
| unreachable call
|
= note: `#[warn(unreachable_code)]` on by default
error: internal compiler error: compiler/rustc_infer/src/infer/canonical/canonicalizer.rs:295:21: escaping late-bound region during canonicalization
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1170:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md
note: rustc 1.59.0-nightly (0b42deacc 2021-12-09) running on x86_64-unknown-linux-gnu
note: compiler flags: -C opt-level=3 -C embed-bitcode=no -C codegen-units=1 --crate-type lib
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [typeck] type-checking `or`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
warning: `playground` (lib) generated 1 warning
error: could not compile `playground`; 1 warning emitted