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 creating region pointer for bare self value #5280

Closed
jdm opened this issue Mar 8, 2013 · 3 comments
Closed

LLVM assertion when creating region pointer for bare self value #5280

jdm opened this issue Mar 8, 2013 · 3 comments
Assignees
Labels
A-lifetimes Area: lifetime related A-traits Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Milestone

Comments

@jdm
Copy link
Contributor

jdm commented Mar 8, 2013

type FontTableTag = u32;

trait FontTableTagConversions {
  fn tag_to_str(self);
}

impl FontTableTagConversions for FontTableTag {
  fn tag_to_str(self) {
    &self;
  }
}

fn main() {
    5.tag_to_str();
}

rustc: /run/media/jdm/ssd/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.`

@graydon
Copy link
Contributor

graydon commented Apr 30, 2013

assigning bug; change assignment if you disagree

@ghost ghost assigned nikomatsakis Apr 30, 2013
@catamorphism
Copy link
Contributor

Reproduced with efd1438

@Blei
Copy link
Contributor

Blei commented Jun 28, 2013

This seems to be fixed on 887ae82 (linux 64).

@luqmana luqmana closed this as completed Jun 28, 2013
dotdash added a commit to dotdash/rust that referenced this issue Jun 29, 2013
Currently we pass all "self" arguments by reference, for the pointer
variants this means that we end up with double indirection which causes
a unnecessary performance hit.

The fix itself is pretty straight-forward and just means that "self"
needs to be handled like any other argument, except for by-value "self"
which still needs to be passed by reference. This is because
non-pointer types can't just be stuffed into the environment slot which
is used to pass "self".

What made things tricky is that there was also a bug in the typechecker
where the method map entries are created. For type impls, that stored
the base type instead of the actual self-type in the method map, e.g.
Foo instead of &Foo for &self. That worked with pass-by-reference, but
fails with pass-by-value which needs the real type.

Code that makes use of methods seems to be about 10% faster with this
change. Also, build times are reduced by about 4%.

Fixes rust-lang#4355, rust-lang#4402, rust-lang#5280, rust-lang#4406 and rust-lang#7285
bors added a commit that referenced this issue Jun 29, 2013
Currently we pass all "self" arguments by reference, for the pointer
variants this means that we end up with double indirection which causes
a unnecessary performance hit.

The fix itself is pretty straight-forward and just means that "self"
needs to be handled like any other argument, except for by-value "self"
which still needs to be passed by reference. This is because
non-pointer types can't just be stuffed into the environment slot which
is used to pass "self".

What made things tricky is that there was also a bug in the typechecker
where the method map entries are created. For type impls, that stored
the base type instead of the actual self-type in the method map, e.g.
Foo instead of &Foo for &self. That worked with pass-by-reference, but
fails with pass-by-value which needs the real type.

Code that makes use of methods seems to be about 10% faster with this
change. Also, build times are reduced by about 4%.

Fixes #4355, #4402, #5280, #4406 and #7285
bors added a commit to rust-lang-ci/rust that referenced this issue May 2, 2020
…ip1995,Manishearth

needless_doc_main: only check rust code

This fixes rust-lang#5280 by checking the language attribute on code blocks.

---

changelog: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-lifetimes Area: lifetime related A-traits Area: Trait system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants