about summary refs log tree commit diff
path: root/tests/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2025-05-16Rollup merge of #140834 - lcnr:apit-folder, r=compiler-errorsMatthias Krüger-89/+0
move (or remove) some impl Trait tests Probably not actually worth the effort, so I am stopping here :sweat_smile:
2025-05-09Merge typeck loop with static/const item eval loopOli Scherer-8/+8
2025-05-09move (and remove) impl Trait testslcnr-89/+0
2025-05-05Auto merge of #140453 - Zoxc:next-disambiguator, r=oli-obkbors-12/+12
Remove global `next_disambiguator` state and handle it with a `DisambiguatorState` type This removes `Definitions.next_disambiguator` as it doesn't guarantee deterministic def paths when `create_def` is called in parallel. Instead a new `DisambiguatorState` type is passed as a mutable reference to `create_def` to help create unique def paths. `create_def` calls with distinct `DisambiguatorState` instances must ensure that that the def paths are unique without its help. Anon associated types did rely on this global state for uniqueness and are changed to use (method they're defined in + their position in the method return type) as the `DefPathData` to ensure uniqueness. This also means that the method they're defined in appears in error messages, which is nicer. `DefPathData::NestedStatic` is added to use for nested data inside statics instead of reusing `DefPathData::AnonConst` to avoid conflicts with those. cc `@oli-obk`
2025-05-04compiletest: Support matching on non-json lines in compiler outputVadim Petrochenkov-4/+5
and migrate most of remaining `error-pattern`s to it.
2025-05-03Rollup merge of #140568 - moxian:reg-140545, r=compiler-errorsMatthias Krüger-0/+29
Add regression test for #140545 Closes #140545 I am not very knowledgable about the typesystem internals, so I couldn't come up with a good name for the test. But I'm happy to move it to a more appropriate place if there is one (`tests/ui/impl-trait/non-defining-uses` maybe?) r? types (or reroll as appropriate if this is not actually a T-types issue; i'm clueless)
2025-05-02Add a regression testmoxian-0/+29
for #140545
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-49/+55
2025-04-29Remove global `next_disambiguator` state and handle it with a ↵John Kåre Alsaker-12/+12
`DisambiguatorState` type
2025-04-28Do not compute type_of for impl item if impl where clauses are unsatisfiedMichael Goulet-0/+32
2025-04-25Don't use item name to look up associated item from trait itemMichael Goulet-0/+49
2025-04-20Don't compute name of associated item if it's an RPITITMichael Goulet-0/+62
2025-04-17Rollup merge of #139854 - fmease:modern-diag-for-lt-in-ty, r=davidtwcoMatthias Krüger-6/+8
Improve parse errors for stray lifetimes in type position While technically & syntactically speaking lifetimes do begin[^1] types in type contexts (this essentially excludes generic argument lists) and require a following `+` to form a complete type (`'a +` denotes a bare trait object type), the likelihood that a user meant to write a lifetime-prefixed bare trait object type in *modern* editions (Rust ≥2021) when placing a lifetime into a type context is incredibly low (they would need to add at least three tokens to turn it into a *semantically* well-formed TOT: `'a` → `dyn 'a + Trait`). Therefore let's *lie* in modern editions (just like in PR https://github.com/rust-lang/rust/pull/131239, a precedent if you will) by stating "*expected type, found lifetime*" in such cases which is a lot more a approachable, digestible and friendly compared to "*lifetime in trait object type must be followed by `+`*" (as added in PR https://github.com/rust-lang/rust/pull/69760). I've also added recovery for "ampersand-less" reference types (e.g., `'a ()`, `'a mut Ty`) in modern editions because it was trivial to do and I think it's not unlikely to occur in practice. Fixes #133413. [^1]: For example, in the context of decl macros, this implies that a lone `'a` always matches syntax fragment `ty` ("even if" there's a later macro matcher expecting syntax fragment `lifetime`). Rephrased, lifetimes (in type contexts) *commit* to the type parser.
2025-04-15Don't compute name of associated item if it's an RPITITMichael Goulet-0/+21
2025-04-15Improve diagnostic for E0178 (bad `+` in type)León Orell Valerian Liehr-6/+8
Namely, use a more sensical primary span. Don't pretty-print AST nodes for the diagnostic message. Why: * It's lossy (e.g., it doesn't replicate trailing `+`s in trait objects. * It's prone to leak error nodes (printed as `(/*ERROR*/)`) since the LHS can easily represent recovered code (e.g., `fn(i32?) + T`).
2025-04-14add RPITIT tests: method compat auto trait leakagelcnr-0/+224
2025-04-14move testslcnr-0/+0
2025-04-14do not leak auto traits in item boundslcnr-0/+36
2025-04-11Rollup merge of #139662 - nnethercote:tweak-DefPathData, r=compiler-errorsJacob Pratt-6/+6
Tweak `DefPathData` Some improvements in and around `DefPathData`, following on from #137977. r? `@spastorino`
2025-04-11Auto merge of #139578 - ferrocene:pa-compiletest-edition, r=jieyouxubors-1/+1
Fix breakage when running compiletest with `--test-args=--edition=2015` Compiletest has an `--edition` flag to change the default edition tests are run with. Unfortunately no test suite successfully executes when that flag is passed. If the edition is set to something greater than 2015 the breakage is expected, since the test suite currently supports only edition 2015 (Ferrous Systems will open an MCP about fixing that soonish). Surprisingly, the test suite is also broken if `--edition=2015` is passed to compiletest. This PR focuses on fixing the latter. This PR fixes the two categories of failures happening when `--edition=2015` is passed: * Some edition-specific tests set their edition through `//@ compile-flags` instead of `//@ edition`. Compiletest doesn't parse the compile flags, so it would see no `//@ edition` and add another `--edition` flag, leading to a rustc error. * Compiletest would add the edition after `//@ compile-flags`, while some tests depend on flags passed to `//@ compile-flags` being the last flags in the rustc invocation. Note that for the first category, I opted to manually go and replace all `//@ compile-flags` setting an edition with an explicit `//@ edition`. We could've changed compiletest to instead check whether an edition was set in `//@ compile-flags`, but I thought it was better to enforce a consistent way to set the edition in tests. I also added the edition to the stamp, so that changing `--edition` results in tests being re-executed. r? `@jieyouxu`
2025-04-11Change how anonymous associated types are printed.Nicholas Nethercote-6/+6
Give them their own symbol `anon_assoc`, as is done for all the other anonymous `DefPathData` variants.
2025-04-11Improve `AssocItem::descr`.Nicholas Nethercote-6/+6
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-10replace `//@ compile-flags: --edition` with `//@ edition`Pietro Albini-1/+1
2025-04-09Auto merge of #139555 - petrochenkov:errkind-ann, r=jieyouxubors-35/+35
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-08UI tests: add missing diagnostic kinds where possibleVadim Petrochenkov-35/+35
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-07Fix stack overflow in exhaustiveness due to recursive HIR opaque type valuesMichael Goulet-0/+189
2025-04-07compiletest: Stricter parsing for diagnostic kindsVadim Petrochenkov-4/+4
2025-04-03add `TypingMode::Borrowck`lcnr-141/+153
2025-03-28Rollup merge of #139063 - fmease:fix-tait-atpit-gating, r=oli-obkMatthias Krüger-1/+39
Fix TAIT & ATPIT feature gating in the presence of anon consts Fixes #139055 (https://github.com/rust-lang/rust/issues/119924#issuecomment-1928659690). r? oli-obk or anybody else
2025-03-28Fix TAIT & ATPIT feature gating in the presence of anon constsLeón Orell Valerian Liehr-1/+39
2025-03-25Rollup merge of #138911 - compiler-errors:define-opaque, r=oli-obkJacob Pratt-0/+42
Allow defining opaques in statics and consts r? oli-obk Fixes https://github.com/rust-lang/rust/issues/138902
2025-03-25Test define opaques in extern itemsMichael Goulet-0/+30
2025-03-25Allow defining opaques in statics and constsMichael Goulet-0/+12
2025-03-23Stabilize precise_capturing_in_traitsMichael Goulet-37/+20
2025-03-19merge opaque types of nested bodieslcnr-39/+6
2025-03-11Implement `#[define_opaque]` attribute for functions.Oli Scherer-254/+360
2025-03-05Rollup merge of #137728 - Darksonn:no-tuple-unsize, r=oli-obk许杰友 Jieyou Xu (Joe)-15/+0
Remove unsizing coercions for tuples See https://github.com/rust-lang/rust/issues/42877#issuecomment-2686010847 and below comments for justification. Tracking issue: #42877 Fixes: #135217
2025-03-03Do not recover missing lifetime with random in-scope lifetimeMichael Goulet-48/+11
2025-02-27Delete tuple unsizingAlice Ryhl-15/+0
2025-02-27Rollup merge of #137304 - pitaj:rangebounds-is_empty-intersect, r=ibraheemdevMatthias Krüger-1/+2
add `IntoBounds::intersect` and `RangeBounds::is_empty` - ACP: https://github.com/rust-lang/libs-team/issues/539 - Tracking issue for `is_empty`: #137300 - Tracking issue for `IntoBounds`: #136903
2025-02-22Auto merge of #137406 - matthiaskrgr:rollup-9nknrsb, r=matthiaskrgrbors-51/+19
Rollup of 8 pull requests Successful merges: - #136458 (Do not deduplicate list of associated types provided by dyn principal) - #136474 ([`compiletest`-related cleanups 3/7] Make the distinction between sources root vs test suite sources root in compiletest less confusing) - #136592 (Make sure we don't overrun the stack in canonicalizer) - #136787 (Remove `lifetime_capture_rules_2024` feature) - #137207 (Add #[track_caller] to Duration Div impl) - #137245 (Tweak E0277 when predicate comes indirectly from ?) - #137257 (Ignore fake borrows for packed field check) - #137399 (fix ICE in layout computation with unnormalizable const) r? `@ghost` `@rustbot` modify labels: rollup
2025-02-22Rollup merge of #136787 - compiler-errors:lt2024feat, r=oli-obkMatthias Krüger-51/+19
Remove `lifetime_capture_rules_2024` feature Just use edition 2024 instead
2025-02-21More sophisticated span trimmingMichael Goulet-18/+12
2025-02-19add `IntoBounds::intersect` and `RangeBounds::is_empty`Peter Jaszkowiak-1/+2
2025-02-17Deeply normalize associated type bounds before proving themMichael Goulet-0/+6
2025-02-14Rollup merge of #136971 - HypheX:patch1, r=WaffleLapkinJubilee-0/+37
Add a new check-pass UI test for returning `impl Fn(T) -> impl Trait` This PR closes #107883 by adding a ui test.
2025-02-14Add new ui test for returning an Fn trait that returns impl TraitXelph-0/+37
Change description from compiletest to regression test Co-authored-by: 许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com> Improve test name, location, and description Update tests/ui/impl-trait/impl-fn-rpit-opaque-107883.rs Co-authored-by: waffle <waffle.lapkin@gmail.com>
2025-02-14Trim suggestion parts to the subset that is purely additiveMichael Goulet-6/+6
2025-02-14Use underline suggestions for purely 'additive' replacementsMichael Goulet-18/+12