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 when taking function pointer to generic intrinsic #30922

Closed
durka opened this issue Jan 14, 2016 · 1 comment
Closed

ICE when taking function pointer to generic intrinsic #30922

durka opened this issue Jan 14, 2016 · 1 comment

Comments

@durka
Copy link
Contributor

durka commented Jan 14, 2016

ICE on stable, beta, and nightly.

Code:

fn main() {
    println!("{:?}", 
{let _ = std::ptr::copy::<u8>;}
    );
}

ICE:

   Compiling expr v0.1.0 (file:///Users/alex/.multirust/toolchains/nightly/cargo/.cargo/script-cache/expr-68b6f2d3c9cc0b56)
error: internal compiler error: can't monomorphize a NodeForeignItem(ForeignItem { name: copy(65), attrs: [Spanned { node: Attribute_ { id: AttrId(1448), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// Copies `count * size_of<T>` bytes from `src` to `dst`. The source", CookedStr), span: ../src/libcore/intrinsics.rs:242:38: 243:43 }), span: ../src/libcore/intrinsics.rs:357:5: 357:74 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:357:5: 357:74 }, Spanned { node: Attribute_ { id: AttrId(1449), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// and destination may overlap.", CookedStr), span: ../src/libcore/intrinsics.rs:243:48: 244:16 }), span: ../src/libcore/intrinsics.rs:358:5: 358:37 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:358:5: 358:37 }, Spanned { node: Attribute_ { id: AttrId(1450), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:244:21: 244:24 }), span: ../src/libcore/intrinsics.rs:359:5: 359:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:359:5: 359:8 }, Spanned { node: Attribute_ { id: AttrId(1451), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// `copy` is semantically equivalent to C\'s `memmove`.", CookedStr), span: ../src/libcore/intrinsics.rs:244:29: 245:13 }), span: ../src/libcore/intrinsics.rs:360:5: 360:60 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:360:5: 360:60 }, Spanned { node: Attribute_ { id: AttrId(1452), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:245:18: 245:21 }), span: ../src/libcore/intrinsics.rs:361:5: 361:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:361:5: 361:8 }, Spanned { node: Attribute_ { id: AttrId(1453), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// # Safety", CookedStr), span: ../src/libcore/intrinsics.rs:245:26: 245:38 }), span: ../src/libcore/intrinsics.rs:362:5: 362:17 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:362:5: 362:17 }, Spanned { node: Attribute_ { id: AttrId(1454), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:246:3: 246:6 }), span: ../src/libcore/intrinsics.rs:363:5: 363:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:363:5: 363:8 }, Spanned { node: Attribute_ { id: AttrId(1455), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// Care must be taken with the ownership of `src` and `dst`.", CookedStr), span: ../src/libcore/intrinsics.rs:246:11: 249:4 }), span: ../src/libcore/intrinsics.rs:364:5: 364:66 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:364:5: 364:66 }, Spanned { node: Attribute_ { id: AttrId(1456), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// This method semantically moves the values of `src` into `dst`.", CookedStr), span: ../src/libcore/intrinsics.rs:250:1: 250:67 }), span: ../src/libcore/intrinsics.rs:365:5: 365:71 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:365:5: 365:71 }, Spanned { node: Attribute_ { id: AttrId(1457), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// However it does not drop the contents of `dst`, or prevent the contents of `src`", CookedStr), span: ../src/libcore/intrinsics.rs:251:3: 252:19 }), span: ../src/libcore/intrinsics.rs:366:5: 366:89 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:366:5: 366:89 }, Spanned { node: Attribute_ { id: AttrId(1458), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// from being dropped or used.", CookedStr), span: ../src/libcore/intrinsics.rs:252:24: 252:55 }), span: ../src/libcore/intrinsics.rs:367:5: 367:36 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:367:5: 367:36 }, Spanned { node: Attribute_ { id: AttrId(1459), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:253:2: 253:5 }), span: ../src/libcore/intrinsics.rs:368:5: 368:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:368:5: 368:8 }, Spanned { node: Attribute_ { id: AttrId(1460), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// # Examples", CookedStr), span: ../src/libcore/intrinsics.rs:253:10: 253:24 }), span: ../src/libcore/intrinsics.rs:369:5: 369:19 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:369:5: 369:19 }, Spanned { node: Attribute_ { id: AttrId(1461), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:253:29: 253:32 }), span: ../src/libcore/intrinsics.rs:370:5: 370:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:370:5: 370:8 }, Spanned { node: Attribute_ { id: AttrId(1462), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// Efficiently create a Rust vector from an unsafe buffer:", CookedStr), span: ../src/libcore/intrinsics.rs:253:37: 254:28 }), span: ../src/libcore/intrinsics.rs:371:5: 371:64 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:371:5: 371:64 }, Spanned { node: Attribute_ { id: AttrId(1463), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:254:33: 254:36 }), span: ../src/libcore/intrinsics.rs:372:5: 372:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:372:5: 372:8 }, Spanned { node: Attribute_ { id: AttrId(1464), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// ```", CookedStr), span: ../src/libcore/intrinsics.rs:254:41: 254:48 }), span: ../src/libcore/intrinsics.rs:373:5: 373:12 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:373:5: 373:12 }, Spanned { node: Attribute_ { id: AttrId(1465), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// use std::ptr;", CookedStr), span: ../src/libcore/intrinsics.rs:254:53: 255:4 }), span: ../src/libcore/intrinsics.rs:374:5: 374:22 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:374:5: 374:22 }, Spanned { node: Attribute_ { id: AttrId(1466), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:255:9: 255:12 }), span: ../src/libcore/intrinsics.rs:375:5: 375:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:375:5: 375:8 }, Spanned { node: Attribute_ { id: AttrId(1467), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// # #[allow(dead_code)]", CookedStr), span: ../src/libcore/intrinsics.rs:255:17: 257:12 }), span: ../src/libcore/intrinsics.rs:376:5: 376:30 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:376:5: 376:30 }, Spanned { node: Attribute_ { id: AttrId(1468), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// unsafe fn from_buf_raw<T>(ptr: *const T, elts: usize) -> Vec<T> {", CookedStr), span: ../src/libcore/intrinsics.rs:257:17: 258:24 }), span: ../src/libcore/intrinsics.rs:377:5: 377:74 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:377:5: 377:74 }, Spanned { node: Attribute_ { id: AttrId(1469), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///     let mut dst = Vec::with_capacity(elts);", CookedStr), span: ../src/libcore/intrinsics.rs:258:29: 260:41 }), span: ../src/libcore/intrinsics.rs:378:5: 378:52 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:378:5: 378:52 }, Spanned { node: Attribute_ { id: AttrId(1470), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///     dst.set_len(elts);", CookedStr), span: ../src/libcore/intrinsics.rs:260:46: 260:72 }), span: ../src/libcore/intrinsics.rs:379:5: 379:31 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:379:5: 379:31 }, Spanned { node: Attribute_ { id: AttrId(1471), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///     ptr::copy(ptr, dst.as_mut_ptr(), elts);", CookedStr), span: ../src/libcore/intrinsics.rs:260:77: 262:38 }), span: ../src/libcore/intrinsics.rs:380:5: 380:52 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:380:5: 380:52 }, Spanned { node: Attribute_ { id: AttrId(1472), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///     dst", CookedStr), span: ../src/libcore/intrinsics.rs:262:43: 264:2 }), span: ../src/libcore/intrinsics.rs:381:5: 381:16 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:381:5: 381:16 }, Spanned { node: Attribute_ { id: AttrId(1473), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// }", CookedStr), span: ../src/libcore/intrinsics.rs:264:7: 264:12 }), span: ../src/libcore/intrinsics.rs:382:5: 382:10 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:382:5: 382:10 }, Spanned { node: Attribute_ { id: AttrId(1474), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("/// ```", CookedStr), span: ../src/libcore/intrinsics.rs:264:17: 265:5 }), span: ../src/libcore/intrinsics.rs:383:5: 383:12 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:383:5: 383:12 }, Spanned { node: Attribute_ { id: AttrId(1475), style: Outer, value: Spanned { node: MetaNameValue("doc", Spanned { node: LitStr("///", CookedStr), span: ../src/libcore/intrinsics.rs:266:2: 266:5 }), span: ../src/libcore/intrinsics.rs:384:5: 384:8 }, is_sugared_doc: true }, span: ../src/libcore/intrinsics.rs:384:5: 384:8 }, Spanned { node: Attribute_ { id: AttrId(1476), style: Outer, value: Spanned { node: MetaList("stable", [Spanned { node: MetaNameValue("feature", Spanned { node: LitStr("rust1", CookedStr), span: ../src/libcore/intrinsics.rs:267:17: 268:2 }), span: ../src/libcore/intrinsics.rs:385:14: 385:32 }, Spanned { node: MetaNameValue("since", Spanned { node: LitStr("1.0.0", CookedStr), span: ../src/libcore/intrinsics.rs:269:4: 269:11 }), span: ../src/libcore/intrinsics.rs:385:33: 385:49 }]), span: ../src/libcore/intrinsics.rs:385:7: 385:50 }, is_sugared_doc: false }, span: ../src/libcore/intrinsics.rs:385:5: 385:50 }], node: ForeignItemFn(FnDecl { inputs: [Arg { ty: type(*const T), pat: pat(72: src), id: 71 }, Arg { ty: type(*mut T), pat: pat(76: dst), id: 75 }, Arg { ty: type(usize), pat: pat(80: count), id: 79 }], output: DefaultReturn(../src/libcore/intrinsics.rs:270:12: 270:12), variadic: false }, Generics { lifetimes: [], ty_params: [TyParam { name: T(1580), id: 82, bounds: [], default: None, span: ../src/libcore/intrinsics.rs:269:30: 269:31 }], where_clause: WhereClause { id: 83, predicates: [] } }), id: 70, span: ../src/libcore/intrinsics.rs:386:5: 386:62, vis: Public })
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
thread 'rustc' panicked at 'Box<Any>', ../src/libsyntax/errors/mod.rs:469
stack backtrace:
   1:        0x10e1489b8 - sys::backtrace::tracing::imp::write::h205a11cf52158765f0t
   2:        0x10e14ed6f - panicking::default_handler::_<closure>::closure.42055
   3:        0x10e14e7b2 - panicking::default_handler::hc5f9b2cc38e6415fZYx
   4:        0x10e116614 - sys_common::unwind::begin_unwind_inner::hd4bbb2308abfe323h3s
   5:        0x10d84c1da - sys_common::unwind::begin_unwind::h12496273753689425178
   6:        0x10d84c641 - errors::Handler::bug::hdef34fc4eaae66ce9ed
   7:        0x10ad87d4f - session::Session::bug::h388e66a8222d872c8Qt
   8:        0x10a6f17f4 - trans::monomorphize::monomorphic_fn::h096821ead46d9aaaeyP
   9:        0x10a6e11bf - trans::callee::trans_fn_ref_with_substs::h05a8e0f864bd6f19qtp
  10:        0x10a6dff2f - trans::callee::trans_fn_ref::h1144e47ea9da6bf0Eip
  11:        0x10a71db84 - trans::expr::trans_def_fn_unadjusted::h5dfbe914c47b97a4bSD
  12:        0x10a718c5b - trans::consts::const_expr_unadjusted::hadb254ab8566d69fKyu
  13:        0x10a714687 - trans::consts::const_expr::h911e74302508d9e4Ogu
  14:        0x10a7156e7 - trans::consts::get_const_expr_as_global::hd5ae4fa5ac33c9cbLau
  15:        0x10a67ac56 - trans::expr::trans::h131c0f930fdc6284rxC
  16:        0x10a7322a3 - trans::expr::trans_to_lvalue::h6635c0f082e0b6a0l1C
  17:        0x10a69ca9e - trans::base::init_local::hbe583f5fb6292b86hIi
  18:        0x10a6b55a1 - trans::controlflow::trans_block::he23a1b48be99e429zcx
  19:        0x10a755f51 - trans::expr::trans_rvalue_dps_unadjusted::hee0517592b0b4bd1KzD
  20:        0x10a754885 - trans::expr::trans_unadjusted::h2c3cdc2e741fe618c2C
  21:        0x10a67b549 - trans::expr::trans::h131c0f930fdc6284rxC
  22:        0x10a7322a3 - trans::expr::trans_to_lvalue::h6635c0f082e0b6a0l1C
  23:        0x10a75f4af - trans::expr::trans_addr_of::h4910fcfa3b614ff5okE
  24:        0x10a754cad - trans::expr::trans_unadjusted::h2c3cdc2e741fe618c2C
  25:        0x10a6b9350 - trans::expr::trans_into::ha182c3679c0f7c083qC
  26:        0x10a6b7cd8 - trans::expr::trans_adt::hba95cfeb79fd913ci2D
  27:        0x10a758398 - trans::expr::trans_rvalue_dps_unadjusted::hee0517592b0b4bd1KzD
  28:        0x10a7545fa - trans::expr::trans_unadjusted::h2c3cdc2e741fe618c2C
  29:        0x10a67b549 - trans::expr::trans::h131c0f930fdc6284rxC
  30:        0x10a7322a3 - trans::expr::trans_to_lvalue::h6635c0f082e0b6a0l1C
  31:        0x10a793a5b - trans::_match::trans_match_inner::hc54ca21fc98f7ea9r3L
  32:        0x10a755ed6 - trans::expr::trans_rvalue_dps_unadjusted::hee0517592b0b4bd1KzD
  33:        0x10a7545fa - trans::expr::trans_unadjusted::h2c3cdc2e741fe618c2C
  34:        0x10a67b549 - trans::expr::trans::h131c0f930fdc6284rxC
  35:        0x10a7322a3 - trans::expr::trans_to_lvalue::h6635c0f082e0b6a0l1C
  36:        0x10a75f4af - trans::expr::trans_addr_of::h4910fcfa3b614ff5okE
  37:        0x10a754cad - trans::expr::trans_unadjusted::h2c3cdc2e741fe618c2C
  38:        0x10a67b549 - trans::expr::trans::h131c0f930fdc6284rxC
  39:        0x10a6ee3b5 - trans::callee::trans_args::he2ea0a418a6f5bf2I4p
  40:        0x10a6f3e77 - trans::callee::trans_call_inner::h1022655365734521182
  41:        0x10a756c21 - trans::expr::trans_rvalue_dps_unadjusted::hee0517592b0b4bd1KzD
  42:        0x10a7545fa - trans::expr::trans_unadjusted::h2c3cdc2e741fe618c2C
  43:        0x10a67b549 - trans::expr::trans::h131c0f930fdc6284rxC
  44:        0x10a6ee3b5 - trans::callee::trans_args::he2ea0a418a6f5bf2I4p
  45:        0x10a6f3e77 - trans::callee::trans_call_inner::h1022655365734521182
  46:        0x10a756c21 - trans::expr::trans_rvalue_dps_unadjusted::hee0517592b0b4bd1KzD
  47:        0x10a6b9330 - trans::expr::trans_into::ha182c3679c0f7c083qC
  48:        0x10a732235 - trans::controlflow::trans_stmt_semi::hd7994b082826448eDbx
  49:        0x10a6b557d - trans::controlflow::trans_block::he23a1b48be99e429zcx
  50:        0x10a6b0459 - trans::base::trans_closure::h93f148365767cb227vj
  51:        0x10a6b5f05 - trans::base::trans_fn::hdadb98ea2f3363a8TFj
  52:        0x10a6ba6b1 - trans::base::trans_item::h6d527a74db9fcd19X3j
  53:        0x10a6d50fb - trans::base::TransItemsWithinModVisitor<'a, 'tcx>.Visitor<'v>::visit_item::h760a7a92bcad9971d4k
  54:        0x10a6c6c55 - trans::base::trans_crate::h8a61c24454d2cf9dINk
  55:        0x109f5c54d - driver::phase_4_translate_to_llvm::h6a6d28e27ce2fe48PTa
  56:        0x109f52739 - driver::phase_3_run_analysis_passes::_<closure>::closure.26438
  57:        0x109f34fa4 - middle::ty::context::ctxt<'tcx>::create_and_enter::h370372343873663919
  58:        0x109f30c5d - driver::phase_3_run_analysis_passes::h16107789473110901907
  59:        0x109f026aa - driver::compile_input::hbc12c04dfe7ee2c0kca
  60:        0x109ef443f - run_compiler::h6bc2c57b5033a6e4Rwc
  61:        0x109ef113c - sys_common::unwind::try::try_fn::h10843292888798321982
  62:        0x10e146668 - __rust_try
  63:        0x10e13e42e - sys_common::unwind::try::inner_try::h060cb066aa382f27PZs
  64:        0x109ef1511 - boxed::F.FnBox<A>::call_box::h15928378584472144199
  65:        0x10e14db0d - sys::thread::Thread::new::thread_start::h3906ff09ada8499amex
  66:     0x7fff8a49f898 - _pthread_body
  67:     0x7fff8a49f729 - _pthread_start

Could not compile `expr`.

To learn more, run the command again with --verbose.
internal error: cargo failed with status 101
An unknown error occurred

To learn more, run the command again with --verbose.
@huonw
Copy link
Member

huonw commented Jan 14, 2016

Dupe of #15694 (and #20318). Thanks for filing!

@huonw huonw closed this as completed Jan 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants