Skip to content

Using enclosing function's type parameter in enum definition yields ICE instead of error #5997

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
jld opened this issue Apr 22, 2013 · 5 comments · Fixed by #13525
Closed
Labels
A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@jld
Copy link
Contributor

jld commented Apr 22, 2013

fn f<T>() { enum E { V(T) } }
pub fn main() { f::<int>(); }

⇒ error: internal compiler error: fictitious type ty_param({idx: 0, def_id: {crate: 0, node: 1}}) in sizing_type_of()

fn f<T>() { struct S(T); }
pub fn main() { f::<int>(); }

⇒ error: attempt to use a type argument out of scope

@metajack
Copy link
Contributor

This still happens on today's master.

Nominating for production ready.

@nikomatsakis
Copy link
Contributor

To be clear: I think the expected behavior here is an error
because the T is not in scope for nested items. So the
code ought to be enum<T> { Foo(T) } (similar to how a nested
fn couldn't reference T)

@graydon
Copy link
Contributor

graydon commented Aug 22, 2013

just a bug, removing milestone/nomination.

@huonw
Copy link
Member

huonw commented Dec 19, 2013

Triage, we're still creating types that are apparently fictitious and crashing.

@flaper87
Copy link
Contributor

This no longer ICE, it now outputs an error: error: missing type param T in the substitution of T

Adding the type parameter to the enum succeeds. Flagging as needs test.

Ryman added a commit to Ryman/rust that referenced this issue Apr 17, 2014
flip1995 pushed a commit to flip1995/rust that referenced this issue Sep 10, 2020
…tem_push, r=ebroto

Fix FP in `same_item_push`

Don't emit a lint when the pushed item doesn't have Clone trait

Fix rust-lang#5979

changelog: Fix FP in `same_item_push` not to emit a lint when the pushed item doesn't have Clone trait
flip1995 pushed a commit to flip1995/rust that referenced this issue Oct 9, 2020
Add changelog for 1.48 beta

[Rendered](https://github.com/ebroto/rust-clippy/blob/changelog_1_48/CHANGELOG.md)

I've not added the PRs fixing `same_item_push` because those were backported, namely:
* [rust-lang#5908](rust-lang/rust-clippy#5908)
* [rust-lang#5997](rust-lang/rust-clippy#5997)
* [rust-lang#6016](rust-lang/rust-clippy#6016)

The following PR was reverted, so I've ignored it too:
* [rust-lang#5984](rust-lang/rust-clippy#5984)

~~Also, I took the liberty of adding a "Thanks" section, naming all the contributors to this release. I think they deserve visibility in the changelog. Please tell me if we want to add this or maybe it's redundant given we link to the PRs?~~

changelog: none

r? `@flip1995`
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-type-system Area: Type system E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants