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

ICE from associated const in field type of lifetime-parametric struct #68875

Closed
mortonsc opened this issue Feb 6, 2020 · 2 comments · Fixed by #98683
Closed

ICE from associated const in field type of lifetime-parametric struct #68875

mortonsc opened this issue Feb 6, 2020 · 2 comments · Fixed by #98683
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. 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) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@mortonsc
Copy link

mortonsc commented Feb 6, 2020

Attempting to build this code generates an ICE (play):

struct DataWrapper<'a> {
    data: &'a [u8; Self::SIZE],
}

impl DataWrapper<'_> {
    const SIZE: usize = 14;
}

The error message, on my machine:

$ rustc src/main.rs --verbose
error: internal compiler error: src/librustc_mir/borrow_check/universal_regions.rs:762: cannot convert `ReEarlyBound(0, 'a)` to a region vid

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:905: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.41.0 running on x86_64-unknown-linux-gnu

error: aborting due to previous error

Looks like it's related to #56445, but the construction that triggers it is different enough that it seems worth posting.

@JohnTitor JohnTitor added A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. 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. labels Feb 6, 2020
@rust-lang-glacier-bot rust-lang-glacier-bot added the glacier ICE tracked in rust-lang/glacier. label Feb 7, 2020
@chrissimpkins
Copy link
Member

Source: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=bd71263c3ae486f4cda40f73e4024821

Stack trace

   Compiling playground v0.0.1 (/playground)
error: internal compiler error: src/librustc_mir/borrow_check/universal_regions.rs:762: cannot convert `ReEarlyBound(0, 'a)` to a region vid

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:905:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:84
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:61
   4: core::fmt::write
             at src/libcore/fmt/mod.rs:1025
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1426
   6: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:65
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:50
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:193
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:475
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::bug
  14: rustc_errors::Handler::bug
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
  16: rustc::ty::context::tls::with_opt::{{closure}}
  17: rustc::ty::context::tls::with_opt
  18: rustc::util::bug::opt_span_bug_fmt
  19: rustc::util::bug::bug_fmt
  20: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid::{{closure}}
  21: rustc_mir::borrow_check::universal_regions::UniversalRegionIndices::to_region_vid
  22: rustc_mir::borrow_check::type_check::constraint_conversion::ConstraintConversion::convert_all
  23: rustc_mir::borrow_check::type_check::TypeChecker::fully_perform_op
  24: rustc_mir::borrow_check::type_check::type_check
  25: rustc_mir::borrow_check::nll::compute_regions
  26: rustc_mir::borrow_check::do_mir_borrowck
  27: rustc::ty::context::GlobalCtxt::enter_local
  28: rustc_mir::borrow_check::mir_borrowck
  29: rustc::ty::query::__query_compute::mir_borrowck
  30: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  31: rustc::dep_graph::graph::DepGraph::with_task_impl
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  33: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  34: rustc_mir::transform::optimized_mir
  35: rustc::ty::query::__query_compute::optimized_mir
  36: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  37: rustc::dep_graph::graph::DepGraph::with_task_impl
  38: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  39: rustc_mir::interpret::eval_context::InterpCx<M>::load_mir
  40: rustc_mir::const_eval::const_eval_raw_provider
  41: rustc::ty::query::__query_compute::const_eval_raw
  42: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval_raw>::compute
  43: rustc::dep_graph::graph::DepGraph::with_task_impl
  44: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  45: rustc_mir::const_eval::const_eval_provider
  46: rustc::ty::query::__query_compute::const_eval
  47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
  48: rustc::dep_graph::graph::DepGraph::with_task_impl
  49: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  50: rustc_mir::const_eval::const_eval_provider
  51: rustc::ty::query::__query_compute::const_eval
  52: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
  53: rustc::dep_graph::graph::DepGraph::with_task_impl
  54: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  55: rustc::ty::sty::Const::eval::{{closure}}
  56: rustc::ty::sty::Const::eval
  57: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable for &rustc::ty::TyS>::super_fold_with
  58: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
  59: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable for &rustc::ty::TyS>::super_fold_with
  60: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
  61: rustc::traits::project::normalize
  62: rustc_typeck::check::FnCtxt::normalize_associated_types_in
  63: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  64: rustc::ty::context::GlobalCtxt::enter_local
  65: rustc_typeck::check::wfcheck::check_item_well_formed
  66: rustc::ty::query::__query_compute::check_item_well_formed
  67: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::check_item_well_formed>::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::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  71: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  72: rustc_data_structures::sync::par_for_each_in
  73: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  74: rustc::hir::Crate::par_visit_all_item_likes
  75: rustc::util::common::time
  76: rustc_typeck::check_crate
  77: rustc_interface::passes::analysis
  78: rustc::ty::query::__query_compute::analysis
  79: rustc::dep_graph::graph::DepGraph::with_task_impl
  80: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  81: rustc::ty::context::tls::enter_global
  82: rustc_interface::interface::run_compiler_in_existing_thread_pool
  83: std::thread::local::LocalKey<T>::with
  84: scoped_tls::ScopedKey<T>::set
  85: syntax::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.41.0 (5e1a79984 2020-01-27) 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 [mir_borrowck] processing `DataWrapper::data::{{constant}}#0`
#1 [optimized_mir] processing `DataWrapper::data::{{constant}}#0`
#2 [const_eval_raw] const-evaluating `DataWrapper::data::{{constant}}#0`
#3 [const_eval] const-evaluating + checking `DataWrapper::data::{{constant}}#0`
#4 [const_eval] const-evaluating + checking `DataWrapper::data::{{constant}}#0`
#5 [check_item_well_formed] processing `DataWrapper`
#6 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `playground`.

To learn more, run the command again with --verbose.

Cargo bisection

With cargo-bisect-rustc

regression in nightly-2019-07-31

Bisect output

checking nightly-2019-07-30
std for x86_64-unknown-linux-gnu: 170.30 MB / 170.30 MB [=======================================] 100.00 % 19.06 MB/s uninstalling nightly-2019-07-30
verifying the start of the range does not reproduce the regression
std for x86_64-unknown-linux-gnu: 170.30 MB / 170.30 MB [=======================================] 100.00 % 18.76 MB/s uninstalling nightly-2019-07-30
tested nightly-2019-07-30, got No
confirmed the start of the range does not reproduce the regression
verifying the end of the range reproduces the regression
std for x86_64-unknown-linux-gnu: 170.30 MB / 170.30 MB [=======================================] 100.00 % 19.19 MB/s uninstalling nightly-2019-07-31
tested nightly-2019-07-31, got Yes
confirmed the end of the range reproduces the regression
searched toolchains nightly-2019-07-30 through nightly-2019-07-31
std for x86_64-unknown-linux-gnu: 170.30 MB / 170.30 MB [=======================================] 100.00 % 18.37 MB/s uninstalling nightly-2019-07-31
regression in nightly-2019-07-31
fetching https://static.rust-lang.org/dist/2019-07-31/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2019-07-31: 40 B / 40 B [=====================================================] 100.00 % 319.54 KB/s converted 2019-07-31 to dddb7fca09dc817ba275602b950bb81a9032fb6d
fetching https://static.rust-lang.org/dist/2019-07-30/channel-rust-nightly-git-commit-hash.txt
nightly manifest 2019-07-30: 40 B / 40 B [=====================================================] 100.00 % 480.83 KB/s converted 2019-07-30 to 04b88a9eba8abbac87eddcb2998beea09589c2c9
looking for regression commit between 2019-07-31 and 2019-07-30
fetching commits from 04b88a9eba8abbac87eddcb2998beea09589c2c9 to dddb7fca09dc817ba275602b950bb81a9032fb6d
cloning rust repository
looking up first commit
looking up second commit
checking that commits are by bors and thus have ci artifacts...
finding bors merge commits
found 4 bors merge commits in the specified range
opening existing repository at "rust.git"
refreshing repository
no commits between 04b88a9eba8abbac87eddcb2998beea09589c2c9 and dddb7fca09dc817ba275602b950bb81a9032fb6d within last 167 days

$ git log --oneline --author=bors 04b88a9eba8abbac87eddcb2998beea09589c2c9..dddb7fca09dc817ba275602b950bb81a9032fb6d

dddb7fc Auto merge of #62805 - Xanewok:update-rls, r=Xanewok
f690098 Auto merge of #62766 - alexcrichton:stabilize-pipelined-compilation, r=oli-obk
4eeaaa7 Auto merge of #63124 - Centril:rollup-onohtqt, r=Centril

@JohnTitor
Copy link
Member

JohnTitor commented Dec 30, 2020

Triage:
This is no longer ICE even with the const_generics feature flag: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=da62e951439946342683318b24b8c72a

@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
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 29, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Jun 29, 2022
@bors bors closed this as completed in 5f75e71 Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-borrow-checker Area: The borrow checker C-bug Category: This is a bug. 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) ❄️ 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