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

"intrinsic getting reified" #34123

Closed
steveklabnik opened this issue Jun 6, 2016 · 5 comments
Closed

"intrinsic getting reified" #34123

steveklabnik opened this issue Jun 6, 2016 · 5 comments
Labels
A-intrinsics Area: Intrinsics C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way.

Comments

@steveklabnik
Copy link
Member

steveklabnik commented Jun 6, 2016

While trying to reproduce #12633, one of my sillier code samples caused an ICE:

pub fn main() {
    let copy = std::intrinsics::copy;
    let assign: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) = copy;
}

output (edited to update backtrace):

error: internal compiler error: src/librustc_trans/collector.rs:605: intrinsic DefId { krate: CrateNum(2), node: DefIndex(2147484733) => core/95b59a2d6e560334339d9c64d12f4a24::intrinsics[0]::[1]::copy[0] } being reified

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: run with `RUST_BACKTRACE=1` for a backtrace

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:473
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
....
  13: rustc_trans::collector::visit_instance_use
             at /rust/src/librustc_trans/collector.rs:605
  14: <rustc_trans::collector::MirNeighborCollector<'a, 'tcx> as rustc::mir::visit::Visitor<'tcx>>::visit_rvalue
             at /rust/src/librustc_trans/collector.rs:588
             at /rust/src/librustc_trans/collector.rs:492
  15: rustc::mir::visit::Visitor::super_statement
             at /rust/src/librustc/mir/visit.rs:357
             at /rust/src/librustc/mir/visit.rs:115
             at /rust/src/librustc/mir/visit.rs:326
  16: rustc::mir::visit::Visitor::super_basic_block_data
             at /rust/src/librustc/mir/visit.rs:107
             at /rust/src/librustc/mir/visit.rs:290
  17: rustc::mir::visit::Visitor::super_mir
             at /rust/src/librustc/mir/visit.rs:95
             at /rust/src/librustc/mir/visit.rs:262
  18: rustc_trans::collector::collect_neighbours
             at /rust/src/librustc_trans/collector.rs:978
  19: rustc_trans::collector::collect_items_rec
             at /rust/src/librustc_trans/collector.rs:350
  20: rustc::dep_graph::graph::DepGraph::with_ignore
             at /rust/src/librustc_trans/collector.rs:278
             at /rust/src/librustc/dep_graph/graph.rs:77
  21: rustc_trans::collector::collect_crate_translation_items
             at /rust/src/librustc_trans/collector.rs:269
  22: rustc::util::common::time
             at /rust/src/librustc_trans/base.rs:1587
             at /rust/src/librustc/util/common.rs:48
  23: rustc_trans::base::collect_and_partition_translation_items
             at /rust/src/librustc_trans/base.rs:1586
  24: rustc_trans::base::trans_crate
             at /rust/src/librustc_trans/base.rs:1108
  25: rustc::util::common::time
             at /rust/src/librustc_driver/driver.rs:1051
             at /rust/src/librustc/util/common.rs:48
  26: rustc_driver::driver::phase_4_translate_to_llvm
             at /rust/src/librustc_driver/driver.rs:1049
  27: rustc_driver::driver::compile_input::{{closure}}
             at /rust/src/librustc_driver/driver.rs:206
  28: <std::thread::local::LocalKey<T>>::with
             at /rust/src/librustc_driver/driver.rs:1032
             at /rust/src/librustc/ty/context.rs:915
             at /rust/src/libstd/thread/local.rs:253
  29: rustc::ty::context::tls::enter
             at /rust/src/librustc/ty/context.rs:912
  30: <std::thread::local::LocalKey<T>>::with
             at /rust/src/librustc/ty/context.rs:899
             at /rust/src/libstd/thread/local.rs:253
  31: rustc::ty::context::tls::enter_global
             at /rust/src/librustc/ty/context.rs:896
  32: rustc::ty::context::TyCtxt::create_and_enter
             at /rust/src/librustc/ty/context.rs:706
  33: rustc_driver::driver::phase_3_run_analysis_passes
             at /rust/src/librustc_driver/driver.rs:940
  34: rustc_driver::driver::compile_input
             at /rust/src/librustc_driver/driver.rs:172
  35: rustc_driver::run_compiler
             at /rust/src/librustc_driver/lib.rs:224
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Jun 6, 2016
@solson
Copy link
Member

solson commented Nov 4, 2016

I think this case is similar: https://is.gd/nTzJmH

(But I'm not too worried since it's behind one of those "going to become an error" warnings.)

@Mark-Simulacrum Mark-Simulacrum added the C-bug Category: This is a bug. label Jul 22, 2017
@steveklabnik
Copy link
Member Author

This appears to be fixed

rror[E0658]: intrinsics are subject to change
 --> src/main.rs:3:17
  |
3 |     let assign: unsafe extern "rust-intrinsic" fn(*const i32, *mut i32, usize) = copy;
  |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658

as @solson predicted. closing!

@bjorn3
Copy link
Member

bjorn3 commented Sep 25, 2018

Adding #![feature(intrinsics)] to the original example still gives an ice.

@bjorn3
Copy link
Member

bjorn3 commented Jul 26, 2019

New repro:

#![feature(intrinsics)]

fn main(){
    let transmute = std::intrinsics::transmute;
    let assign: unsafe extern "rust-intrinsic" fn(*const i32) -> *mut i32 = transmute;
}

Rust version: rustc 1.38.0-nightly (890881f8f 2019-07-25)

Backtrace:

   Compiling playground v0.0.1 (/playground)
warning: unused variable: `assign`
 --> src/main.rs:5:9
  |
5 |     let assign: unsafe extern "rust-intrinsic" fn(*const i32) -> *mut i32 = transmute;
  |         ^^^^^^ help: consider prefixing with an underscore: `_assign`
  |
  = note: `#[warn(unused_variables)]` on by default

error: internal compiler error: src/librustc_mir/monomorphize/collector.rs:722: intrinsic DefId(2:905 ~ core[463c]::intrinsics[0]::[1]::transmute[0]) being reified

thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:646:9
stack backtrace:
   0: backtrace::backtrace::libunwind::trace
             at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
   1: backtrace::backtrace::trace_unsynchronized
             at /cargo/registry/src/github.com-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::monomorphize::collector::visit_instance_use
  17: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc::mir::visit::Visitor>::visit_rvalue
  18: rustc_mir::monomorphize::collector::collect_items_rec
  19: rustc_mir::monomorphize::collector::collect_crate_mono_items::{{closure}}
  20: rustc::util::common::time
  21: rustc_mir::monomorphize::collector::collect_crate_mono_items
  22: rustc::util::common::time
  23: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  24: rustc::ty::query::__query_compute::collect_and_partition_mono_items
  25: rustc::dep_graph::graph::DepGraph::with_task_impl
  26: rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt>::get_query
  27: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_utils::codegen_backend::CodegenBackend>::codegen_crate
  28: rustc::util::common::time
  29: rustc_interface::passes::start_codegen
  30: rustc::ty::context::tls::enter_global
  31: rustc_interface::passes::BoxedGlobalCtxt::access::{{closure}}
  32: rustc_interface::passes::create_global_ctxt::{{closure}}
  33: rustc_interface::passes::BoxedGlobalCtxt::enter
  34: rustc_interface::queries::Query<T>::compute
  35: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::ongoing_codegen
  36: rustc_interface::interface::run_compiler_in_existing_thread_pool
  37: std::thread::local::LocalKey<T>::with
  38: scoped_tls::ScopedKey<T>::set
  39: syntax::with_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: aborting due to previous error


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.38.0-nightly (890881f8f 2019-07-25) 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

error: Could not compile `playground`.

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

@jonas-schievink jonas-schievink added A-intrinsics Area: Intrinsics requires-nightly This issue requires a nightly compiler in some way. labels Jun 13, 2020
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 8, 2020
@Mark-Simulacrum
Copy link
Member

Closing as a duplicate of #15694, this was fixed in #64104. (And a test has been added in that PR).

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Nov 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-intrinsics Area: Intrinsics C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants