about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
2025-08-10Auto merge of #135846 - estebank:non-exhaustive-dfv-ctor-2, r=BoxyUwUbors-0/+144
Detect struct construction with private field in field with default When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value. ``` error[E0603]: struct `Priv1` is private --> $DIR/non-exhaustive-ctor-2.rs:19:39 | LL | let _ = S { field: (), field1: m::Priv1 {} }; | ------ ^^^^^ private struct | | | while setting this field | note: the struct `Priv1` is defined here --> $DIR/non-exhaustive-ctor-2.rs:14:4 | LL | struct Priv1 {} | ^^^^^^^^^^^^ help: the type `Priv1` of field `field1` is private, but you can construct the default value defined for it in `S` using `..` in the struct initializer expression | LL | let _ = S { field: (), .. }; | ~~ ```
2025-08-10cfg_select: Support unbraced expressionsJosh Triplett-12/+38
When operating on expressions, `cfg_select!` can now handle expressions without braces. (It still requires braces for other things, such as items.) Expand the test coverage and documentation accordingly.
2025-08-10show a trailing comma on singleton tuple constructors in witness patsdianne-8/+8
2025-08-10Do not point at macro invocation when providing inference contextEsteban Küber-5/+1
2025-08-10Add test showing innecessary inference spanEsteban Küber-0/+42
2025-08-10Account for macros when trying to point at inference causeEsteban Küber-10/+2
Do not point at macro invocation which expands to an inference error. Avoid the following: ``` error[E0308]: mismatched types --> $DIR/does-not-have-iter-interpolated.rs:12:5 | LL | quote!($($nonrep)*); | ^^^^^^^^^^^^^^^^^^^ | | | expected `HasIterator`, found `ThereIsNoIteratorInRepetition` | expected due to this | here the type of `has_iter` is inferred to be `ThereIsNoIteratorInRepetition` ```
2025-08-10Fix macro infinite recursion test to not trigger warning about semicolon in exprJosh Triplett-8/+8
The test cases for issue 41731 are about infinite macro recursion that incorporates `print!` and `println!`. However, they also included trailing semicolons despite expanding to expressions; that isn't what these particular test cases are designed to test. Eliminate the trailing semicolons, to simplify future work on removing this special case. Every *other* macro that expands to a semicolon in an expression is a test case for that specifically.
2025-08-10Auto merge of #145223 - jhpratt:rollup-xcqbwqe, r=jhprattbors-54/+102
Rollup of 7 pull requests Successful merges: - rust-lang/rust#144553 (Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/`) - rust-lang/rust#145064 (Add regression test for `saturating_sub` bounds check issue) - rust-lang/rust#145121 (bootstrap: `x.py dist rustc-src` should keep LLVM's siphash) - rust-lang/rust#145150 (Replace unsafe `security_attributes` function with safe `inherit_handle` alternative) - rust-lang/rust#145152 (Use `eq_ignore_ascii_case` to avoid heap alloc in `detect_confuse_type`) - rust-lang/rust#145200 (mbe: Fix typo in attribute tracing) - rust-lang/rust#145222 (Fix typo with paren rustc_llvm/build.rs) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-10Rollup merge of #145064 - okaneco:saturating_sub_regression_tests, r=nikicJacob Pratt-0/+19
Add regression test for `saturating_sub` bounds check issue Add codegen test for issue where `valid_index.saturating_sub(X)` produced an extra bounds check. This was fixed by the LLVM upgrade. Closes rust-lang/rust#139759
2025-08-10Rollup merge of #144553 - Oneirical:uncountable-integer-4, r=jieyouxuJacob Pratt-54/+83
Rehome 32 `tests/ui/issues/` tests to other subdirectories under `tests/ui/` rust-lang/rust#143902 divided into smaller, easier to review chunks. Part of rust-lang/rust#133895 Methodology: 1. Refer to the previously written `tests/ui/SUMMARY.md` 2. Find an appropriate category for the test, using the original issue thread and the test contents. 3. Add the issue URL at the bottom (not at the top, as that would mess up stderr line numbers) 4. Rename the tests to make their purpose clearer Inspired by the methodology that `@Kivooeo` was using. r? `@jieyouxu`
2025-08-10Add support for method callsEsteban Küber-22/+684
2025-08-10Point at the `Fn()` or `FnMut()` bound that coerced a closure, which caused ↵Esteban Küber-21/+225
a move error When encountering a move error involving a closure because the captured value isn't `Copy`, and the obligation comes from a bound on a type parameter that requires `Fn` or `FnMut`, we point at it and explain that an `FnOnce` wouldn't cause the move error. ``` error[E0507]: cannot move out of `foo`, a captured variable in an `Fn` closure --> f111.rs:15:25 | 14 | fn do_stuff(foo: Option<Foo>) { | --- ----------- move occurs because `foo` has type `Option<Foo>`, which does not implement the `Copy` trait | | | captured outer variable 15 | require_fn_trait(|| async { | -- ^^^^^ `foo` is moved here | | | captured by this `Fn` closure 16 | if foo.map_or(false, |f| f.foo()) { | --- variable moved due to use in coroutine | help: `Fn` and `FnMut` closures require captured values to be able to be consumed multiple times, but an `FnOnce` consume them only once --> f111.rs:12:53 | 12 | fn require_fn_trait<F: Future<Output = ()>>(_: impl Fn() -> F) {} | ^^^^^^^^^ help: consider cloning the value if the performance cost is acceptable | 16 | if foo.clone().map_or(false, |f| f.foo()) { | ++++++++ ```
2025-08-10Detect struct construction with private field in field with defaultEsteban Küber-0/+144
When trying to construct a struct that has a public field of a private type, suggest using `..` if that field has a default value. ``` error[E0603]: struct `Priv1` is private --> $DIR/non-exhaustive-ctor.rs:25:39 | LL | let _ = S { field: (), field1: m::Priv1 {} }; | ------ ^^^^^ private struct | | | while setting this field | note: the struct `Priv1` is defined here --> $DIR/non-exhaustive-ctor.rs:14:4 | LL | struct Priv1 {} | ^^^^^^^^^^^^ help: the field `field1` you're trying to set has a default value, you can use `..` to use it | LL | let _ = S { field: (), .. }; | ~~ ```
2025-08-10Add a post-dist test for compiling a basic program with CraneliftJakub Beránek-0/+11
2025-08-10Auto merge of #144544 - JonathanBrouwer:illformed-in-deps, r=traviscrossbors-0/+176
Start reporting future breakage for `ILL_FORMED_ATTRIBUTE_INPUT` in dependencies This has been a warn lint since early 2019 and a deny-by-default lint since late 2019. We're currently transitioning some of the cases where this lint is being produced to a hard error (https://github.com/rust-lang/rust/pull/143607 https://github.com/rust-lang/rust/pull/143808 and more) So let's report this lint in all dependencies for the remaining attributes r? `@traviscross` `@rustbot` labels +I-lang-nominated +T-lang -T-compiler cc `@jdonszelmann` (Separate question: Why does the "Future incompatibility report" only trigger if `report_in_deps` is true, even if the future incompatibility happens in the same crate, is this correct?) This also needs a crater run, but I don't have permissions to trigger this
2025-08-10Rehome tests/ui/issues/ tests [4/?]Oneirical-54/+83
2025-08-10test: Add rustdoc test for enum negative overflowEval EXEC-0/+22
2025-08-10Auto merge of #145210 - Zalathar:rollup-dm4reb2, r=Zalatharbors-118/+937
Rollup of 17 pull requests Successful merges: - rust-lang/rust#141624 (unstable-book: Add stubs for environment variables; document some of the important ones) - rust-lang/rust#143093 (Simplify polonius location-sensitive analysis) - rust-lang/rust#144402 (Stabilize loongarch32 inline asm) - rust-lang/rust#144403 (`tests/ui/issues/`: The Issues Strike Back [4/N]) - rust-lang/rust#144739 (Use new public libtest `ERROR_EXIT_CODE` constant in rustdoc) - rust-lang/rust#145089 (Improve error output when a command fails in bootstrap) - rust-lang/rust#145112 ([win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC) - rust-lang/rust#145129 ([win][arm64ec] Add `/machine:arm64ec` when linking LLVM as Arm64EC) - rust-lang/rust#145130 (improve "Documentation problem" issue template.) - rust-lang/rust#145135 (Stabilize `duration_constructors_lite` feature) - rust-lang/rust#145145 (some `derive_more` refactors) - rust-lang/rust#145147 (rename `TraitRef::from_method` to `from_assoc`) - rust-lang/rust#145156 (Override custom Cargo `build-dir` in bootstrap) - rust-lang/rust#145160 (Change days-threshold to 28 in [behind-upstream]) - rust-lang/rust#145162 (`{BTree,Hash}Map`: add "`Entry` API" section heading) - rust-lang/rust#145187 (Fix an unstable feature comment that wasn't a doc comment) - rust-lang/rust#145191 (`suggest_borrow_generic_arg`: use the correct generic args) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-10strip prefix of temporary file names when it exceeds filesystem name length ↵Pierre Tardy-0/+39
limit When doing lto, rustc generates filenames that are concatenating many information. In the case of this testcase, it is concatenating crate name and rust file name, plus some hash, and the extension. In some other cases it will concatenate even more information reducing the maximum effective crate name to about 110 chars on linux filesystems where filename max length is 255 This commit is ensuring that the temporary file names are limited in size, while still reasonabily ensuring the unicity (with hashing of the stripped part)
2025-08-10fix: re-enable self-assignmentLee ByeongJun-10/+51
2025-08-10Ignore impl associated types in jump to def featureGuillaume Gomez-0/+20
2025-08-10add place mention for `#[loop_match]` scrutineeFolkert de Vries-0/+369
2025-08-10Fix panic if an item does not have a bodyGuillaume Gomez-0/+24
2025-08-10Better handling of paths in link to def featureGuillaume Gomez-18/+58
2025-08-10Add support for trait associated itemsGuillaume Gomez-0/+15
2025-08-10Rollup merge of #145191 - dianne:fix-borrow-suggestion-args, r=compiler-errorsStuart Cook-0/+31
`suggest_borrow_generic_arg`: use the correct generic args The suggestion now gets calls' generic arguments from the callee's type to handle cases where the callee isn't an identifier expression. Fixes rust-lang/rust#145164.
2025-08-10Rollup merge of #145112 - dpaoliello:raw-dylib-link-ordinal, r=jieyouxuStuart Cook-2/+3
[win][arm64ec] Partial fix for raw-dylib-link-ordinal on Arm64EC These are the test fixes required to get `raw-dylib-link-ordinal` working on Arm64EC. For the test to completely pass, we also need an updated `ar_archive_writer` with <https://github.com/rust-lang/ar_archive_writer/pull/24> merged in.
2025-08-10Rollup merge of #144403 - Kivooeo:issue4, r=jieyouxuStuart Cook-30/+154
`tests/ui/issues/`: The Issues Strike Back [4/N] Some `tests/ui/issues/` housekeeping, to trim down number of tests directly under `tests/ui/issues/`. Part of https://github.com/rust-lang/rust/issues/133895. r? ````````@jieyouxu````````
2025-08-10Rollup merge of #144402 - heiher:stabilize-loong32-asm, r=AmanieuStuart Cook-41/+157
Stabilize loongarch32 inline asm r? ````````@Amanieu````````
2025-08-10Rollup merge of #143093 - lqd:polonius-pre-alpha, r=jackh726Stuart Cook-45/+592
Simplify polonius location-sensitive analysis This PR reworks the location-sensitive analysis into what we think is a worthwhile subset of the datalog analysis. A sort of polonius alpha analysis that handles NLL problem case 3 and more, but is still using the faster "reachability as an approximation of liveness", as well as the same loans-in-scope computation as NLLs -- and thus doesn't handle full flow-sensitivity like the datalog implementation. In the last few months, we've identified this subset as being actionable: - we believe we can make a stabilizable version of this analysis - it is an improvement over the status quo - it can also be modeled in a-mir-formality, or some other formalism, for assurances about soundness, and I believe ````````@nikomatsakis```````` is interested in looking into this during H2. - and we've identified the areas of work we wish to explore later to gradually expand the supported cases: the differences between reachability and liveness, support of kills, and considerations of time-traveling, for example. The approach in this PR is to try less to have the graph only represent live paths, by checking whether we reach a live region during traversal and recording the loan as live there, instead of equating traversal with liveness like today because it has subtleties with the typeck edges in statements (that could forward loans to the successor point without ensuring their liveness). We can then also simplify these typeck stmt edges. And we also can simplify traversal by removing looking at kills, because that's enough to handle a bunch of NLL problem 3 cases -- and we can gradually support them more and more in traversal in the future, to reduce the approximation of liveness. There's still some in-progress pieces of work w/r/t opaque types that I'm expecting [lcnr's opaque types rework](https://github.com/rust-lang/rust/pull/139587), and [amanda's SCCs rework](https://github.com/rust-lang/rust/pull/130227) to handle. That didn't seem to show up in tests until I rebased today (and shows lack of test coverage once again) when https://github.com/rust-lang/rust/pull/142255 introduced a couple of test failures with the new captures rules from edition 2024. It's not unexpected since we know more work is needed with member constraints (and we're not even using SCCs in this prototype yet) I'll look into these anyways, both for future work, and checking how these other 2 PRs would change things. --- I'm not sure the following means a lot until we have some formalism in-place, but: - I've changed the polonius compare-mode to use this analysis: the tests pass with it, except 2 cases with minor diagnostics differences, and the 2 edition 2024 opaque types one I mentioned above and need to investigate - things that are expected to work still do work: it bootstraps, can run our rustc-perf benchmarks (and the results are not even that bad), and a crater run didn't find any regressions (forgetting that crater currently fails to test around a quarter of all crates 👼) - I've added tests with improvements, like the NLL problem case 3 and others, as well as some that behave the same as NLLs today and are thus worse than the datalog implementation r? ````````@jackh726```````` (no rush I know you're deep in phd work and "implmentating" the new trait solver for r-a :p <3) This also fixes rust-lang/rust#135646, a diagnostics ICE from the previous implementation.
2025-08-10Auto merge of #145144 - scottmcm:unsigned_overflow_intr, r=nikicbors-16/+22
Stop using uadd.with.overflow As discussed in [#t-compiler/llvm > &#96;uadd.with.overflow&#96; (again) @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/187780-t-compiler.2Fllvm/topic/.60uadd.2Ewith.2Eoverflow.60.20.28again.29/near/533041085), stop emitting `uadd.with.overflow` in favour of `add`+`icmp` instead. r? nikic
2025-08-10Start reporting future breakage for `ILL_FORMED_ATTRIBUTE_INPUT` in dependenciesJonathan Brouwer-0/+176
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-10Ignore coroutine witness type region args in auto trait confirmationMichael Goulet-0/+14
2025-08-09`suggest_borrow_generic_arg`: use the correct generic argsdianne-0/+31
2025-08-09Auto merge of #145146 - fee1-dead-contrib:push-zmqrkurlzrxy, r=nnethercotebors-13/+18
remove `P` Previous work: rust-lang/rust#141603 MCP: https://github.com/rust-lang/compiler-team/issues/878 cc `@nnethercote`
2025-08-09commentsKivooeo-30/+96
2025-08-09Auto merge of #145142 - Zalathar:rollup-oi6s8kg, r=Zalatharbors-64/+396
Rollup of 23 pull requests Successful merges: - rust-lang/rust#141658 (rustdoc search: prefer stable items in search results) - rust-lang/rust#141828 (Add diagnostic explaining STATUS_STACK_BUFFER_OVERRUN not only being used for stack buffer overruns if link.exe exits with that exit code) - rust-lang/rust#144823 (coverage: Extract HIR-related helper code out of the main module) - rust-lang/rust#144883 (Remove unneeded `drop_in_place` calls) - rust-lang/rust#144923 (Move several more float tests to floats/mod.rs) - rust-lang/rust#144988 (Add annotations to the graphviz region graph on region origins) - rust-lang/rust#145010 (Couple of minor abi handling cleanups) - rust-lang/rust#145017 (Explicitly disable vector feature on s390x baseline of bad-reg test) - rust-lang/rust#145027 (Optimize `char::is_alphanumeric`) - rust-lang/rust#145050 (add member constraints tests) - rust-lang/rust#145073 (update enzyme submodule to handle llvm 21) - rust-lang/rust#145080 (Escape diff strings in MIR dataflow graphviz) - rust-lang/rust#145082 (Fix some bad formatting in `-Zmacro-stats` output.) - rust-lang/rust#145083 (Fix cross-compilation of Cargo) - rust-lang/rust#145096 (Fix wasm target build with atomics feature) - rust-lang/rust#145097 (remove unnecessary `TypeFoldable` impls) - rust-lang/rust#145100 (Rank doc aliases lower than equivalently matched items) - rust-lang/rust#145103 (rustc_metadata: remove unused private trait impls) - rust-lang/rust#145115 (defer opaque type errors, generally greatly reduce tainting) - rust-lang/rust#145119 (rustc_public: fix missing parenthesis in pretty discriminant) - rust-lang/rust#145124 (Recover `for PAT = EXPR {}`) - rust-lang/rust#145132 (Refactor map_unit_fn lint) - rust-lang/rust#145134 (Reduce indirect assoc parent queries) r? `@ghost` `@rustbot` modify labels: rollup
2025-08-09remove `P`Deadbeef-13/+18
2025-08-09add `nonpoison::rwlock` implementationConnor Tsui-8/+8
Adds the equivalent `nonpoison` types to the `poison::rwlock` module. These types and implementations are gated under the `nonpoison_rwlock` feature gate. Also blesses the ui tests that now have a name conflicts (because these types no longer have unique names). The full path distinguishes the different types.
2025-08-09rustc_target: Add the `32s` target feature for LoongArchWANG Rui-0/+1
2025-08-08Stop using uadd.with.overflowScott McMurray-16/+22
2025-08-09Rollup merge of #145124 - compiler-errors:for-eq, r=lqdStuart Cook-15/+25
Recover `for PAT = EXPR {}` I type this constantly, and the existing suggestion to put `in` before the `=` is misleading.
2025-08-09Rollup merge of #145119 - makai410:pretty-fix, r=compiler-errorsStuart Cook-2/+2
rustc_public: fix missing parenthesis in pretty discriminant
2025-08-09Rollup merge of #145115 - lcnr:less-borrowck-tainting, r=compiler-errorsStuart Cook-37/+123
defer opaque type errors, generally greatly reduce tainting fixes the test for rust-lang/rust#135528, does not actually fix that issue properly. This is useful as it causes the migration to rust-lang/rust#139587 to be a lot easier.
2025-08-09Rollup merge of #145100 - GuillaumeGomez:rank-doc-alias-lower, r=lolbinarycatStuart Cook-0/+47
Rank doc aliases lower than equivalently matched items Follow-up of https://github.com/rust-lang/rust/pull/143988. cc `@lolbinarycat`
2025-08-09Rollup merge of #145082 - nnethercote:macro-stats-fix-widths, r=petrochenkovStuart Cook-5/+32
Fix some bad formatting in `-Zmacro-stats` output. r? `@petrochenkov`
2025-08-09Rollup merge of #145050 - lcnr:add-opaque-type-tests, r=lqdStuart Cook-1/+101
add member constraints tests taken from rust-lang/rust#139587.
2025-08-09Rollup merge of #145017 - pmur:murp/s390x-improve-asm-test, r=nnethercoteStuart Cook-1/+1
Explicitly disable vector feature on s390x baseline of bad-reg test If the baseline s390x cpu is changed to a newer variant, such as z13, the vector feature may be enabled by default. When rust is packaged on fedora 38 and newer, it is set to z13. Explicitly disable vector support on the baseline test for consistent results across s390x cpus.
2025-08-09Rollup merge of #144883 - scottmcm:remove-unneeded-drop_in_place, r=nnethercoteStuart Cook-0/+37
Remove unneeded `drop_in_place` calls Might as well pull this out from rust-lang/rust#144561 because this is still used in things like `Vec::truncate` where it'd be nice to allow it be removed if inlined enough to see that the type is `Copy`. So long as perf says it's ok, at least 🤞
2025-08-09Rollup merge of #141658 - lolbinarycat:rustdoc-search-stability-rank-138067, ↵Stuart Cook-3/+28
r=GuillaumeGomez rustdoc search: prefer stable items in search results fixes https://github.com/rust-lang/rust/issues/138067 this does add a new field to the search index, but since we're only listing unstable items instead of adding a boolean flag to every item, it should only increase the search index size of sysroot crates, since those are the only ones using the `staged_api` feature, at least as far as the rust project is concerned.