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 on dereferencing non-Copy raw pointer on latest nightly #52262

Closed
IsaacWoods opened this issue Jul 11, 2018 · 19 comments
Closed

ICE on dereferencing non-Copy raw pointer on latest nightly #52262

IsaacWoods opened this issue Jul 11, 2018 · 19 comments
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@IsaacWoods
Copy link
Contributor

IsaacWoods commented Jul 11, 2018

Firstly, I have been unable to reproduce this minimally, but it should be similar to something like this, but this example gives the correct error. I'll update this issue if I can find a proper repro.

However, locally I'm getting an ICE:

error: internal compiler error: Accessing `(*_5)` with the kind `Write(Move)` shouldn't be possible
  --> src/madt.rs:40:31
   |
40 |         let header = unsafe { *(pointer as *const EntryHeader) };
   |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: (MoveData { move_paths: [Mov
ePath { place: _0 }, MovePath { place: _1 }, MovePath { place: _2 }, MovePath { place: _3 }, MovePat
h { place: _4 }, MovePath { place: _5 }, MovePath { place: _6 }, MovePath { place: _7 }, MovePath {
place: _8 }, MovePath { place: _9 }, MovePath { place: _10 }, MovePath { place: _11 }, MovePath { pl
ace: _12 }], moves: [mp6@bb0[6], mp6@bb0[7], mp5@bb0[9], mp9@bb0[15]], loc_map: LocationMap { map: [
[[], [], [], [], [], [], [mo0], [mo1], [], [mo2], [], [], [], [], [], [mo3]]] }, path_map: [[], [],
[], [], [], [mo2], [mo0, mo1], [], [], [mo3], [], [], []], rev_lookup: MovePathLookup { locals: [mp0
, mp1, mp2, mp3, mp4, mp5, mp6, mp7, mp8, mp9, mp10, mp11, mp12], projections: {} }, inits: [mp1@src
/madt.rs:38:13: 38:22 (Deep), mp3@src/madt.rs:39:23: 39:46 (Deep), mp6@src/madt.rs:40:33: 40:40 (Dee
p), mp5@src/madt.rs:40:32: 40:63 (Deep), mp4@src/madt.rs:40:31: 40:63 (Deep), mp12@<panic macros>:4:
1: 4:72 (Deep), mp10@<panic macros>:4:1: 4:72 (Deep), mp9@<panic macros>:4:1: 4:72 (Deep)], init_loc
_map: LocationMap { map: [[[], [in1], [], [], [], [in2], [in3], [], [in4], [], [], [], [in5], [in6],
 [in7], []]] }, init_path_map: [[], [in0], [], [in1], [in4], [in3], [in2], [], [], [in7], [in6], [],
 [in5]] }, [IllegalMove { cannot_move_out_of: IllegalMoveOrigin { location: bb0[8], kind: BorrowedCo
ntent { target_ty: madt::EntryHeader } } }])', libcore/result.rs:945:5
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::print
             at libstd/sys_common/backtrace.rs:71
             at libstd/sys_common/backtrace.rs:59
   2: std::panicking::default_hook::{{closure}}
             at libstd/panicking.rs:211
   3: std::panicking::default_hook
             at libstd/panicking.rs:227
   4: rustc::util::common::panic_hook
   5: std::panicking::rust_panic_with_hook
             at libstd/panicking.rs:479
   6: std::panicking::continue_panic_fmt
             at libstd/panicking.rs:390
   7: rust_begin_unwind
             at libstd/panicking.rs:325
   8: core::panicking::panic_fmt
             at libcore/panicking.rs:77
   9: core::result::unwrap_failed
  10: <rustc_mir::transform::elaborate_drops::ElaborateDrops as rustc_mir::transform::MirPass>::run_
pass
  11: rustc_mir::transform::optimized_mir::{{closure}}
  12: rustc_mir::transform::optimized_mir
  13: rustc::ty::query::__query_compute::optimized_mir
  14: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::q
ueries::optimized_mir<'tcx>>::compute
  15: rustc::ty::context::tls::with_context
  16: rustc::dep_graph::graph::DepGraph::with_task_impl
  17: rustc::ty::context::tls::with_related_context
  18: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_wit
h_job
  19: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_query
  20: rustc::ty::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::instance_mir
  21: rustc_mir::monomorphize::collector::collect_items_rec
  22: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
  23: rustc::util::common::time
  24: rustc_mir::monomorphize::collector::collect_crate_mono_items
  25: rustc::util::common::time
  26: rustc_codegen_llvm::base::collect_and_partition_mono_items
  27: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::q
ueries::collect_and_partition_mono_items<'tcx>>::compute
  28: rustc::ty::context::tls::with_context
  29: rustc::dep_graph::graph::DepGraph::with_task_impl
  30: rustc::ty::context::tls::with_related_context
  31: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_wit
h_job
  32: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query
  33: rustc::ty::query::plumbing::force_from_dep_node
  34: rustc::dep_graph::graph::DepGraph::try_mark_green
  35: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_mark_green_
and_read
  36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::get_query
  37: rustc_metadata::encoder::encode_metadata
  38: rustc_metadata::cstore_impl::<impl rustc::middle::cstore::CrateStore for rustc_metadata::cstor
e::CStore>::encode_metadata
  39: rustc::ty::context::TyCtxt::encode_metadata
  40: rustc_codegen_llvm::base::write_metadata
  41: rustc::util::common::time
  42: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBacken
d>::codegen_crate
  43: rustc::util::common::time
  44: rustc_driver::driver::phase_4_codegen
  45: rustc_driver::driver::compile_input::{{closure}}
  46: rustc::ty::context::tls::enter_context
  47: <std::thread::local::LocalKey<T>>::with
  48: rustc::ty::context::TyCtxt::create_and_enter
  49: rustc_driver::driver::compile_input
  50: rustc_driver::run_compiler_with_pool
  51: <scoped_tls::ScopedKey<T>>::set
  52: <scoped_tls::ScopedKey<T>>::set
  53: syntax::with_globals
  54: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  55: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  56: rustc_driver::run
  57: rustc_driver::main
  58: std::rt::lang_start::{{closure}}
  59: std::panicking::try::do_call
             at libstd/rt.rs:59
             at libstd/panicking.rs:310
  60: __rust_maybe_catch_panic
             at libpanic_unwind/lib.rs:105
  61: std::rt::lang_start_internal
             at libstd/panicking.rs:289
             at libstd/panic.rs:392
             at libstd/rt.rs:58
  62: main
  63: __libc_start_main
  64: <unknown>
query stack during panic:
#0 [optimized_mir] processing `<madt::MadtEntryIter<'a> as core::iter::Iterator>::next`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error

error: internal compiler error: unexpected panic

This is with rustc 1.29.0-nightly (e5f6498d3 2018-07-10).

@varkor varkor added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jul 12, 2018
@hellow554
Copy link
Contributor

hellow554 commented Jul 12, 2018

Your example does not panic on the playground (which uses the given nightly compiler) 😮

@IsaacWoods
Copy link
Contributor Author

@hellow554 yup, am aware and I'm trying to find a minimal example that does (it does locally even after a cargo clean). There's clearly some subtlety in the actual code causing it to ICE

@estebank estebank added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 8, 2019
@estebank
Copy link
Contributor

estebank commented May 8, 2019

@IsaacWoods do you still have the original trigger for this error? If so, could you let us know if the problem still persists?

@IsaacWoods
Copy link
Contributor Author

@estebank I do not have the full crate to test easily, but a better testcase adapted slightly from the actual code passes on the latest nightly (gives the correct error), so I don't think this persists.

@jonas-schievink jonas-schievink added C-bug Category: This is a bug. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 6, 2019
@ghost
Copy link

ghost commented Sep 30, 2019

I have one with:

$ rustv
!! master-installed (default)
!! Executing '/home/user/.cargo/bin/rustc' in pwd='/home/user/build/2nonpkgs/rust.stuff/memdb' with args(1): '-vV'
rustc 1.40.0-dev (f3c8eba64 2019-09-28)
binary: rustc
commit-hash: f3c8eba643a815d720e7f20699b3dca144c845c4
commit-date: 2019-09-28
host: x86_64-unknown-linux-gnu
release: 1.40.0-dev
LLVM version: 9.0
!! master-installed (default)
!! Executing '/home/user/.cargo/bin/cargo' in pwd='/home/user/build/2nonpkgs/rust.stuff/memdb' with args(1): '-vV'
cargo 1.39.0-nightly (ab6fa8908 2019-09-25)
release: 1.39.0
commit-hash: ab6fa8908c9b6c8f7e2249231c395eebfbc49891
commit-date: 2019-09-25

Source code here: https://github.com/howaboutsynergy/memdb/tree/write_move_shouldnt_be_possible
just run ./go

output:

/home/user/build/2nonpkgs/rust.stuff/memdb 
$ ./go
!! master-installed (default)
!! Executing '/home/user/.cargo/bin/cargo' in pwd='/home/user/build/2nonpkgs/rust.stuff/memdb' with args(1): 'build'
   Compiling memdb v1.0.0 (/home/user/build/2nonpkgs/rust.stuff/memdb)
error[E0507]: cannot move out of `*key` which is behind a shared reference
  --> src/lib.rs:28:74
   |
28 |     format!("Attempted to delete inexisting key '{}'", String::from_utf8(*key).unwrap())
   |                                                                          ^^^^ move occurs because `*key` has type `std::vec::Vec<u8>`, which does not implement the `Copy` trait

error: internal compiler error: src/librustc_mir/borrow_check/mod.rs:1949: Accessing `(*_3)` with the kind `Write(Move)` shouldn't be possible
  --> src/lib.rs:28:74
   |
28 |     format!("Attempted to delete inexisting key '{}'", String::from_utf8(*key).unwrap())
   |                                                                          ^^^^

thread '<unnamed>' panicked at 'Box<Any>', src/librustc_errors/lib.rs:871: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.40.0-dev (f3c8eba64 2019-09-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=5 -Z external-macro-backtrace -C debuginfo=2 -C incremental -C target-cpu=native --crate-type lib

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

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0507`.
error: could not compile `memdb`.

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

with backtrace
$ RUST_BACKTRACE=1 ./go
!! master-installed (default)
!! Executing '/home/user/.cargo/bin/cargo' in pwd='/home/user/build/2nonpkgs/rust.stuff/memdb' with args(1): 'build'
   Compiling memdb v1.0.0 (/home/user/build/2nonpkgs/rust.stuff/memdb)
error[E0507]: cannot move out of `*key` which is behind a shared reference
  --> src/lib.rs:28:74
   |
28 |     format!("Attempted to delete inexisting key '{}'", String::from_utf8(*key).unwrap())
   |                                                                          ^^^^ move occurs because `*key` has type `std::vec::Vec<u8>`, which does not implement the `Copy` trait

error: internal compiler error: src/librustc_mir/borrow_check/mod.rs:1949: Accessing `(*_3)` with the kind `Write(Move)` shouldn't be possible
  --> src/lib.rs:28:74
   |
28 |     format!("Attempted to delete inexisting key '{}'", String::from_utf8(*key).unwrap())
   |                                                                          ^^^^

thread '<unnamed>' panicked at 'Box<Any>', src/librustc_errors/lib.rs:871:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:76
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:60
   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:64
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:196
   9: std::panicking::default_hook
             at src/libstd/panicking.rs:210
  10: rustc_driver::report_ice
             at src/librustc_driver/lib.rs:1187
  11: std::panicking::rust_panic_with_hook
             at src/libstd/panicking.rs:477
  12: std::panicking::begin_panic
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:407
  13: rustc_errors::HandlerInner::span_bug
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/<::std::macros::panic macros>:3
  14: rustc_errors::Handler::span_bug
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc_errors/lib.rs:641
  15: rustc::util::bug::opt_span_bug_fmt::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/util/bug.rs:35
  16: rustc::ty::context::tls::with_opt::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1949
  17: rustc::ty::context::tls::with_context_opt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1899
  18: rustc::ty::context::tls::with_opt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1949
  19: rustc::util::bug::opt_span_bug_fmt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/util/bug.rs:32
  20: rustc::util::bug::span_bug_fmt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/util/bug.rs:23
  21: rustc_mir::borrow_check::MirBorrowckCtxt::check_access_permissions
             at src/librustc_mir/borrow_check/mod.rs:1949
  22: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
             at src/librustc_mir/borrow_check/mod.rs:929
  23: rustc_mir::borrow_check::MirBorrowckCtxt::consume_operand
             at src/librustc_mir/borrow_check/mod.rs:0
  24: rustc_mir::borrow_check::MirBorrowckCtxt::consume_rvalue
             at src/librustc_mir/borrow_check/mod.rs:0
  25: <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::DataflowResultsConsumer>::visit_statement_entry
             at src/librustc_mir/borrow_check/mod.rs:500
  26: rustc_mir::dataflow::DataflowResultsConsumer::process_basic_block
             at src/librustc_mir/dataflow/mod.rs:344
  27: rustc_mir::dataflow::DataflowResultsConsumer::analyze_results
             at src/librustc_mir/dataflow/mod.rs:332
  28: rustc_mir::borrow_check::do_mir_borrowck
             at src/librustc_mir/borrow_check/mod.rs:279
  29: rustc_mir::borrow_check::mir_borrowck::{{closure}}
             at src/librustc_mir/borrow_check/mod.rs:95
  30: rustc::infer::InferCtxtBuilder::enter::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/infer/mod.rs:528
  31: rustc::ty::context::GlobalCtxt::enter_local::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1599
  32: rustc::ty::context::tls::enter_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1821
  33: rustc_rayon_core::tlv::with
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/tlv.rs:19
  34: rustc::ty::context::tls::set_tlv
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1728
  35: rustc::ty::context::tls::enter_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1820
  36: rustc::ty::context::GlobalCtxt::enter_local::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1598
  37: rustc::ty::context::tls::with_related_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1927
  38: rustc::ty::context::tls::with_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1910
  39: rustc::ty::context::tls::with_context_opt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1899
  40: rustc::ty::context::tls::with_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1910
  41: rustc::ty::context::tls::with_related_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1923
  42: rustc::ty::context::GlobalCtxt::enter_local
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1590
  43: rustc::infer::InferCtxtBuilder::enter
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/infer/mod.rs:527
  44: rustc_mir::borrow_check::mir_borrowck
             at src/librustc_mir/borrow_check/mod.rs:92
  45: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:1002
  46: rustc::ty::query::__query_compute::mir_borrowck
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:953
  47: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:994
  48: rustc::dep_graph::graph::DepGraph::with_task_impl::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/dep_graph/graph.rs:277
  49: rustc::ty::context::tls::enter_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1821
  50: rustc_rayon_core::tlv::with
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/tlv.rs:19
  51: rustc::ty::context::tls::set_tlv
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1728
  52: rustc::ty::context::tls::enter_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1820
  53: rustc::dep_graph::graph::DepGraph::with_task_impl::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/dep_graph/graph.rs:276
  54: rustc::ty::context::tls::with_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1910
  55: rustc::ty::context::tls::with_context_opt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1899
  56: rustc::ty::context::tls::with_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1910
  57: rustc::dep_graph::graph::DepGraph::with_task_impl
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/dep_graph/graph.rs:270
  58: rustc::dep_graph::graph::DepGraph::with_task
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/dep_graph/graph.rs:202
  59: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::force_query_with_job::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:561
  60: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::start_query::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:277
  61: rustc::ty::context::tls::enter_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1821
  62: rustc_rayon_core::tlv::with
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/tlv.rs:19
  63: rustc::ty::context::tls::set_tlv
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1728
  64: rustc::ty::context::tls::enter_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1820
  65: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::start_query::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:276
  66: rustc::ty::context::tls::with_related_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1927
  67: rustc::ty::context::tls::with_context::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1910
  68: rustc::ty::context::tls::with_context_opt
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1899
  69: rustc::ty::context::tls::with_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1910
  70: rustc::ty::context::tls::with_related_context
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1923
  71: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::start_query
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:265
  72: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::force_query_with_job::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:553
  73: rustc::ty::query::plumbing::with_diagnostics
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:210
  74: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::force_query_with_job
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:552
  75: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:430
  76: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::ensure_query
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:615
  77: rustc::ty::query::TyCtxtEnsure::mir_borrowck
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/query/plumbing.rs:1030
  78: rustc_interface::passes::analysis::{{closure}}::{{closure}}
             at src/librustc_interface/passes.rs:939
  79: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/mod.rs:2797
  80: <rustc_rayon::iter::for_each::ForEachConsumer<F> as rustc_rayon::iter::plumbing::Folder<T>>::consume_iter::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/for_each.rs:55
  81: <core::slice::Iter<T> as core::iter::traits::iterator::Iterator>::fold
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libcore/slice/mod.rs:3211
  82: <rustc_rayon::iter::for_each::ForEachConsumer<F> as rustc_rayon::iter::plumbing::Folder<T>>::consume_iter
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/for_each.rs:55
  83: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:441
  84: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:430
  85: rustc_rayon_core::join::join_context::{{closure}}::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:130
  86: rustc_rayon_core::job::StackJob<L,F,R>::run_inline
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:102
  87: rustc_rayon_core::join::join_context::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:160
  88: rustc_rayon_core::registry::in_worker
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:798
  89: rustc_rayon_core::join::join_context
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:119
  90: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:419
  91: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:430
  92: rustc_rayon_core::join::join_context::{{closure}}::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:130
  93: <rustc_rayon_core::job::StackJob<L,F,R> as rustc_rayon_core::job::Job>::execute::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:121
  94: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:315
  95: std::panicking::try::do_call
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:292
  96: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
  97: std::panicking::try
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:271
  98: std::panic::catch_unwind
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:394
  99: rustc_rayon_core::unwind::halt_unwinding
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/unwind.rs:19
 100: <rustc_rayon_core::job::StackJob<L,F,R> as rustc_rayon_core::job::Job>::execute
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:121
 101: rustc_rayon_core::job::JobRef::execute
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:62
 102: rustc_rayon_core::registry::WorkerThread::execute
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:657
 103: rustc_rayon_core::registry::WorkerThread::wait_until_cold
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:637
 104: rustc_rayon_core::registry::WorkerThread::wait_until
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:611
 105: rustc_rayon_core::join::join_context::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:175
 106: rustc_rayon_core::registry::in_worker
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:798
 107: rustc_rayon_core::join::join_context
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:119
 108: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:419
 109: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:421
 110: rustc_rayon_core::join::join_context::{{closure}}::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:137
 111: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:315
 112: std::panicking::try::do_call
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:292
 113: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
 114: std::panicking::try
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:271
 115: std::panic::catch_unwind
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:394
 116: rustc_rayon_core::unwind::halt_unwinding
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/unwind.rs:19
 117: rustc_rayon_core::join::join_context::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:137
 118: rustc_rayon_core::registry::in_worker
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:798
 119: rustc_rayon_core::join::join_context
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:119
 120: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:419
 121: rustc_rayon::iter::plumbing::bridge_producer_consumer::helper::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-0.2.0/src/iter/plumbing/mod.rs:430
 122: rustc_rayon_core::join::join_context::{{closure}}::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/join/mod.rs:130
 123: <rustc_rayon_core::job::StackJob<L,F,R> as rustc_rayon_core::job::Job>::execute::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:121
 124: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:315
 125: std::panicking::try::do_call
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:292
 126: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
 127: std::panicking::try
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:271
 128: std::panic::catch_unwind
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:394
 129: rustc_rayon_core::unwind::halt_unwinding
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/unwind.rs:19
 130: <rustc_rayon_core::job::StackJob<L,F,R> as rustc_rayon_core::job::Job>::execute
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:121
 131: rustc_rayon_core::job::JobRef::execute
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/job.rs:62
 132: rustc_rayon_core::registry::WorkerThread::execute
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:657
 133: rustc_rayon_core::registry::WorkerThread::wait_until_cold
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:637
 134: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc_interface/util.rs:235
 135: scoped_tls::ScopedKey<T>::set
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
 136: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc_interface/util.rs:235
 137: rustc::ty::context::tls::with_thread_locals::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1809
 138: std::thread::local::LocalKey<T>::try_with
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/thread/local.rs:262
 139: std::thread::local::LocalKey<T>::with
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/thread/local.rs:239
 140: rustc::ty::context::tls::with_thread_locals::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc/ty/context.rs:1801
 141: std::thread::local::LocalKey<T>::try_with
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/thread/local.rs:262
 142: std::thread::local::LocalKey<T>::with
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/thread/local.rs:239
 143: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc_interface/util.rs:234
 144: scoped_tls::ScopedKey<T>::set
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
 145: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc_interface/util.rs:230
 146: scoped_tls::ScopedKey<T>::set
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
 147: rustc_interface::util::spawn_thread_pool::{{closure}}::{{closure}}::{{closure}}::{{closure}}
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/librustc_interface/util.rs:229
 148: rustc_rayon_core::thread_pool::ThreadPool::scoped_pool::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/thread_pool/mod.rs:104
 149: __rust_maybe_catch_panic
             at src/libpanic_unwind/lib.rs:80
 150: std::panicking::try
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panicking.rs:271
 151: std::panic::catch_unwind
             at /home/user/build/2nonpkgs/rust.stuff/rust/rust/src/libstd/panic.rs:394
 152: rustc_rayon_core::unwind::halt_unwinding
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/unwind.rs:19
 153: rustc_rayon_core::registry::main_loop
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:747
 154: rustc_rayon_core::registry::Registry::new::{{closure}}
             at /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-rayon-core-0.2.0/src/registry.rs:145
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-dev (f3c8eba64 2019-09-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=5 -Z external-macro-backtrace -C debuginfo=2 -C incremental -C target-cpu=native --crate-type lib

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

query stack during panic:
    Building [=======================================================> ] 63/64: memdb                                                                    

^ yes it's stuck there, not sure why! I will C-c after a while, been a few minutes. It's probably cargo's doing?

@ghost
Copy link

ghost commented Sep 30, 2019

here's a simplified version but beware that it doesn't show the ICE on playground:
https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=666c4fdb2df458f87edce89277024726

ICE shown only locally,
or could it be that my (locally built)"nightly" is too old now (couple of days) and this ICE is gone? or more likely playground strips ICE from output? It just needs -Z treat-err-as-bug=500

@ghost
Copy link

ghost commented Sep 30, 2019

the better testcase mentioned above also ICEs only locally, and the ICE cannot be seen on playground.

$ cargo build
!! master-installed (default)
!! Executing '/home/user/.cargo/bin/cargo' in pwd='/tmp/two' with args(1): 'build'
   Compiling two v0.1.0 (/tmp/two)
error[E0507]: cannot move out of a raw pointer
  --> src/main.rs:52:35
   |
52 |             let header = unsafe { *(self.pointer as *const EntryHeader) };
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |                                   |
   |                                   move occurs because value has type `EntryHeader`, which does not implement the `Copy` trait
   |                                   help: consider borrowing here: `&*(self.pointer as *const EntryHeader)`

error: internal compiler error: src/librustc_mir/borrow_check/mod.rs:1949: Accessing `(*_8)` with the kind `Write(Move)` shouldn't be possible
  --> src/main.rs:52:35
   |
52 |             let header = unsafe { *(self.pointer as *const EntryHeader) };
   |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

thread '<unnamed>' panicked at 'Box<Any>', src/librustc_errors/lib.rs:871: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.40.0-dev (f3c8eba64 2019-09-28) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=5 -Z external-macro-backtrace -C debuginfo=2 -C incremental -C target-cpu=native --crate-type bin

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

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0507`.
error: could not compile `two`.

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

@hellow554
Copy link
Contributor

@howaboutsynergy your compiler looks incorrect to me, or am I missing something?

note: rustc 1.40.0-dev (f3c8eba 2019-09-28) running on x86_64-unknown-linux-gnu

vs

rustup override set nightly-2019-09-29
info: syncing channel updates for 'nightly-2019-09-29-x86_64-unknown-linux-gnu'
info: latest update on 2019-09-29, rust version 1.40.0-nightly (488381c 2019-09-28)

@ghost
Copy link

ghost commented Oct 1, 2019

@hellow554 yeah, I've compiled rust locally, but here's with current latest nightly:

$ RUST_BACKTRACE=1 cargo build
!! nightly-x86_64-unknown-linux-gnu (default)
!! Executing '/home/user/.cargo/bin/cargo' in pwd='/tmp/blah' with args(1): 'build'
   Compiling blah v0.1.0 (/tmp/blah)
error[E0507]: cannot move out of `*key` which is behind a shared reference
  --> src/main.rs:15:35
   |
15 |                 String::from_utf8(*key).unwrap()
   |                                   ^^^^ move occurs because `*key` has type `std::vec::Vec<u8>`, which does not implement the `Copy` trait

error: internal compiler error: src/librustc_mir/borrow_check/mod.rs:1949: Accessing `(*_4)` with the kind `Write(Move)` shouldn't be possible
  --> src/main.rs:15:35
   |
15 |                 String::from_utf8(*key).unwrap()
   |                                   ^^^^

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:871:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.37/src/backtrace/mod.rs:66
   2: std::sys_common::backtrace::_print_fmt
             at src/libstd/sys_common/backtrace.rs:76
   3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
             at src/libstd/sys_common/backtrace.rs:60
   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:64
   7: std::sys_common::backtrace::print
             at src/libstd/sys_common/backtrace.rs:49
   8: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:196
   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:477
  12: std::panicking::begin_panic
  13: rustc_errors::HandlerInner::span_bug
  14: rustc_errors::Handler::span_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::span_bug_fmt
  21: rustc_mir::borrow_check::MirBorrowckCtxt::access_place
  22: rustc_mir::borrow_check::MirBorrowckCtxt::consume_operand
  23: <rustc_mir::borrow_check::MirBorrowckCtxt as rustc_mir::dataflow::DataflowResultsConsumer>::visit_statement_entry
  24: rustc_mir::borrow_check::do_mir_borrowck
  25: rustc::ty::context::GlobalCtxt::enter_local
  26: rustc_mir::borrow_check::mir_borrowck
  27: rustc::ty::query::__query_compute::mir_borrowck
  28: rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors for rustc::ty::query::queries::mir_borrowck>::compute
  29: rustc::dep_graph::graph::DepGraph::with_task_impl
  30: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  31: rustc::ty::<impl rustc::ty::context::TyCtxt>::par_body_owners
  32: rustc::util::common::time
  33: rustc_interface::passes::analysis
  34: rustc::ty::query::__query_compute::analysis
  35: rustc::dep_graph::graph::DepGraph::with_task_impl
  36: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  37: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  38: rustc_interface::passes::create_global_ctxt::{{closure}}
  39: rustc_interface::interface::run_compiler_in_existing_thread_pool
  40: std::thread::local::LocalKey<T>::with
  41: scoped_tls::ScopedKey<T>::set
  42: 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-nightly (22bc9e1d9 2019-09-30) running on x86_64-unknown-linux-gnu

note: compiler flags: -Z treat-err-as-bug=5 -Z external-macro-backtrace -C debuginfo=2 -C incremental -C target-cpu=native --crate-type bin

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

query stack during panic:
#0 [mir_borrowck] processing `<MyError as std::fmt::Display>::fmt`
#1 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0507`.
error: could not compile `blah`.

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

that's running the example from this comment above.

@hellow554
Copy link
Contributor

It is only happening because of the compiler option -Z treat-err-as-bug. Not sure what it is, or why you have it enabled :) But yeah, I can provoke an ICE with it.

@ghost
Copy link

ghost commented Oct 1, 2019

It is only happening because of the compiler option -Z treat-err-as-bug. Not sure what it is, or why you have it enabled :) But yeah, I can provoke an ICE with it.

that's odd, I have it in .cargo/config as

[target.'cfg(any(windows, unix))']
rustflags = ["-C", "target-cpu=native"
, "-Z", "treat-err-as-bug=5"                                                        
, "-Z", "external-macro-backtrace"
]

but I'd think it only triggers if at least 5 errors were encountered, not just 1.
even works with "-Z", "treat-err-as-bug=500" heh.
Nice catch!

as to why I have it: #27189 (comment)

@oli-obk oli-obk added the B-unstable Blocker: Implemented in the nightly compiler and unstable. label Oct 1, 2019
@oli-obk
Copy link
Contributor

oli-obk commented Oct 1, 2019

treat-err-as-bug is solely a debugging option for rustc and was never meant to be used outside rustc debugging. It is meant to generate ICEs.

That said, it should probably work as advertised. Not sure why it's bailing out so early.

@oli-obk oli-obk added the P-low Low priority label Oct 1, 2019
@estebank
Copy link
Contributor

estebank commented Oct 1, 2019

Changing this

// rust-lang/rust#46908: In pure NLL mode this code path should
// be unreachable (and thus we signal an ICE in the else branch here).
span_bug!(
span,
"Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
place,
kind,
);

