about summary refs log tree commit diff
path: root/tests
AgeCommit message (Collapse)AuthorLines
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 #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-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-09Rollup merge of #139364 - Kohei316:feat/doc-hidden-suggestion, r=nnethercoteMatthias Krüger-0/+45
Make the compiler suggest actual paths instead of visible paths if the visible paths are through any doc hidden path. close #127011 Currently, when emitting a diagnostic about a valid trait, the compiler suggestes using visible paths of the trait even if they are through a doc hidden path. This PR updates the compiler to suggest actual paths in these cases.
2025-04-09Rollup merge of #138869 - ChrisDenton:command-curdir, r=tgross35Matthias Krüger-0/+36
Try not to use verbatim paths in `Command::current_dir` If possible, we should try not to use verbatim paths in `Command::current_dir`. It might work but it might also break code in the subprocess that assume the current directory isn't verbatim (including Windows APIs). cc ``@ehuss`` Side note: we now have a lot of ad-hoc fixes like this spread about the place. It'd be good to make a proper `WindowsPath` type that handles all this in one place. But that's a bigger job for another PR.
2025-04-09Speed up `String::push` and `String::insert`lincot-0/+11
Improve performance of `String` methods by avoiding unnecessary memcpy for the character bytes, with added codegen check to ensure compliance.
2025-04-09Auto merge of #139327 - cjgillot:gvn-place, r=oli-obkbors-28/+159
Allow GVN to produce places and not just locals. That may be too big of a hammer, as we may introduce new deref projections (possible UB footgun + probably not good for perf). The second commit opts out of introducing projections that don't have a stable offset, which is probably what we want. Hence no new Deref and no new Index projections. Fixes https://github.com/rust-lang/rust/issues/138936 cc `@scottmcm` `@dianqk`
2025-04-09Remove some dead or leftover code related to rustc-intrinsic abi removalOli Scherer-23/+0
2025-04-09Migrate some tests to `dont-require-annotations`Vadim Petrochenkov-16/+16
2025-04-09Auto merge of #139552 - matthiaskrgr:rollup-b194mk8, r=matthiaskrgrbors-12/+30
Rollup of 10 pull requests Successful merges: - #139494 (Restrict some queries by def-kind more) - #139496 (Revert r-a changes of rust-lang/rust#139455) - #139506 (add missing word in doc comment (part 2)) - #139515 (Improve presentation of closure signature mismatch from `Fn` trait goal) - #139520 (compiletest maintenance: sort deps and drop dep on `anyhow`) - #139523 (Rustc dev guide subtree update) - #139526 (Fix deprecation note for std::intrinsics) - #139528 (compiletest: Remove the `--logfile` flag) - #139541 (Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations) - #139547 (Update library tracking issue template to set S-tracking-unimplemented) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-09Auto merge of #139555 - petrochenkov:errkind-ann, r=jieyouxubors-928/+930
UI tests: add missing diagnostic kinds where possible The subset of https://github.com/rust-lang/rust/pull/139427 that only adds diagnostic kinds to line annotations, without changing any other things in annotations or compiletest. After this only non-viral `NOTE`s and `HELP`s should be missing. r? `@jieyouxu`
2025-04-08Auto merge of #139536 - matthiaskrgr:rollup-j6goald, r=matthiaskrgrbors-57/+259
Rollup of 7 pull requests Successful merges: - #139476 (rm `RegionInferenceContext::var_infos`) - #139485 (compiletest: Stricter parsing for diagnostic kinds) - #139491 (Update books) - #139500 (document panic behavior of Vec::resize and Vec::resize_with) - #139501 (Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types) - #139504 (add missing word in doc comment) - #139509 (clean: remove Deref<Target=RegionKind> impl for Region and use `.kind()`) r? `@ghost` `@rustbot` modify labels: rollup
2025-04-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-928/+930
2025-04-08Rollup merge of #139541 - compiler-errors:transmute, r=lcnrMatthias Krüger-0/+18
Instantiate higher-ranked transmute goal w/ placeholders before emitting sub-obligations This avoids an ICE where we weren't keeping track of bound variables correctly in the `Freeze` obligations we emit for transmute goals. We could use `rebind` instead on that goal, but I think it's better just to instantiate the binder. Fixes #139538 r? `@lcnr` or reassign
2025-04-08Rollup merge of #139515 - compiler-errors:sig-mismatch, r=lcnrMatthias Krüger-12/+12
Improve presentation of closure signature mismatch from `Fn` trait goal Flip the order of "expected" and "found" since that wasn't correct. Don't present the arguments as a tuple, since it leaves a trailing comma. Instead, just use `fn(arg, arg)`. Finally, be better with binders since we were just skipping binders. r? oli-obk or reassign
2025-04-08report call site of inlined scopes for large assignment lintsJonathan Gruner-0/+39
2025-04-08Add spawn thread testSantiago Pastorino-0/+78
2025-04-08Instantiate higher-ranked transmute goalMichael Goulet-0/+18
2025-04-08Test interaction between RFC 2229 migration and use closuresSantiago Pastorino-0/+78
2025-04-08Add multiple closure use variantsSantiago Pastorino-0/+48
2025-04-08Add .use block testSantiago Pastorino-0/+11
2025-04-08Rollup merge of #139501 - compiler-errors:suppress-stack-overflow, r=lcnrMatthias Krüger-0/+189
Fix stack overflow in exhaustiveness due to recursive HIR opaque hidden types This fixes several spicy non-trivial recursive opaque definitions inferred from HIR typeck, ensuring that they don't cause stack overflows in exhaustiveness code, which currently reveals opaques manually in a way that is not overflow aware (as opposed to something like the normalizer folders). These should eventually be outright rejected, but today (some) non-trivial recursive opaque definitions are accepted, and changing that requires an FCP, so for now just make sure we don't stack overflow :^) Fixes https://github.com/rust-lang/rust/issues/139402 r? lcnr
2025-04-08Rollup merge of #139485 - petrochenkov:errkind-light, r=oli-obk,jieyouxuMatthias Krüger-57/+70
compiletest: Stricter parsing for diagnostic kinds Non-controversial parts of https://github.com/rust-lang/rust/pull/139427 not requiring many changes in the test suite. r? ``@jieyouxu``
2025-04-08Auto merge of #138499 - lcnr:borrowck-typeck_root, r=oli-obkbors-26/+92
borrowck typeck children together with their root This introduces new cycle errors, even with `feature(inline_const_pat)` removed, see the `non-structural-match-types-cycle-err.rs` test. The new cycle error happens as the layout of `async`-blocks relies on their `optimized_mir`. As that now depends on `mir_borrowck` of its typeck parent, computing the layout of an `async`-block during MIR building, e.g. when evaluating a named `const` pattern. I think there's currently no way to have a named const pattern whose type references an async block while being allowed? cc `@oli-obk` `@RalfJung` I cannot think of other cases where we currently rely on the MIR of a typeck children while borrowchecking their parent. The crater run came back without any breakage. My work here will prevent any future features which rely on this as we'll get locked into borrowchecking them together as I continue to work on https://github.com/rust-lang/types-team/issues/129, cc `@rust-lang/types.` r? compiler-errors
2025-04-08compiletest: Trim whitespace from environment variable namesZalathar-0/+23
2025-04-08Rollup merge of #139464 - nnethercote:fix-139248-AND-fix-139445, r=petrochenkovStuart Cook-0/+77
Allow for reparsing failure when reparsing a pasted metavar. Fix some metavar reparsing issues. Fixes #139248 and #139445. r? `@petrochenkov`
2025-04-08Rollup merge of #139421 - compiler-errors:upcast-no-principal-with-proj, ↵Stuart Cook-0/+13
r=oli-obk Fix trait upcasting to dyn type with no principal when there are projections #126660 (which I had originally authored, lol) had a subtle bug that is the moral equivalent of #114036, which is that when upcasting from `dyn Principal<Projection = Ty> + AutoTrait` to `dyn AutoTrait`, we were dropping the trait ref for `Principal` but not its projections (if there were any). With debug assertions enabled, this triggers the assertion I luckily added in a2a0cfe82563146325674b8d437f9f9f6e703703, but even without debug assertions this is a logical bug since we had a dyn type with just a projection bound but no principal, so it caused a type mismatch. This does not need an FCP because this should've been covered by the FCP in #126660, but we just weren't testing a case when casting from a `dyn` type with projections 😸 Fixes #139418 r? ````@oli-obk```` (or anyone)
2025-04-08Rollup merge of #139346 - ↵Stuart Cook-0/+83
compiler-errors:non-lifetime-binder-diag-hir-wf-check, r=oli-obk Don't construct preds w escaping bound vars in `diagnostic_hir_wf_check` See comment inline. Fixes #139330 r? oli-obk
2025-04-08Rollup merge of #139124 - xtexx:gh-139082, r=compiler-errorsStuart Cook-0/+21
compiler: report error when trait object type param reference self Fixes #139082. Emits an error when `Self` is found in the projection bounds of a trait object. In type aliases, `Self` has no meaning, so `type A = &'static dyn B` where `trait B = Fn() -> Self` will expands to `type A = &'static Fn() -> Self` which is illegal, causing the region solver to bail out when hitting the uninferred Self. r? ````@compiler-errors```` ````@fee1-dead````
2025-04-08Rollup merge of #139098 - scottmcm:assert-impossible-tags, r=WaffleLapkinStuart Cook-19/+456
Tell LLVM about impossible niche tags I was trying to find a better way of emitting discriminant calculations, but sadly had no luck. So here's a fairly small PR with the bits that did seem worth bothering: 1. As the [`TagEncoding::Niche` docs](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_abi/enum.TagEncoding.html#variant.Niche) describe, it's possible to end up with a dead value in the input that's not already communicated via the range parameter attribute nor the range load metadata attribute. So this adds an `llvm.assume` in non-debug mode to tell LLVM about that. (That way it can tell that the sides of the `select` have disjoint possible values.) 2. I'd written a bunch more tests, or at least made them parameterized, in the process of trying things out, so this checks in those tests to hopefully help future people not trip on the same weird edge cases, like when the tag type is `i8` but yet there's still a variant index and discriminant of `258` which doesn't fit in that tag type because the enum is really weird.
2025-04-08Rollup merge of #139024 - compiler-errors:tweak-default-value-err, r=lcnrStuart Cook-12/+19
Make error message for missing fields with `..` and without `..` more consistent When `..` is not present, we say "missing field `bar` in initializer", but when it is present we say "missing mandatory field `bar`". I don't see why the primary error message should change, b/c the root cause is the same. Let's harmonize these error messages and instead use a label to explain that `..` is required b/c it's not defaulted. r? estebank
2025-04-08Rollup merge of #138676 - compiler-errors:overflow-implied-bounds, r=lcnrStuart Cook-0/+19
Implement overflow for infinite implied lifetime bounds Not a great error message, but better than a hang Fixes #138665 Fixes #102966 Fixes #115407 r? lcnr
2025-04-08Improve presentation of closure signature mismatch from Fn trait goalMichael Goulet-12/+12
2025-04-08Allow for reparsing failure when reparsing a pasted metavar.Nicholas Nethercote-0/+30
Fixes #139445. The additional errors aren't great but the first one is still good and it's the most important, and imperfect errors are better than ICEing.
2025-04-08Allow for missing invisible close delim when reparsing an expression.Nicholas Nethercote-0/+47
This can happen when invalid syntax is passed to a declarative macro. We shouldn't be too strict about the token stream position once the parser has rejected the invalid syntax. Fixes #139248.
2025-04-07Address PR feedbackScott McMurray-0/+16