about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-04-11Rollup merge of #139654 - nnethercote:AssocKind-descr, r=compiler-errorsStuart Cook-49/+49
Improve `AssocItem::descr`. The commit adds "associated" to the description of associated types and associated consts, to match the description of associated functions. This increases error message precision and consistency with `AssocKind::fmt`. The commit also notes an imperfection in `AssocKind::fmt`; fixing this imperfection is possible but beyond the scope of this PR. r? `@estebank`
2025-04-11Rollup merge of #139641 - BoxyUwU:allow_parend_array_len_infer, ↵Stuart Cook-1/+72
r=compiler-errors Allow parenthesis around inferred array lengths In #135272 it was noticed that we weren't handling `Vec<(((((_)))))>` correctly under the new desugaring for `generic_arg_infer`, this had to be fixed in order to not regress stable code for types that should continue working. This has the side effect of *also* allowing the following to work: ```rust #![feature(generic_arg_infer)] struct Bar<const N: usize>; fn main() { let a: Bar<((_))> = Bar::<10>; } ``` However I did not make the same change for array lengths resulting in the following not compiling: ```rust #![feature(generic_arg_infer)] fn main() { let a: [u8; (((_)))] = [2; 2]; let a: [u8; 2] = [2; (((((_)))))]; } ``` This is rather inconsistent as parenthesis around `_` *are* supported for const args to non-arrays, and type args. This PR fixes this allowing the above example to compile. No stable impact. r? compiler-errors
2025-04-11Rollup merge of #139564 - compiler-errors:deeply-norm, r=lcnrStuart Cook-42/+139
Deeply normalize obligations in `BestObligation` folder Built on #139513. This establishes a somewhat rough invariant that the `Obligation`'s predicate is always deeply normalized in the folder; when we construct a new obligation we normalize it. Putting this up for discussion since it does affect some goals. r? lcnr
2025-04-11Rollup merge of #139469 - jieyouxu:compiletest-supports-crate-type, r=onur-ozkanStuart Cook-38/+31
Introduce a `//@ needs-crate-type` compiletest directive The `//@ needs-crate-type: $crate_types...` directive takes a comma-separated list of crate types that the target platform must support in order for the test to be run. This allows the test writer to semantically convey that the ignore condition is based on target crate type needs, instead of using a general purpose `//@ ignore-$target` directive (often without comment). Fixes #132309. ### Example ```rs //@ needs-crate-type: dylib (ignored on e.g. wasm32-unknown-unknown) //@ compile-flags: --crate-type=dylib fn foo() {} ``` ### Review advice - Best reviewed commit-by-commit. - The impl is not very clean, I briefly attempted to clean up the directive handling but found that more invasive changes are needed, so I'd like to not block on the cleanup for now. try-job: test-various try-job: armhf-gnu
2025-04-11Rollup merge of #138998 - ↵Stuart Cook-0/+21
rperier:donot_suggest_to_use_impl_trait_in_closure_params, r=Noratrieb Don't suggest the use of `impl Trait` in closure parameter Fixes #138932
2025-04-11Rollup merge of #138904 - madsmtm:apple-test-no-std, r=tgross35Stuart Cook-0/+41
Test linking and running `no_std` binaries I looked around, but it seems that we do not have a test that tests a `#![no_std]` + `#![no_main]` binary. So now I've added one. Motivated by discussion in [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/channel/219381-t-libs/topic/Provide.20.60__isPlatformVersionAtLeast.60.20in.20.60std.60.3F/with/507870028). r? ```@tgross35``` try-job: arm-android try-job: armhf-gnu try-job: dist-ohos try-job: x86_64-mingw-1
2025-04-11Rollup merge of #138682 - Alexendoo:extra-symbols, r=fee1-deadStuart Cook-0/+1
Allow drivers to supply a list of extra symbols to intern Allows adding new symbols as `const`s in external drivers, desirable in Clippy so we can use them in patterns to replace code like https://github.com/rust-lang/rust/blob/75530e9f72a1990ed2305e16fd51d02f47048f12/src/tools/clippy/clippy_lints/src/casts/cast_ptr_alignment.rs#L66 The Clippy change adds a couple symbols as a demo, the exact `clippy_utils` API and replacing other usages can be done on the Clippy side to minimise sync conflicts --- try-job: aarch64-gnu
2025-04-11Rollup merge of #138182 - durin42:llvm-21-fp128-windows, r=tgross35Stuart Cook-1/+2
rustc_target: update x86_win64 to match the documented calling convention for f128 llvm/llvm-project@5ee1c0b7148571ed9d60e447b66fb0f35de14576 updates llvm to match the documented calling convention to pass f128 indirectly. This change makes us do that on all versions of LLVM, not just starting with LLVM 21. `@rustbot` label llvm-main try-job: dist-x86_64-msvc try-job: dist-x86_64-mingw try-job: x86_64-msvc-1 try-job: x86_64-msvc-2 try-job: x86_64-mingw-1 try-job: x86_64-mingw-2
2025-04-11Rollup merge of #137447 - folkertdev:simd-extract-insert-dyn, r=scottmcmStuart Cook-2/+114
add `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}` fixes https://github.com/rust-lang/rust/issues/137372 adds `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}`, which contrary to their non-dyn counterparts allow a non-const index. Many platforms (but notably not x86_64 or aarch64) have dedicated instructions for this operation, which stdarch can emit with this change. Future work is to also make the `Index` operation on the `Simd` type emit this operation, but the intrinsic can't be used directly. We'll need some MIR shenanigans for that. r? `@ghost`
2025-04-11Improve `AssocItem::descr`.Nicholas Nethercote-49/+49
The commit adds "associated" to the description of associated types and associated consts, to match the description of associated functions. This increases error message precision and consistency with `AssocKind::fmt`. The commit also notes an imperfection in `AssocKind::fmt`; fixing this imperfection is possible but beyond the scope of this PR.
2025-04-10Auto merge of #137412 - scottmcm:redo-swap, r=cuviperbors-48/+149
Ensure `swap_nonoverlapping` is really always untyped This replaces #134954, which was arguably overcomplicated. ## Fixes #134713 Actually using the type passed to `ptr::swap_nonoverlapping` for anything other than its size + align turns out to not work, so this goes back to always erasing the types down to just bytes. (Except in `const`, which keeps doing the same thing as before to preserve `@RalfJung's` fix from #134689) ## Fixes #134946 I'd previously moved the swapping to use auto-vectorization *on bytes*, but someone pointed out on Discord that the tail loop handling from that left a whole bunch of byte-by-byte swapping around. This goes back to manual tail handling to avoid that, then still triggers auto-vectorization on pointer-width values. (So you'll see `<4 x i64>` on `x86-64-v3` for example.)
2025-04-10tests: adjust expectation for f128 abi on WindowsAugie Fackler-1/+2
llvm/llvm-project@5ee1c0b7148571ed9d60e447b66fb0f35de14576 updates llvm to match the documented calling convention to pass f128 indirectly. @rustbot label llvm-main
2025-04-10add `simd_insert_dyn` and `simd_extract_dyn`Folkert de Vries-2/+114
2025-04-10Deeply normalize obligations in BestObligationMichael Goulet-42/+139
2025-04-10Allow parenthesis around inferred array lengthsBoxy-1/+72
2025-04-10Rollup merge of #139626 - m-ou-se:mut, r=lqdMatthias Krüger-1/+1
Remove unnecessary `mut` in test. The value is moved in `pin!()`, so the binding doesn't need to be `mut` itself. (Rustc doesn't warn about this due to the current hacky implementation of `pin!()`. That is fixed by https://github.com/rust-lang/rust/pull/139114.)
2025-04-10Rollup merge of #139614 - nnethercote:fix-139512, r=oli-obkMatthias Krüger-0/+45
Avoid empty identifiers for delegate params and args. Details in individual commits. r? `@oli-obk`
2025-04-10Rollup merge of #139510 - nnethercote:name-to-ident, r=fee1-deadMatthias Krüger-1/+1
Rename some `name` variables as `ident`. It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`. This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk. r? `@fee1-dead`
2025-04-10Rollup merge of #139502 - yaahc:still-mutable-ice, r=bjorn3Matthias Krüger-0/+110
fix "still mutable" ice while metrics are enabled Resolves "still mutable" ICE discovered by `@matthiaskrgr` here: [#t-docs-rs > metrics intitiative @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/356853-t-docs-rs/topic/metrics.20intitiative/near/510490790) This was caused by invoking `crate_hash` before the `definitions` struct was frozen here: https://github.com/rust-lang/rust/blob/e643f59f6da3a84f43e75dea99afaa5b041ea6bf/compiler/rustc_interface/src/passes.rs#L951 resolved by moving metrics dumping to occur after `analysis` freezes the definitions I'm guessing we didn't discover this in CI because the problem only occurs when you try to calculate the crash hash with incremental compilation enabled when it tries to freeze the definitions here: https://github.com/rust-lang/rust/blob/e643f59f6da3a84f43e75dea99afaa5b041ea6bf/compiler/rustc_middle/src/hir/map.rs#L1172 my understanding is that this causes us to freeze the definitions too early in compilation, then we subsequently try to mutate them, likely during `analysis`, and this causes the ICE. r? `@bjorn3`
2025-04-10Allow drivers to supply a list of extra symbols to internAlex Macleod-0/+1
2025-04-10Auto merge of #139622 - matthiaskrgr:rollup-8ri1vid, r=matthiaskrgrbors-77/+76
Rollup of 13 pull requests Successful merges: - #138167 (Small code improvement in rustdoc hidden stripper) - #138605 (Clean up librustdoc::html::render to be better encapsulated) - #139423 (Suppress missing field error when autoderef bottoms out in infer) - #139449 (match ergonomics: replace `peel_off_references` with a recursive call) - #139507 (compiletest: Trim whitespace from environment variable names) - #139530 (Remove some dead or leftover code related to rustc-intrinsic abi removal) - #139560 (fix title of offset_of_enum feature) - #139563 (emit a better error message for using the macro incorrectly) - #139568 (Don't use empty trait names) - #139580 (Temporarily leave the review rotation) - #139589 (saethlin is back from vacation) - #139592 (rustdoc: Enable Markdown extensions when looking for doctests) - #139599 (Tracking issue template: fine-grained information on style update status) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-10Remove unnecessary `mut`.Mara Bos-1/+1
The value is moved in pin!().
2025-04-10Rollup merge of #139592 - camelid:doctest-md-opts, r=notriddleMatthias Krüger-0/+23
rustdoc: Enable Markdown extensions when looking for doctests Fixes #139064. We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-04-10Rollup merge of #139568 - nnethercote:empty-trait-name, r=compiler-errorsMatthias Krüger-40/+24
Don't use empty trait names Helps with #137978. Details in individual commits. r? ```@davidtwco```
2025-04-10Rollup merge of #139563 - EnzymeAD:better-autodiff-err, r=jieyouxuMatthias Krüger-4/+4
emit a better error message for using the macro incorrectly fixing: https://github.com/EnzymeAD/rust/issues/185 I feel like it's not a perfect message either, so I'm open to suggestions. But at the end of the day users will need to read the docs anyway, and emitting multi-line errors each time this gets triggered can probably become annoying? r? ``@jieyouxu`` since you've reviewed my frontend work back in the days. Tracking: - https://github.com/rust-lang/rust/issues/124509
2025-04-10Rollup merge of #139530 - oli-obk:rustc-intrinsic-cleanup, r=RalfJungMatthias Krüger-23/+0
Remove some dead or leftover code related to rustc-intrinsic abi removal r? ```@RalfJung``` PR that removed the ABI: https://github.com/rust-lang/rust/pull/139455 tracking issue: https://github.com/rust-lang/rust/issues/132735
2025-04-10Rollup merge of #139507 - Zalathar:trim-env-name, r=jieyouxuMatthias Krüger-0/+23
compiletest: Trim whitespace from environment variable names When a test contains a directive like `//@ exec-env: FOO=bar`, compiletest currently includes that leading space in the name of the environment variable, so it is defined as ` FOO` instead of `FOO`. This is an annoying footgun that is pretty much never intended, especially since most other directives *do* trim whitespace. So let's get rid of it by trimming the environment variable name. Values remain untrimmed, since there could conceivably be a use-case for values with leading space, but perhaps we'll end up trimming values too in the future. Recently observed in https://github.com/rust-lang/rust/pull/138603#issuecomment-2783709359. Fixes #132990. Supersedes #133148. --- try-job: test-various
2025-04-10Rollup merge of #139423 - compiler-errors:field-autoderef, r=oli-obkMatthias Krüger-10/+2
Suppress missing field error when autoderef bottoms out in infer I see this error repeatedly when doing refactorings, and it's pretty misleading b/c it's not the source of the error.
2025-04-10Auto merge of #139088 - spastorino:ergonomic-ref-counting-2, r=nikomatsakisbors-52/+110
Ergonomic ref counting: optimize away clones when possible This PR build on top of https://github.com/rust-lang/rust/pull/134797. It optimizes codegen of ergonomic ref-counting when the type being `use`d is only known to be copy after monomorphization. We avoid codening a clone and generate bitwise copy instead. RFC: https://github.com/rust-lang/rfcs/pull/3680 Tracking issue: https://github.com/rust-lang/rust/issues/132290 Project goal: https://github.com/rust-lang/rust-project-goals/issues/107 r? `@nikomatsakis` This PR could better sit on top of https://github.com/rust-lang/rust/pull/131650 but as it did not land yet I've decided to just do minimal changes. It may be the case that doing what I'm doing regress the performance and we may need to go the full route of https://github.com/rust-lang/rust/pull/131650. cc `@saethlin` in this regard.
2025-04-10tests: use specific-purpose `needs-crate-type` over `ignore-$target` directivesJieyou Xu-38/+31
Not all existing tests are converted, I only updated ones that I can easily find via directive comments.
2025-04-10Avoid empty identifiers for delegate params and args.Nicholas Nethercote-2/+2
Instead use `argN`. The empty identifiers could flow to `Liveness::should_warn`, where they would trigger a bounds error. Fixes #139512.
2025-04-10Add a HIR pretty printing test for delegation.Nicholas Nethercote-0/+45
Note that some of the output is currently bogus, with missing params and args: ``` fn add(: _, : _) -> _ { m::add(, ) } ``` The next commit will fix this.
2025-04-10Auto merge of #139000 - compiler-errors:rigid-missing-item, r=lcnrbors-14/+339
Rigidly project missing item due to guaranteed impossible sized predicate This is a somewhat involved change, but it amounts to treating missing impl items due to guaranteed impossible where clauses (dyn/str/slice sized, cc #135480) as *rigid projections* rather than projecting to an error term, since that was preventing either reporting a proper error (in an empty param env) *or* successfully type checking the code (in the presence of trivially false where clauses). Fixes https://github.com/rust-lang/rust/issues/138970 r? `@lcnr` `@oli-obk`
2025-04-10Rename some `name` variables as `ident`.Nicholas Nethercote-1/+1
It bugs me when variables of type `Ident` are called `name`. It leads to silly things like `name.name`. `Ident` variables should be called `ident`, and `name` should be used for variables of type `Symbol`. This commit improves things by by doing `s/name/ident/` on a bunch of `Ident` variables. Not all of them, but a decent chunk.
2025-04-09Auto merge of #139595 - matthiaskrgr:rollup-kaa8aim, r=matthiaskrgrbors-51/+373
Rollup of 10 pull requests Successful merges: - #138470 (Test interaction between RFC 2229 migration and use closures) - #138628 (Add more ergonomic clone tests) - #139164 (std: improve documentation for get_mut() methods regarding forgotten guards) - #139488 (Add missing regression GUI test) - #139489 (compiletest: Add directive `dont-require-annotations`) - #139513 (Report higher-ranked trait error when higher-ranked projection goal fails in new solver) - #139521 (triagebot: roll compiler reviewers for rustc/unstable book) - #139532 (Update `u8`-to-and-from-`i8` suggestions.) - #139551 (report call site of inlined scopes for large assignment lints) - #139575 (Remove redundant words) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-09Make unnormalizable item ambiguous in coherenceMichael Goulet-0/+60
2025-04-09Use a query rather than recomputing the tail repeatedlyMichael Goulet-14/+159
2025-04-09Mark GAT WC as GoalSource::AliasWellFormed so that we recurse into them in ↵Michael Goulet-21/+2
error reporting
2025-04-09Rigidly project missing item due to guaranteed impossible sized predicateMichael Goulet-0/+139
2025-04-09Rollup merge of #139551 - jogru0:121672, r=oli-obkMatthias Krüger-0/+39
report call site of inlined scopes for large assignment lints Addressed issue: #121672 Tracking issue: #83518 r? `@oli-obk` I tried to follow your comment about what to do [here](https://github.com/rust-lang/rust/issues/121672#issuecomment-1972783675). However, I'm totally unfamiliar with the code so far (this is my first contribution touching compiler code), so I apologize in advance if I did something stupid :sweat_smile: In particular, I'm not sure I use the _correct_ source scope to look for inline data, as there is a whole `IndexVec` of them. My changes definitely did something, as can be seen by the added ui test. However, the result is not as anticipated in the issue: ``` LL | let cell = std::cell::UnsafeCell::new(data); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ value moved from here ``` instead of ``` LL | let cell = std::cell::UnsafeCell::new(data); | ^^^^ value moved from here ``` raising my suspicion that maybe I got the wrong source scope.
2025-04-09Rollup merge of #139513 - compiler-errors:higher-ranked-proj, r=lcnrMatthias Krüger-35/+89
Report higher-ranked trait error when higher-ranked projection goal fails in new solver ~~See HACK comment inline. Not actually sure if it should be marked as a *HACK*, b/c~~ it's kinda a legitimate case we want to care about unless we're going to make the proof tree visitor *smarter* about the leak check than the actual trait solver itself. Encountered this while battling with `NiceRegionError`s in the old solver b/c I wondered what this code ended up giving us in the *new* solver as a comparison: ```rust trait Foo {} impl<T: FnOnce(&())> Foo for T {} fn baz<T: Foo>() {} fn main() { baz::<fn(&'static ())>(); } ``` On master it's pretty bad: ``` error[E0271]: type mismatch resolving `<fn(&()) as FnOnce<(&(),)>>::Output == ()` --> <source>:8:11 | 8 | baz::<fn(&'static ())>(); | ^^^^^^^^^^^^^^^ types differ | note: required for `fn(&'static ())` to implement `Foo` --> <source>:3:22 | 3 | impl<T: FnOnce(&())> Foo for T {} | ----------- ^^^ ^ | | | unsatisfied trait bound introduced here ``` After this PR it's much better: ``` error[E0277]: the trait bound `fn(&'static ()): Foo` is not satisfied --> /home/mgx/test.rs:8:11 | 8 | baz::<fn(&'static ())>(); | ^^^^^^^^^^^^^^^ the trait `for<'a> FnOnce(&'a ())` is not implemented for `fn(&'static ())` | = note: expected a closure with arguments `(&'static (),)` found a closure with arguments `(&(),)` note: required for `fn(&'static ())` to implement `Foo` --> /home/mgx/test.rs:3:22 | 3 | impl<T: FnOnce(&())> Foo for T {} | ----------- ^^^ ^ | | | unsatisfied trait bound introduced here note: required by a bound in `baz` --> /home/mgx/test.rs:5:11 | 5 | fn baz<T: Foo>() {} | ^^^ required by this bound in `baz` ``` r? lcnr
2025-04-09Rollup merge of #139489 - petrochenkov:noreqann, r=jieyouxuMatthias Krüger-16/+16
compiletest: Add directive `dont-require-annotations` for making matching on specific diagnostic kinds non-exhaustive. E.g. `//@ dont-require-annotations:ERROR`, like in the examples in this PR. cc https://github.com/rust-lang/rust/pull/139427#issuecomment-2782827583 Closes #132647 FYI `@BoxyUwU` since you've wanted this. r? `@jieyouxu`
2025-04-09Rollup merge of #139488 - GuillaumeGomez:add-missing-gui-test, r=camelidMatthias Krüger-0/+14
Add missing regression GUI test Add missing GUI test for #139282 (and also fixes the invalid CSS). cc `@lolbinarycat` r? `@notriddle`
2025-04-09Rollup merge of #138628 - spastorino:add-more-ergonomic-clone-tests, ↵Matthias Krüger-0/+137
r=nikomatsakis Add more ergonomic clone tests I've added some extra tests. r? `@nikomatsakis`
2025-04-09Rollup merge of #138470 - spastorino:test-rfc2229-and-ergonomic-clones, ↵Matthias Krüger-0/+78
r=nikomatsakis Test interaction between RFC 2229 migration and use closures r? `@nikomatsakis` Fixes #138101
2025-04-09Auto merge of #124810 - lincot:speed-up-string-push-and-string-insert, ↵bors-0/+11
r=tgross35 speed up `String::push` and `String::insert` Addresses the concerns described in #116235. The performance gain comes mainly from avoiding temporary buffers. Complex pattern matching in `encode_utf8` (introduced in #67569) has been simplified to a comparison and an exhaustive `match` in the `encode_utf8_raw_unchecked` helper function. It takes a slice of `MaybeUninit<u8>` because otherwise we'd have to construct a normal slice to uninitialized data, which is not desirable, I guess. Several functions still have that [unneeded zeroing](https://rust.godbolt.org/z/5oKfMPo7j), but a single instruction is not that important, I guess. `@rustbot` label T-libs C-optimization A-str
2025-04-09Report higher-ranked trait error when higher-ranked projection goal fails in ↵Michael Goulet-35/+89
new solver
2025-04-09skip `tests/codegen/swap-small-types` when debug assertions are onScott McMurray-0/+1
In `swap_nonoverlapping_short` there's a new `debug_assert!`, and if that's enabled then the `alloca`s don't optimize out.
2025-04-09rustdoc: Enable Markdown extensions when looking for doctestsNoah Lev-0/+23
We should enable these to avoid misinterpreting uses of the extended syntax as code blocks. This happens in practice with multi-paragraph footnotes, as discovered in #139064.
2025-04-09Ensure `swap_nonoverlapping` is really always untypedScott McMurray-48/+148