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

Don't ICE when implementing Drop on enums #13041

Closed
brson opened this issue Mar 20, 2014 · 2 comments · Fixed by #15272
Closed

Don't ICE when implementing Drop on enums #13041

brson opened this issue Mar 20, 2014 · 2 comments · Fixed by #15272
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority

Comments

@brson
Copy link
Contributor

brson commented Mar 20, 2014

cc #6250

Drop not only doesn't work on enums, it makes the compiler crash. Nominating.

@pnkfelix
Copy link
Member

We will accept ICE's, reluctantly, in a 1.0 release.

Therefore, not a 1.0 blocker. Assigning P-low for now.

@lilyball
Copy link
Contributor

Minimal repro:

enum Foo {
    Bar
}

impl Drop for Foo {
    fn drop(&mut self) {}
}

ICE message:

error: internal compiler error: ID not mapped to struct fields: enum Foo::Foo (id=4)

@ghost ghost mentioned this issue Jun 30, 2014
lnicola pushed a commit to lnicola/rust that referenced this issue Aug 23, 2022
…soc-2, r=Veykril

feat: Generate static method using Self::assoc() syntax

This change improves the `generate_function` assist to support generating static methods/associated functions using the `Self::assoc()` syntax. Previously, one could generate a static method, but only when specifying the type name directly (like `Foo::assoc()`). After this change, `Self` is supported as well as the type name.

Fixes rust-lang#13012
Jarcho pushed a commit to Jarcho/rust that referenced this issue Aug 24, 2024
Refactor `absolute_paths`

Checks are rearranged to do the more expensive checks later. Since the most likely path length will be one (locals and imported/local items) this will exclude such paths on the first check.

Tests were rewritten as they were hard to follow (annotations would have helped), spammy (lots of tests for the same thing) and insufficient.

One thing thing that came up and should be decided on now is what to do about the difference between `path::to::Trait::item` (4 segments) and `path::to::Type::item` (3 segments). The current behaviour treats these as different lengths which is terrible. I personally think these should both be three segments since the item can't actually be imported. Only the type or the trait could be. This makes `crate_name::Trait::item` the shortest absolute path which is shorter than the lint allows by default.

changelog: None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ P-low Low priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants