| Age | Commit message (Collapse) | Author | Lines |
|
|
|
Patterns: represent constants as valtrees
Const patterns are always valtrees now. Let's represent that in the types. We use `ty::Value` for this since it nicely packages value and type, and has some convenient methods.
Cc `@Nadrieril` `@BoxyUwU`
|
|
Rollup of 11 pull requests
Successful merges:
- rust-lang/rust#137872 (Include whitespace in "remove |" suggestion and make it hidden)
- rust-lang/rust#144631 (Fix test intrinsic-raw_eq-const-bad for big-endian)
- rust-lang/rust#145233 (cfg_select: Support unbraced expressions)
- rust-lang/rust#145261 (Improve tracing in bootstrap)
- rust-lang/rust#145324 (Rename and document `ONLY_HOSTS` in bootstrap)
- rust-lang/rust#145353 (bootstrap: Fix jemalloc 64K page support for aarch64 tools)
- rust-lang/rust#145379 (bootstrap: Support passing `--timings` to cargo)
- rust-lang/rust#145397 (Rust documentation, use `rustc-dev-guide` :3)
- rust-lang/rust#145398 (Use `default_field_values` in `Resolver`)
- rust-lang/rust#145401 (cleanup: Remove useless `[T].iter().last()`)
- rust-lang/rust#145403 (Adjust error message grammar to be less awkward)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
Adjust error message grammar to be less awkward
r? ``@estebank``
|
|
cleanup: Remove useless `[T].iter().last()`
|
|
Use `default_field_values` in `Resolver`
Change `Resolver` to use `feature(default_field_values)`. This change is non-exhaustive, as fields may have been added since I made this commit, and `Fx(Index/Hash)(Map/Set)` types would need to have a `const` constructable to change the majority of the fields left over.
Using default field values should make it easier to review when we add or remove fields to `Resolver` in the future, and highlight which fields are run-time dependent in `Resolver::new`.
r? ``@petrochenkov``
|
|
Rust documentation, use `rustc-dev-guide` :3
reviving rust-lang/rust#145385 but on my own fork this time
r? ``@BoxyUwU``
|
|
bootstrap: Support passing `--timings` to cargo
Useful for optimizing the sequencing of the compiler's own build.
|
|
bootstrap: Fix jemalloc 64K page support for aarch64 tools
Resolves rust-lang/rust#133748
The prior page size fix only targeted the compile build step, not the tools step: https://github.com/rust-lang/rust/pull/135081
Also note that since `miri` always uses jemalloc, I didn't copy the `builder.config.jemalloc(target)` check to the tools section.
Tested by running `strings` on the compiled `miri` binary to see the LG_PAGE value.
Before:
```
> strings miri | grep '^LG_PAGE'
LG_PAGE 14
```
After:
```
> strings miri | grep '^LG_PAGE'
LG_PAGE 16
```
May also need a separate fix for the standalone miri repository: https://github.com/rust-lang/miri/issues/4514 (likely a change needed in miri-script?)
|
|
Rename and document `ONLY_HOSTS` in bootstrap
Everytime I examined the `ONLY_HOSTS` flag of bootstrap steps, I was utterly confused. Why is it called ONLY_HOSTS? How does the fact that it is skipped if `--target` is passed, but `--host` is not (which was not accurate) help me?
The reality of the flag is that if it is true, the targets for which the given Step will be built is determined based on the `--host` flag, while if it is false, it is determined based on the `--target` flag, that's pretty much it. The previous comment was just a (not very helpful and not even accurate) corollary of that.
I clarified the comment, and also renamed the flag to `IS_HOST` (happy to brainstorm better names, but the doc. comment change is IMO the main improvement).
r? ``@jieyouxu``
|
|
Improve tracing in bootstrap
I was annoyed that bootstrap had like 5 separate ways of debugging/tracing/profiling, and it was hard for me to understand how are individual steps executed. This PR tries to unify severla things behind `BOOTSTRAP_TRACING`, and improve tracing/profiling in general:
- All generated tracing outputs are now stored in a single directory to make it easier to examine them, plus bootstrap prepares a `latest` symlink to the latest generated tracing output directory for convenience.
- All executed spans are now logged automatically (without requiring usage of `#[tracing::instrument]`).
- A custom span/event formatter was implemented, to provide domain-specific output (like location of executed commands or spans) and hopefully also to reduce visual clutter.
- `tracing_forest` was removed. While it did some useful postprocessing, it didn't expose enough information for making the dynamic step spans work.
- You can now explicitly log steps (`STEP=info`) and/or commands (`COMMAND=info`), to have more granular control over what gets logged.
- `print-step-timings` also show when a step starts its execution (not just when it ends it), so that when some step fails in CI, we can actually see what step it was (before we would only see the end of the previous step).
- The rustc-dev-guide page on debugging/profiling bootstrap was updated.
There are still some things that work outside of tracing (`print-step-timings` and `dump-bootstrap-shims`), but I think that for now this improvement is good enough.
I removed the `> step`, `< step` verbose output, because I found it unusable, as verbose bootstrap output also enables verbose Cargo output, and then you simply drown in too much data, and because I think that the new tracing system makes it obsolete (although it does require recompilation with the `tracing` feature). If you want to keep it, happy to revert 690c781475acb890f33d928186bdaea9ef179330. And the information about cached steps is now also shown in the Graphviz step dependency graph.
We can modify the tracing output however we want, as we now implement it ourselves. Notably, we could also show exit logs for step spans, currently I only show enter spans. Maybe creating indents for each executed nested command is also not needed. Happy to hear feedback!
Some further improvements could be to print step durations, if we decide to also log step exit events. We could also try to enable tracing in CI logs, but it might be too verbose.
Best reviewed commit-by-commit.
r? ``@jieyouxu``
CC ``@Shourya742``
|
|
cfg_select: Support unbraced expressions
Tracking issue for `cfg_select`: rust-lang/rust#115585
When operating on expressions, `cfg_select!` can now handle expressions
without braces. (It still requires braces for other things, such as
items.)
Expand the test coverage and documentation accordingly.
---
I'm not sure whether deciding to extend `cfg_select!` in this way is T-lang or T-libs-api. I've labeled for both, with the request that both teams don't block on each other. :)
|
|
r=compiler-errors
Fix test intrinsic-raw_eq-const-bad for big-endian
The test fails on s390x and presumably other big-endian systems, due to print of raw values. To fix the tests remove the raw output values in the error note with normalize-stderr.
|
|
Include whitespace in "remove |" suggestion and make it hidden
Tweak error rendering of patterns with an extra `|` on either end.
Built on #137409. Only last commit is relevant.
? ``@compiler-errors``
|
|
Rework target checking for built-in attributes
This is a refactoring of target checking for built-in attributes.
This PR has the following goals:
- Only refactor the 80% of the attributes that are simple to target check. More complicated ones like `#[repr]` will be in a future PR. Tho I have written the code in such a way that this will be possible to add in the future.
- No breaking changes.
- This part of the codebase is not very well tested though, we can do a crater run if we want to be sure.
- I've spotted quite a few weird situations (like I don't think an impl block should be deprecated?). We can propose fixing these to in a future PR
Fixes https://github.com/rust-lang/rust/issues/143780
Fixes https://github.com/rust-lang/rust/issues/138510
I've split it in commits and left a description on some of the commits to help review.
r? `@jdonszelmann`
|
|
|
|
|
|
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
|
|
|
|
|
|
Every acceptor gets an `ALLOWED_TARGETS` specification which can specify per target whether it is allowed, warned, or errored.
|
|
|
|
- Added a few more variants which are needed for various attributes
- Previously a trait method with default block had the same target representation as a method in a `impl trait for` block, this has been changed (See `MethodKind`)
- Added `plural_name` for more precision on the form of the name
|
|
|
|
|
|
|
|
no comment
|
|
Stabilize `sse4a` and `tbm` target features
This PR stabilizes the feature flag `sse4a_target_feature` and `tbm_target_feature` (tracking issue rust-lang/rust#44839).
# Public API
The 2 `x86` target features `sse4a` and `tbm`
Also, these were added in LLVM2.6 and LLVM3.4-rc1, respectively, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too!
As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now. The intrinsics were stabilized *long* ago, in 1.27.0
Reference PR:
- https://github.com/rust-lang/reference/pull/1949
cc `@rust-lang/lang`
`@rustbot` label I-lang-nominated
r? lang
|
|
Rollup of 13 pull requests
Successful merges:
- rust-lang/rust#140434 (rustdoc: Allow multiple references to a single footnote)
- rust-lang/rust#142372 (Improve `--remap-path-prefix` documentation)
- rust-lang/rust#142741 (Fix unsoundness in some tests)
- rust-lang/rust#144515 (Implement `ptr_cast_array`)
- rust-lang/rust#144727 (Add tracing to resolve-related functions)
- rust-lang/rust#144959 (fix(unicode-table-generator): fix duplicated unique indices)
- rust-lang/rust#145179 (Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere)
- rust-lang/rust#145250 (Add regression test for a former ICE involving helper attributes containing interpolated tokens)
- rust-lang/rust#145266 (Reduce some queries around associated items)
- rust-lang/rust#145299 (doc test: fix mpsc.rs try_send doc test)
- rust-lang/rust#145323 (Port the `#[linkage]` attribute to the new attribute system)
- rust-lang/rust#145361 (Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved)
- rust-lang/rust#145372 (resolve: Miscellaneous cleanups)
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
resolve: Miscellaneous cleanups
See individual commits.
All noticed when reviewing recent PRs to name resolution.
|
|
Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved
Fixes rust-lang/rust#145294
I initially tried the desired suggestion in this issue, but since that suggestion occurs in the expected type, it is inappropriate to suggest for expected expressions (see other suggest methods in the same file). I believe that suppressing the incorrect suggestion is the more appropriate choice here.
I opted for a slightly more general approach: when the expected type and actual type are the same ADT (e.g., both are Result in this example), we assume that code tend to compare the internal generic parameters(i.e. `Option<&str>` vs `Option<String>`, instead of `E = _` vs `Result<Option<String>>>`). When `E` is an unresolved infer type in the expected type (`_` in this example), we should not wrapp the actual type.
Two commits show the difference.
r? compiler
|
|
Port the `#[linkage]` attribute to the new attribute system
r? `@jdonszelmann`
|
|
doc test: fix mpsc.rs try_send doc test
This Pr want to fix the doctest, to make https://github.com/rust-lang/rust/pull/145293 's CI pass:
r? ``@Zalathar``
https://github.com/rust-lang/rust/actions/runs/16903356990/job/47887354221
```bash
2025-08-12T10:19:32.3873237Z test library/std/src/thread/scoped.rs - thread::scoped::ScopedJoinHandle<'scope,T>::join (line 302) ... ok
2025-08-12T10:19:32.4370250Z test library/std/src/time.rs - time::SystemTimeError::duration (line 688) ... ok
2025-08-12T10:19:32.5121966Z test library/std/src/time.rs - time::UNIX_EPOCH (line 664) ... ok
2025-08-12T10:19:32.5122586Z
2025-08-12T10:19:32.5122738Z failures:
2025-08-12T10:19:32.5122973Z
2025-08-12T10:19:32.5123482Z ---- library/std/src/sync/mpsc.rs - sync::mpsc::SyncSender<T>::try_send (line 691) stdout ----
2025-08-12T10:19:32.5124286Z Test executable failed (exit status: 1).
2025-08-12T10:19:32.5124518Z
2025-08-12T10:19:32.5124605Z stdout:
2025-08-12T10:19:32.5124810Z message 3 received
2025-08-12T10:19:32.5125043Z message 1 received
2025-08-12T10:19:32.5125288Z the third message was never sent
2025-08-12T10:19:32.5125497Z
2025-08-12T10:19:32.5125581Z stderr:
2025-08-12T10:19:32.5125701Z
2025-08-12T10:19:32.5125935Z thread '<unnamed>' (203874) panicked at library/std/src/sync/mpsc.rs:14:25:
2025-08-12T10:19:32.5126459Z called `Result::unwrap()` on an `Err` value: SendError { .. }
2025-08-12T10:19:32.5126836Z stack backtrace:
2025-08-12T10:19:32.5127568Z ␛[0m␛[1m␛[38;5;9merror␛[0m␛[0m␛[1m: the main thread terminated without waiting for all remaining threads␛[0m
2025-08-12T10:19:32.5127971Z
2025-08-12T10:19:32.5128335Z ␛[0m␛[1m␛[38;5;10mnote␛[0m␛[0m␛[1m: set `MIRIFLAGS=-Zmiri-ignore-leaks` to disable this check␛[0m
2025-08-12T10:19:32.5128694Z
2025-08-12T10:19:32.5128943Z ␛[0m␛[1m␛[38;5;9merror␛[0m␛[0m␛[1m: aborting due to 1 previous error␛[0m
2025-08-12T10:19:32.5129519Z
2025-08-12T10:19:32.5129527Z
2025-08-12T10:19:32.5129532Z
2025-08-12T10:19:32.5129537Z
2025-08-12T10:19:32.5129631Z failures:
2025-08-12T10:19:32.5130018Z library/std/src/sync/mpsc.rs - sync::mpsc::SyncSender<T>::try_send (line 691)
2025-08-12T10:19:32.5130396Z
2025-08-12T10:19:32.5130713Z test result: FAILED. 999 passed; 1 failed; 16 ignored; 0 measured; 344 filtered out; finished in 105.92s
```
|
|
Reduce some queries around associated items
|
|
Add regression test for a former ICE involving helper attributes containing interpolated tokens
Add regression test for rust-lang/rust#140612 from rust-lang/rust#140601 or rather rust-lang/rust#140859 that only added it to `stable` not `master`.
Supersedes https://github.com/rust-lang/rust/pull/140584.
r? `@jdonszelmann` or anyone
|
|
Avoid abbreviating "numerator" as "numer", to allow catching typo "numer" elsewhere
`typos.toml` has an exception for "numer", to avoid flagging its use as an abbreviation for "numerator". Remove the use of that abbrevation, spelling out "numerator" instead, and remove the exception, so that typo checks can find future instances of "numer" as a typo for "number".
|
|
fix(unicode-table-generator): fix duplicated unique indices
unicode-table-generator panicked while populating `distinct_indices` because of duplicated indices. This was introduced in rust-lang/rust#144134, where the order of `canonical_words.push(...)` and `canonical_words.len()` was swapped.
Fixes: rust-lang/rust#144134
|
|
Add tracing to resolve-related functions
Resolve-related functions are not called often but still make up for ~3% of execution time for non-repetitive programs (as seen in the first table below, obtained from running the rust snippet at the bottom with `n=1`). On the other hand, for repetitive programs they become less relevant (I tested the same snippet but with `n=100` and got ~1.5%), and it appears that only `try_resolve` is called more often (see the last two tables).
The first table was obtained by opening the trace file in https://ui.perfetto.dev and running the following query:
```sql
select "TOTAL PROGRAM DURATION" as name, count(*), max(ts + dur) as "sum(dur)", 100.0 as "%", null as "min(dur)", null as "max(dur)", null as "avg(dur)", null as "stddev(dur)" from slices union select "TOTAL OVER ALL SPANS (excluding events)" as name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" and dur > 0 union select name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" group by name order by sum(dur) desc, count(*) desc
```
<img width="1687" height="242" alt="image" src="https://github.com/user-attachments/assets/4d4bd890-869b-40f3-a473-8e4c42b02da4" />
The following two tables show how many `resolve` spans there per subname/subcategory, and how much time is spent in each. The first is for `n=1` and the second for `n=100`. The query that was used is:
```sql
select args.string_value as name, count(*), max(dur), avg(dur), sum(dur) from slices inner join args USING (arg_set_id) where args.key = "args." || slices.name and name = "resolve" group by args.string_value
```
<img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/a8749856-c099-492e-a86e-6d67b146af9c" />
<img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/ce3ac1b5-5c06-47d9-85a6-9b921aea348e" />
The snippet I tested with Miri to obtain the above traces is:
```rust
fn main() {
let n: usize = std::env::args().nth(1).unwrap().parse().unwrap();
let mut v = (0..n).into_iter().collect::<Vec<_>>();
for i in &mut v {
*i += 1;
}
}
```
|
|
Implement `ptr_cast_array`
ACP: https://github.com/rust-lang/libs-team/issues/602
Tracking Issue: https://github.com/rust-lang/rust/issues/144514
|
|
Fix unsoundness in some tests
These tests were marked uninit bytes as initilized, which is unsound. Use initialized `MaybeUninit` instead.
|
|
Improve `--remap-path-prefix` documentation
This PR improves the `--remap-path-prefix` documentation by:
- moving it into it's own page
- adding a small example
- mentioning that the remapping is best effort[^1]
- mentioning `link.exe`/PDB issues[^2]
- mentioning the path separator issue (textual replacement)
r? ``@wesleywiser``
[^1]: [#t-compiler > link.exe leaking paths in Windows PDB @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/link.2Eexe.20leaking.20paths.20in.20Windows.20PDB/near/523343774)
[^2]: [#t-compiler > link.exe leaking paths in Windows PDB @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/131828-t-compiler/topic/link.2Eexe.20leaking.20paths.20in.20Windows.20PDB/near/523331762)
|
|
r=fmease,GuillaumeGomez
rustdoc: Allow multiple references to a single footnote
Multiple references to a single footnote is a part of GitHub Flavored Markdown syntax (although not explicitly documented as well as regular footnotes, it is implemented in GitHub's fork of CommonMark) and not prohibited by rustdoc.
cf. <https://github.com/github/cmark-gfm/blob/587a12bb54d95ac37241377e6ddc93ea0e45439b/test/extensions.txt#L762-L780>
However, using it makes multiple `sup` elements with the same `id` attribute, which is invalid per the HTML specification.
Still, not only this is a valid GitHub Flavored Markdown syntax, this is helpful on certain cases and actually tested (accidentally) in `tests/rustdoc/footnote-reference-in-footnote-def.rs`.
This commit keeps track of the number of references per footnote and gives unique ID to each reference.
It also emits *all* back links from a footnote to its references as "↩" (return symbol) plus a numeric list in superscript.
As a known limitation, it assumes that all references to a footnote are rendered (this is not always true if a dangling footnote has one or more references but considered a reasonable compromise).
Also note that, this commit is designed so that no HTML changes will occur unless multiple references to a single footnote is actually used.
|
|
Co-authored-by: Boxy <rust@boxyuwu.dev>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|