-
Notifications
You must be signed in to change notification settings - Fork 352
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
Manual Rustup #3711
Merged
Merged
Manual Rustup #3711
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. @rustbot label +A-thread-locals
…ulacrum std: refactor the TLS implementation As discovered by Mara in #110897, our TLS implementation is a total mess. In the past months, I have simplified the actual macros and their expansions, but the majority of the complexity comes from the platform-specific support code needed to create keys and register destructors. In keeping with #117276, I have therefore moved all of the `thread_local_key`/`thread_local_dtor` modules to the `thread_local` module in `sys` and merged them into a new structure, so that future porters of `std` can simply mix-and-match the existing code instead of having to copy the same (bad) implementation everywhere. The new structure should become obvious when looking at `sys/thread_local/mod.rs`. Unfortunately, the documentation changes associated with the refactoring have made this PR rather large. That said, this contains no functional changes except for two small ones: * the key-based destructor fallback now, by virtue of sharing the implementation used by macOS and others, stores its list in a `#[thread_local]` static instead of in the key, eliminating one indirection layer and drastically simplifying its code. * I've switched over ZKVM (tier 3) to use the same implementation as WebAssembly, as the implementation was just a way worse version of that Please let me know if I can make this easier to review! I know these large PRs aren't optimal, but I couldn't think of any good intermediate steps. `@rustbot` label +A-thread-locals
Save 2 pointers in `TerminatorKind` (96 → 80 bytes) These things don't need to be `Vec`s; boxed slices are enough. The frequent one here is call arguments, but MIR building knows the number of arguments from the THIR, so the collect is always getting the allocation right in the first place, and thus this shouldn't ever add the shrink-in-place overhead.
Add `SliceLike` to `rustc_type_ir`, use it in the generic solver code (+ some other changes) First, we split out `TraitRef::new_from_args` which takes *just* `ty::GenericArgsRef` from `TraitRef::new` which takes `impl IntoIterator<Item: Into<GenericArg>>`. I will explain in a minute why. Second, we introduce `SliceLike`, which allows us to be generic over `List<T>` and `[T]`. This trait has an `as_slice()` and `into_iter()` method, and some other convenience functions. However, importantly, since types like `I::GenericArgs` now implement `SliceLike` rather than `IntoIter<Item = I::GenericArg>`, we can't use `TraitRef::new` on this directly. That's where `new_from_args` comes in. Finally, we adjust all the code to use these slice operators. Some things get simpler, some things get a bit more annoying since we need to use `as_slice()` in a few places. 🤷 r? lcnr
Also get `add nuw` from `uN::checked_add` When I was doing this for `checked_{sub,shl,shr}`, it was mentioned rust-lang/rust#124114 (comment) that it'd be worth trying for `checked_add` too. It makes a particularly-big difference for `x.checked_add(C)`, as doing this means that LLVM removes the intrinsic and does it as a normal `x <= MAX - C` instead. cc `@DianQK` who had commented about `checked_add` related to rust-lang/hashbrown#509 before cc llvm/llvm-project#80637 for how LLVM is unlikely to do this itself
Allow constraining opaque types during various unsizing casts allows unsizing of tuples, arrays and Adts to constraint opaque types in their generic parameters to concrete types on either side of the unsizing cast. Also allows constraining opaque types during trait object casts that only differ in auto traits or lifetimes. cc #116652
transmute size check: properly account for alignment Fixes another place where ZST alignment was ignored when checking whether something is a newtype. I wonder how many more of these there are... Fixes rust-lang/rust#101084
Various refactorings to rustc_interface This should make it easier to move the driver interface away from queries in the future. Many custom drivers call queries like `queries.global_ctxt()` before they are supposed to be called, breaking some things like certain `--print` and `-Zunpretty` options, `-Zparse-only` and emitting the dep info at the wrong point in time. They are also not actually necessary at all. Passing around the query output manually would avoid recomputation too and would be just as easy. Removing driver queries would also reduce the amount of global mutable state of the compiler. I'm not removing driver queries in this PR to avoid breaking the aforementioned custom drivers.
ast: Standardize visiting order for attributes and node IDs This should only affect `macro_rules` scopes and order of diagnostics. Also add a deprecation lint for `macro_rules` called outside of their scope, like in rust-lang/rust#124535.
Un-unsafe the `StableOrd` trait Whilst incorrect implementations of this trait can cause miscompilation, they cannot cause memory unsafety in rustc. [Discussed on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Policy.20of.20.60unsafe.60.20within.20the.20compiler). cc [MCP 533](rust-lang/compiler-team#533), #105175, `@michaelwoerister` r? `@Nilstrieb`
@bors r+ |
☀️ Test successful - checks-actions |
JoJoDeveloping
pushed a commit
to JoJoDeveloping/miri
that referenced
this pull request
Jul 3, 2024
Update books ## rust-lang/book 41 commits in 3131aa4642c627a24f523c82566b94a7d920f68c..d207d894cc5e1d496ab99beeacd1a420e5d4d238 2024-04-19 19:48:19 UTC to 2024-04-08 19:34:07 UTC - Ch. 2: intentionally use `{}` at first (rust-lang/book#3898) - Inline fmt lints for `redirects/` (rust-lang/book#3897) - ch12-03: `expect` is not used multitude times by this chapter (rust-lang/book#3287) - Inline format args to `tools/src` (rust-lang/book#3896) - Improve awkward phrasing around the kinds of closures (rust-lang/book#3290) - Ch. 14: clarify workspace dependency reuse (rust-lang/book#3890) - Edit on line no. 153. Replaced fn add_to_waitlist with fn eat_at_restaurant. (rust-lang/book#3281) - Ch. 2: less ambiguity about numbers (rust-lang/book#3895) - Clarified first slices paragraph (rust-lang/book#3363) - Inline all format arguments (rust-lang/book#3385) - Use v1.58 captured ident formatting in examples (rust-lang/book#3048) - Revert "ch18-03: Guarded match arm exhaustivness clarification" (rust-lang/book#3894) - Ch. 18: further clarify about irrefutable patterns (rust-lang/book#3893) - ch18-02: Minor corrections (rust-lang/book#3381) - Make style of listings 9-7 and 9-8 consistent with 9-6 (rust-lang/book#3217) - ch18-03: Guarded match arm exhaustivness clarification (rust-lang/book#3397) - ch11-03: Unnecessary import removal (rust-lang/book#3284) - Update ch20-01-single-threaded.md (rust-lang/book#3394) - In Appendix D, adds hyperlink to Appendix E (rust-lang/book#3418) - Chapter 13-03 fixed Iterator 'type' to 'trait' (rust-lang/book#3433) - Fix the expected substring in ch11-01 (rust-lang/book#3534) - Ch. 17: clarify 'in order to compile' (rust-lang/book#3892) - Revert "Chapter 15-05: Fix incorrect interpretation of compiler error" (rust-lang/book#3891) - Chapter 15-05: Fix incorrect interpretation of compiler error (rust-lang/book#3501) - Remove direction to authenticate with `cargo login {API token}` (rust-lang/book#3506) - Update syn dependencies in Chapter 19 to 2.0 (rust-lang/book#3888) - Chapter 3: Clarify `return` vs. `break`. (rust-lang/book#3889) - Fix "`Display` type" to "`Display` trait" in ch19-03 (rust-lang/book#3835) - Update listings in ch 11-01 to reflect current output from cargo new (rust-lang/book#3533) - Fix "`test` module" to "`tests` module" in ch11-03 (rust-lang/book#3579) - Ch. 2: fix wording about `cargo update` (rust-lang/book#3882) - Remove hebrew niqqud in 8-14 String::from example (rust-lang/book#3648) - Ch. 16: fix a grammar issue (rust-lang/book#3881) - Update MSVC instructions (rust-lang/book#3616) - Replace RLS with rust-analyzer in ch00 (rust-lang/book#3546) - Fix em dashes (rust-lang/book#3570) - Revert rust-lang#3711 (rust-lang/book#3880) - Procedure Macro: Update dependencies (rust-lang/book#3631) - Parity with rustup's help (rust-lang/book#3642) - Fix confusing sentence (rust-lang/book#3877) - Ch. 7: add a note about the need for `pub` in one more place (rust-lang/book#3879) ## rust-lang/edition-guide 2 commits in eb3eb80e106d03250c1fb7c5666b1c8c59672862..0c68e90acaae5a611f8f5098a3c2980de9845ab2 2024-04-16 21:23:55 UTC to 2024-04-15 16:05:32 UTC - Document RustcEncodable/RustcDecodable (rust-lang/edition-guide#298) - Flesh out detail behind disallowing refs to static mut (rust-lang/edition-guide#299) ## rust-lang/reference 5 commits in 55694913b1301cc809f9bf4a1ad1b3d6920efbd9..5854fcc286557ad3ab34d325073d11d8118096b6 2024-04-21 13:47:07 UTC to 2024-04-15 16:12:40 UTC - Stabilize Wasm target features that are in phase 4 and 5 (rust-lang/reference#1420) - Expand and clarify primitive alignment (rust-lang/reference#1493) - Update clone reference to include closures (rust-lang/reference#1492) - Document how `non_exhaustive` interacts with tuple and unit-like structs. (rust-lang/reference#1491) - Fix link to RISC-V Zkt spec; it was pointing to Zkr (rust-lang/reference#1490) ## rust-lang/rustc-dev-guide 4 commits in b77a34bd46399687b4ce6a17198e9f316c988794..07425fed36b00e60341c5e29e28d37d40cbd4451 2024-04-13 15:16:44 UTC to 2024-04-08 19:00:54 UTC - Add a note about checks with multiple revisions (rust-lang/rustc-dev-guide#1963) - compiletest: clarify that headers must be one header per line (rust-lang/rustc-dev-guide#1962) - chore: fix some typos in conments (rust-lang/rustc-dev-guide#1961) - compiletest: specify which special env var and which particular CI job (rust-lang/rustc-dev-guide#1960)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This bumps us to a rustc commit that doesn't have the chatty
./miri fmt
reported in https://rust-lang.zulipchat.com/#narrow/stream/269128-miri/topic/.22rewriting.20static.22.20printed.20during.20.2E.2Fmiri.20build