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 playing with no_std -- requires sized lang_item #17392

Closed
eminence opened this issue Sep 19, 2014 · 3 comments
Closed

ICE when playing with no_std -- requires sized lang_item #17392

eminence opened this issue Sep 19, 2014 · 3 comments
Labels
A-DSTs Area: Dynamically-sized types (DSTs) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@eminence
Copy link
Contributor

The error message is clear enough, but it seems like this shouldn't be an ICE

achin@bigbox ~/tmp/rust $ cat a.rs
#![no_std]

fn start(argc: int, argv: *const *const u8) -> int {
#![start]
    0
}

achin@bigbox ~/tmp/rust $ env RUST_BACKTRACE=1 rustc a.rs
a.rs:3:10: 3:14 error: internal compiler error: requires `sized` lang_item
a.rs:3 fn start(argc: int, argv: *const *const u8) -> int {
                ^~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /storage/home/achin/devel/rust/src/libsyntax/ast_util.rs:751

stack backtrace:
   1:     0x7f12bb0c0320 - rt::backtrace::imp::write::h5011a823a9d2b90elLq
   2:     0x7f12bb0c34e0 - failure::on_fail::h8355a77906713dc1N6q
   3:     0x7f12bf6b5fc0 - unwind::begin_unwind_inner::hf77d41f3604ab71fMTd
   4:     0x7f12bbe80f30 - unwind::begin_unwind::h8610426004860857751
   5:     0x7f12bbe80e80 - diagnostic::SpanHandler::span_bug::h925d5319dcb2c79dCPE
   6:     0x7f12bfee7c80 - driver::session::Session::span_bug::hb917b060592cc0ddBVx
   7:     0x7f12c00e0270 - middle::traits::util::obligation_for_builtin_bound::h5938aa6972bf6dc1JTX
   8:     0x7f12c02e87a0 - middle::typeck::check::FnCtxt<'a, 'tcx>::require_type_meets::hbacd2d580e0d8f3dMRU
   9:     0x7f12c02d4ef0 - middle::typeck::check::check_fn::closure.133210
  10:     0x7f12c000f3b0 - middle::pat_util::pat_bindings::closure.119668
  11:     0x7f12bbe47fc0 - ast_util::walk_pat::h7662487bce0fe586boB
  12:     0x7f12c02cfb90 - middle::typeck::check::check_fn::h52ba20c670decb0agUS
  13:     0x7f12c02cf9a0 - middle::typeck::check::check_bare_fn::h86b61dfcb7621b98jJS
  14:     0x7f12c02c8760 - middle::typeck::check::check_item::h3fa2f0abe5095d12YgT
  15:     0x7f12c02cf620 - middle::typeck::check::check_item_types::h0692a1ee5102a933hIS
  16:     0x7f12bfd269d0 - util::common::time::h18183101536224942747
  17:     0x7f12c05c14f0 - middle::typeck::check_crate::h703f92e8dad23bd1zIk
  18:     0x7f12c062e340 - driver::driver::phase_3_run_analysis_passes::hb0cf3abc00099bf1xcx
  19:     0x7f12c06297b0 - driver::driver::compile_input::hdc9d5d157f48b333uTw
  20:     0x7f12c06ae7f0 - driver::run_compiler::hfa4d73e40e8a65111KA
  21:     0x7f12c06ae6d0 - driver::main_args::closure.147050
  22:     0x7f12bfd401c0 - task::TaskBuilder<S>::try_future::closure.101861
  23:     0x7f12bfd3ffb0 - task::TaskBuilder<S>::spawn_internal::closure.101832
  24:     0x7f12bfa06bd0 - task::spawn_opts::closure.8443
  25:     0x7f12bf70c400 - rust_try_inner
  26:     0x7f12bf70c3f0 - rust_try
  27:     0x7f12bf6b35c0 - unwind::try::hed0a4efeac87f00buId
  28:     0x7f12bf6b3420 - task::Task::run::h9fc26630f08499c2cYc
  29:     0x7f12bfa06940 - task::spawn_opts::closure.8383
  30:     0x7f12bf6b5010 - thread::thread_start::h1e1e155278f838d3rid
  31:     0x7f12ba466100 - start_thread
  32:     0x7f12bf38ad49 - clone
  33:                0x0 - <unknown>

Built with rustc 0.12.0-pre (af3889f 2014-09-18 21:20:38 +0000)

@japaric
Copy link
Member

japaric commented Sep 19, 2014

internal compiler error: requires sized lang_item

cc @nick29581

@nrc nrc added the A-DSTs Area: Dynamically-sized types (DSTs) label Sep 19, 2014
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 22, 2014
@mcoffin
Copy link
Contributor

mcoffin commented Sep 22, 2014

+1 getting same ICE with

#![crate_name = "prog"]
#![no_std]

#[start]
fn main(argc: int, argv: *const *const u8) -> int {
    0
}

@nrc
Copy link
Member

nrc commented Sep 23, 2014

I have a fix for this (coming up, changes the ICE to an error), but note that the code is still incorrect. You do need a sized lang item:

#![feature(lang_items)]
#![no_std]

#[lang="sized"]
trait Sized {}

#[start]
fn start(argc: int, argv: *const *const u8) -> int {
    0
}

bors added a commit that referenced this issue Sep 29, 2014
closes #17392 

r? @nikomatsakis 

Kind of a first draft because I'm not sure if this is the right approach. I believe the general idea of giving an error rather than an ICE in obligation_for_builtin_bound is right, but not sure about returning an Option, etc.

Also, could probably have a better error message.
@nrc nrc closed this as completed in 1c36d1c Sep 30, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Jun 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-DSTs Area: Dynamically-sized types (DSTs) I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants