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

std tests: use __OsLocalKeyInner from realstd #106638

Merged
merged 1 commit into from
Jan 12, 2023
Merged

Conversation

RalfJung
Copy link
Member

@RalfJung RalfJung commented Jan 9, 2023

This is basically the same as #100201, but for __OsLocalKeyInner:

Some std tests are failing in Miri on Windows because this static is getting duplicated, and Miri does not handle that properly -- Miri does not support this magic .CRT$XLB linker section, but instead just looks up this particular hard-coded static in the standard library. This PR lets the test suite use the std static instead of having its own copy.

Fixes rust-lang/miri#2754
r? @thomcc

@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 Jan 9, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

Copy link
Member

@thomcc thomcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay, been swamped with work.

This seems fine to me.

@thomcc
Copy link
Member

thomcc commented Jan 12, 2023

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jan 12, 2023

📌 Commit ad79b20 has been approved by thomcc

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 Jan 12, 2023
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jan 12, 2023
std tests: use __OsLocalKeyInner from realstd

This is basically the same as rust-lang#100201, but for __OsLocalKeyInner:

Some std tests are failing in Miri on Windows because [this static](https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/library/std/src/sys/windows/thread_local_key.rs#L234-L239) is getting duplicated, and Miri does not handle that properly -- Miri does not support this magic `.CRT$XLB` linker section, but instead just looks up this particular hard-coded static in the standard library. This PR lets the test suite use the std static instead of having its own copy.

Fixes rust-lang/miri#2754
r? ``@thomcc``
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 12, 2023
…iaskrgr

Rollup of 10 pull requests

Successful merges:

 - rust-lang#106167 (Fix invalid syntax and incomplete suggestion in impl Trait parameter type suggestions for E0311)
 - rust-lang#106309 (Prefer non-`[type error]` candidates during selection)
 - rust-lang#106532 (Allow codegen to unsize `dyn*` to `dyn`)
 - rust-lang#106596 (Hide more of long types in E0271)
 - rust-lang#106638 (std tests: use __OsLocalKeyInner from realstd)
 - rust-lang#106676 (Test that we cannot use trait impl methods arguments as defining uses)
 - rust-lang#106702 (Conserve cause of `ImplDerivedObligation` in E0599)
 - rust-lang#106732 (rustc_llvm: replace llvm::makeArrayRef with ArrayRef constructors.)
 - rust-lang#106733 (Revert "warn newer available version of the x tool")
 - rust-lang#106748 (Clean up `OnUnimplementedFormatString::verify`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit db8301b into rust-lang:master Jan 12, 2023
@rustbot rustbot added this to the 1.68.0 milestone Jan 12, 2023
@RalfJung RalfJung deleted the realstd branch January 31, 2023 11:06
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 1, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang#100201 and rust-lang#106638, which got reverted by rust-lang#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? `@m-ou-se`
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 2, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang#100201 and rust-lang#106638, which got reverted by rust-lang#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? ``@m-ou-se``
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 3, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang#100201 and rust-lang#106638, which got reverted by rust-lang#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? ```@m-ou-se```
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 3, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang#100201 and rust-lang#106638, which got reverted by rust-lang#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? ````@m-ou-se````
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request May 3, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang#100201 and rust-lang#106638, which got reverted by rust-lang#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? `````@m-ou-se`````
JohnTitor added a commit to JohnTitor/rust that referenced this pull request May 5, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang#100201 and rust-lang#106638, which got reverted by rust-lang#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? ``````@m-ou-se``````
thomcc pushed a commit to tcdi/postgrestd that referenced this pull request Jul 18, 2023
avoid duplicating TLS state between test std and realstd

This basically re-lands rust-lang/rust#100201 and rust-lang/rust#106638, which got reverted by rust-lang/rust#110861. This works around 2 Miri limitations:
- Miri doesn't support the magic linker section that our Windows TLS support relies on, and instead knows where in std to find the symbol that stores the thread callback.
- For macOS, Miri only supports at most one destructor to be registered per thread.

The 2nd would not be very hard to fix (though the intended destructor order is unclear); the first would be a lot of work to fix. Neither of these is a problem for regular Rust code, but in the std test suite we have essentially 2 copies of the std code and then these both become issues. To avoid that we have the std test crate import the TLS code from the real std instead of having its own copy.

r? ``````@m-ou-se``````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

dtors_in_dtors_in_dtors test fails on 32bit Windows targets
4 participants