-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
StaticForeignItem
and StaticItem
are the same
#126767
Conversation
Some changes occurred in src/tools/clippy cc @rust-lang/clippy |
Yes, so I can explain a bit what's going on here. It's true these types are actually the same right now and we can totally proceed with an r+ but they shouldn't be the same and we would need to reintroduce this type later if we remove it now.
This issue was a preexisting issue before unsafe extern blocks but unsafe extern blocks make it a bit worser by needing to add yet another attribute that make these 2 types a little bit more different. But the problem is that in parsing code we convert from one type to the other just for the sake of code reuse as we parse items and foreign items with the same code and using the same type, this is why these conversions exist. We should be reusing code in a different way. I have this in my todo list and also have a branch with some changes made to disantangle a lot of that code and to make these two types different as they should be. In any case ... feel free to do whatever you want this PR. I meant, take this as a |
Ouch, @bors r- |
Well so here's the problem. After #124482, we now allow this code to parse:
I'm kind of mixed on whether that's a good thing or not, (and it should have probably been feature gated rather than silently going from fail -> pass) but we will probably need to support it when In that case, we need to be able to maximally parse statics with an optional |
so tl;dr we need to maximally be able to parse
|
So yeah, I don't think there's actually any splitting that's possible to be done here without regressing macro code? @bors r=spastorino |
…m, r=spastorino `StaticForeignItem` and `StaticItem` are the same The struct `StaticItem` and `StaticForeignItem` are the same, so remove `StaticForeignItem`. Having them be separate is unique to `static` items -- unlike `ForeignItemKind::{Fn,TyAlias}`, which use the normal AST item. r? `@spastorino` or `@oli-obk`
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#124101 (Add PidFd::{kill, wait, try_wait}) - rust-lang#126125 (Improve conflict marker recovery) - rust-lang#126481 (Add `powerpc-unknown-openbsd` maintenance status) - rust-lang#126613 (Print the tested value in int_log tests) - rust-lang#126617 (Expand `avx512_target_feature` to include VEX variants) - rust-lang#126700 (Make edition dependent `:expr` macro fragment act like the edition-dependent `:pat` fragment does) - rust-lang#126707 (Pass target to inaccessible-temp-dir rmake test) - rust-lang#126767 (`StaticForeignItem` and `StaticItem` are the same) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 8 pull requests Successful merges: - rust-lang#126125 (Improve conflict marker recovery) - rust-lang#126481 (Add `powerpc-unknown-openbsd` maintenance status) - rust-lang#126613 (Print the tested value in int_log tests) - rust-lang#126617 (Expand `avx512_target_feature` to include VEX variants) - rust-lang#126700 (Make edition dependent `:expr` macro fragment act like the edition-dependent `:pat` fragment does) - rust-lang#126707 (Pass target to inaccessible-temp-dir rmake test) - rust-lang#126767 (`StaticForeignItem` and `StaticItem` are the same) - rust-lang#126774 (Fix another assertion failure for some Expect diagnostics.) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#126767 - compiler-errors:static-foreign-item, r=spastorino `StaticForeignItem` and `StaticItem` are the same The struct `StaticItem` and `StaticForeignItem` are the same, so remove `StaticForeignItem`. Having them be separate is unique to `static` items -- unlike `ForeignItemKind::{Fn,TyAlias}`, which use the normal AST item. r? ``@spastorino`` or ``@oli-obk``
The struct
StaticItem
andStaticForeignItem
are the same, so removeStaticForeignItem
. Having them be separate is unique tostatic
items -- unlikeForeignItemKind::{Fn,TyAlias}
, which use the normal AST item.r? @spastorino or @oli-obk