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: No move_errors should be allowed in MIR borrowck #67947

Closed
DutchGhost opened this issue Jan 6, 2020 · 2 comments · Fixed by #67967
Closed

ICE: No move_errors should be allowed in MIR borrowck #67947

DutchGhost opened this issue Jan 6, 2020 · 2 comments · Fixed by #67967
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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

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

struct Bug {
    A: [(); { *"" }.len()],
}
Backtrace:
 Compiling playground v0.0.1 (/playground)
error[E0161]: cannot move a value of type str: the size of str cannot be statically determined
 --> src/lib.rs:2:13
  |
2 |     A: [(); { *"" }.len()],
  |             ^^^^^^^

error[E0507]: cannot move out of a shared reference
 --> src/lib.rs:2:15
  |
2 |     A: [(); { *"" }.len()],
  |               ^^^ move occurs because value has type `str`, which does not implement the `Copy` trait

error: internal compiler error: src/librustc_mir/transform/elaborate_drops.rs:31: No `move_errors` should be allowed in MIR borrowck

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:931:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/gitpro.ttaallkk.top-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/gitpro.ttaallkk.top-1ecc6299db9ec823/backtrace-0.3.40/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:77
   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:1028
   5: std::io::Write::write_fmt
             at src/libstd/io/mod.rs:1412
   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:188
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:205
  10: rustc_driver::report_ice
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:468
  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_context_opt
  18: rustc::ty::context::tls::with_opt
  19: rustc::util::bug::opt_span_bug_fmt
  20: rustc::util::bug::bug_fmt
  21: <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_pass
  22: rustc_mir::transform::run_passes
  23: rustc_mir::transform::run_optimization_passes
  24: rustc_mir::transform::optimized_mir
  25: rustc::ty::query::__query_compute::optimized_mir
  26: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::optimized_mir>::compute
  27: rustc::dep_graph::graph::DepGraph::with_task_impl
  28: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  29: rustc_mir::interpret::eval_context::InterpCx<M>::load_mir
  30: rustc_mir::const_eval::const_eval_raw_provider
  31: rustc::ty::query::__query_compute::const_eval_raw
  32: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval_raw>::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::const_eval::const_eval_provider
  36: rustc::ty::query::__query_compute::const_eval
  37: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
  38: rustc::dep_graph::graph::DepGraph::with_task_impl
  39: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  40: rustc_mir::const_eval::const_eval_provider
  41: rustc::ty::query::__query_compute::const_eval
  42: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::const_eval>::compute
  43: rustc::dep_graph::graph::DepGraph::with_task_impl
  44: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  45: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_const
  46: rustc::ty::structural_impls::<impl rustc::ty::fold::TypeFoldable for &rustc::ty::TyS>::super_fold_with
  47: <rustc::traits::project::AssocTypeNormalizer as rustc::ty::fold::TypeFolder>::fold_ty
  48: rustc::traits::project::normalize
  49: rustc_typeck::check::FnCtxt::normalize_associated_types_in
  50: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  51: rustc::ty::context::GlobalCtxt::enter_local
  52: rustc_typeck::check::wfcheck::check_item_well_formed
  53: rustc::ty::query::__query_compute::check_item_well_formed
  54: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::check_item_well_formed>::compute
  55: rustc::dep_graph::graph::DepGraph::with_task_impl
  56: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  57: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
  58: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  59: rustc_data_structures::sync::par_for_each_in
  60: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:78
  61: rustc::hir::Crate::par_visit_all_item_likes
  62: rustc::util::common::time
  63: rustc_typeck::check_crate
  64: rustc_interface::passes::analysis
  65: rustc::ty::query::__query_compute::analysis
  66: rustc::dep_graph::graph::DepGraph::with_task_impl
  67: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  68: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  69: rustc_interface::passes::create_global_ctxt::{{closure}}
  70: rustc_interface::passes::BoxedGlobalCtxt::enter
  71: rustc_interface::interface::run_compiler_in_existing_thread_pool
  72: std::thread::local::LocalKey<T>::with
  73: scoped_tls::ScopedKey<T>::set
  74: 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.40.0 (73528e339 2019-12-16) running on x86_64-unknown-linux-gnu

note: compiler flags: -C codegen-units=1 -C debuginfo=2 --crate-type lib

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [optimized_mir] processing `Bug::A::{{constant}}#0`
#1 [const_eval_raw] const-evaluating `Bug::A::{{constant}}#0`
#2 [const_eval] const-evaluating + checking `Bug::A::{{constant}}#0`
#3 [const_eval] const-evaluating + checking `Bug::A::{{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 3 previous errors

Some errors have detailed explanations: E0161, E0507.
For more information about an error, try `rustc --explain E0161`.
error: could not compile `playground`.

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

Possibly related to #67696, except with a different ICE message.

@csmoe csmoe added A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html 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 Jan 6, 2020
@matthewjasper
Copy link
Contributor

The bug here should be delayed:

Err(_) => bug!("No `move_errors` should be allowed in MIR borrowck"),

@Centril Centril added the E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. label Jan 6, 2020
@pnkfelix
Copy link
Member

pnkfelix commented Jan 9, 2020

triage: P-medium, removing I-nominated label.

@pnkfelix pnkfelix added P-medium Medium priority and removed I-nominated labels Jan 9, 2020
@bors bors closed this as completed in 08c5999 Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir Area: Mid-level IR (MIR) - https://blog.rust-lang.org/2016/04/19/MIR.html C-bug Category: This is a bug. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. 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.

6 participants