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

LLVM assertion when implementing methods that take self by-value on numeric types #5474

Closed
bstrie opened this issue Mar 21, 2013 · 1 comment
Labels
A-trait-system Area: Trait system I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.

Comments

@bstrie
Copy link
Contributor

bstrie commented Mar 21, 2013

This:

fn main() {
    10u.to_vec();
}

trait ToVec {
    fn to_vec(self);
}

impl ToVec for uint {
    fn to_vec(self){}
}

causes this:

rustc: /media/linhaus/rust/src/llvm/lib/VMCore/Instructions.cpp:2383: static llvm::CastInst* llvm::CastInst::CreatePointerCast(llvm::Value*, llvm::Type*, const llvm::Twine&, llvm::Instruction*): Assertion `S->getType()->isPointerTy() && "Invalid cast"' failed.
Aborted

Changing self to &self makes it work, so it has to do with passing self by-value.

@jdm
Copy link
Contributor

jdm commented Mar 21, 2013

Duplicate of #5321.

@jdm jdm closed this as completed Mar 21, 2013
oli-obk pushed a commit to oli-obk/rust that referenced this issue May 2, 2020
Reenable rustfmt integration test

changelog: none
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 I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
Projects
None yet
Development

No branches or pull requests

2 participants