about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2024-12-19coverage: Add a synthetic test for when all spans are discardedZalathar-3/+67
2024-12-19coverage: Identify source files by ID, not by interned filenameZalathar-37/+33
2024-12-19coverage: Store coverage source regions as `Span` until codegenZalathar-217/+189
2024-12-19coverage: Quietly skip functions that end up having no mappingsZalathar-7/+2
In codegen, a used function with `FunctionCoverageInfo` but no mappings has historically indicated a bug. However, that will no longer be the case after moving some fallible span-processing steps into codegen.
2024-12-19coverage: Rename some FFI fields from `span` to `cov_span`Zalathar-9/+10
This will avoid confusion with actual `Span` spans.
2024-12-19Auto merge of #133809 - mrkajetanp:ci-aarch64-dist, r=Kobzolbors-99/+129
ci: Move dist-aarch64-linux to an aarch64 runner Move the dist-aarch64-linux CI job to an aarch64 runner instead of cross-compiling it from an x86 one. This will make it possible to perform optimisations such as LTO, PGO and BOLT later on. r? `@Kobzol` try-job: dist-aarch64-linux try-job: dist-x86_64-linux try-job: dist-i686-linux
2024-12-18Auto merge of #133328 - nnethercote:simplify-SwitchInt-handling, r=tmiaskobors-246/+178
Simplify `SwitchInt` handling Dataflow handling of `SwitchInt` is currently complicated. This PR simplifies it. r? `@cjgillot`
2024-12-18Auto merge of #134443 - joshtriplett:use-field-init-shorthand, ↵bors-16/+17
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. EDIT: this PR also updates `rustfmt.toml` to set `use_field_init_shorthand = true`.
2024-12-18Auto merge of #134470 - jieyouxu:rollup-kld7kmk, r=jieyouxubors-1191/+1715
Rollup of 11 pull requests Successful merges: - #130786 ( mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in `EarlyOtherwiseBranch`) - #133926 (Fix const conditions for RPITITs) - #134161 (Overhaul token cursors) - #134253 (Overhaul keyword handling) - #134394 (Clarify the match ergonomics 2024 migration lint's output) - #134399 (Do not do if ! else, use unnegated cond and swap the branches instead) - #134420 (refactor: replace &PathBuf with &Path to enhance generality) - #134436 (tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore) - #134444 (Fix `x build --stage 1 std` when using cg_cranelift as the default backend) - #134452 (fix(LazyCell): documentation of get[_mut] was wrong) - #134460 (Merge some patterns together) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-18Rollup merge of #134460 - oli-obk:push-ysuklyupnzpq, r=jieyouxu许杰友 Jieyou Xu (Joe)-21/+5
Merge some patterns together just something I noticed while browsing code. No change in functionality, deduplicates the 100% equal match arms by creating one big or pattern
2024-12-18Rollup merge of #134452 - jalil-salame:fix-lazy-cell-docs, r=tgross35许杰友 Jieyou Xu (Joe)-2/+2
fix(LazyCell): documentation of get[_mut] was wrong - `LazyCell::get`: said it was returning a **mutable** reference. - `LazyCell::get_mut`: said it was returning a reference (the mutable was missing). Related to #129333 (`lazy_get`). `LazyLock`'s documentation was correct.
2024-12-18Rollup merge of #134444 - jyn514:cranelift-std, r=bjorn3许杰友 Jieyou Xu (Joe)-0/+5
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`````
2024-12-18Rollup merge of #134436 - taiki-e:assembly-asm-minicore, r=jieyouxu许杰友 Jieyou Xu (Joe)-489/+110
tests/assembly/asm: Remove uses of rustc_attrs and lang_items features by using minicore Similar to https://github.com/rust-lang/rust/pull/134385 (for tests/ui/asm), but for tests/assembly/asm. r? jieyouxu
2024-12-18Rollup merge of #134420 - Integral-Tech:pathbuf-refactor, r=compiler-errors许杰友 Jieyou Xu (Joe)-18/+15
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 ```
2024-12-18Rollup merge of #134399 - spastorino:invert-if-condition, r=jieyouxu许杰友 Jieyou Xu (Joe)-3/+3
Do not do if ! else, use unnegated cond and swap the branches instead I'm tidying up my ergonomic ref counting PR and I'm going to make some small, simple and unrelated changes outside that PR, so the main PR sticks more straight to the point.
2024-12-18Rollup merge of #134394 - dianne:clarify-pat-2024-migration, r=compiler-errors许杰友 Jieyou Xu (Joe)-189/+315
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 #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); | + ```
2024-12-18Rollup merge of #134253 - nnethercote:overhaul-keywords, r=petrochenkov许杰友 Jieyou Xu (Joe)-121/+67
Overhaul keyword handling The compiler's list of keywords has some problems. - It contains several items that aren't keywords. - The order isn't quite right in a couple of places. - Some of the names of predicates relating to keywords are confusing. - rustdoc and rustfmt have their own (incorrect) versions of the keyword list. - `AllKeywords` is unnecessarily complex. r? ```@jieyouxu```
2024-12-18Rollup merge of #134161 - nnethercote:overhaul-token-cursors, r=spastorino许杰友 Jieyou Xu (Joe)-211/+200
Overhaul token cursors Some nice cleanups here. r? `````@davidtwco`````
2024-12-18Rollup merge of #133926 - compiler-errors:const-conditions, r=lcnr许杰友 Jieyou Xu (Joe)-28/+254
Fix const conditions for RPITITs Fixes #133918 r? lcnr
2024-12-18Rollup merge of #130786 - DianQK:early_otherwise_branch_cleanup, r=oli-obk许杰友 Jieyou Xu (Joe)-109/+739
mir-opt: a sub-BB of a cleanup BB must also be a cleanup BB in `EarlyOtherwiseBranch` Fixes #130769. r? `@cjgillot` or mir-opt
2024-12-18Auto merge of #134428 - nikic:llvm-19.1.6, r=cuviperbors-0/+0
Update to LLVM 19.1.6 Fixes the wasm64 build failure reported at https://github.com/rust-lang/llvm-project/pull/180.
2024-12-18mir-opt: Do not handle the cleanup BB in the EarlyOtherwiseBranchDianQK-86/+53
2024-12-18mir: require `is_cleanup` when creating `BasicBlockData`DianQK-25/+30
2024-12-18mir-opt: a sub-BB of a cleanup BB must also be a cleanup BBDianQK-1/+322
2024-12-18Reapply "Auto merge of #129047 - DianQK:early_otherwise_branch_scalar, ↵DianQK-85/+422
r=cjgillot" This reverts commit 16a02664e66afbfcd738b600d4a409e809040695.
2024-12-18Do not do if ! else, use unnegated cond and swap the branches insteadSantiago Pastorino-3/+3
2024-12-18ci: Organise shared helper scriptsKajetan Puchalski-199/+31
Move shared helper scripts used by Docker builds under docker/scripts.
2024-12-18ci: Move dist-aarch64-linux to an aarch64 runnerKajetan Puchalski-47/+245
Move the dist-aarch64-linux CI job to an aarch64 runner instead of cross-compiling it from an x86 one. This will make it possible to perform optimisations such as LTO, PGO and BOLT later on.
2024-12-18Merge some patterns togetherOli Scherer-21/+5
2024-12-18Auto merge of #134425 - clubby789:cargo-update, r=jieyouxubors-197/+228
Pin `cc` and run `cargo update` `cc` tends to cause issues with automatic bumps so locking it to be bumped individually when necessary <details> <summary>compiler and tools dependencies</summary> ``` Updating allocator-api2 v0.2.20 -> v0.2.21 Updating annotate-snippets v0.11.4 -> v0.11.5 Updating anyhow v1.0.93 -> v1.0.94 Updating bstr v1.11.0 -> v1.11.1 Updating chrono v0.4.38 -> v0.4.39 Updating clap v4.5.21 -> v4.5.23 Updating clap_builder v4.5.21 -> v4.5.23 Updating clap_complete v4.5.38 -> v4.5.39 Updating clap_lex v0.7.3 -> v0.7.4 Updating colored v2.1.0 -> v2.2.0 Updating console v0.15.8 -> v0.15.10 Updating crossbeam-channel v0.5.13 -> v0.5.14 Updating crossbeam-deque v0.8.5 -> v0.8.6 Updating crossbeam-utils v0.8.20 -> v0.8.21 Updating encode_unicode v0.3.6 -> v1.0.0 Updating fastrand v2.2.0 -> v2.3.0 Updating home v0.5.9 -> v0.5.11 Updating js-sys v0.3.74 -> v0.3.76 Updating libc v0.2.167 -> v0.2.168 Updating miniz_oxide v0.8.0 -> v0.8.1 Updating pest v2.7.14 -> v2.7.15 Updating pest_derive v2.7.14 -> v2.7.15 Updating pest_generator v2.7.14 -> v2.7.15 Updating pest_meta v2.7.14 -> v2.7.15 Updating redox_syscall v0.5.7 -> v0.5.8 Updating rustc-stable-hash v0.1.0 -> v0.1.1 Updating rustix v0.38.41 -> v0.38.42 Updating self_cell v1.0.4 -> v1.1.0 Updating semver v1.0.23 -> v1.0.24 Updating serde v1.0.215 -> v1.0.216 Updating serde_derive v1.0.215 -> v1.0.216 Adding thiserror v2.0.7 Adding thiserror-impl v2.0.7 Updating time v0.3.36 -> v0.3.37 Updating time-macros v0.2.18 -> v0.2.19 Updating tokio v1.41.1 -> v1.42.0 Updating wasm-bindgen v0.2.97 -> v0.2.99 Updating wasm-bindgen-backend v0.2.97 -> v0.2.99 Updating wasm-bindgen-macro v0.2.97 -> v0.2.99 Updating wasm-bindgen-macro-support v0.2.97 -> v0.2.99 Updating wasm-bindgen-shared v0.2.97 -> v0.2.99 Updating wasm-encoder v0.221.0 -> v0.221.2 Updating wasmparser v0.221.0 -> v0.221.2 Updating wast v221.0.0 -> v221.0.2 Updating wat v1.221.0 -> v1.221.2 ``` </details> <details> <summary>library dependencies</summary> ``` Updating allocator-api2 v0.2.20 -> v0.2.21 Updating libc v0.2.167 -> v0.2.168 ``` </details> <details> <summary>rustbook dependencies</summary> ``` Updating anyhow v1.0.93 -> v1.0.94 Updating bstr v1.11.0 -> v1.11.1 Updating chrono v0.4.38 -> v0.4.39 Updating clap v4.5.21 -> v4.5.23 Updating clap_builder v4.5.21 -> v4.5.23 Updating clap_complete v4.5.38 -> v4.5.39 Updating clap_lex v0.7.3 -> v0.7.4 Updating fastrand v2.2.0 -> v2.3.0 Updating js-sys v0.3.74 -> v0.3.76 Updating libc v0.2.167 -> v0.2.168 Updating miniz_oxide v0.8.0 -> v0.8.1 Updating pest v2.7.14 -> v2.7.15 Updating pest_derive v2.7.14 -> v2.7.15 Updating pest_generator v2.7.14 -> v2.7.15 Updating pest_meta v2.7.14 -> v2.7.15 Updating pulldown-cmark-to-cmark v19.0.0 -> v19.0.1 Updating redox_syscall v0.5.7 -> v0.5.8 Updating rustix v0.38.41 -> v0.38.42 Updating semver v1.0.23 -> v1.0.24 Updating serde v1.0.215 -> v1.0.216 Updating serde_derive v1.0.215 -> v1.0.216 Adding thiserror v2.0.7 Adding thiserror-impl v2.0.7 Updating wasm-bindgen v0.2.97 -> v0.2.99 Updating wasm-bindgen-backend v0.2.97 -> v0.2.99 Updating wasm-bindgen-macro v0.2.97 -> v0.2.99 Updating wasm-bindgen-macro-support v0.2.97 -> v0.2.99 Updating wasm-bindgen-shared v0.2.97 -> v0.2.99 Removing windows-sys v0.52.0 ``` </details>
2024-12-18Improve comments on `Keywords`.Nicholas Nethercote-2/+17
In particular, clarify which predicates apply to which keywords.
2024-12-18Move `gen` in the keyword list.Nicholas Nethercote-3/+3
`gen` is an edition-specific keyword used in unstable Rust, and so belongs with `try` (as `is_unused_keyword_conditional` indicates). Also, the cases in `is_unused_keyword_conditional` should be in alphabetical order, to match the keyword list. These changes don't affect the behaviour of any of the `Symbol::is_*` functions.
2024-12-18Only have one source of truth for keywords.Nicholas Nethercote-78/+31
`rustc_symbol` is the source of truth for keywords. rustdoc has its own implicit definition of keywords, via the `is_doc_keyword`. It (presumably) intends to include all keywords, but it omits `yeet`. rustfmt has its own explicit list of Rust keywords. It also (presumably) intends to include all keywords, but it omits `await`, `builtin`, `gen`, `macro_rules`, `raw`, `reuse`, `safe`, and `yeet`. Also, it does linear searches through this list, which is inefficient. This commit fixes all of the above problems by introducing a new predicate `is_any_keyword` in rustc and using it in rustdoc and rustfmt. It documents that it's not the right predicate in most cases.
2024-12-18Simplify `AllKeywords`.Nicholas Nethercote-39/+17
It's a verbose reinvention of a range type, and can be cut down a lot.
2024-12-18fix(LazyCell): documentation of get[_mut] was wrongJalil David Salamé Messina-2/+2
- `LazyCell::get`: said it was returning a **mutable** reference. - `LazyCell::get_mut`: said it was returning a reference (the mutable was missing).
2024-12-18Auto merge of #134450 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 6 commits in 769f622e12db0001431d8ae36d1093fb8727c5d9..99dff6d77db779716dda9ca3b29c26addd02c1be 2024-12-14 04:27:35 +0000 to 2024-12-18 00:55:17 +0000 - fix(build-std): make Resolve align to what to build (rust-lang/cargo#14938) - test(build-std): Isolate output test to avoid spurious `[BLOCKING]` messages from concurrent runs (rust-lang/cargo#14943) - docs: fix wrong changelog PR link (rust-lang/cargo#14947) - docs(unstable): Correct stabilization version for MSRV-resolver (rust-lang/cargo#14945) - Update release information for home 0.5.11 (rust-lang/cargo#14939) - Limit release trigger to 0.* tags (rust-lang/cargo#14940)
2024-12-18Remove a comment that shouldn't have been committed.Nicholas Nethercote-1/+0
2024-12-18Fix const conditions for RPITITsMichael Goulet-28/+254
2024-12-18Auto merge of #134243 - nnethercote:re-export-more-rustc_span, r=jieyouxubors-617/+371
Re-export more `rustc_span::symbol` things from `rustc_span`. `rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers to `rustc_span::`. This is a 300+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one. r? `@jieyouxu`
2024-12-17Update cargoWeihang Lo-0/+0
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-617/+371
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-18Overhaul `TokenTreeCursor`.Nicholas Nethercote-70/+67
- 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.
2024-12-18Auto merge of #134439 - matthiaskrgr:rollup-grmmmx2, r=matthiaskrgrbors-550/+612
Rollup of 7 pull requests Successful merges: - #133265 (Add a range argument to vec.extract_if) - #133801 (Promote powerpc64le-unknown-linux-musl to tier 2 with host tools) - #134323 (coverage: Dismantle `map_data.rs` by moving its responsibilities elsewhere) - #134378 (An octuple of polonius fact generation cleanups) - #134408 (Regression test for RPIT inheriting lifetime from projection) - #134423 (bootstrap: use specific-purpose ui test path for `test_valid` self-test) - #134426 (Fix typo in uint_macros.rs) Failed merges: - #133103 (Pass FnAbi to find_mir_or_eval_fn) r? `@ghost` `@rustbot` modify labels: rollup
2024-12-17Fix `x build --stage 1 std` when using cg_cranelift as the default backendjyn-0/+5
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.
2024-12-18Factor out repeated code from `eat_dollar`.Nicholas Nethercote-2/+1
2024-12-18Remove `Peekable<TokenStreamIter>` uses.Nicholas Nethercote-31/+27
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`.
2024-12-18Rename `RefTokenTreeCursor`.Nicholas Nethercote-119/+117
Because `TokenStreamIter` is a much better name for a `TokenStream` iterator. Also rename the `TokenStream::trees` method as `TokenStream::iter`, and some local variables.
2024-12-18Simplify `RefTokenTreeCursor::look_ahead`.Nicholas Nethercote-10/+10
It's only ever used with a lookahead of 0, so this commit removes the lookahead and renames it `peek`.
2024-12-18Change the lookahead in `MacroParser::new`.Nicholas Nethercote-1/+1
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.
2024-12-17Add the edition guide link from the match 2024 migration lint to the error ↵dianne-0/+12
as well