Skip to content

LLVM assertion failure with nested trait #3702

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

Closed
ashee opened this issue Oct 9, 2012 · 3 comments
Closed

LLVM assertion failure with nested trait #3702

ashee opened this issue Oct 9, 2012 · 3 comments
Labels
A-trait-system Area: Trait system A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@ashee
Copy link

ashee commented Oct 9, 2012

My environment

amitava:l2 amitava$ uname -a
Darwin amitava.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64
amitava:l2 amitava$ rustc --version
rustc 0.4 (c3f9b72 2012-09-30 21:35:32 -0700)
host: x86_64-apple-darwin

trait-test.rs

use io::println;

fn main() {
  trait Text {
    fn to_str(&self) -> ~str;
  }

  fn to_string(t: Text) {
    println(t.to_str());
  }

}

assertion failure

amitava:l2 amitava$ rustc trait-test.rs
Assertion failed: (Ty && "Invalid GetElementPtrInst indices for type!"), function checkGEPType, file /Users/amitava/opt/rust/src/rust/src/llvm/include/llvm/Instructions.h, line 705.
Abort trap: 6
@catamorphism
Copy link
Contributor

Edited to make the title a little clearer.

@erickt
Copy link
Contributor

erickt commented Oct 18, 2012

I ran into different code that may be tripping over the same bug:

trait Add {
    fn to_int(&self) -> int;
    fn add_dynamic(&self, other: &Add) -> int;
}

impl int: Add {
    fn to_int(&self) -> int { *self }
    fn add_dynamic(&self, other: &Add) -> int {
        self.to_int() + other.to_int()
    }
}

fn main() { }

rustc 0.4 and HEAD errors with:

Assertion failed: (Ty && "Invalid GetElementPtrInst indices for type!"), function checkGEPType, file /Users/etryzelaar/Projects/rust/rust/src/llvm/include/llvm/Instructions.h, line 705.

@catamorphism
Copy link
Contributor

@ashee 's example compiles successfully now, and @erickt 's fails with a proper type error. Thanks for the reports!

RalfJung pushed a commit to RalfJung/rust that referenced this issue Jul 14, 2024
Run tests for all specified targets

Currently cargo-miri uses the first target specified in the command line. However, when multiple targets are specified in a `cargo build` invocation, cargo will build for all of them.

Miri should match this behaviour to reduce surprises.

Fixes: rust-lang#3460
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-trait-system Area: Trait system A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants