about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-01-08Merge from rustcRalf Jung-1764/+6896
2025-01-12Auto merge of #135402 - matthiaskrgr:rollup-cz7hs13, r=matthiaskrgrbors-118/+285
Rollup of 6 pull requests Successful merges: - #129259 (Add inherent versions of MaybeUninit methods for slices) - #135374 (Suggest typo fix when trait path expression is typo'ed) - #135377 (Make MIR cleanup for functions with impossible predicates into a real MIR pass) - #135378 (Remove a bunch of diagnostic stashing that doesn't do anything) - #135397 (compiletest: add erroneous variant to `string_enum`s conversions error) - #135398 (add more crash tests) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-12Rollup merge of #135398 - matthiaskrgr:crash, r=lqdMatthias Krüger-0/+56
add more crash tests try-job: aarch64-apple try-job: x86_64-msvc try-job: x86_64-gnu try-job: dist-i586-gnu-i586-i686-musl
2025-01-12Rollup merge of #135378 - compiler-errors:unnecessary-stashing, r=chenyukangMatthias Krüger-118/+159
Remove a bunch of diagnostic stashing that doesn't do anything #121669 removed a bunch of conditional diagnostic stashing/canceling, but left around the `steal` calls which just emitted the error eagerly instead of canceling the diagnostic. I think that these no-op `steal` calls don't do much and are confusing to encounter, so let's remove them. The net effect is: 1. We emit more duplicated errors, since stashing has the side effect of duplicating diagnostics. This is not a big deal, since outside of `-Zdeduplicate-diagnostics=no`, the errors are already being deduplicated by the compiler. 2. It changes the order of diagnostics, since we're no longer stashing and then later stealing the errors. I don't think this matters much for the changes that the UI test suite manifests, and it makes these errors less order dependent.
2025-01-12Rollup merge of #135377 - compiler-errors:impossible-step, r=oli-obkMatthias Krüger-0/+40
Make MIR cleanup for functions with impossible predicates into a real MIR pass It's a bit jarring to see the body of a function with an impossible-to-satisfy where clause suddenly go to a single `unreachable` terminator when looking at the MIR dump output in order, and I discovered it's because we manually replace the body outside of a MIR pass. Let's make it into a fully flegded MIR pass so it's more clear what it's doing and when it's being applied.
2025-01-12Rollup merge of #135374 - compiler-errors:typo-trait-method, r=fee1-deadMatthias Krüger-0/+30
Suggest typo fix when trait path expression is typo'ed When users write something like `Default::defualt()` (notice the typo), failure to resolve the erroneous `defualt` item will cause resolution + lowering to interpret this as a type-dependent path whose self type is `Default` which is a trait object without `dyn`, rather than a trait function like `<_ as Default>::default()`. Try to provide a bit of guidance in this situation when we can detect the typo. Fixes https://github.com/rust-lang/rust/issues/135349
2025-01-12add more crash testsMatthias Krüger-0/+56
2025-01-12Auto merge of #135396 - matthiaskrgr:rollup-zublg1c, r=matthiaskrgrbors-2/+44
Rollup of 5 pull requests Successful merges: - #135266 (Remove emsdk version update from 1.84.0 relnotes) - #135364 (Cleanup `suggest_binding_for_closure_capture_self` diag in borrowck) - #135375 (allow rustdoc-js tests to be run at stage0) - #135379 (Make (unstable API) `UniqueRc` invariant for soundness) - #135389 (compiletest: include stage0-sysroot libstd dylib in recipe dylib search path) r? `@ghost` `@rustbot` modify labels: rollup
2025-01-12Rollup merge of #135379 - steffahn:uniquerc-invariant, r=Mark-SimulacrumMatthias Krüger-0/+42
Make (unstable API) `UniqueRc` invariant for soundness Add test case from https://github.com/rust-lang/rust/pull/133572#issuecomment-2543007164 (comment in review of `UniqueArc`), and fix the issue for `UniqueRc`.
2025-01-12Rollup merge of #135364 - yotamofek:borrowck-diag-fix, r=compiler-errorsMatthias Krüger-2/+2
Cleanup `suggest_binding_for_closure_capture_self` diag in borrowck Mostly grammar fix/improvement, but also a small cleanup to use iterators instead of for loops for collecting into a vector.
2025-01-11Address PR feedbackScott McMurray-4/+43
2025-01-11[mir-opt] simplify `Repeat`s that don't actually repeat the operandScott McMurray-12/+72
2025-01-11Make UniqueRc invariant for soundnessFrank Steffahn-0/+42
2025-01-11Make MIR cleanup for functions with impossible predicates into a real MIR passMichael Goulet-0/+40
2025-01-11Remove a bunch of diagnostic stashing that doesn't do anythingMichael Goulet-118/+159
2025-01-11Suggest typos when trait path expression is typodMichael Goulet-0/+30
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-11improve clunky grammar in borrowck diagnosticYotam Ofek-2/+2
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