about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-11Rollup merge of #135314 - compiler-errors:eagerly-mono-closures, r=wesleywiserMatthias Krüger-3/+16
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 #134776 - estebank:vanilla-ice, r=lcnrMatthias Krüger-0/+28
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-0/+87
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 #135357 - jhpratt:rollup-gs00yt3, r=jhprattbors-22/+49
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 #135236 - scottmcm:more-mcp807-library-updates, r=ChrisDentonJacob Pratt-22/+49
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-11Auto merge of #135274 - saethlin:array-repeats, r=compiler-errorsbors-0/+146
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-0/+26
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-11Avoid unnecessary note when type has escaping boundsEsteban Küber-1/+0
2025-01-11Avoid duplicated noteEsteban Küber-1/+0
2025-01-11Account for `for<'a>` types when checking for non-structural type in ↵Esteban Küber-0/+30
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-10add `-Zmin-function-alignment`Folkert de Vries-0/+87
2025-01-10mir_build: check annotated functions w/out callersDavid Wood-53/+112
2025-01-10don't collect `#[rustc_force_inline]` in eager modeDavid Wood-0/+59
2025-01-10inline: re-introduce some callee body checksDavid Wood-0/+102
2025-01-10inline: force inlining shimsDavid Wood-0/+9
2025-01-10mir_transform: implement forced inliningDavid Wood-0/+953
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-10Use llvm.memset.p0i8.* to initialize all same-bytes arraysOli Scherer-5/+3
2025-01-10Auto merge of #135327 - jhpratt:rollup-5uyir52, r=jhprattbors-67/+708
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-10Rollup merge of #135320 - camelid:coroutines-typo, r=lqdJacob Pratt-6/+6
Fix typo in `#[coroutine]` gating error
2025-01-10Rollup merge of #135083 - compiler-errors:invalid-predicate-source, r=camelidJacob Pratt-0/+72
Do not ICE when encountering predicates from other items in method error reporting See the comments I left in the code and the test file. Fixes https://github.com/rust-lang/rust/issues/124350
2025-01-10Rollup merge of #134732 - ↵Jacob Pratt-12/+26
compiler-errors:unify-conditional-const-error-reporting, r=RalfJung Unify conditional-const error reporting with non-const error reporting This PR unifies the error reporting between `ConditionallyConstCall` and `FnCallNonConst` so that the former will refer to syntactical sugar like operators by their sugared name, rather than calling all operators "methods". We achieve this by making the "non-const" part of the error message generic over the "non" part so we can plug in "conditionally" instead. This should ensure that as we constify traits in the standard library, we don't regress error messages for things like `==`. r? fmease or reassign
2025-01-10Rollup merge of #134693 - SpriteOvO:proc-macro-use-to-tokens-in-quote, ↵Jacob Pratt-49/+604
r=tgross35 proc_macro: Use `ToTokens` trait in `quote` macro Tracking issues: #130977, #54722 This PR changed `proc_macro::quote!` to use `ToTokens` trait instead of `TokenStream::from`, and migrated test cases from `quote` crate. r? `@dtolnay` CC `@tgross35`
2025-01-10Auto merge of #135273 - dianne:argument-patterns-are-not-boring, r=lqdbors-7/+9
Remove special-casing for argument patterns in MIR typeck (attempt to fix perf regression of #133858) See [my comment](https://github.com/rust-lang/rust/pull/133858#issuecomment-2579029618) on #133858 for more information. This is just a guess as to what went wrong, and I haven't been able to get the profiler running locally, so I'll need a perf run to make sure this actually helps. There's one test's stderr that suffers a bit, but this was just papering over the issue anyway. Making region errors point to the correct constraints in the presence of invariance/contravariance is a broader problem; the current way it's handled is mostly based on guesswork, luck, and hoping it works out. Properly handling that (somehow) would improve the test's stderr without the hack that this PR reverts.
2025-01-10Add regression test for option initializationOli Scherer-0/+28
2025-01-09Update a bunch of library types for MCP807Scott McMurray-22/+49
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.
2025-01-09Fix typo in `#[coroutine]` gating errorNoah Lev-6/+6
2025-01-10Rollup merge of #135308 - compiler-errors:scope-visit, r=oli-obkMatthias Krüger-0/+16
Make sure to walk into nested const blocks in `RegionResolutionVisitor` Fixes https://github.com/rust-lang/rust/issues/135306 I tried auditing the rest of the visitors that called `.visit_body`, and it seems like this is the only one that was missing it. I wonder if we should modify intravisit (specifcially, that `NestedBodyFilter` stuff) to make this less likely to happen, tho... r? oli-obk
2025-01-10Rollup merge of #135304 - steffahn:tests_from_132289, r=compiler-errorsMatthias Krüger-0/+178
Add tests cases from review of #132289 Adding my comments as test-cases as suggested by ``@jackh726`` in https://github.com/rust-lang/rust/pull/132289#issuecomment-2564602267
2025-01-10Rollup merge of #135294 - ChrisDenton:bare-fn-width, r=jieyouxuMatthias Krüger-6/+8
Make `bare-fn-no-impl-fn-ptr-99875` test less dependent on path width This sets diagnostic-width to some arbitrary number. Seems to work on my machine.
2025-01-10Rollup merge of #133088 - the8472:randomize-me-harder, r=workingjubileeMatthias Krüger-71/+310
`-Zrandomize-layout` harder. `Foo<T> != Foo<U>` Tracking issue: #106764 Previously randomize-layout only used a deterministic shuffle based on the seed stored in an Adt's ReprOptions, meaning that `Foo<T>` and `Foo<U>` were shuffled by the same seed. This change adds a similar seed to each calculated LayoutData so that a struct can be randomized both based on the layout of its fields and its per-type seed. Primitives start with simple seed derived from some of their properties. Though some types can no longer be distinguished at that point, e.g. usize and u64 will still be treated the same.
2025-01-10Eagerly collect mono items for non-generic closuresMichael Goulet-3/+16
2025-01-10test that coercions still work under randomizationThe 8472-8/+40
2025-01-10exclude unsizable tail from randomization seed calculationThe 8472-3/+4
2025-01-10adjust UI testsThe 8472-71/+248
2025-01-10Foo<T> != Foo<U> under layout randomizationThe 8472-0/+29
previously field ordering was using the same seed for all instances of Foo, now we pass seed values through the layout tree so that not only the struct itself affects layout but also its fields
2025-01-09Add an InstSimplify for repetitive array expressionsBen Kimock-0/+146
2025-01-09Make sure to walk into nested const blocks in RegionResolutionVisitorMichael Goulet-0/+16
2025-01-09Fix `proc_macro::quote!` for raw identAsuna-1/+21
2025-01-09Migrate check-fail tests for `proc_macro::quote!` from `quote` crateAsuna-0/+163
2025-01-09Migrate basic tests for `proc_macro::quote!` from `quote` crateAsuna-0/+368
2025-01-09Append `TokenTree` with `ToTokens` in `proc_macro::quote!`Asuna-19/+23
2025-01-09Add tests cases from review of #132289Frank Steffahn-0/+178
2025-01-09Make bare-fn test less dependent on path widthChris Denton-6/+8
2025-01-09Unify conditional and non const call error reportingMichael Goulet-20/+26
2025-01-09Add note back to conditionally-const error messageMichael Goulet-0/+8
2025-01-09Rollup merge of #135261 - compiler-errors:coverage-has-identity-substs, ↵Matthias Krüger-0/+53
r=oli-obk Account for identity substituted items in symbol mangling See the inline comment. r? oli-obk Fixes #135235
2025-01-09Rollup merge of #135195 - oli-obk:push-toyoyrupruko, r=lcnrMatthias Krüger-70/+97
Make `lit_to_mir_constant` and `lit_to_const` infallible My motivation for this change is just that it's annoying to check everywhere, especially since all but one call site was just ICEing on errors anyway right there. They can still fail, but now just return an error constant instead of having the caller handle the error. fixes #114317 fixes #126182
2025-01-09add comment to testlcnr-4/+6
2025-01-09Account for identity substituted items in symbol manglingMichael Goulet-0/+51
2025-01-09Auto merge of #135279 - matthiaskrgr:rollup-ek2qere, r=matthiaskrgrbors-0/+1
Rollup of 5 pull requests Successful merges: - #135212 (Remove outdated information in the `unreachable_pub` lint description) - #135225 (Explicitly build proc macro test with panic=unwind) - #135242 (add missing provenance APIs on NonNull) - #135247 (Add a list of symbols for stable standard library crates) - #135269 (Remove some unnecessary `.into()` calls) r? `@ghost` `@rustbot` modify labels: rollup