about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-08-18comment style changesDeadbeef-35/+34
2025-08-18Remove the `From` derive macro from preludeJakub Beránek-22/+57
To avoid backwards compatibility problems.
2025-08-18Auto merge of #145551 - Zalathar:rollup-eo75r94, r=Zalatharbors-257/+1150
Rollup of 10 pull requests Successful merges: - rust-lang/rust#144838 (Fix outdated doc comment) - rust-lang/rust#145206 (Port `#[custom_mir(..)]` to the new attribute system) - rust-lang/rust#145208 (Implement declarative (`macro_rules!`) derive macros (RFC 3698)) - rust-lang/rust#145309 (Fix `-Zregparm` for LLVM builtins) - rust-lang/rust#145355 (Add codegen test for issue 122734) - rust-lang/rust#145420 (cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind`) - rust-lang/rust#145451 (Add static glibc to the nix dev shell) - rust-lang/rust#145460 (Speedup `copy_src_dirs` in bootstrap) - rust-lang/rust#145476 (Fix typo in doc for library/std/src/fs.rs#set_permissions) - rust-lang/rust#145485 (Fix deprecation attributes on foreign statics) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-18Provide more useful command creation spansJakub Beránek-0/+4
2025-08-18Print what bootstrap invocation failed when an error happens in CIJakub Beránek-0/+11
2025-08-18ci: add timeout to windows disk cleanup waitMarcoIeni-3/+18
2025-08-18Do not overwrite the value of `RUSTC_ADDITIONAL_SYSROOT_PATHS`Jakub Beránek-1/+28
2025-08-18Remove the no_sanitize attribute in favor of sanitizeBastian Kersting-406/+239
This removes the #[no_sanitize] attribute, which was behind an unstable feature named no_sanitize. Instead, we introduce the sanitize attribute which is more powerful and allows to be extended in the future (instead of just focusing on turning sanitizers off). This also makes sanitize(kernel_address = ..) attribute work with -Zsanitize=address To do it the same as how clang disables address sanitizer, we now disable ASAN on sanitize(kernel_address = "off") and KASAN on sanitize(address = "off"). The same was added to clang in https://reviews.llvm.org/D44981.
2025-08-18Implement the #[sanitize(..)] attributeBastian Kersting-7/+771
This change implements the #[sanitize(..)] attribute, which opts to replace the currently unstable #[no_sanitize]. Essentially the new attribute works similar as #[no_sanitize], just with more flexible options regarding where it is applied. E.g. it is possible to turn a certain sanitizer either on or off: `#[sanitize(address = "on|off")]` This attribute now also applies to more places, e.g. it is possible to turn off a sanitizer for an entire module or impl block: ```rust \#[sanitize(address = "off")] mod foo { fn unsanitized(..) {} #[sanitize(address = "on")] fn sanitized(..) {} } \#[sanitize(thread = "off")] impl MyTrait for () { ... } ``` This attribute is enabled behind the unstable `sanitize` feature.
2025-08-18nll-relate: improve hr opaque types supportlcnr-26/+32
2025-08-18Rollup merge of #145485 - JonathanBrouwer:fix-deprecation-targets, ↵Stuart Cook-3/+13
r=jdonszelmann Fix deprecation attributes on foreign statics r? ````````@jdonszelmann```````` Fixes https://github.com/rust-lang/rust/issues/145437
2025-08-18Rollup merge of #145476 - alurm:patch-1, r=ibraheemdevStuart Cook-1/+1
Fix typo in doc for library/std/src/fs.rs#set_permissions "privalage" -> "privilege". Was reading the docs and have noticed this.
2025-08-18Rollup merge of #145460 - Kobzol:bootstrap-speedup-copy-src-dirs, r=jieyouxuStuart Cook-40/+42
Speedup `copy_src_dirs` in bootstrap I was kinda offended by how slow it was. Just the `copy_src_dirs` part took ~3s locally in the `x dist rustc-src` step. In release mode it was just 1s, but that's kind of cheating (I wonder if we should build bootstrap in release mode on CI though...). Did some basic optimizations to bring it down to ~1s also in debug mode. Maybe it's overkill, due to https://github.com/rust-lang/rust/pull/145455. Up to you whether we should merge it or close it :) r? `````````@jieyouxu`````````
2025-08-18Rollup merge of #145451 - WaffleLapkin:norailoveyou, r=NoratriebStuart Cook-0/+1
Add static glibc to the nix dev shell This fixes `tests/ui/process/nofile-limit.rs` which fails to link on nixos for me without this change.
2025-08-18Rollup merge of #145420 - Zalathar:llvm-c, r=WaffleLapkinStuart Cook-89/+14
cg_llvm: Use LLVM-C bindings for `LLVMSetTailCallKind`, `LLVMGetTypeKind` This PR replaces two existing `LLVMRust` bindings with equivalent calls to the LLVM-C API. For `LLVMGetTypeKind`, we avoid the UB hazard by declaring the foreign function to return `RawEnum<TypeKind>` (which is a wrapper around `u32`), and then perform checked conversion from `u32` to `TypeKind`.
2025-08-18Rollup merge of #145355 - clubby789:option-match-eq, r=nikicStuart Cook-0/+78
Add codegen test for issue 122734 Closes rust-lang/rust#122734
2025-08-18Rollup merge of #145309 - winstonallo:issue-145271-fix, r=tgross35Stuart Cook-0/+86
Fix `-Zregparm` for LLVM builtins This fixes the issue where `-Zregparm=N` was not working correctly when calling LLVM intrinsics By default on `x86-32`, arguments are passed on the stack. The `-Zregparm=N` flag allows the first `N` arguments to be passed in registers instead. When calling intrinsics like `memset`, LLVM still passes parameters on the stack, which prevents optimizations like tail calls. As proposed by ````@tgross35,```` I fixed this by setting the `NumRegisterParameters` LLVM module flag to `N` when the `-Zregparm=N` is set. ```rust // compiler/rust_codegen_llvm/src/context.rs#375-382 if let Some(regparm_count) = sess.opts.unstable_opts.regparm { llvm::add_module_flag_u32( llmod, llvm::ModuleFlagMergeBehavior::Error, "NumRegisterParameters", regparm_count, ); } ``` [Here](https://rust.godbolt.org/z/YMezreo48) is a before/after compiler explorer. Here is the final result for the code snippet in the original issue: ```asm entrypoint: push esi mov esi, eax mov eax, ecx mov ecx, esi pop esi jmp memset ; Tail call parameters in registers ``` Fixes: https://github.com/rust-lang/rust/issues/145271
2025-08-18Rollup merge of #145208 - joshtriplett:mbe-derive, r=petrochenkovStuart Cook-29/+593
Implement declarative (`macro_rules!`) derive macros (RFC 3698) This is a draft for review, and should not be merged yet. This is layered atop https://github.com/rust-lang/rust/pull/145153 , and has only two additional commits atop that. The first handles parsing and provides a test for various parse errors. The second implements expansion and handles application. This implements RFC 3698, "Declarative (`macro_rules!`) derive macros". Tracking issue: https://github.com/rust-lang/rust/issues/143549 This has one remaining issue, which I could use some help debugging: in `tests/ui/macros/macro-rules-derive-error.rs`, the diagnostics for `derive(fn_only)` (for a `fn_only` with no `derive` rules) and `derive(ForwardReferencedDerive)` both get emitted twice, as a duplicate diagnostic. From what I can tell via adding some debugging code, `unresolved_macro_suggestions` is getting called twice from `finalize_macro_resolutions` for each of them, because `self.single_segment_macro_resolutions` has two entries for the macro, with two different `parent_scope` values. I'm not clear on why that happened; it doesn't happen with the equivalent code using attrs. I'd welcome any suggestions for fixing this.
2025-08-18Rollup merge of #145206 - scrabsha:push-uxovoqzrxnlx, r=jdonszelmannStuart Cook-91/+318
Port `#[custom_mir(..)]` to the new attribute system r? ``````````@jdonszelmann``````````
2025-08-18Rollup merge of #144838 - Kivooeo:doc-subtype, r=notriddleStuart Cook-4/+4
Fix outdated doc comment This updates the documentation comment for `Type::is_doc_subtype_of` to more accurately describe its purpose as a subtyping check, rather than equality fixes rust-lang/rust#138572 r? ````````````@tgross35````````````
2025-08-17Fix up library crate order in linker testJosh Triplett-1/+1
2025-08-17Update cargoWeihang Lo-0/+0
2025-08-17Rehome tests/ui/issues/ tests [5/?]Oneirical-118/+134
2025-08-17Add `-Zindirect-branch-cs-prefix` optionMiguel Ojeda-5/+88
This is intended to be used for Linux kernel RETPOLINE builds. Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-08-17Add -Zindirect-branch-cs-prefix (from draft PR)Alice Ryhl-0/+30
2025-08-17Add `//@ ignore-stage1` to query_stability.rs testSamuel Moelius-10/+11
2025-08-17Auto merge of #145284 - nnethercote:type_name-print-regions, r=lcnrbors-57/+78
Print regions in `type_name`. Currently they are skipped, which is a bit weird, and it sometimes causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`. Most regions are erased by the time `type_name` does its work. So all regions are now printed as `'_` in non-optional places. Not perfect, but better than the status quo. `c_name` is updated to trim lifetimes from MIR pass names, so that the `PASS_NAMES` sanity check still works. It is also renamed as `simplify_pass_type_name` and made non-const, because it doesn't need to be const and the non-const implementation is much shorter. The commit also renames `should_print_region` as `should_print_optional_region`, which makes it clearer that it only applies to some regions. Fixes rust-lang/rust#145168. r? `@lcnr`
2025-08-17Auto merge of #144081 - RalfJung:const-ptr-fragments, r=oli-obkbors-358/+542
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-16Indent some code inside `cfg_select!`Josh Triplett-174/+178
The previous code inside `cfg_if!` wasn't indented, so the conversion to `cfg_select!` left it not indented. Indent it.
2025-08-16std: fix more typosbinarycat-2/+2
2025-08-16typos: allow moresobinarycat-0/+1
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-32/+80
2025-08-17refactor return type of `suggest_ampmut` into an enumDeadbeef-171/+178
2025-08-16fmt::DisplayInt abstraction obsolete with better macroPascal S. de Kloe-94/+72
2025-08-16run spellcheck as a tidy extra check in cibinarycat-6/+6
2025-08-16overhaul `&mut` suggestions in borrowck errorsDeadbeef-332/+475
2025-08-16library: Migrate from `cfg_if` to `cfg_select`Josh Triplett-607/+845
Migrate the standard library from using the external `cfg_if` crate to using the now-built-in `cfg_select` macro. This does not yet eliminate the dependency from `library/std/Cargo.toml`, because while the standard library itself no longer uses `cfg_if`, it also incorporates the `backtrace` crate, which does. Migration assisted by the following vim command (after selecting the full `cfg_if!` invocation): ``` '<,'>s/\(cfg_if::\)\?cfg_if/cfg_select/ | '<,'>s/^\( *\)} else {/\1}\r\1_ => {/c | '<,'>s/^\( *\)} else if #\[cfg(\(.*\))\] /\1}\r\1\2 => /e | '<,'>s/if #\[cfg(\(.*\))\] {/\1 => {/e ``` This is imperfect, but substantially accelerated the process. This prompts for confirmation on the `} else {` since that can also appear inside one of the arms. This also requires manual intervention to handle any multi-line conditions.
2025-08-16Auto merge of #145304 - m-ou-se:simplify-panic, r=oli-obkbors-73/+8
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-16Only check std in cross-compilation instead of building itJakub Beránek-57/+153
2025-08-16take attr style into account in attr diagnosticsJana Dönszelmann-37/+53
2025-08-16Avoid copying rustc rmeta artifacts into the build compiler sysrootJakub Beránek-65/+189
This helps to avoid polluting the sysroot of the build compiler.
2025-08-16Fix deprecation attribute on foreign statics & typesJonathan Brouwer-3/+10
2025-08-16Don't show foreign types as an allowed target if the feature is not enabledJonathan Brouwer-0/+3
2025-08-16Optimize `copy_src_dirs`Jakub Beránek-39/+42
2025-08-16Do not call `fs::remove_file` in `cp_link_filtered_recurse`Jakub Beránek-1/+0
The target is removed by `copy_link` too, so no need to duplicate the syscall.
2025-08-16Remove `LlvmArchiveBuilder` and supporting code/bindingsZalathar-543/+6
2025-08-15Auto merge of #145475 - jhpratt:rollup-jr0wado, r=jhprattbors-36/+722
Rollup of 11 pull requests Successful merges: - rust-lang/rust#143717 (Add `Default` impls for `Pin`ned `Box`, `Rc`, `Arc`) - rust-lang/rust#144054 (Stabilize as_array_of_cells) - rust-lang/rust#144907 (fix: Reject async assoc fns of const traits/impls in ast_passes) - rust-lang/rust#144922 (Implement `#[derive(From)]`) - rust-lang/rust#144963 (Stabilize `core::iter::chain`) - rust-lang/rust#145436 (fix(tests/rmake/wasm-unexpected-features): change features from `WASM1` to `MVP`) - rust-lang/rust#145453 (Remove duplicated tracing span in bootstrap) - rust-lang/rust#145454 (Fix tracing debug representation of steps without arguments in bootstrap) - rust-lang/rust#145455 (Do not copy files in `copy_src_dirs` in dry run) - rust-lang/rust#145462 (Stabilize `const_exposed_provenance` feature) - rust-lang/rust#145466 (Enable new `[range-diff]` feature in triagebot) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-16Fix typo in doc for library/std/src/fs.rs#set_permissionsAlan Urmancheev-1/+1
"privalage" -> "privilege"