Closed
Description
Repro:
pub trait Trait {}
#[repr(transparent)]
pub struct Wrapper<T: Trait>(T);
#[repr(transparent)]
pub struct Ref<'a>(&'a u8);
impl Trait for Ref {}
extern "C" {
pub fn repro(_: Wrapper<Ref>);
}
As of current nightly:
$ RUST_BACKTRACE=1 rustc +nightly-2020-12-29 src/lib.rs --crate-type lib
thread 'rustc' panicked at 'internal error: entered unreachable code', compiler/rustc_infer/src/infer/error_reporting/mod.rs:156:14
stack backtrace:
0: rust_begin_unwind
at /rustc/2987785df3d46d5ff144a5c67fbb8f5cca798d78/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/2987785df3d46d5ff144a5c67fbb8f5cca798d78/library/core/src/panicking.rs:92:14
2: core::panicking::panic
at /rustc/2987785df3d46d5ff144a5c67fbb8f5cca798d78/library/core/src/panicking.rs:50:5
3: rustc_infer::infer::error_reporting::msg_span_from_free_region
4: rustc_infer::infer::error_reporting::note_and_explain_region
5: rustc_infer::infer::error_reporting::note::<impl rustc_infer::infer::InferCtxt>::report_concrete_failure
6: rustc_infer::infer::error_reporting::<impl rustc_infer::infer::InferCtxt>::report_region_errors
7: rustc_infer::infer::InferCtxt::resolve_regions_and_report_errors
8: rustc_typeck::check::regionck::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::regionck_item
9: rustc_infer::infer::InferCtxtBuilder::enter
10: rustc_typeck::check::wfcheck::check_item_well_formed
11: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::check_item_well_formed>::compute
12: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
13: rustc_data_structures::stack::ensure_sufficient_stack
14: rustc_query_system::query::plumbing::get_query_impl
15: rustc_query_system::query::plumbing::ensure_query_impl
16: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc_hir::itemlikevisit::ParItemLikeVisitor>::visit_item
17: rustc_data_structures::sync::par_for_each_in
18: rustc_hir::hir::Crate::par_visit_all_item_likes
19: rustc_session::session::Session::track_errors
20: rustc_typeck::check_crate
21: rustc_interface::passes::analysis
22: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::analysis>::compute
23: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
24: rustc_data_structures::stack::ensure_sufficient_stack
25: rustc_query_system::query::plumbing::get_query_impl
26: rustc_interface::passes::QueryContext::enter
27: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
28: rustc_span::with_source_map
29: rustc_interface::interface::create_compiler_and_run
note: rustc 1.51.0-nightly (2987785df 2020-12-28) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [check_item_well_formed] checking that `` is well-formed
#1 [analysis] running analysis passes on this crate
end of query stack
This is the unreachable line:
The same crash reproduces back to 1.47.0. Older stable compilers do not crash:
$ RUST_BACKTRACE=1 rustc +1.46.0 src/lib.rs --crate-type lib
error[E0726]: implicit elided lifetime not allowed here
--> src/lib.rs:9:16
|
9 | impl Trait for Ref {}
| ^^^- help: indicate the anonymous lifetime: `<'_>`
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsCategory: This is a bug.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.