to self.infcx.tcx.sess.delay_span_bug should fix the ICE with no other ill-behavior.

@ghost
Copy link

ghost commented Oct 2, 2019

@estebank confirmed working(no more ICE), thank you! tested with stage1&2 rust 7130fc5 (with reverted PR 64895)

https://github.com/rust-lang/rust/issues/52262#issuecomment-537168375

diff --git a/src/librustc_mir/borrow_check/mod.rs b/src/librustc_mir/borrow_check/mod.rs
index cfa211ad5af..8f4dbb3bb81 100644
--- a/src/librustc_mir/borrow_check/mod.rs
+++ b/src/librustc_mir/borrow_check/mod.rs
@@ -1946,11 +1946,11 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
                 ) {
                     // rust-lang/rust#46908: In pure NLL mode this code path should
                     // be unreachable (and thus we signal an ICE in the else branch here).
-                    span_bug!(
+                    self.infcx.tcx.sess.delay_span_bug(
                         span,
-                        "Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
+                        format!("Accessing `{:?}` with the kind `{:?}` shouldn't be possible",
                         place,
-                        kind,
+                        kind).as_str()
                     );
                 }
                 return false;

@oli-obk
Copy link
Contributor

oli-obk commented Oct 2, 2019

If you open a PR about this, please also adjust the comment explaining why we need a delay_span_bug instead of just aborting

@ghost
Copy link

ghost commented Oct 2, 2019

If you open a PR about this, please also adjust the comment explaining why we need a delay_span_bug instead of just aborting

I won't open one, I've no idea how/why this works. All I know is that it works xD and I trust that it's correct.

@estebank
Copy link
Contributor

estebank commented Oct 2, 2019

@howaboutsynergy could you show us the minimum set of errors that rustc emits while originally reproducing the ICE? That might help us create a minimized repro case.

@ghost
Copy link

ghost commented Oct 2, 2019

tl;dr: done #65011 (comment)

deleted

If you run nightly on this code, it should show you the errors, with RUST_BACKTRACE=1. Or, am I misunderstanding the question? xD

Oh and you have to run it with -Z treat-err-as-bug=50, as figured out by @hellow554 above.

Centril added a commit to Centril/rust that referenced this issue Oct 4, 2019
Do not ICE when dereferencing non-Copy raw pointer

CC rust-lang#52262. Confirmed to remove the unnecessary ICE, but without a repro case.
tmandry added a commit to tmandry/rust that referenced this issue Oct 5, 2019
Do not ICE when dereferencing non-Copy raw pointer

CC rust-lang#52262. Confirmed to remove the unnecessary ICE, but without a repro case.
tmandry added a commit to tmandry/rust that referenced this issue Oct 6, 2019
Do not ICE when dereferencing non-Copy raw pointer

CC rust-lang#52262. Confirmed to remove the unnecessary ICE, but without a repro case.
@varkor
Copy link
Member

varkor commented Oct 7, 2019

A test for this was added in #65011.

@varkor varkor closed this as completed Oct 7, 2019
correabuscar pushed a commit to correabuscar/memdb that referenced this issue Mar 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-unstable Blocker: Implemented in the nightly compiler and unstable. 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. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

6 participants