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

trait lang item on a struct #20875

Closed
apreiml opened this Issue Jan 10, 2015 · 13 comments

Comments

Projects
None yet
@apreiml
Copy link
Contributor

apreiml commented Jan 10, 2015

thread 'rustc' panicked at 'assertion failed: did.krate != ast::LOCAL_CRATE', /build/buildd/rust-nightly-201501100408~14f9d1f~trusty/src/librustc/middle/ty.rs:5407

stack backtrace:
   1:     0x2ae1b47dd480 - sys::backtrace::write::h62c31c8ce34639e5Jzt
   2:     0x2ae1b47ff6a0 - <unknown>
   3:     0x2ae1b476d210 - rt::unwind::begin_unwind_inner::he6cbf3e88d73f0799tz
   4:     0x2ae1b6036a70 - <unknown>
   5:     0x2ae1b63d0fd0 - middle::ty::lookup_trait_def::hdfbea244d3d6f091YK8
   6:     0x2ae1b63f2700 - middle::ty::predicates_for_trait_ref::he697e3d5878aab355L8
   7:     0x2ae1b63ca680 - middle::traits::util::Elaborator<'cx, 'tcx>.Iterator::next::h50ca4a7d9ffad3d9fiU
   8:     0x2ae1b6427160 - middle::ty::required_region_bounds::h4b25d429295ec69eKi9
   9:     0x2ae1b5138730 - <unknown>
  10:     0x2ae1b5126470 - <unknown>
  11:     0x2ae1b5176c50 - <unknown>
  12:     0x2ae1b525c500 - <unknown>
  13:     0x2ae1b5257040 - check_crate::h79cca79b16d5148023x
  14:     0x2ae1b43df660 - driver::phase_3_run_analysis_passes::h1b173e994da54b02gwa
  15:     0x2ae1b43c7fa0 - driver::compile_input::hff268245321ca983xba
  16:     0x2ae1b4497c40 - <unknown>
  17:     0x2ae1b4497aa0 - <unknown>
  18:     0x2ae1b4496820 - <unknown>
  19:     0x2ae1b48645c0 - <unknown>
  20:     0x2ae1b48645b0 - rust_try
  21:     0x2ae1b4496b10 - <unknown>
  22:     0x2ae1b47ed540 - <unknown>
  23:     0x2ae1ba30c0c0 - start_thread
  24:     0x2ae1b4df9ec9 - __clone
  25:                0x0 - <unknown>

make: *** [main.o] Error 101

Version (nightly from : http://ppa.launchpad.net/hansjorg/rust/ubuntu)

rustc 1.0.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 1.0.0-dev

I've tried to compile: https://github.com/apreiml/rustboot

@crumblingstatue

This comment has been minimized.

Copy link
Contributor

crumblingstatue commented Jan 10, 2015

Here is a test case:

#![no_std]

#![feature(lang_items)]
#[lang="sized"]

struct Foo; // can be omitted

struct Bar<T> {field: T}

fn main() {}

The ICE happens at least when the sized lang item is improperly defined (is not a trait), and a generic item is defined.

@flaper87 flaper87 added the I-ICE label Jan 10, 2015

@zhangpf

This comment has been minimized.

Copy link

zhangpf commented Jan 20, 2015

http://is.gd/SpIRJe
encounter the same problem.

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Jan 27, 2015

@pnkfelix

This comment has been minimized.

Copy link
Member

pnkfelix commented Jan 27, 2015

(actually maybe this does not really need @nikomatsakis 's attention; I suspect we could just make the code check a bit more carefully that the Sized lang-item matches expectations (and issue a proper error when it does not.)

@tamird

This comment has been minimized.

Copy link
Contributor

tamird commented Apr 22, 2015

Triage bump: still ICEs.

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

#[lang="sized"]
struct Bar<T> {field: T}

fn main() {}

@steveklabnik steveklabnik referenced this issue Oct 23, 2015

Closed

Add ICEs to Glacier #29249

171 of 200 tasks complete
@bltavares

This comment has been minimized.

Copy link
Contributor

bltavares commented Oct 25, 2015

I could not compile the latest example and I'm not sure what is causing it.
http://is.gd/O7SWvV

Removing the lang pragma makes it compile, but I guess that is that is a change on the semantics.

@steveklabnik

This comment has been minimized.

Copy link
Member

steveklabnik commented Oct 25, 2015

@alexcrichton the recent changes to no_std probably change these samples, huh? Any ideas on how to reproduce?

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Oct 25, 2015

@steveklabnik

Use no_core instead of no_std. However, as a rule, we don't type-check lang items (e.g. you can cause also cause an easy ICE if you add type parameters or associated items to Sized).

@bltavares

This comment has been minimized.

Copy link
Contributor

bltavares commented Oct 25, 2015

Is this the same ICE?

#![feature(no_core,lang_items)]
#![no_core]

#[lang="sized"]
struct Bar<T> {field: T}

fn main() {}

The error message is different than the OP's error.

error: internal compiler error: unexpected panic
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 'No def'n found for DefId { krate: 0, node: DefIndex(2) => Bar } in tcx.super_predicates', ../src/librustc/middle/ty/mod.rs:1897
@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Oct 25, 2015

@bltavares
Sure. lang_items is unstable for a reason.

@bltavares

This comment has been minimized.

Copy link
Contributor

bltavares commented Oct 25, 2015

@arielb1 Cool. I will add it to steveklabnik/glacier then.

bltavares added a commit to bltavares/glacier that referenced this issue Oct 25, 2015

@bltavares bltavares referenced this issue Oct 25, 2015

Merged

20875 #59

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Oct 25, 2015

@bltavares

It is unlikely to be fixed.

@Mark-Simulacrum Mark-Simulacrum changed the title rustc panicked trait lang item on a struct Jun 13, 2017

@Mark-Simulacrum

This comment has been minimized.

Copy link
Member

Mark-Simulacrum commented Jul 22, 2017

This ICE is effectively caused by #9307, so I'm going to close in favor of that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.