about summary refs log tree commit diff
path: root/src/tools
AgeCommit message (Collapse)AuthorLines
2025-08-17Deduplicate layout_of_adtjackh726-47/+19
2025-08-17impl HirDisplay for next_solver::Tyjackh726-392/+584
2025-08-17Convert more of dyn_compatibility to next-solverjackh726-130/+123
2025-08-17Convert some of dyn_compatibility to next-solver and remove ↵jackh726-53/+79
generic_predicates_without_parent_query
2025-08-17fix: Make lang items query properly filter out overwritten/excluded sysrootsShoyu Vanilla-68/+166
2025-08-17Auto merge of #144081 - RalfJung:const-ptr-fragments, r=oli-obkbors-69/+104
const-eval: full support for pointer fragments This fixes https://github.com/rust-lang/const-eval/issues/72 and makes `swap_nonoverlapping` fully work in const-eval by enhancing per-byte provenance tracking with tracking of *which* of the bytes of the pointer this one is. Later, if we see all the same bytes in the exact same order, we can treat it like a whole pointer again without ever risking a leak of the data bytes (that encode the offset into the allocation). This lifts the limitation that was discussed quite a bit in https://github.com/rust-lang/rust/pull/137280. For a concrete piece of code that used to fail and now works properly consider this example doing a byte-for-byte memcpy in const without using intrinsics: ```rust use std::{mem::{self, MaybeUninit}, ptr}; type Byte = MaybeUninit<u8>; const unsafe fn memcpy(dst: *mut Byte, src: *const Byte, n: usize) { let mut i = 0; while i < n { *dst.add(i) = *src.add(i); i += 1; } } const _MEMCPY: () = unsafe { let ptr = &42; let mut ptr2 = ptr::null::<i32>(); // Copy from ptr to ptr2. memcpy(&mut ptr2 as *mut _ as *mut _, &ptr as *const _ as *const _, mem::size_of::<&i32>()); assert!(*ptr2 == 42); }; ``` What makes this code tricky is that pointers are "opaque blobs" in const-eval, we cannot just let people look at the individual bytes since *we don't know what those bytes look like* -- that depends on the absolute address the pointed-to object will be placed at. The code above "breaks apart" a pointer into individual bytes, and then puts them back together in the same order elsewhere. This PR implements the logic to properly track how those individual bytes relate to the original pointer, and to recognize when they are in the right order again. We still reject constants where the final value contains a not-fully-put-together pointer: I have no idea how one could construct an LLVM global where one byte is defined as "the 3rd byte of a pointer to that other global over there" -- and even if LLVM supports this somehow, we can leave implementing that to a future PR. It seems unlikely to me anyone would even want this, but who knows.^^ This also changes the behavior of Miri, by tracking the order of bytes with provenance and only considering a pointer to have valid provenance if all bytes are in the original order again. This is related to https://github.com/rust-lang/unsafe-code-guidelines/issues/558. It means one cannot implement XOR linked lists with strict provenance any more, which is however only of theoretical interest. Practically I am curious if anyone will show up with any code that Miri now complains about - that would be interesting data. Cc `@rust-lang/opsem`
2025-08-16tidy: add better error reporting for if typos can't be runbinarycat-1/+0
2025-08-16tidy: run typos check in src root, not current dirbinarycat-4/+17
2025-08-16tidy now installs typos-cli as-needed via cargobinarycat-28/+76
2025-08-16Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obkbors-9/+1
Revert "Partially outline code inside the panic! macro". This reverts https://github.com/rust-lang/rust/pull/115670 Without any tests/benchmarks that show some improvement, it's hard to know whether the change had any positive effect. (And if it did, whether that effect is still achieved today.)
2025-08-16refactor: Hard-code `char::is_control`Karl Meakin-1/+0
According to https://www.unicode.org/policies/stability_policy.html#Property_Value, the set of codepoints in `Cc` will never change. So we can hard-code the patterns to match against instead of using a table.
2025-08-15rustdoc-search: search backend with partitioned suffix treeMichael Howell-90/+97
2025-08-15Use a more specific error message when talking about the server logsKirill Bulatov-1/+3
2025-08-15stabilize strict provenance atomic ptrKivooeo-1/+0
2025-08-15add static glibc to the nix dev shellWaffle Lapkin-0/+1
this fixes `tests/ui/process/nofile-limit.rs` which fails to link on nixos for me without this change
2025-08-15Rollup merge of #145431 - AMS21:fix_141531, r=jieyouxuJakub Beránek-3/+15
Enhance UI test output handling for runtime errors When a UI test runs a compiled binary and an error/forbid pattern check fails, the failure message previously only showed compiler output, hiding the executed programs stdout/stderr. This makes it harder to see near-miss or unexpected runtime lines. Fixed rust-lang/rust#141531 Supersedes rust-lang/rust#141977
2025-08-15Use aarch64-apple-darwin as the fallback doc source for `-apple-`Jake Goulding-1/+1
We are moving away from `x86_64-apple-darwin`, so soon these docs won't be available.
2025-08-15Enhance UI test output handling for runtime errorsAMS21-3/+15
When a UI test runs a compiled binary and an error/forbid pattern check fails, the failure message previously only showed compiler output, hiding the executed programs stdout/stderr. This makes it harder to see near-miss or unexpected runtime lines.
2025-08-15Merge link_name and export_namebjorn3-1/+1
2025-08-15Rollup merge of #145275 - StackOverflowExcept1on:fix-wasm32v1-none, ↵Stuart Cook-1/+1
r=alexcrichton fix(compiler/rustc_codegen_llvm): apply `target-cpu` attribute Resolves rust-lang/rust#140174 r? ```@alexcrichton``` try-job: `test-various*`
2025-08-15Rollup merge of #145189 - rust-lang:cargo_update, r=clubby789Stuart Cook-22/+22
Weekly `cargo update` Automation to keep dependencies in `Cargo.lock` current. r? dep-bumps The following is the output from `cargo update`: ```txt compiler & tools dependencies: Locking 18 packages to latest compatible versions Updating anstream v0.6.19 -> v0.6.20 Updating anstyle-query v1.1.3 -> v1.1.4 Updating anstyle-svg v0.1.9 -> v0.1.10 Updating anstyle-wincon v3.0.9 -> v3.0.10 Updating camino v1.1.10 -> v1.1.11 Updating clap v4.5.42 -> v4.5.43 Updating clap_builder v4.5.42 -> v4.5.43 Updating cxx v1.0.161 -> v1.0.166 Updating cxx-build v1.0.161 -> v1.0.166 Updating cxxbridge-cmd v1.0.161 -> v1.0.166 Updating cxxbridge-flags v1.0.161 -> v1.0.166 Updating cxxbridge-macro v1.0.161 -> v1.0.166 Updating derive-where v1.5.0 -> v1.6.0 Updating hashbrown v0.15.4 -> v0.15.5 Updating indenter v0.3.3 -> v0.3.4 Updating rustversion v1.0.21 -> v1.0.22 Updating scratch v1.0.8 -> v1.0.9 Updating zerovec v0.11.2 -> v0.11.4 note: pass `--verbose` to see 36 unchanged dependencies behind latest library dependencies: Locking 1 package to latest compatible version Updating hashbrown v0.15.4 -> v0.15.5 note: pass `--verbose` to see 2 unchanged dependencies behind latest rustbook dependencies: Locking 10 packages to latest compatible versions Updating anstream v0.6.19 -> v0.6.20 Updating anstyle-query v1.1.3 -> v1.1.4 Updating anstyle-wincon v3.0.9 -> v3.0.10 Updating cc v1.2.31 -> v1.2.32 Updating clap v4.5.42 -> v4.5.43 Updating clap_builder v4.5.42 -> v4.5.43 Updating clap_complete v4.5.55 -> v4.5.56 Updating hashbrown v0.15.4 -> v0.15.5 Updating rustversion v1.0.21 -> v1.0.22 Updating zerovec v0.11.2 -> v0.11.4 ```
2025-08-15Add the directive `compare-output-by-lines`ywxt-1/+15
2025-08-15Rollup merge of #122661 - estebank:assert-macro-span, r=petrochenkovStuart Cook-9/+16
Change the desugaring of `assert!` for better error output In the desugaring of `assert!`, we now expand to a `match` expression instead of `if !cond {..}`. The span of incorrect conditions will point only at the expression, and not the whole `assert!` invocation. ``` error[E0308]: mismatched types --> $DIR/issue-14091.rs:2:13 | LL | assert!(1,1); | ^ expected `bool`, found integer ``` We no longer mention the expression needing to implement the `Not` trait. ``` error[E0308]: mismatched types --> $DIR/issue-14091-2.rs:15:13 | LL | assert!(x, x); | ^ expected `bool`, found `BytePos` ``` Now `assert!(val)` desugars to: ```rust match val { true => {}, _ => $crate::panic::panic_2021!(), } ``` Fix #122159.
2025-08-15Merge ref '3507a749b365' from rust-lang/rustThe Miri Cronjob Bot-11/+41
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 3507a749b365aae4eefa96ab700a9315d3280ee7 Filtered ref: 67f9124a1e199effc310447c1c1f9548093bd8f9 This merge was created using https://github.com/rust-lang/josh-sync.
2025-08-15add commentjackh726-0/+7
2025-08-15Add test for webrender-2022 metricsjackh726-0/+32
2025-08-15Prepare for merging from rust-lang/rustThe Miri Cronjob Bot-1/+1
This updates the rust-version file to 3507a749b365aae4eefa96ab700a9315d3280ee7.
2025-08-15refactor: Add tests for case conversionsKarl Meakin-11/+41
2025-08-15refactor: `generate_tests`Karl Meakin-52/+45
Rewrite `generate_tests` to be more idiomatic.
2025-08-15refactor: rewrite `ranges_from_set`Karl Meakin-66/+17
The `merge_ranges` function was very complicated and hard to understand. Forunately, we can use `slice::chunk_by` to achieve the same thing.
2025-08-15refactor: Include size of case conversion tablesKarl Meakin-13/+35
Include the sizes of the `to_lowercase` and `to_uppercase` tables in the total size calculations.
2025-08-15refactor: Include table sizes in comment at top of `unicode_data.rs`Karl Meakin-11/+9
To make changes in table size obvious from git diffs
2025-08-14Merge pull request #20453 from jackh726/nts-part2Lukas Wirth-2/+9
Fix webrender-2022 metrics - shift vars when mapping dyn
2025-08-14feat: hint at unterminated strings in unknown prefix errorsRalf Anton Beier-1/+49
When encountering 'unknown literal prefix' errors, check for unbalanced quotes in recent code and suggest checking for unterminated string literals.
2025-08-14Track diagnostic generations per packageLukas Wirth-24/+32
2025-08-14Rollup merge of #145179 - joshtriplett:number, r=RalfJungGuillaume Gomez-2/+2
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".
2025-08-14Rollup merge of #144959 - Marcondiro:master, r=Mark-SimulacrumGuillaume Gomez-1/+1
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
2025-08-14Rollup merge of #144727 - Stypox:add-tracing-to-resolve, r=RalfJungGuillaume Gomez-0/+2
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; } } ```
2025-08-14Merge pull request #20455 from A4-Tacks/fix-indent-conv-match-to-let-elseShoyu Vanilla (Flint)-6/+58
Fix indent for convert_match_to_let_else
2025-08-14Merge pull request #20456 from A4-Tacks/match-with-if-let-guardShoyu Vanilla (Flint)-12/+52
Add guard to let-chain for replace_match_with_if_let
2025-08-14Add guard to let-chain for replace_match_with_if_letA4-Tacks-12/+52
```rust fn main() { match$0 Some(0) { Some(n) if n % 2 == 0 && n != 6 => (), _ => code(), } } ``` -> ```rust fn main() { if let Some(n) = Some(0) && n % 2 == 0 && n != 6 { () } else { code() } }
2025-08-14Fix indent for convert_match_to_let_elseA4-Tacks-6/+58
Example --- ``` //- minicore: option fn f() { let x$0 = match Some(()) { Some(it) => it, None => {//comment println!("nope"); return }, }; } ``` **Old output**: ```rust fn f() { let Some(x) = Some(()) else {//comment println!("nope"); return }; } ``` **This PR output**: ```rust fn f() { let Some(x) = Some(()) else {//comment println!("nope"); return }; } ```
2025-08-13Auto merge of #144793 - petrochenkov:extprel3, r=davidtwcobors-2/+22
resolve: Split extern prelude into two scopes One scope for `extern crate` items and another for `--extern` options, with the former shadowing the latter. If in a single scope some things can overwrite other things, especially with ad hoc restrictions like `MacroExpandedExternCrateCannotShadowExternArguments`, then it's not really a single scope. So this PR splits `Scope::ExternPrelude` into two cleaner scopes. This is similar to how https://github.com/rust-lang/rust/pull/144131 splits module scope into two scopes for globs and non-globs, but simpler.
2025-08-13Shift vars when mapping Dynjackh726-0/+3
2025-08-13Don't panic if unable to identify host in metricsjackh726-2/+6
2025-08-13fix(compiler/rustc_codegen_llvm): apply `target-cpu` attributeStackOverflowExcept1on-1/+1
2025-08-13Merge pull request #20390 from A4-Tacks/if-else-comp-in-args-or-letChayim Refael Friedman-1/+127
Add if..else completions in LetStmt and ArgList
2025-08-13Rollup merge of #145153 - joshtriplett:macro-kinds-plural, r=petrochenkovGuillaume Gomez-5/+3
Handle macros with multiple kinds, and improve errors (I recommend reviewing this commit-by-commit.) Switch to a bitflags `MacroKinds` to support macros with more than one kind Review everything that uses `MacroKind`, and switch anything that could refer to more than one kind to use `MacroKinds`. Add a new `SyntaxExtensionKind::MacroRules` for `macro_rules!` macros, using the concrete `MacroRulesMacroExpander` type, and have it track which kinds it can handle. Eliminate the separate optional `attr_ext`, now that a `SyntaxExtension` can handle multiple macro kinds. This also avoids the need to downcast when calling methods on `MacroRulesMacroExpander`, such as `get_unused_rule`. Integrate macro kind checking into name resolution's `sub_namespace_match`, so that we only find a macro if it's the right type, and eliminate the special-case hack for attributes. This allows detecting and report macro kind mismatches early, and more precisely, improving various error messages. In particular, this eliminates the case in `failed_to_match_macro` to check for a function-like invocation of a macro with no function-like rules. Instead, macro kind mismatches now result in an unresolved macro, and we detect this case in `unresolved_macro_suggestions`, which now carefully distinguishes between a kind mismatch and other errors. This also handles cases of forward-referenced attributes and cyclic attributes. ---- In this PR, I've minimally fixed up `rustdoc` so that it compiles and passes tests. This is just the minimal necessary fixes to handle the switch to `MacroKinds`, and it only works for macros that don't actually have multiple kinds. This will panic (with a `todo!`) if it encounters a macro with multiple kinds. rustdoc needs further fixes to handle macros with multiple kinds, and to handle attributes and derive macros that aren't proc macros. I'd appreciate some help from a rustdoc expert on that. ---- r? ````````@petrochenkov````````
2025-08-13Merge pull request #20448 from donni-h/patch-2Chayim Refael Friedman-1/+1
Fix dead link to Cargo.toml in documentation
2025-08-13Update clippy testsVadim Petrochenkov-2/+22