about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2025-01-11Auto merge of #135370 - matthiaskrgr:rollup-g2w6d5n, r=matthiaskrgrbors-437/+706
Rollup of 4 pull requests Successful merges: - #134030 (add `-Zmin-function-alignment`) - #134776 (Avoid ICE: Account for `for<'a>` types when checking for non-structural type in constant as pattern) - #135205 (Rename `BitSet` to `DenseBitSet`) - #135314 (Eagerly collect mono items for non-generic closures) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-11Rollup merge of #135314 - compiler-errors:eagerly-mono-closures, r=wesleywiserMatthias Krüger-3/+60
Eagerly collect mono items for non-generic closures This allows users to use `-Zprint-mono-items=eager` to eagerly monomorphize closures and coroutine bodies, in case they want to inspect the LLVM or ASM for those items. `-Zprint-mono-items`, which used to be called `-Zprint-trans-items`, was originally added in https://github.com/rust-lang/rust/pull/30900: > Eager mode is meant to be used in conjunction with incremental compilation > where a stable set of translation items is more important than a minimal > one. Thus, eager mode will instantiate drop-glue for every drop-able type > in the crate, even of no drop call for that type exists (yet). It will > also instantiate default implementations of trait methods, something that > otherwise is only done on demand. Although it remains an unstable option, its purpose has somewhat expanded since then, and as far as I can tell it's generally useful for cases when you want to monomorphize as many items as possible, even if they're unreachable. Specifically, it's useful for debugging since you can look at the codegen'd body of a function, since we don't emit items that are not reachable in monomorphization. And even more specifically, it would be very to monomorphize the coroutine body of an async fn, since those you can't easily call those without a runtime. This PR enables this usecase since we now monomorphize `DefKind::Closure`.
2025-01-11Rollup merge of #135205 - lqd:bitsets, r=Mark-SimulacrumMatthias Krüger-380/+397
Rename `BitSet` to `DenseBitSet` r? `@Mark-Simulacrum` as you requested this in https://github.com/rust-lang/rust/pull/134438#discussion_r1890659739 after such a confusion. This PR renames `BitSet` to `DenseBitSet` to make it less obvious as the go-to solution for bitmap needs, as well as make its representation (and positives/negatives) clearer. It also expands the comments there to hopefully make it clearer when it's not a good fit, with some alternative bitsets types. (This migrates the subtrees cg_gcc and clippy to use the new name in separate commits, for easier review by their respective owners, but they can obvs be squashed)
2025-01-11Rollup merge of #134776 - estebank:vanilla-ice, r=lcnrMatthias Krüger-51/+104
Avoid ICE: Account for `for<'a>` types when checking for non-structural type in constant as pattern When we encounter a constant in a pattern, we check if it is non-structural. If so, we check if the type implements `PartialEq`, but for types with escaping bound vars the check would be incorrect as is, so we break early. This is ok because these types would be filtered anyways. Slight tweak to output to remove unnecessary context as a drive-by. Fix #134764.
2025-01-11Rollup merge of #134030 - folkertdev:min-fn-align, r=workingjubileeMatthias Krüger-3/+145
add `-Zmin-function-alignment` tracking issue: https://github.com/rust-lang/rust/issues/82232 This PR adds the `-Zmin-function-alignment=<align>` flag, that specifies a minimum alignment for all* functions. ### Motivation This feature is requested by RfL [here](https://github.com/rust-lang/rust/issues/128830): > i.e. the equivalents of `-fmin-function-alignment` ([GCC](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-fmin-function-alignment_003dn), Clang does not support it) / `-falign-functions` ([GCC](https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html#index-falign-functions), [Clang](https://clang.llvm.org/docs/ClangCommandLineReference.html#cmdoption-clang1-falign-functions)). > > For the Linux kernel, the behavior wanted is that of GCC's `-fmin-function-alignment` and Clang's `-falign-functions`, i.e. align all functions, including cold functions. > > There is [`feature(fn_align)`](https://github.com/rust-lang/rust/issues/82232), but we need to do it globally. ### Behavior The `fn_align` feature does not have an RFC. It was decided at the time that it would not be necessary, but maybe we feel differently about that now? In any case, here are the semantics of this flag: - `-Zmin-function-alignment=<align>` specifies the minimum alignment of all* functions - the `#[repr(align(<align>))]` attribute can be used to override the function alignment on a per-function basis: when `-Zmin-function-alignment` is specified, the attribute's value is only used when it is higher than the value passed to `-Zmin-function-alignment`. - the target may decide to use a higher value (e.g. on x86_64 the minimum that LLVM generates is 16) - The highest supported alignment in rust is `2^29`: I checked a bunch of targets, and they all emit the `.p2align 29` directive for targets that align functions at all (some GPU stuff does not have function alignment). *: Only with `build-std` would the minimum alignment also be applied to `std` functions. --- cc `@ojeda` r? `@workingjubilee` you were active on the tracking issue
2025-01-11Auto merge of #135292 - lqd:rustcperfup, r=kobzolbors-0/+0
bump `rustc-perf` submodule This updates the `rustc-perf` submodule to pull in the recent changes, in particular the error handling in https://github.com/rust-lang/rustc-perf/pull/2021 fixing the error we saw in a recent run. I think I did this correctly, submodules are so annoying. r? kobzol (opening as draft to do a perf run and check that nothing has changed indeed)
2025-01-11migrate `clippy` to the `DenseBitSet` nameRémy Rakic-18/+18
2025-01-11migrate `rustc_codegen_gcc` to the `DenseBitSet` nameRémy Rakic-5/+5
2025-01-11document the use-cases of `DenseBitSet` a bit moreRémy Rakic-1/+7
2025-01-11rename `BitSet` to `DenseBitSet`Rémy Rakic-356/+367
This should make it clearer that this bitset is dense, with the advantages and disadvantages that it entails.
2025-01-11Auto merge of #135357 - jhpratt:rollup-gs00yt3, r=jhprattbors-250/+748
Rollup of 6 pull requests Successful merges: - #134074 (bootstrap: `std::io::ErrorKind::CrossesDevices` is finally stable) - #135236 (Update a bunch of library types for MCP807) - #135301 (re-add a warning for old master branch, but with much simpler logic) - #135324 (Initial fs module for uefi) - #135326 (support target specific `optimized-compiler-builtins`) - #135347 (Use `NonNull::without_provenance` within the standard library) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-11Rollup merge of #135347 - samueltardieu:push-qvyxtxsqyxyr, r=jhprattJacob Pratt-29/+13
Use `NonNull::without_provenance` within the standard library This API removes the need for several `unsafe` blocks, and leads to clearer code. It uses feature `nonnull_provenance` (#135243). Close #135343
2025-01-11Rollup merge of #135326 - onur-ozkan:target-specific-compiler-builtins, ↵Jacob Pratt-2/+36
r=jieyouxu support target specific `optimized-compiler-builtins` Makes it possible to control `optimized-compiler-builtins` for per target. This was raised in the [zulip discussion](https://rust-lang.zulipchat.com/#narrow/channel/326414-t-infra.2Fbootstrap/topic/Building.20and.20packaging.20Rust.20with.20x86_64-unknown-uefi.20support/near/492765883) yesterday.
2025-01-11Rollup merge of #135324 - Ayush1325:uefi-fs-unsupported, r=joboetJacob Pratt-1/+344
Initial fs module for uefi - Just a copy of unsupported fs right now to reduce the noise from future PRs to allow for easier review. - For the full working version of fs on uefi, see [0] - This is an effort to break the original PR (#129700) into much smaller chunks for faster upstreaming. [0]: https://github.com/Ayush1325/rust/tree/uefi-file-full
2025-01-11Rollup merge of #135301 - lolbinarycat:bootstrap-old-master-resurected, ↵Jacob Pratt-0/+3
r=onur-ozkan re-add a warning for old master branch, but with much simpler logic instead of calling into git or checking the modification time of files, simply print the warning if there is a very large number of "modified" files. also make the wording much softer, so false positives are less alarming. (warning was removed in https://github.com/rust-lang/rust/issues/134935)
2025-01-11Rollup merge of #135236 - scottmcm:more-mcp807-library-updates, r=ChrisDentonJacob Pratt-214/+351
Update a bunch of library types for MCP807 This greatly reduces the number of places that actually use the `rustc_layout_scalar_valid_range_*` attributes down to just 3: ``` library/core\src\ptr\non_null.rs 68:#[rustc_layout_scalar_valid_range_start(1)] library/core\src\num\niche_types.rs 19: #[rustc_layout_scalar_valid_range_start($low)] 20: #[rustc_layout_scalar_valid_range_end($high)] ``` Everything else -- PAL Nanoseconds, alloc's `Cap`, niched FDs, etc -- all just wrap those `niche_types` types. r? ghost
2025-01-11Rollup merge of #134074 - GrigorenkoPV:bootstrap-io-error-more, r=jieyouxuJacob Pratt-4/+1
bootstrap: `std::io::ErrorKind::CrossesDevices` is finally stable
2025-01-11Auto merge of #135274 - saethlin:array-repeats, r=compiler-errorsbors-0/+176
Add an InstSimplify for repetitive array expressions I noticed in https://github.com/rust-lang/rust/pull/135068#issuecomment-2569955426 that GVN's implementation of this same transform was quite profitable on the deep-vector benchmark. But of course GVN doesn't run in unoptimized builds, so this is my attempt to write a version of this transform that benefits the deep-vector case and is fast enough to run in InstSimplify. The benchmark suite indicates that this is effective.
2025-01-11Auto merge of #135258 - oli-obk:push-ktzskvxuwnlt, r=saethlinbors-7/+47
Use llvm.memset.p0i8.* to initialize all same-bytes arrays Similar to #43488 debug builds can now handle `0x0101_u16` and other multi-byte scalars that have all the same bytes (instead of special casing just `0`)
2025-01-10Improve the safety documentation on new_uncheckedScott McMurray-1/+7
2025-01-10never print the warning on CIbinarycat-1/+1
2025-01-11review commentsEsteban Küber-57/+67
Replace tuple with struct and remove unnecessary early return.
2025-01-11Avoid unnecessary note when type has escaping boundsEsteban Küber-4/+9
2025-01-11Avoid duplicated noteEsteban Küber-7/+8
2025-01-11Account for `for<'a>` types when checking for non-structural type in ↵Esteban Küber-3/+40
constant as pattern When we encounter a constant in a pattern, we check if it is non-structural. If so, we check if the type implements `PartialEq`, but for types with escaping bound vars the check would be incorrect as is, so we break early. This is ok because these types would be filtered anyways. Fix #134764.
2025-01-11Auto merge of #135346 - weihanglo:update-cargo, r=weihanglobors-0/+0
Update cargo 18 commits in fd784878cfa843e3e29a6654ecf564c62fae6735..088d496082726091024f1689c124a0c3dccbd775 2025-01-03 20:06:26 +0000 to 2025-01-10 20:10:21 +0000 - docs(reference): Fix PkgIdSpec kind docs (rust-lang/cargo#15049) - feat: Added warning when failing to update index cache (rust-lang/cargo#15014) - docs(ref): Fix the inverted logic about MSRV (rust-lang/cargo#15044) - chore(deps): update msrv (1 version) to v1.84 (rust-lang/cargo#15041) - Remove unnecessary into conversions (rust-lang/cargo#15042) - docs(contrib): Start guidelines for schema design (rust-lang/cargo#15037) - fix: emit warnings as warnings when learning rust target info (rust-lang/cargo#15036) - fix(schemas): Fix the `[lints]` JSON Schema (rust-lang/cargo#15035) - fix(schemas): Fix 'metadata' JSON Schema (rust-lang/cargo#15033) - shorten comment on Ord for SourceKind (rust-lang/cargo#15029) - Make `"C"` explicit in `extern "C"`. (rust-lang/cargo#15034) - simplify SourceID Ord/Eq (rust-lang/cargo#14980) - Setup cargo environment for `cargo rustc --print` (rust-lang/cargo#15026) - Avoid naming variables `str` (rust-lang/cargo#15025) - Bump to 0.87.0; update changelog (rust-lang/cargo#15022) - Update libgit2 to 1.9 (rust-lang/cargo#15018) - Remove condition on RUSTUP_WINDOWS_PATH_ADD_BIN (rust-lang/cargo#15017) - Fix https::self_signed_should_fail for macos (rust-lang/cargo#15016)
2025-01-10Use `NonNull::without_provenance` within the standard librarySamuel Tardieu-29/+13
This API removes the need for several `unsafe` blocks, and leads to clearer code.
2025-01-10Update cargoWeihang Lo-0/+0
2025-01-10Auto merge of #135339 - joboet:ptr-is-zero, r=Noratriebbors-13/+12
alloc: remove unsound `IsZero` for raw pointers Fixes #135338
2025-01-10add `-Zmin-function-alignment`Folkert de Vries-3/+145
2025-01-10Auto merge of #134082 - davidtwco:forced-inlining, r=saethlinbors-661/+2402
mir_transform: implement `#[rustc_force_inline]` Adds `#[rustc_force_inline]` which is similar to always inlining but reports an error if the inlining was not possible. - `#[rustc_force_inline]` can only be applied to free functions to guarantee that the MIR inliner will be able to resolve calls. - `rustc_mir_transform::inline::Inline` is refactored into two passes (`Inline` and `ForceInline`), sharing the vast majority of the implementation. - `rustc_mir_transform::inline::ForceInline` can't be disabled so annotated items are always inlined. - `rustc_mir_transform::inline::ForceInline` runs regardless of optimisation level. - `#[rustc_force_inline]` won't inline unless target features match, as with normal inlining. - MIR validation will ICE if a `#[rustc_force_inline]` isn't inlined, to guarantee that it will never be codegened independently. As a further guarantee, monomorphisation collection will always decide that `#[rustc_force_inline]` functions cannot be codegened locally. - Like other intrinsics, `#[rustc_force_inline]` annotated functions cannot be cast to function pointers. - As with other rustc attrs, this cannot be used by users, just within the compiler and standard library. - This is only implemented within rustc, so should avoid any limitations of LLVM's inlining. It is intended that this attribute be used with intrinsics that must be inlined for security reasons. For example, pointer authentication intrinsics would allow Rust users to make use of pointer authentication instructions, but if these intrinsic functions were in the binary then they could be used as gadgets with ROP attacks, defeating the point of introducing them. We don't have any intrinsics like this today, but I expect to upstream some once a force inlining mechanism such as this is available. cc rust-lang/rust#131687 rust-lang/rfcs#3711 - this approach should resolve the concerns from these previous attempts r? `@saethlin`
2025-01-10mir_build: check annotated functions w/out callersDavid Wood-98/+223
2025-01-10clarify `target_feature` + forced inliningDavid Wood-7/+9
2025-01-10don't collect `#[rustc_force_inline]` in eager modeDavid Wood-4/+65
2025-01-10inline: move should inline checkDavid Wood-5/+5
2025-01-10validator: move force inline checkDavid Wood-23/+10
2025-01-10inline: remove unnecessary promoted checkDavid Wood-4/+0
2025-01-10inline: re-introduce some callee body checksDavid Wood-2/+131
2025-01-10inline: force inlining shimsDavid Wood-12/+27
2025-01-10codegen_attrs: force inlining takes precedenceDavid Wood-28/+33
2025-01-10mir_transform: implement forced inliningDavid Wood-670/+2091
Adds `#[rustc_force_inline]` which is similar to always inlining but reports an error if the inlining was not possible, and which always attempts to inline annotated items, regardless of optimisation levels. It can only be applied to free functions to guarantee that the MIR inliner will be able to resolve calls.
2025-01-10alloc: remove unsound `IsZero` for raw pointersjoboet-13/+12
Fixes #135338
2025-01-10Use llvm.memset.p0i8.* to initialize all same-bytes arraysOli Scherer-10/+12
2025-01-10Auto merge of #135328 - bjorn3:sync_cg_clif-2025-01-10, r=bjorn3bors-320/+93
Subtree sync for rustc_codegen_cranelift This has a couple of changes that will conflict with https://github.com/rust-lang/rust/pull/134338. r? `@ghost` `@rustbot` label +A-codegen +A-cranelift +T-compiler
2025-01-10Auto merge of #135327 - jhpratt:rollup-5uyir52, r=jhprattbors-399/+1162
Rollup of 7 pull requests Successful merges: - #132607 (Used pthread name functions returning result for FreeBSD and DragonFly) - #134693 (proc_macro: Use `ToTokens` trait in `quote` macro) - #134732 (Unify conditional-const error reporting with non-const error reporting) - #135083 (Do not ICE when encountering predicates from other items in method error reporting) - #135251 (Only treat plain literal patterns as short) - #135320 (Fix typo in `#[coroutine]` gating error) - #135321 (remove more redundant into() conversions) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-10Merge commit 'e39eacd2d415803ef82de3b6a314e4f2d0fbc4dc' into ↵bjorn3-320/+93
sync_cg_clif-2025-01-10
2025-01-10Rustup to rustc 1.86.0-nightly (824759493 2025-01-09)bjorn3-1/+1
2025-01-10Rollup merge of #135321 - matthiaskrgr:out_of_into, r=lqdJacob Pratt-5/+4
remove more redundant into() conversions
2025-01-10Rollup merge of #135320 - camelid:coroutines-typo, r=lqdJacob Pratt-7/+7
Fix typo in `#[coroutine]` gating error
2025-01-10Rollup merge of #135251 - oli-obk:push-lmpyvvyrtplk, r=ytmimiJacob Pratt-12/+43
Only treat plain literal patterns as short See https://github.com/rust-lang/rust/pull/134228#discussion_r1905848384 and https://github.com/rust-lang/rust/pull/134228#discussion_r1905916702 for context. We never wanted to treat const blocks and paths as short, only plain literals. I don't know how to write a test for this, it.s not clear to me how the short pattern check actually affects the formatting