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

Avoid use imports in thread_local_inner! #131866

Merged
merged 1 commit into from
Oct 18, 2024
Merged

Conversation

jieyouxu
Copy link
Member

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 #131863.

By using qualified imports, i.e. `$crate::...::LocalKey`.
@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2024

r? @jhpratt

rustbot has assigned @jhpratt.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Oct 18, 2024
@jhpratt
Copy link
Member

jhpratt commented Oct 18, 2024

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Oct 18, 2024

📌 Commit 7b2320c has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2024
jhpratt added a commit to jhpratt/rust that referenced this pull request 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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 18, 2024
Rollup of 3 pull requests

Successful merges:

 - rust-lang#131809 (Fix predicate signatures in retain_mut docs)
 - rust-lang#131858 (Remove outdated documentation for `repeat_n`)
 - rust-lang#131866 (Avoid use imports in `thread_local_inner!`)

r? `@ghost`
`@rustbot` modify labels: rollup
@Noratrieb
Copy link
Member

@rustbot label beta-nominated
#131863 (comment)

@rustbot rustbot added the beta-nominated Nominated for backporting to the compiler in the beta channel. label Oct 18, 2024
@ChrisDenton
Copy link
Member

Should this be stable nominated too? Maybe it's not worth a point release on its own but if one does happen for some other reason then it might be good to include this?

@lqd
Copy link
Member

lqd commented Oct 18, 2024

A comment on the issue says the following about stable nomination:

I think it's uncommon enough that a backport to stable isn't necessary, though that's up to the team.

@Noratrieb
Copy link
Member

Given that no one complained during the entire 1.81 cycle, this doesn't seem very urgent. Beta should be enough imo

jhpratt added a commit to jhpratt/rust that referenced this pull request 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 pull request 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.
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 18, 2024
Rollup of 9 pull requests

Successful merges:

 - rust-lang#130136 (Partially stabilize const_pin)
 - rust-lang#131755 (Regression test for AVR `rjmp` offset)
 - rust-lang#131774 (Add getentropy for RTEMS)
 - rust-lang#131802 (Dont ICE when computing coverage of synthetic async closure body)
 - rust-lang#131809 (Fix predicate signatures in retain_mut docs)
 - rust-lang#131858 (Remove outdated documentation for `repeat_n`)
 - rust-lang#131866 (Avoid use imports in `thread_local_inner!`)
 - rust-lang#131874 (Default to the medium code model on OpenHarmony LoongArch target)
 - rust-lang#131877 (checktools.sh: add link to issue for more context about disabled Miri tests)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit af85d52 into rust-lang:master Oct 18, 2024
6 checks passed
@rustbot rustbot added this to the 1.84.0 milestone Oct 18, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request 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.
@jieyouxu jieyouxu deleted the thread_local branch October 18, 2024 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beta-nominated Nominated for backporting to the compiler in the beta channel. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hygiene issues with use declarations in thread_local! implementation
7 participants