-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Hygiene issues with use declarations in thread_local!
implementation
#131863
Labels
C-bug
Category: This is a bug.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
Comments
Nominating for backport to beta as this is a regression. I think it's uncommon enough that a backport to stable isn't necessary, though that's up to the team. |
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Oct 18, 2024
Avoid use imports in `thread_local_inner!` Previously, the use imports in `thread_local_inner!` can shadow user-provided types or type aliases of the names `Storage`, `EagerStorage`, `LocalStorage` and `LocalKey`. This PR fixes that by dropping the use imports and instead refer to the std-internal types via fully qualified paths. A basic test is added to ensure `thread_local!`s with static decls with type names that match the aforementioned std-internal type names can successfully compile. Fixes rust-lang#131863.
(@jhpratt usually I think we add the beta nomination label on the PR itself not the issue because we might possibly get more than one backlinked PRs, not relevant in this case anyway) |
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Oct 18, 2024
Avoid use imports in `thread_local_inner!` Previously, the use imports in `thread_local_inner!` can shadow user-provided types or type aliases of the names `Storage`, `EagerStorage`, `LocalStorage` and `LocalKey`. This PR fixes that by dropping the use imports and instead refer to the std-internal types via fully qualified paths. A basic test is added to ensure `thread_local!`s with static decls with type names that match the aforementioned std-internal type names can successfully compile. Fixes rust-lang#131863.
jhpratt
added a commit
to jhpratt/rust
that referenced
this issue
Oct 18, 2024
Avoid use imports in `thread_local_inner!` Previously, the use imports in `thread_local_inner!` can shadow user-provided types or type aliases of the names `Storage`, `EagerStorage`, `LocalStorage` and `LocalKey`. This PR fixes that by dropping the use imports and instead refer to the std-internal types via fully qualified paths. A basic test is added to ensure `thread_local!`s with static decls with type names that match the aforementioned std-internal type names can successfully compile. Fixes rust-lang#131863.
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 18, 2024
Rollup merge of rust-lang#131866 - jieyouxu:thread_local, r=jhpratt Avoid use imports in `thread_local_inner!` Previously, the use imports in `thread_local_inner!` can shadow user-provided types or type aliases of the names `Storage`, `EagerStorage`, `LocalStorage` and `LocalKey`. This PR fixes that by dropping the use imports and instead refer to the std-internal types via fully qualified paths. A basic test is added to ensure `thread_local!`s with static decls with type names that match the aforementioned std-internal type names can successfully compile. Fixes rust-lang#131863.
youknowone
added a commit
to youknowone/rust
that referenced
this issue
Oct 24, 2024
Fixes rust-lang#131863 for wasm targets All other macros were done in rust-lang#131866, but this sub module is missed.
workingjubilee
added a commit
to workingjubilee/rustc
that referenced
this issue
Oct 24, 2024
…r=tgross35 Avoid using imports in thread_local_inner! in static Fixes rust-lang#131863 for wasm targets All other macros were done in rust-lang#131866, but this sub module is missed. r? `@jieyouxu`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Oct 25, 2024
Rollup merge of rust-lang#132101 - youknowone:thread_local-gyneiene, r=tgross35 Avoid using imports in thread_local_inner! in static Fixes rust-lang#131863 for wasm targets All other macros were done in rust-lang#131866, but this sub module is missed. r? `@jieyouxu`
cuviper
pushed a commit
to cuviper/rust
that referenced
this issue
Nov 7, 2024
Fixes rust-lang#131863 for wasm targets All other macros were done in rust-lang#131866, but this sub module is missed. (cherry picked from commit 5368b12)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-libs
Relevant to the library team, which will review and decide on the PR/issue.
The above code worked in 1.80.1 but fails to compile with 1.81.0 on platforms without
cfg(target_thread_local)
. In my case this wasaarch64-linux-android
.The issue seems to be that the macro expansion contains a use declaration that pulls in another type called
Storage
into the scope:rust/library/std/src/sys/thread_local/os.rs
Lines 24 to 25 in 3ed6e3c
This changed recently in #126953.
A similar change was made to the implementation for platforms with
cfg(target_thread_local)
in #125525:rust/library/std/src/sys/thread_local/native/mod.rs
Lines 57 to 59 in 3ed6e3c
Replacing
Storage
withEagerStorage
in the example produces a similar regression for 1.79.0 -> 1.80.0.The example is from
yakui
.Version it worked on
It most recently worked on: 1.80.1
Version with regression
rustc --version --verbose
:Backtrace
Backtrace
@rustbot modify labels: +regression-from-stable-to-stable -regression-untriaged
The text was updated successfully, but these errors were encountered: