about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-02-14Rollup merge of #134016 - zachs18:stable-const-str-split_at, r=AmanieuJubilee-5/+5
Stabilize `const_is_char_boundary` and `const_str_split_at`. Tracking issues: #131516, #131518 Stabilized const API: ```rs // in `core` impl str { // const_is_char_boundary feature const fn is_char_boundary(&self, index: usize) -> bool; // const_str_split_at feature, depends on const_is_char_boundary const fn split_at(&self, mid: usize) -> (&str, &str); const fn split_at_mut(&mut self, mid: usize) -> (&mut str, &mut str); const fn split_at_checked(&self, mid: usize) -> Option<(&str, &str)>; const fn split_at_mut_checked(&mut self, mid: usize) -> Option<(&mut str, &mut str)>; } ``` This will allow safely splitting string slices during const-eval. Closes #131516, Closes #131518 This will need FCP. r? libs-api IIUC these do not use any new const language features (i.e. they are implementable manually on stable 1.83.0 using `unsafe`: [playground link](https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=3679632cd1041084796241b7ac8edfbd)). Cc ``@rust-lang/wg-const-eval`` (I don't know if I have the permissions for this ping; if not, someone else please ping wg-const-eval if it is necessary)
2025-02-14Rollup merge of #133312 - lolbinarycat:triagebot-rustdoc-labels, ↵Jubilee-0/+37
r=GuillaumeGomez triagebot: automatically add more rustdoc related labels [inspired by zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/242269-t-release.2Ftriage/topic/auto-adding.20team.20labels.20based.20on.20certain.20other.20labels)
2025-02-14Auto merge of #137030 - matthiaskrgr:rollup-267aumr, r=matthiaskrgrbors-1104/+1068
Rollup of 9 pull requests Successful merges: - #135778 (account for `c_enum_min_bits` in `multiple-reprs` UI test) - #136052 (Correct comment for FreeBSD and DragonFly BSD in unix/thread) - #136886 (Remove the common prelude module) - #136956 (add vendor directory to .gitignore) - #136958 (Fix presentation of purely "additive" replacement suggestion parts) - #136967 (Use `slice::fill` in `io::Repeat` implementation) - #136976 (alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr) - #137007 (Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_operand`) - #137008 (Move code into `rustc_mir_transform`) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-14Rollup merge of #137008 - nnethercote:mv-code-into-rustc_mir_transform, ↵Matthias Krüger-78/+77
r=oli-obk Move code into `rustc_mir_transform` I found two modules in other crates that are better placed in `rustc_mir_transform`, because that's the only crate that uses them. r? ``@matthewjasper``
2025-02-14Rollup merge of #137007 - pvdrz:fix-aarch64-alloc-layout, r=compiler-errorsMatthias Krüger-0/+269
Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_operand` PR #136450 introduced a diff that includes a pointer-sized alloc. This doesn't cause any problems on the compiler test suite but it affects the test suite that ferrocene has for `aarch64-unknown-none` as the snapshot of the diff only includes a 32-bit alloc even though this should be a 64-bit alloc on `aarch64-unknown-none`. r? ``@compiler-errors``
2025-02-14Rollup merge of #136976 - jedbrown:jed/doc-boxed-deferred-init, r=tgross35Matthias Krüger-84/+44
alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr In the deferred initialization pattern, the docs were needlessly going through `as_mut_ptr().write()` to initialize, which is unnecessary use of a pointer, needs to be inside an `unsafe` block, and may weaken alias analysis.
2025-02-14Rollup merge of #136967 - DaniPopes:io-repeat-fill, r=joboetMatthias Krüger-18/+11
Use `slice::fill` in `io::Repeat` implementation Use the existing `fill` methods on slices instead of manually writing the fill loop.
2025-02-14Rollup merge of #136958 - compiler-errors:additive-replacmeent, r=estebankMatthias Krüger-897/+640
Fix presentation of purely "additive" replacement suggestion parts #127541 changes replacement suggestions to use the "diff" view always, which I think is really verbose in cases where a replacement snippet is a "superset" of the snippet that is being replaced. Consider: ``` LL - Self::Baz: Clone, LL + Self::Baz: Clone, T: std::clone::Clone ``` In this code, we suggest replacing `", "` with `", T: std::clone::Clone"`. This is a consequence of how the snippet is constructed. I believe that since the string that is being replaced is a subset of the replacement string, it's not providing much value to present this as a diff. Users should be able to clearly understand what's being suggested here using the `~` underline view we've been suggesting for some time now. Given that this affects ~100 tests out of the ~1000 UI tests affected, I expect this to be a pretty meaningful improvement of the fallout of #127541. --- In the last commit, this PR also "trims" replacement parts so that they are turned into their purely additive subset, if possible. See the diff for what this means. --- r? estebank
2025-02-14Rollup merge of #136956 - jyn514:ignore-vendor, r=NoratriebMatthias Krüger-0/+2
add vendor directory to .gitignore
2025-02-14Rollup merge of #136886 - ehuss:remove-prelude-common, r=jhprattMatthias Krüger-25/+13
Remove the common prelude module This fixes the issues described in https://github.com/rust-lang/rust/issues/136102. Primarily, this resolves some issues with how the documentation for the prelude is generated: - It avoids showing "unstable" for macros in the prelude that are actually stable. - Avoids duplication of some pages due to the previous lack of `doc(no_inline)`. - Makes the different edition preludes consistent, and sets a pattern that can be used by future editions. We may need to rearrange these modules in the future if we decide to remove anything from the prelude again. If we do, I think we should look into a different solution that avoids the documentation problems. Closes https://github.com/rust-lang/rust/issues/136102
2025-02-14Rollup merge of #136052 - no1wudi:fix, r=workingjubileeMatthias Krüger-1/+1
Correct comment for FreeBSD and DragonFly BSD in unix/thread
2025-02-14Rollup merge of #135778 - ferrocene:ja-gh135777, r=workingjubileeMatthias Krüger-1/+11
account for `c_enum_min_bits` in `multiple-reprs` UI test fixes #135777
2025-02-14Auto merge of #136575 - scottmcm:nsuw-math, r=nikicbors-44/+81
Set both `nuw` and `nsw` in slice size calculation There's an old note in the code to do this, and now that [LLVM-C has an API for it](https://github.com/llvm/llvm-project/blob/f0b8ff12519270adcfef93410abff76ab073476a/llvm/include/llvm-c/Core.h#L4403-L4408), we might as well. And it's been there since what looks like LLVM 17 https://github.com/llvm/llvm-project/commit/de9b6aa341d8951625d62ae3dac8670ebb3eb006 so doesn't even need to be conditional. (There's other places, like `RawVecInner` or `Layout`, that might want to do things like this too, but I'll leave those for a future PR.)
2025-02-14Auto merge of #136735 - scottmcm:transmute-nonnull, r=oli-obkbors-78/+148
`transmute` should also assume non-null pointers Previously it only did integer-ABI things, but this way it does data pointers too. That gives more information in general to the backend, and allows slightly simplifying one of the helpers in slice iterators.
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-304/+321
2025-02-14Consider add-prefix replacements tooMichael Goulet-330/+222
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-535/+369
2025-02-14Auto merge of #137010 - workingjubilee:rollup-g00c07v, r=workingjubileebors-186/+314
Rollup of 9 pull requests Successful merges: - #135439 (Make `-O` mean `OptLevel::Aggressive`) - #136460 (Simplify `rustc_span` `analyze_source_file`) - #136904 (add `IntoBounds` trait) - #136908 ([AIX] expect `EINVAL` for `pthread_mutex_destroy`) - #136924 (Add profiling of bootstrap commands using Chrome events) - #136951 (Use the right binder for rebinding `PolyTraitRef`) - #136981 (ci: switch loongarch jobs to free runners) - #136992 (Update backtrace) - #136993 ([cg_llvm] Remove dead error message) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-13Rollup merge of #136993 - dpaoliello:cleanllvm4, r=workingjubileeJubilee-8/+0
[cg_llvm] Remove dead error message Part of #135502 Discovered a dead error message in rustc_codegen_llvm, so removing it. r? ``@Zalathar``
2025-02-13Rollup merge of #136992 - ehuss:update-backtrace, r=workingjubileeJubilee-0/+0
Update backtrace This updates the backtrace submodule. 6 commits in f8cc6ac9acc4e663ecd96f9bcf1ff4542636d1b9..9d2c34e7e63afe1e71c333b247065e3b7ba4d883 2025-01-04 03:37:47 +0100 to 2025-02-13 14:14:18 -0800 - Various cleanups: https://github.com/rust-lang/backtrace-rs/pull/673 - libunwind: Use builtin _Unwind_GetIP for NuttX on ARM platform: https://github.com/rust-lang/backtrace-rs/pull/692 - remove outdated docs part on Dbghelp::ensure_open: https://github.com/rust-lang/backtrace-rs/pull/696 - Cleanup Windows trace modules: https://github.com/rust-lang/backtrace-rs/pull/697 - Attempt to fix ARM32 Windows: https://github.com/rust-lang/backtrace-rs/pull/685 - Prepare backtrace for Rust 2024: https://github.com/rust-lang/backtrace-rs/pull/700
2025-02-13Rollup merge of #136981 - marcoieni:no-largedisk-loongarch, r=KobzolJubilee-2/+2
ci: switch loongarch jobs to free runners try-job: dist-loongarch64-linux try-job: dist-loongarch64-musl
2025-02-13Rollup merge of #136951 - compiler-errors:clause-binder, r=lqdJubilee-2/+20
Use the right binder for rebinding `PolyTraitRef` Fixes #136940 I committed a slightly different test which still demonstrates the issue.
2025-02-13Rollup merge of #136924 - Kobzol:bootstrap-tracing, r=jieyouxuJubilee-4/+84
Add profiling of bootstrap commands using Chrome events Since we now have support for tracing in bootstrap, and the execution of most commands is centralized within a few functions, it's quite trivial to also trace command execution, and visualize it using the Chrome profiler. This can be helpful both to profile what takes time in bootstrap and also to get a visual idea of what happens in a given bootstrap invocation (since the execution of external commands is usually the most interesting thing). This is how it looks: ![image](https://github.com/user-attachments/assets/3351489e-3a0f-4729-9082-5bf40c586d4b) I first tried to use [tracing-flame](https://github.com/tokio-rs/tracing/tree/master/tracing-flame), but the output wasn't very useful, because the event/stackframe names were bootstrap code locations, instead of the command contents. r? ``@jieyouxu``
2025-02-13Rollup merge of #136908 - mustartt:aix-mutex-destory-einval, r=joboetJubilee-3/+3
[AIX] expect `EINVAL` for `pthread_mutex_destroy` Calling `pthread_mutex_destory` on a mutex initalized with the static initializer macro `PTHREAD_MUTEX_INITIALIZER` will result in `EINVAL` if the mutex is not lock/unlocked prior to calling `pthread_mutex_destroy`.
2025-02-13Rollup merge of #136904 - pitaj:range-into_bounds, r=tgross35Jubilee-1/+111
add `IntoBounds` trait for `range_into_bounds` feature Tracking issue: #136903 ACP: https://github.com/rust-lang/libs-team/issues/538
2025-02-13Rollup merge of #136460 - real-eren:simplify-rustc_span-analyze, r=NoratriebJubilee-132/+55
Simplify `rustc_span` `analyze_source_file` Simplifies the logic to what the code *actually* does, which is to just record newlines and multibyte characters. Checking for other ASCII control characters is unnecessary because the generic fallback doesn't do anything for those cases. Also uses a simpler (and more efficient) means of iterating the set bits of the mask.
2025-02-13Rollup merge of #135439 - clubby789:O3, r=NoratriebJubilee-34/+39
Make `-O` mean `OptLevel::Aggressive` Implementation of this MCP: https://github.com/rust-lang/compiler-team/issues/828, changing the meaning of `-O` from `-Copt-level=2` to `-Copt-level=3`. This also renames `OptLevel::Default` to `OptLevel::More`, as `Default` no longer makes sense.
2025-02-13Set both `nuw` and `nsw` in slice size calculationScott McMurray-44/+81
There's an old note in the code to do this, and now that LLVM-C has an API for it, we might as well.
2025-02-14Move `MirPatch` from `rustc_middle` to `rustc_mir_transform`.Nicholas Nethercote-42/+43
Because it's only used in `rustc_mir_transform`. (Presumably it is currently in `rustc_middle` because lots of other MIR-related stuff is, but that's not a hard requirement.) And because `rustc_middle` is huge and it's always good to make it smaller.
2025-02-14Move drop elaboration infrastructure.Nicholas Nethercote-37/+35
`rustc_mir_dataflow/src/elaborate_drops.rs` contains some infrastructure used by a few MIR passes: the `elaborate_drop` function, the `DropElaborator` trait, etc. `rustc_mir_transform/src/elaborate_drops.rs` (same file name, different crate) contains the `ElaborateDrops` pass. It relies on a lot of the infrastructure from `rustc_mir_dataflow/src/elaborate_drops.rs`. It turns out that the drop infrastructure is only used in `rustc_mir_transform`, so this commit moves it there. (The only exception is the small `DropFlagState` type, which is moved to the existing `rustc_mir_dataflow/src/drop_flag_effects.rs`.) The file is renamed from `rustc_mir_dataflow/src/elaborate_drops.rs` to `rustc_mir_transform/src/elaborate_drop.rs` (with no trailing `s`) because (a) the `elaborate_drop` function is the most important export, and (b) `rustc_mir_transform/src/elaborate_drops.rs` already exists. All the infrastructure pieces that used to be `pub` are now `pub(crate)`, because they are now only used within `rustc_mir_transform`.
2025-02-13Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_operand`Christian Poveda-0/+269
2025-02-14Auto merge of #137001 - workingjubilee:rollup-u3dn4gc, r=workingjubileebors-681/+1159
Rollup of 11 pull requests Successful merges: - #136863 (rework rigid alias handling ) - #136869 (Fix diagnostic when using = instead of : in let binding) - #136895 (debuginfo: Set bitwidth appropriately in enum variant tags) - #136928 (eagerly prove WF when resolving fully qualified paths) - #136941 (Move `llvm.ccache` to `build.ccache`) - #136950 (rustdoc: use better, consistent SVG icons for scraped examples) - #136957 (coverage: Eliminate more counters by giving them to unreachable nodes) - #136960 (Compiletest should not inherit all host RUSTFLAGS) - #136962 (unify LLVM version finding logic) - #136970 (ci: move `x86_64-gnu-debug` job to the free runner) - #136973 (Fix `x test --stage 1 ui-fulldeps` on macOS (until the next beta bump)) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-13Rollup merge of #136973 - jyn514:fulldeps-stage1, r=jieyouxuJubilee-6/+8
Fix `x test --stage 1 ui-fulldeps` on macOS (until the next beta bump) "stage 1" for fulldeps means "compile with stage 0, link against stage 1". But this code wanted to switch on the compiler that's building, not the compiler that's being tested. Fix the check. Previously, it would fail with a warning about linker-messages: ``` --- stderr ------------------------------- warning[E0602]: unknown lint: `linker_messages` | = note: requested on the command line with `-A linker_messages` = note: `#[warn(unknown_lints)]` on by default ``` cc https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/unknown.20lint.3A.20.60linker_messages.60.20when.20blessing.20tests.20on.20.2E.2E.2E, https://github.com/rust-lang/rust/pull/136960
2025-02-13Rollup merge of #136970 - marcoieni:no-largedisk, r=KobzolJubilee-3/+1
ci: move `x86_64-gnu-debug` job to the free runner try-job: x86_64-gnu-debug
2025-02-13Rollup merge of #136962 - onur-ozkan:fix-enzyme-note, r=jieyouxuJubilee-10/+18
unify LLVM version finding logic kind a self-explanatory
2025-02-13Rollup merge of #136960 - jyn514:compiletest-args, r=jieyouxuJubilee-6/+5
Compiletest should not inherit all host RUSTFLAGS I told ``@rhelmot`` to do this in #134913. But it's not correct; compiletest shouldn't inherit RUSTFLAGS at all. Pass a single new --host-rustcflags to compiletest instead, without overwriting any existing arguments. Fixes the following failure, which only happens when building llvm from source and then running `x test --stage 1 ui-fulldeps`: ``` diff --git a/tests/ui-fulldeps/fluent-messages/test.stderr b/tests/ui-fulldeps/fluent-messages/test.stderr index 0b3bb14ce51..978ac46c5a2 100644 --- a/tests/ui-fulldeps/fluent-messages/test.stderr +++ b/tests/ui-fulldeps/fluent-messages/test.stderr ``@@`` -1,3 +1,8 ``@@`` +warning[E0602]: unknown lint: `linker_messages` + | + = note: requested on the command line with `-A linker_messages` + = note: `#[warn(unknown_lints)]` on by default ``` See https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/.E2.9C.94.20unknown.20lint.3A.20.60linker_messages.60.20when.20blessing.20tests.20on.20.2E.2E.2E for more context.
2025-02-13Rollup merge of #136957 - Zalathar:counters, r=oli-obkJubilee-229/+237
coverage: Eliminate more counters by giving them to unreachable nodes When preparing a function's coverage counters and metadata during codegen, any part of the original coverage graph that was removed by MIR optimizations can be treated as having an execution count of zero. Somewhat counter-intuitively, if we give those unreachable nodes a _higher_ priority for receiving physical counters (instead of counter expressions), that ends up reducing the total number of physical counters needed. This works because if a node is unreachable, we don't actually create a physical counter for it. Instead that node gets a fixed zero counter, and any other node that would have relied on that physical counter in its counter expression can just ignore that term completely.
2025-02-13Rollup merge of #136950 - notriddle:notriddle/svg-example-buttons, ↵Jubilee-5/+76
r=GuillaumeGomez rustdoc: use better, consistent SVG icons for scraped examples ## Screenshots ![](https://github.com/user-attachments/assets/f305fb20-5ded-428a-b0d0-04e8b7762769) ![](https://github.com/user-attachments/assets/5b9bee5e-74b9-447b-a19a-49f32b6bf218) ![image](https://github.com/user-attachments/assets/d855a8c8-dc24-44f9-a067-1e0f0654c28a) ![image](https://github.com/user-attachments/assets/71bca54a-0562-480a-8989-938acc351307) ## Description This continues two ongoing projects - Replacing ascii art with real icons that don't look like syntax, are understandable to people who're familiar with desktop computers and smart devices, and aren't ugly. - Using labels and tooltips to clarify these icons, when the limits of popular iconography hit us. In this case, I've added tooltips, because, unfortunately, there's not room for always-visible labels. r? ``@GuillaumeGomez``
2025-02-13Rollup merge of #136941 - Kobzol:ccache-build, r=onur-ozkanJubilee-15/+34
Move `llvm.ccache` to `build.ccache` (S)ccache can be useful for more things that just LLVM. For example, we will soon want to use it also for GCC, and theoretically also for building stage0 Rust tools (https://github.com/rust-lang/rust/pull/136921, https://rust-lang.zulipchat.com/#narrow/channel/242791-t-infra/topic/Using.20sccache.20for.20Rust). r? ``@onur-ozkan``
2025-02-13Rollup merge of #136928 - lcnr:method-lookup-check-wf, r=compiler-errorsJubilee-158/+338
eagerly prove WF when resolving fully qualified paths fixes https://github.com/rust-lang/trait-system-refactor-initiative/issues/161. This hopefully shouldn't impact perf. I do think we need to deal with at least part of the fallout here, opening for vibes. r? ``@compiler-errors``
2025-02-13Rollup merge of #136895 - maurer:fix-enum-discr, r=nikicJubilee-3/+9
debuginfo: Set bitwidth appropriately in enum variant tags Previously, we unconditionally set the bitwidth to 128-bits, the largest an enum would possibly be. Then, LLVM would cut down the constant by chopping off leading zeroes before emitting the DWARF. LLVM only supported 64-bit enumerators, so this would also have occasionally resulted in truncated data. LLVM added support for 128-bit enumerators in llvm/llvm-project#125578 That patchset trusts the constant to describe how wide the variant tag is, so the high 64-bits of zeros are considered potentially load-bearing. As a result, we went from emitting tags that looked like: DW_AT_discr_value (0xfe) (because `dwarf::BestForm` selected `data1`) to emitting tags that looked like: DW_AT_discr_value (<0x10> fe ff ff ff 00 00 00 00 00 00 00 00 00 00 00 00 ) This makes the `DW_AT_discr_value` encode at the bitwidth of the tag, which: 1. Is probably closer to our intentions in terms of describing the data. 2. Doesn't invoke the 128-bit support which may not be supported by all debuggers / downstream tools. 3. Will result in smaller debug information.
2025-02-13Rollup merge of #136869 - chenyukang:yukang-fix-133713-let-binding, r=estebankJubilee-1/+73
Fix diagnostic when using = instead of : in let binding Fixes #133713 r? ``@estebank``
2025-02-13Rollup merge of #136863 - lcnr:treat-as-rigid, r=compiler-errorsJubilee-245/+360
rework rigid alias handling Necessary for https://github.com/rust-lang/rust/pull/136824 if we treat coinductive cycles as errors as we otherwise don't emit an error for ```rust trait Overflow { type Assoc; } impl<T> Overflow for T { type Assoc = <T as Overflow>::Assoc; } ``` The important part is that we only add a `RigidAlias` candidate in cases where the alias is actually supposed to be rigid: - its trait bound has been proven via a `ParamEnv` or `ItemBound` candidate - it's one of the special builtin traits which have a blanket impl with a `default` assoc type This means that we now more explicitly control which aliases should rigid to avoid accidentally accepting cyclic aliases. This requires changes to diagnostics as we no longer enter an explicit `RigidAlias` candidate for `NormalizesTo` goals whose trait bound doesn't hold. To fix this I've modified the `BestObligation` visitor always ignore `RigidAlias` candidates and to instead manually check these requirements if there are no applicable candidates. I also removed the hack for handling `structurally_normalize_ty` failures. This fixes #134905 as we no longer continue to use the `EvalCtxt` even though a nested goal failed. r? ``@compiler-errors``
2025-02-14fallout :skull_emoji:lcnr-133/+291
2025-02-13[cg_llvm] Remove dead error messageDaniel Paoliello-8/+0
2025-02-14eagerly prove WF when resolving fully qualified pathslcnr-25/+47
2025-02-13adjust derive_errorlcnr-79/+204
2025-02-13Update backtraceEric Huss-0/+0
2025-02-13Auto merge of #134633 - GrigorenkoPV:get_disjoint_mut, r=cuviperbors-103/+98
Stabilize `get_many_mut` as `get_disjoint_mut` Tracking issue: #104642 Closes #104642 FCP completed in https://github.com/rust-lang/rust/issues/104642#issuecomment-2558161073
2025-02-13rework pointee handling for the new rigid alias approachlcnr-67/+79