-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Rollup of 7 pull requests #134454
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
Rollup of 7 pull requests #134454
Conversation
Co-authored-by: Jack Wrenn <me@jswrenn.com>
Co-authored-by: Camille Gillot <gillot.camille@gmail.com>
Field init shorthand allows writing initializers like `tcx: tcx` as `tcx`. The compiler already uses it extensively. Fix the last few places where it isn't yet used.
As it happens, lookahead values of 0, 1, and 2 all work fine here, due to the structure of the code. (Values or 3 or greater cause test failures.) This commit changes the lookahead to zero because that will facilitate cleanups in subsequent commits.
It's only ever used with a lookahead of 0, so this commit removes the lookahead and renames it `peek`.
Because `TokenStreamIter` is a much better name for a `TokenStream` iterator. Also rename the `TokenStream::trees` method as `TokenStream::iter`, and some local variables.
Currently there are two ways to peek at a `TokenStreamIter`. - Wrap it in a `Peekable` and use that traits `peek` method. - Use `TokenStreamIter`'s inherent `peek` method. Some code uses one, some use the other. This commit converts all places to the inherent method. This eliminates mixing of `TokenStreamIter` and `Peekable<TokenStreamIter>` and some use of `impl Iterator` and `dyn Iterator`.
…ckend Before, cg_cranelift would ICE when trying to lower f16 and f128. The library/ crates had all the infrastructure to omit using them, it just wasn't hooked up to bootstrap.
- Move it to `rustc_parse`, which is the only crate that uses it. This lets us remove all the `pub` markers from it. - Change `next_ref` and `look_ahead` to `get` and `bump`, which work better for the `rustc_parse` uses. - This requires adding a `TokenStream::get` method, which is simple. - In `TokenCursor`, we currently duplicate the `DelimSpan`/`DelimSpacing`/`Delimiter` from the surrounding `TokenTree::Delimited` in the stack. This isn't necessary so long as we don't prematurely move past the `Delimited`, and is a small perf win on a very hot code path. - In `parse_token_tree`, we clone the relevant `TokenTree::Delimited` instead of constructing an identical one from pieces.
Variants::Single: do not use invalid VariantIdx for uninhabited enums ~~Stacked on top of rust-lang#133681, only the last commit is new.~~ Currently, `Variants::Single` for an empty enum contains a `VariantIdx` of 0; looking that up in the enum variant list will ICE. That's quite confusing. So let's fix that by adding a new `Variants::Empty` case for types that have 0 variants.
…r=lcnr Fix const conditions for RPITITs Fixes rust-lang#133918 r? lcnr
…, r=spastorino Overhaul token cursors Some nice cleanups here. r? ``@davidtwco``
… r=compiler-errors Clarify the match ergonomics 2024 migration lint's output This makes a few changes: - Rather than using the whole pattern as a span for the lint, this collects spans for each problematic default binding mode reset and labels them with why they're problems. - The lint's suggestions are now verbose-styled, so that it's clear what's being suggested vs. what's problematic. - The wording is now less technical, and the hard error version of this diagnostic now links to the same reference material as the lint (currently an unwritten page of the edition guide). I'm not totally confident in the wording or formatting, so I'd appreciate feedback on that in particular. I tried to draw a connection with word choice between the labels and the suggestion, but it might be imprecise, unclear, or cluttered. If so, it might be worth making the labels more terse and adding notes that explain them, but that's harder to read in a way too. cc ``@Nadrieril`` ``@Jules-Bertholet`` Closes rust-lang#133854. For reference, the error from that issue becomes: ``` error: pattern uses features incompatible with edition 2024 --> $DIR/remove-me.rs:6:25 | LL | map.iter().filter(|(&(_x, _y), &_c)| false); | ^ ^ cannot implicitly match against multiple layers of reference | | | cannot implicitly match against multiple layers of reference | help: make the implied reference pattern explicit | LL | map.iter().filter(|&(&(_x, _y), &_c)| false); | + ```
…compiler-errors refactor: replace &PathBuf with &Path to enhance generality - According to [style.md](https://github.com/rust-lang/rust/blob/master/src/tools/rust-analyzer/docs/dev/style.md#useless-types): > More generally, always prefer types on the left ```rust // GOOD BAD &[T] &Vec<T> &str &String Option<&T> &Option<T> &Path &PathBuf ```
…and, r=lqd,tgross35,nnethercote Use field init shorthand where possible Field init shorthand allows writing initializers like `tcx: tcx` as `tcx`. The compiler already uses it extensively. Fix the last few places where it isn't yet used.
Fix `x build --stage 1 std` when using cg_cranelift as the default backend Before, cg_cranelift would ICE when trying to lower f16 and f128. The library/ crates had all the infrastructure to omit using them, it just wasn't hooked up to bootstrap. r? ``@bjorn3``
@bors r+ rollup=never p=5 |
The job Click to see the possible cause of the failure (guessed by this bot)
|
@bors r- |
@@ -4,6 +4,7 @@ use_small_heuristics = "Max" | |||
merge_derives = false | |||
group_imports = "StdExternalCrate" | |||
imports_granularity = "Module" | |||
use_field_init_shorthand = true |
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.
This PR changes the fmt config, that's why it causes unrelated PRs to break.
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.
... Thanks, I missed that part.
Successful merges:
x build --stage 1 std
when using cg_cranelift as the default backend #134444 (Fixx build --stage 1 std
when using cg_cranelift as the default backend)r? @ghost
@rustbot modify labels: rollup
Create a similar rollup