about summary refs log tree commit diff
path: root/tests/ui/generics
AgeCommit message (Collapse)AuthorLines
2025-07-13Auto merge of #143357 - cjgillot:no-assoc-item-kind, r=compiler-errorsbors-34/+34
Retire hir::*ItemRef. This information was kept for various places that iterate on HIR to know about trait-items and impl-items. This PR replaces them by uses of the `associated_items` query that contain pretty much the same information. This shortens many spans to just `def_span`, which can be easier to read.
2025-07-13Remove hir::AssocItemKind.Camille GILLOT-34/+34
2025-07-13cleaned up some testsKivooeo-11/+20
Additionally, remove unused `tests/ui/auxiliary/svh-*` crates that are duplicates of `tests/ui/svh/auxiliary/svh-*`.
2025-07-13moved testsKivooeo-0/+35
2025-07-04Rollup merge of #143300 - Kivooeo:tf25, r=tgross35Jubilee-0/+46
`tests/ui`: A New Order [25/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-04Rollup merge of #143202 - Kivooeo:tf18, r=tgross35Jubilee-0/+37
`tests/ui`: A New Order [18/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-05cleaned up some testsKivooeo-7/+9
2025-07-01Rollup merge of #143210 - Kivooeo:tf19, r=tgross35Guillaume Gomez-0/+32
`tests/ui`: A New Order [19/N] > [!NOTE] > > Intermediate commits are intended to help review, but will be squashed prior to merge. Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@tgross35`
2025-07-01moved testsKivooeo-0/+44
2025-07-01cleaned up some testsKivooeo-13/+18
2025-07-01moved test filesKivooeo-0/+32
2025-06-30cleaned up some testsKivooeo-17/+22
2025-06-29moved & deleted some testsKivooeo-0/+27
2025-06-29Rollup merge of #142417 - Kivooeo:tf12, r=jieyouxuGuillaume Gomez-0/+47
`tests/ui`: A New Order [12/N] Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895. r? `@jieyouxu`
2025-06-28cleaned up some testsKivooeo-0/+47
2025-06-27Report infer ty errors during hir ty loweringOli Scherer-6/+0
This centralizes the placeholder type error reporting in one location, but it also exposes the granularity at which we convert things from hir to ty more. E.g. previously infer types in where bounds were errored together with the function signature, but now they are independent.
2025-06-26Rollup merge of #142981 - compiler-errors:verbose-missing-suggestion, r=estebankMatthias Krüger-6/+12
Make missing lifetime suggestion verbose I keep seeing this suggestion when working on rustc, and it's annoying that it's inline. Part of https://github.com/rust-lang/rust/issues/141973. Feel free to close this if there's another PR already doing this. r? ``@estebank``
2025-06-25Rollup merge of #142200 - Kivooeo:tf8, r=jieyouxuJana Dönszelmann-0/+50
`tests/ui`: A New Order [8/N] Some `tests/ui/` housekeeping, to trim down number of tests directly under `tests/ui/`. Part of rust-lang/rust#133895.
2025-06-24Make missing lifetime suggestion verboseMichael Goulet-6/+12
2025-06-23cleaned up some testsKivooeo-0/+50
2025-06-11cleaned up some testsKivooeo-0/+37
2025-06-05Auto merge of #138677 - shepmaster:consistent-elided-lifetime-syntax, ↵bors-4/+4
r=traviscross,jieyouxu Add a new `mismatched-lifetime-syntaxes` lint The lang-team [discussed this](https://hackmd.io/nf4ZUYd7Rp6rq-1svJZSaQ) and I attempted to [summarize](https://github.com/rust-lang/rust/pull/120808#issuecomment-2701863833) their decision. The summary-of-the-summary is: - Using two different kinds of syntax for elided lifetimes is confusing. In rare cases, it may even [lead to unsound code](https://github.com/rust-lang/rust/issues/48686)! Some examples: ```rust // Lint will warn about these fn(v: ContainsLifetime) -> ContainsLifetime<'_>; fn(&'static u8) -> &u8; ``` - Matching up references with no lifetime syntax, references with anonymous lifetime syntax, and paths with anonymous lifetime syntax is an exception to the simplest possible rule: ```rust // Lint will not warn about these fn(&u8) -> &'_ u8; fn(&'_ u8) -> &u8; fn(&u8) -> ContainsLifetime<'_>; ``` - Having a lint for consistent syntax of elided lifetimes will make the [future goal](https://github.com/rust-lang/rust/issues/91639) of warning-by-default for paths participating in elision much simpler. --- This new lint attempts to accomplish the goal of enforcing consistent syntax. In the process, it supersedes and replaces the existing `elided-named-lifetimes` lint, which means it starts out life as warn-by-default.
2025-06-04Replace `elided_named_lifetimes` with `mismatched_lifetime_syntaxes`Jake Goulding-4/+4
2025-06-02Clarify why we are talking about a failed const eval at a random placeOli Scherer-2/+2
2025-06-02Use the informative error as the main const eval error messageOli Scherer-9/+8
2025-05-10Warn when #[export_name] is used with generic functionsMu001999-0/+460
2025-04-30compiletest: Make diagnostic kind mandatory on line annotationsVadim Petrochenkov-28/+30
2025-04-24Revert overzealous parse recovery for single colonsLeón Orell Valerian Liehr-1/+3
2025-04-16Remove old diagnostic notes for type ascription syntaxZalathar-1/+0
Type ascription syntax was removed in 2023.
2025-03-14Do not suggest using `-Zmacro-backtrace` for builtin macrosEsteban Küber-4/+0
For macros that are implemented on the compiler, we do *not* mention the `-Zmacro-backtrace` flag. This includes `derive`s and standard macros.
2025-03-12Disentangle ForwardGenericParamBan and ConstParamTy ribsMichael Goulet-12/+12
2025-02-28Shorten span of panic failures in const contextEsteban Küber-4/+4
Previously, we included a redundant prefix on the panic message and a postfix of the location of the panic. The prefix didn't carry any additional information beyond "something failed", and the location of the panic is redundant with the diagnostic's span, which gets printed out even if its code is not shown. ``` error[E0080]: evaluation of constant value failed --> $DIR/assert-type-intrinsics.rs:11:9 | LL | MaybeUninit::<!>::uninit().assume_init(); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ evaluation panicked: aborted execution: attempted to instantiate uninhabited type `!` ``` ``` error[E0080]: evaluation of `Fail::<i32>::C` failed --> $DIR/collect-in-dead-closure.rs:9:19 | LL | const C: () = panic!(); | ^^^^^^^^ evaluation panicked: explicit panic | = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` ``` error[E0080]: evaluation of constant value failed --> $DIR/uninhabited.rs:41:9 | LL | assert!(false); | ^^^^^^^^^^^^^^ evaluation panicked: assertion failed: false | = note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- When the primary span for a const error is the same as the first frame in the const error report, skip it. ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ evaluation panicked: explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ the failure occurred here = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ explicit panic | note: inside `f::<{closure@$DIR/issue-88434-removal-index-should-be-less.rs:3:31: 3:34}>` --> $DIR/issue-88434-removal-index-should-be-less.rs:10:5 | LL | panic!() | ^^^^^^^^ note: inside `_CONST` --> $DIR/issue-88434-removal-index-should-be-less.rs:3:24 | LL | const _CONST: &[u8] = &f(&[], |_| {}); | ^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` --- Revert order of constant evaluation errors Point at the code the user wrote first and std functions last. ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ evaluation panicked: Some error occurred | note: called from `my_fn` --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ``` instead of ``` error[E0080]: evaluation of constant value failed --> $DIR/const-errs-dont-conflict-103369.rs:10:5 | LL | panic!("Some error occurred"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Some error occurred | note: called from `<() as ConstGenericTrait<{my_fn(1)}>>::{constant#0}` --> $DIR/const-errs-dont-conflict-103369.rs:5:25 | LL | impl ConstGenericTrait<{my_fn(1)}> for () {} | ^^^^^^^^ = note: this error originates in the macro `$crate::panic::panic_2015` which comes from the expansion of the macro `panic` (in Nightly builds, run with -Z macro-backtrace for more info) ```
2025-02-15Try to recover from path sep error in parseryukang-3/+1
2025-02-10Show diff suggestion format on verbose replacementEsteban Küber-6/+9
``` error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields --> $DIR/attempted-access-non-fatal.rs:7:15 | LL | let _ = 2.l; | ^ | help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix | LL - let _ = 2.l; LL + let _ = 2.0f64; | ```
2025-02-06Remove some unnecessary parens in `assert!` conditionsEsteban Küber-1/+1
While working on #122661, some of these started triggering our "unnecessary parens" lints due to a change in the `assert!` desugaring. A cursory search identified a few more. Some of these have been carried from before 1.0, were a bulk rename from the previous name of `assert!` left them in that state. I went and removed as many of these unnecessary parens as possible in order to have fewer annoyances in the future if we make the lint smarter.
2025-01-23Bless and add testsBoxy-5/+0
2024-12-13Use a more precise span in placeholder_type_error_diagArthur Carcano-0/+60
Closes: https://github.com/rust-lang/rust/issues/123861
2024-11-26tests: remove `//@ pretty-expanded` usages许杰友 Jieyou Xu (Joe)-9/+0
Done with ```bash sd '//@ pretty-expanded.*\n' '' tests/ui/**/*.rs ``` and ``` sd '//@pretty-expanded.*\n' '' tests/ui/**/*.rs ```
2024-11-20Store resolution for self and crate root module segmentsMichael Goulet-0/+50
2024-08-31elided_named_lifetimes: bless & add testsPavel Grigorenko-2/+2
2024-07-22Revert suggestion verbosity changeEsteban Küber-238/+117
2024-07-22On generic and lifetime removal suggestion, do not leave behind stray `,`Esteban Küber-26/+26
2024-07-22Change suggestion message wordingEsteban Küber-50/+50
2024-07-22Use verbose suggestion for "wrong # of generics"Esteban Küber-117/+238
2024-07-18More accurate span for type parameter suggestionEsteban Küber-12/+18
After: ``` error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 | LL | impl Foo<T: Default> for String {} | ^^^^^^^^^^ associated item constraint not allowed here | help: declare the type parameter right after the `impl` keyword | LL - impl Foo<T: Default> for String {} LL + impl<T: Default> Foo<T> for String {} | ``` Before: ``` error[E0229]: associated item constraints are not allowed here --> $DIR/impl-block-params-declared-in-wrong-spot-issue-113073.rs:3:10 | LL | impl Foo<T: Default> for String {} | ^^^^^^^^^^ associated item constraint not allowed here | help: declare the type parameter right after the `impl` keyword | LL | impl<T: Default> Foo<T> for String {} | ++++++++++++ ~ ```
2024-07-12Use more accurate span for `:` to `::` suggestionEsteban Küber-1/+1
2024-07-12Make parse error suggestions verbose and fix spansEsteban Küber-7/+17
Go over all structured parser suggestions and make them verbose style. When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
2024-07-09Automatically taint when reporting errors from ItemCtxtOli Scherer-10/+2
2024-06-26Automatically taint InferCtxt when errors are emittedOli Scherer-2/+10
2024-06-05Update TestsVeera-0/+129