Uh oh!
There was an error while loading. Please reload this page.
(WIP) rustc: Implement nested C-like enums - #17050
Closed
pczarn wants to merge 2 commits into
Closed
Conversation
huonw
commented
Sep 7, 2014
Contributor
I wonder if this could be approached as a general enum-discriminant collapsing optimisation, with C-like enums + E.g. enumFoo{A,B,C}enumBar{X(Foo),Y}enumBaz{S(Bar),T(int)}would "inline" the discriminant values of their sub-enum. |
brson
commented
Sep 9, 2014
Contributor
This seems pretty RFC-worthy to me. I've never heard any suggestion that we extend C-like enums in this way. |
alexcrichton
commented
Sep 17, 2014
Member
I agree with @brson that this looks like it needs an RFC to move forward as it's a bit of a language change. Closing. |
lnicola pushed a commit
to lnicola/rust
that referenced
this pull request
Apr 20, 2024
…r=Veykril internal: make function builder create ast directly I am working on rust-lang#17050. In the process, I noticed a place in the code that could be refactored. Currently, the `function builder` creates the `ast` through the `function template` , but those two processes can be combined into one function. I thought I should work on this first and created a PR.
lnicola pushed a commit
to lnicola/rust
that referenced
this pull request
Apr 20, 2024
…r=Veykril internal: make function builder create ast directly I am working on rust-lang#17050. In the process, I noticed a place in the code that could be refactored. Currently, the `function builder` creates the `ast` through the `function template` , but those two processes can be combined into one function. I thought I should work on this first and created a PR.
lnicola pushed a commit
to lnicola/rust
that referenced
this pull request
May 19, 2024
…-new, r=Veykril feature: Make generate function assist generate a function as a constructor if the generated function has the name "new" and is an asscociated function. closerust-lang#17050 This PR makes `generate function assist` generate a function as a constructor if the generated function has the name "new" and is an asscociated function. If the asscociate type is a record struct, it generates the constructor like this. ```rust impl Foo { fn new() -> Self { Self { field_1: todo!(), field_2: todo!() } } } ``` If the asscociate type is a tuple struct, it generates the constructor like this. ```rust impl Foo { fn new() -> Self { Self(todo!(), todo!()) } } ``` If the asscociate type is a unit struct, it generates the constructor like this. ```rust impl Foo { fn new() -> Self { Self } } ``` If the asscociate type is another adt, it generates the constructor like this. ```rust impl Foo { fn new() -> Self { todo!() } } ```
rust-borsBot
pushed a commit
that referenced
this pull request
Aug 7, 2026
*[View all comments](https://triagebot.infra.rust-lang.org/gh-comments/rust-lang/rust-clippy/pull/17050)* Add a new Clippy source test `lint-attributes-organization` which checks that: - top-level inner lint-related attributes (`allow`/`deny`/`expect`/`forbid`/`warn`) are not repeated in tests - unprefixed lint names (`unused`) come before prefixed ones (`clippy::cast_precision_loss`) - lint names are ordered in each category changelog: none
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allows
#[repr(XX)]on more complex enums. Checks for inner variant collisions.Example