You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm seeing an internal compiler error on the following input (found by fuzz-rustc):
const e = &&39;pubfnmain(){}
$ rustc main.rs
error: missing type for `const` item
--> main.rs:1:7
|
1 | const e = & & 39;
| ^ help: provide a type for the item: `e: &&i32`
error: internal compiler error: src/librustc_infer/infer/lexical_region_resolve/mod.rs:497: cannot relate region: LUB(ReErased, ReErased)
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:880: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/blob/master/CONTRIBUTING.md#bug-reports
note: rustc 1.44.0-nightly (211365947 2020-03-30) running on x86_64-unknown-linux-gnu
error: aborting due to 2 previous errors
searched nightlies: from nightly-2020-03-09 to nightly-2020-03-31
regressed nightly: nightly-2020-03-20
searched commits: from f509b26 to f4c675c
regressed commit: 57e1da5
Compiling playground v0.0.1(/playground)
error: missing type for `const` item
--> src/main.rs:1:7
|
1 | const e = &&39;
| ^ help: provide a typefor the item: `e:&&i32`
error: internal compiler error: src/librustc_infer/infer/lexical_region_resolve/mod.rs:497:cannot relate region:LUB(ReErased,ReErased)
thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:880:9stack backtrace:0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/libunwind.rs:861:backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.46/src/backtrace/mod.rs:662:std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:783: <std::sys_common::backtrace::_print::DisplayBacktraceas core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:594:core::fmt::write
at src/libcore/fmt/mod.rs:10695:std::io::Write::write_fmt
at src/libstd/io/mod.rs:14396:std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:627:std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:498:std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:1989:std::panicking::default_hook
at src/libstd/panicking.rs:21810:rustc_driver::report_ice
11: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:51512:std::panicking::begin_panic
13: rustc_errors::HandlerInner::bug
14: rustc_errors::Handler::bug
15: rustc_middle::util::bug::opt_span_bug_fmt::{{closure}}16: rustc_middle::ty::context::tls::with_opt::{{closure}}17: rustc_middle::ty::context::tls::with_opt
18: rustc_middle::util::bug::opt_span_bug_fmt
19: rustc_middle::util::bug::bug_fmt
20: rustc_infer::infer::lexical_region_resolve::LexicalResolver::lub_concrete_regions
21: rustc_infer::infer::lexical_region_resolve::LexicalResolver::sub_concrete_regions
22: rustc_infer::infer::lexical_region_resolve::LexicalResolver::infer_variable_values
23: rustc_infer::infer::lexical_region_resolve::resolve
24: rustc_infer::infer::InferCtxt::resolve_regions_and_report_errors
25: rustc_typeck::check::regionck::<impl rustc_typeck::check::FnCtxt>::regionck_item
26: rustc_middle::ty::context::GlobalCtxt::enter_local
27: rustc_typeck::check::wfcheck::check_item_type
28: rustc_typeck::check::wfcheck::check_item_well_formed
29: 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
30: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
31: rustc_query_system::query::plumbing::get_query
32: rustc_query_system::query::plumbing::ensure_query
33: rustc_data_structures::sync::par_for_each_in
34: rustc_hir::hir::Crate::par_visit_all_item_likes
35: rustc_session::session::Session::track_errors
36: rustc_typeck::check_crate
37: rustc_interface::passes::analysis
38: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt>for rustc_middle::ty::query::queries::analysis>::compute
39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
40: rustc_query_system::query::plumbing::get_query
41: rustc_middle::ty::context::tls::enter_global
42: rustc_interface::interface::run_compiler_in_existing_thread_pool
43: scoped_tls::ScopedKey<T>::set
44: rustc_ast::attr::with_globals
note:Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
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.44.0-nightly (76b11980a 2020-04-01) running on x86_64-unknown-linux-gnu
note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type bin
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0[check_item_well_formed] processing `e`
#1[analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors
error: could not compile `playground`.To learn more, run the command again with --verbose.
We should replace all regions in that situation with 'static, just so the code which ICEs here will continue to ICE for legitimate bugs.
Hmmmm, I'm not sure I agree with that assessment, unless -- well -- I guess you're saying that the "correct static type" for any such expression would be 'static anyway?
I have no idea why changing const e = to const e: _ = changes anything but they should both ICE IMO (before we switch to replacing erased regions with 'static).
I'm now worried there are other places in which typeck_tables_of is used to extract some type and "export" it outside of the context of the body, without the necessary precautions.
Activity
dwrensha commentedon Mar 31, 2020
Report from
cargo bisect-rustc:searched nightlies: from nightly-2020-03-09 to nightly-2020-03-31
regressed nightly: nightly-2020-03-20
searched commits: from f509b26 to f4c675c
regressed commit: 57e1da5
Centril commentedon Mar 31, 2020
This is presumably due to #69189 -- cc @matthewjasper
spastorino commentedon Apr 1, 2020
This was briefly discussed in our Zulip pre-triage meeting. Tagging it as
P-high.Not removing nomination until we can assign this issue.
Centril commentedon Apr 2, 2020
pnkfelix commentedon Apr 2, 2020
@rustbot assign @matthewjasper
(assigning based on claim that this was injected by PR #69189)
eddyb commentedon Apr 2, 2020
This is the feature where
type_offor aconstwith a missing type will look at the body and get the type from there.We should replace all regions in that situation with
'static, just so the code which ICEs here will continue to ICE for legitimate bugs.Centril commentedon Apr 2, 2020
Doesn't reproduce with (added
: _):nikomatsakis commentedon Apr 2, 2020
Hmmmm, I'm not sure I agree with that assessment, unless -- well -- I guess you're saying that the "correct static type" for any such expression would be
'staticanyway?eddyb commentedon Apr 2, 2020
@nikomatsakis yes, this is recovery for a guaranteed error, after all.
A slightly more aggressive example:
Results in this query stack for the ICE:
I have no idea why changing
const e =toconst e: _ =changes anything but they should both ICE IMO (before we switch to replacing erased regions with'static).I'm now worried there are other places in which
typeck_tables_ofis used to extract some type and "export" it outside of the context of the body, without the necessary precautions.Rollup merge of rust-lang#70716 - matthewjasper:infer-const-type-regi…