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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @michaelwoerister @bjorn3 Could we make it so that on Windows you cannot use
#[thread_local]
from a function that may end up unable to actually reference that thread-local? See also linked issue:(Though I have no idea what's happening here, since it doesn't change when/where these functions are codegenned, they're not generic and didn't have
#[inline(always)]
on it).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, the context for this PR is #94820 where I was seeing local test failures related to dtors (but this didn't seem to affect CI). However, I'm not able to reproduce it now and unfortunately back then I was rather lax in my documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any chance LTO or ThinLTO was enabled in a way that could result in some of these definitions crossing between LLVM modules?
Alternatively, if you move the functions into different modules than the
#[thread_local] static
, could you sometimes end up with them being in separate CGUs and somehow that being enough to cause an issue?Sadly that's also still not enough because of the whole "per-DLL/EXE" aspect.
It might be something like ThinLTO'd
librustc_driver-*.so
againstlibstd-*.so
but thelibstd-*.so
s I'm seeing in nightly don't seem to have any LLVM bitcode sections so it can't be that.(A custom build of
libstd-*.so
might still have LLVM bitcode - also just noticed I'm looking at Linux.so
s not Windows.dll
s, but I doubt that would affect whether we put LLVM bitcode in them?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, in general, ThinLTO can cause small functions like this one to be inlined into other modules. I haven't looked at this specific case though.