rust icon indicating copy to clipboard operation
rust copied to clipboard

Avoid use imports in `thread_local_inner!`

Open jieyouxu opened this issue 1 year ago • 5 comments

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.

jieyouxu avatar Oct 18 '24 02:10 jieyouxu

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 avatar Oct 18 '24 02:10 rustbot

@bors r+ rollup

jhpratt avatar Oct 18 '24 03:10 jhpratt

:pushpin: Commit 7b2320c3df9e57e8920a8eeec94e907e3d3e6347 has been approved by jhpratt

It is now in the queue for this repository.

bors avatar Oct 18 '24 03:10 bors

@rustbot label beta-nominated https://github.com/rust-lang/rust/issues/131863#issuecomment-2421186397

Noratrieb avatar Oct 18 '24 06:10 Noratrieb

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?

ChrisDenton avatar Oct 18 '24 06:10 ChrisDenton

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.

lqd avatar Oct 18 '24 07:10 lqd

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

Noratrieb avatar Oct 18 '24 08:10 Noratrieb