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

Unused lifetime cause ICE #64173

Closed
DutchGhost opened this issue Sep 5, 2019 · 1 comment · Fixed by #96730
Closed

Unused lifetime cause ICE #64173

DutchGhost opened this issue Sep 5, 2019 · 1 comment · Fixed by #96730
Labels
A-NLL Area: Non Lexical Lifetimes (NLL) E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@DutchGhost
Copy link
Contributor

DutchGhost commented Sep 5, 2019

The following code ICE's on stable, beta and nightly:

use core::mem::size_of;

struct Bug<'s> {
    array: [(); size_of::<&Self>()],
}
Backtrace:
  Compiling playground v0.0.1 (/playground)
error: internal compiler error: src/librustc_mir/borrow_check/nll/universal_regions.rs:741: cannot convert `ReEarlyBound(0, 's)` to a region vid

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:650:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/git.luolix.top-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:47
   3: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:36
   4: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:200
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:214
   6: rustc::util::common::panic_hook
   7: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:481
   8: std::panicking::begin_panic
   9: rustc_errors::Handler::bug
  10: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  11: rustc::ty::context::tls::with_opt::{{closure}}
  12: rustc::ty::context::tls::with_context_opt
  13: rustc::ty::context::tls::with_opt
  14: rustc::util::bug::opt_span_bug_fmt
  15: rustc::util::bug::bug_fmt
  16: rustc_mir::borrow_check::nll::universal_regions::UniversalRegionIndices::to_region_vid::{{closure}}
  17: rustc_mir::borrow_check::nll::type_check::constraint_conversion::ConstraintConversion::to_region_vid
  18: rustc_mir::borrow_check::nll::type_check::constraint_conversion::ConstraintConversion::convert_all
  19: rustc_mir::borrow_check::nll::type_check::TypeChecker::fully_perform_op
  20: rustc_mir::borrow_check::nll::type_check::type_check
  21: rustc_mir::borrow_check::nll::compute_regions
  22: rustc_mir::borrow_check::do_mir_borrowck
  23: rustc::ty::context::GlobalCtxt::enter_local
  24: rustc_mir::borrow_check::mir_borrowck
  25: rustc::ty::query::__query_compute::mir_borrowck
  26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  29: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  30: rustc_mir::transform::optimized_mir
  31: rustc::ty::query::__query_compute::optimized_mir
  32: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  33: rustc::dep_graph::graph::DepGraph::with_task_impl
  34: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  35: rustc_mir::interpret::eval_context::InterpretCx<M>::load_mir
  36: rustc_mir::const_eval::const_eval_raw_provider
  37: rustc::ty::query::__query_compute::const_eval_raw
  38: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval_raw>::compute
  39: rustc::dep_graph::graph::DepGraph::with_task_impl
  40: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  41: rustc_mir::const_eval::const_eval_provider
  42: rustc::ty::query::__query_compute::const_eval
  43: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
  44: rustc::dep_graph::graph::DepGraph::with_task_impl
  45: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  46: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_const
  47: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable for &rustc::ty::TyS>::super_fold_with
  48: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
  49: rustc::traits::project::normalize
  50: rustc_typeck::check::FnCtxt::normalize_associated_types_in
  51: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  52: rustc::ty::context::GlobalCtxt::enter_local
  53: rustc_typeck::check::wfcheck::check_item_well_formed
  54: rustc::ty::query::__query_compute::check_item_well_formed
  55: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::check_item_well_formed>::compute
  56: rustc::dep_graph::graph::DepGraph::with_task_impl
  57: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  58: <rustc_typeck::check::wfcheck::CheckTypeWellFormedVisitor as rustc::hir::itemlikevisit::ParItemLikeVisitor>::visit_item
  59: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:82
  60: rustc_data_structures::sync::par_for_each_in
  61: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:82
  62: rustc::hir::Crate::par_visit_all_item_likes
  63: rustc::util::common::time
  64: rustc_typeck::check_crate
  65: rustc_interface::passes::analysis
  66: rustc::ty::query::__query_compute::analysis
  67: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::analysis>::compute
  68: rustc::dep_graph::graph::DepGraph::with_task_impl
  69: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  70: rustc::ty::context::tls::enter_global
  71: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  72: rustc_interface::passes::create_global_ctxt::{{closure}}
  73: rustc_interface::interface::run_compiler_in_existing_thread_pool
  74: std::thread::local::LocalKey<T>::with
  75: scoped_tls::ScopedKey<T>::set
  76: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [mir_borrowck] processing `Bug::array::{{constant}}#0`
#1 [optimized_mir] processing `Bug::array::{{constant}}#0`
 --> src/lib.rs:4:17
  |
4 |     array: [(); size_of::<&Self>()],
  |                 ^^^^^^^^^^^^^^^^^^
#2 [const_eval_raw] const-evaluating `Bug::array::{{constant}}#0`
#3 [const_eval] const-evaluating + checking `Bug::array::{{constant}}#0`
#4 [check_item_well_formed] processing `Bug`
#5 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

Feel free to close if this is a duplicate of #56445.
What I noticed is that when the lifetime is removed, it just compiles fine:

use core::mem::size_of;

struct Bug {
    array: [(); size_of::<&Self>()],
}
@Centril Centril added 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. P-medium Medium priority A-NLL Area: Non Lexical Lifetimes (NLL) labels Sep 5, 2019
@matthewjasper matthewjasper added the E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. label Sep 19, 2019
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Oct 15, 2019
@JohnTitor
Copy link
Member

Triage:
This is no longer ICE with the latest nightly as well as #56445: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=a9cdb892a6353014ff5b57258e3cd22c

@JohnTitor JohnTitor added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Dec 30, 2020
JohnTitor added a commit to JohnTitor/rust that referenced this issue May 5, 2022
compiler-errors added a commit to compiler-errors/rust that referenced this issue May 5, 2022
…=compiler-errors

Add a regression test for rust-lang#64173 and rust-lang#66152

Closes rust-lang#64173
Closes rust-lang#66152

Mixed the code as the root cause seems the same.
compiler-errors added a commit to compiler-errors/rust that referenced this issue May 6, 2022
…=compiler-errors

Add a regression test for rust-lang#64173 and rust-lang#66152

Closes rust-lang#64173
Closes rust-lang#66152

Mixed the code as the root cause seems the same.
bors added a commit to rust-lang-ci/rust that referenced this issue May 6, 2022
…piler-errors

Rollup of 7 pull requests

Successful merges:

 - rust-lang#96174 (mark ptr-int-transmute test as no_run)
 - rust-lang#96639 (Fix typo in `offset_from` documentation)
 - rust-lang#96704 (Add rotation animation on settings button when loading)
 - rust-lang#96730 (Add a regression test for rust-lang#64173 and rust-lang#66152)
 - rust-lang#96741 (Improve settings loading strategy)
 - rust-lang#96744 (Implement [OsStr]::join)
 - rust-lang#96747 (Add `track_caller` to `DefId::expect_local()`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors closed this as completed in b78179e May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-NLL Area: Non Lexical Lifetimes (NLL) E-hard Call for participation: Hard difficulty. Experience needed to fix: A lot. E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. glacier ICE tracked in rust-lang/glacier. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-medium Medium priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants