about summary refs log tree commit diff
path: root/tests/ui/const-generics/issues
AgeCommit message (Collapse)AuthorLines
2023-11-30generic_const_exprs: suggest to add the feature, not use itRalf Jung-10/+10
2023-11-24Show number in error message even for one errorNilstrieb-44/+44
Co-authored-by: Adrian <adrian.iosdev@gmail.com>
2023-10-18Tweak wording of type errors involving type paramsEsteban Küber-1/+1
Fix #78206.
2023-10-16Normalize alloc-id in tests.Camille GILLOT-1/+1
2023-10-06Auto merge of #114811 - estebank:impl-ambiguity, r=wesleywiserbors-3/+12
Show more information when multiple `impl`s apply - When there are `impl`s without type params, show only those (to avoid showing overly generic `impl`s). ``` error[E0283]: type annotations needed --> $DIR/multiple-impl-apply.rs:34:9 | LL | let y = x.into(); | ^ ---- type must be known at this point | note: multiple `impl`s satisfying `_: From<Baz>` found --> $DIR/multiple-impl-apply.rs:14:1 | LL | impl From<Baz> for Bar { | ^^^^^^^^^^^^^^^^^^^^^^ ... LL | impl From<Baz> for Foo { | ^^^^^^^^^^^^^^^^^^^^^^ = note: required for `Baz` to implement `Into<_>` help: consider giving `y` an explicit type | LL | let y: /* Type */ = x.into(); | ++++++++++++ ``` - Lower the importance of `T: Sized`, `T: WellFormed` and coercion errors, to prioritize more relevant errors. The pre-existing deduplication logic deals with hiding redundant errors better that way, and we show errors with more metadata that is useful to the user. - Show `<SelfTy as Trait>::assoc_fn` suggestion in more cases. ``` error[E0790]: cannot call associated function on trait without specifying the corresponding `impl` type --> $DIR/cross-return-site-inference.rs:38:16 | LL | return Err(From::from("foo")); | ^^^^^^^^^^ cannot call associated function of trait | help: use a fully-qualified path to a specific available implementation | LL | return Err(</* self type */ as From>::from("foo")); | +++++++++++++++++++ + ``` Fix #88284.
2023-10-05Add a note to duplicate diagnosticsAlex Macleod-0/+4
2023-10-04Reorder fullfillment errors to keep more interesting ones firstEsteban Küber-3/+12
In `report_fullfillment_errors` push back `T: Sized`, `T: WellFormed` and coercion errors to the end of the list. The pre-existing deduplication logic eliminates redundant errors better that way, keeping the resulting output with fewer errors than before, while also having more detail.
2023-09-28make adt_const_params feature suggestion more consistent with others and ↵asquared31415-17/+27
only suggest it when the type can probably work
2023-09-10Point out if a local trait has no implementationsMichael Goulet-0/+5
2023-08-23Improve note for the invalid_reference_casting lintUrgau-0/+1
Add link to the book interior mutability chapter, https://doc.rust-lang.org/book/ch15-05-interior-mutability.html.
2023-07-29Adjust some tests for invalid_reference_casting improvementsUrgau-3/+3
2023-07-29Revert "Temporarily switch invalid_reference_casting lint to allow-by-default"Urgau-2/+11
This reverts commit f25ad54a4d0febbcb2b7e951835228b7b2320b49.
2023-07-29Auto merge of #113422 - Urgau:cast_ref_to_mut-pre-beta, r=Nilstriebbors-11/+2
Rename and allow `cast_ref_to_mut` lint This PR is a small subset of https://github.com/rust-lang/rust/pull/112431, that is the renaming of the lint (`cast_ref_to_mut` -> `invalid_reference_casting`). BUT also temporarily change the default level of the lint from deny-by-default to allow-by-default until https://github.com/rust-lang/rust/pull/112431 is merged. r? `@Nilstrieb`
2023-07-18moved note as unspanned note, moved note to the bottom of the msgnxya-5/+1
2023-07-18added links as a notenxya-1/+1
2023-07-18add links to query documentation for E0391nxya-1/+1
2023-07-18added links as a notenxya-1/+6
2023-07-18add links to query documentation for E0391nxya-1/+1
2023-07-13Temporarily switch invalid_reference_casting lint to allow-by-defaultUrgau-11/+2
2023-07-13Rename cast_ref_to_mut lint to invalid_reference_castingUrgau-1/+1
2023-07-10Do not set up wrong span for adjustmentsMichael Goulet-1/+1
2023-06-27Don't sort strings right after we just sorted by typesMichael Goulet-6/+6
2023-06-12Adjust UI tests for `unit_bindings`许杰友 Jieyou Xu (Joe)-1/+1
- Either explicitly annotate `let x: () = expr;` where `x` has unit type, or remove the unit binding to leave only `expr;` instead. - Fix disjoint-capture-in-same-closure test
2023-06-01Implement custom diagnostic for ConstParamTyMichael Goulet-46/+47
2023-05-31Adjust tests for newly uplifted cast_ref_to_mut lintUrgau-2/+11
2023-05-09Rollup merge of #111215 - BoxyUwU:resolve_anon_consts_differently, r=cjgillotMatthias Krüger-45/+35
Various changes to name resolution of anon consts Sorry this PR is kind of all over the place ^^' Fixes #111012 - Rewrites anon const nameres to all go through `fn resolve_anon_const` explicitly instead of `visit_anon_const` to ensure that we do not accidentally resolve anon consts as if they are allowed to use generics when they aren't. Also means that we dont have bits of code for resolving anon consts that will get out of sync (i.e. legacy const generics and resolving path consts that were parsed as type arguments) - Renames two of the `LifetimeRibKind`, `AnonConst -> ConcreteAnonConst` and `ConstGeneric -> ConstParamTy` - Noticed while doing this that under `generic_const_exprs` all lifetimes currently get resolved to errors without any error being emitted which was causing a bunch of tests to pass without their bugs having been fixed, incidentally fixed that in this PR and marked those tests as `// known-bug:`. I'm fine to break those since `generic_const_exprs` is a very unstable incomplete feature and this PR _does_ make generic_const_exprs "less broken" as a whole, also I can't be assed to figure out what the underlying causes of all of them are. This PR reopens #77357 #83993 - Changed `generics_of` to stop providing generics and predicates to enum variant discriminant anon consts since those are not allowed to use generic parameters - Updated the error for non 'static lifetime in const arguments and the error for non 'static lifetime in const param tys to use `derive(Diagnostic)` I have a vague idea why const-arg-in-const-arg.rs, in-closure.rs and simple.rs have started failing which is unfortunate since these were deliberately made to work, I think lifetime resolution being broken just means this regressed at some point and nobody noticed because the tests were not testing anything :( I'm fine breaking these too for the same reason as the tests for #77357 #83993. I couldn't get `// known-bug` to work for these ICEs and just kept getting different stderr between CI and local `--bless` so I just removed them and will create an issue to track re-adding (and fixing) the bugs if this PR lands. r? `@cjgillot` cc `@compiler-errors`
2023-05-05improve diagnostics and bless testsBoxy-45/+35
2023-05-05Stabilize const_ptr_readbors-1/+1
2023-04-12Special-case item attributes in the suggestion outputEsteban Küber-4/+0
2023-04-12Tweak output for 'add line' suggestionEsteban Küber-4/+8
2023-03-01Add regression test for #105821Yuki Okushi-0/+23
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2023-02-23diagnostics: remove inconsistent English article "this" from E0107Michael Howell-2/+2
Consider `tests/ui/const-generics/generic_const_exprs/issue-102768.stderr`, the error message where it gives additional notes about where the associated type is defined, and how the dead code lint doesn't have an article, like in `tests/ui/lint/dead-code/issue-85255.stderr`. They don't have articles, so it seems unnecessary to have one here.
2023-02-21Specify what 'this' actually isMichael Goulet-8/+8
2023-02-16Remove save-analysis.Nicholas Nethercote-5/+4
Most tests involving save-analysis were removed, but I kept a few where the `-Zsave-analysis` was an add-on to the main thing being tested, rather than the main thing being tested. For `x.py install`, the `rust-analysis` target has been removed. For `x.py dist`, the `rust-analysis` target has been kept in a degenerate form: it just produces a single file `reduced.json` indicating that save-analysis has been removed. This is necessary for rustup to keep working. Closes #43606.
2023-02-09Introduce `ReError`Esteban Küber-2/+2
CC #69314
2023-01-30Modify primary span label for E0308Esteban Küber-1/+1
The previous output was unintuitive to users.
2023-01-19Fix known-bug, silence ICE stderrMichael Goulet-3/+1
2023-01-18defer array len printing to const arg printingBoxy-12/+12
2023-01-17Rollup merge of #101698 - raldone01:feat/const_cmp_typeid, r=scottmcmDylan DPC-21/+16
Constify `TypeId` ordering impls Tracking issue: #101871 Adding const ordering to `TypeId` allows rtti crates to optimize some casting scenarios (without transmuting to `u64`). This would also prevent these crates from breaking if the underlying type is changed from `u64` to something different. Feature gate: `#![feature(const_cmp_type_id)]`
2023-01-16Constify `TypeId` ordering implsonestacked-21/+16
2023-01-16Properly pluralize 'generic constants'Michael Goulet-4/+4
2023-01-11Move /src/test to /testsAlbert Larsan-0/+3057