about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2022-02-26Provide extra note if synthetic type args are specifiedGary Guo-0/+1
2022-02-24Remove in-band lifetimesMichael Goulet-16/+12
2022-02-17fix impl trait message, bless testsMichael Goulet-220/+110
2022-02-17Add more information to `impl Trait` deny errorMichael Goulet-108/+218
2022-02-12Update chalk testsMatthew Jasper-6/+4
2022-02-11Revert "Auto merge of #92007 - oli-obk:lazy_tait2, r=nikomatsakis"Oli Scherer-748/+510
This reverts commit e7cc3bddbe0d0e374d05e7003e662bba1742dbae, reversing changes made to 734368a200904ef9c21db86c595dc04263c87be0.
2022-02-11Revert "Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obk"Oli Scherer-20/+8
This reverts commit 1f0a96862ac9d4c6ca3e4bb500c8b9eac4d83049, reversing changes made to bf242bb1199e25ca2274df5c4114e0c9436b74e9.
2022-02-11Revert "Fix regression from lazy opaque types"Oli Scherer-94/+2
This reverts commit 239f1e716dcb1e145b5df5f9439524c817d123b2.
2022-02-09Auto merge of #92306 - Aaron1011:opaque-type-op, r=oli-obkbors-8/+20
Improve opaque type higher-ranked region error message under NLL Currently, any higher-ranked region errors involving opaque types fall back to a generic "higher-ranked subtype error" message when run under NLL. This PR adds better error message handling for this case, giving us the same kinds of error messages that we currently get without NLL: ``` error: implementation of `MyTrait` is not general enough --> $DIR/opaque-hrtb.rs:12:13 | LL | fn foo() -> impl for<'a> MyTrait<&'a str> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough | = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`... = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2` error: aborting due to previous error ``` To accomplish this, several different refactoring needed to be made: * We now have a dedicated `InstantiateOpaqueType` struct which implements `TypeOp`. This is used to invoke `instantiate_opaque_types` during MIR type checking. * `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is needed to report opaque type region errors. * We no longer assume that all `TypeOp`s correspond to canonicalized queries. This allows us to properly handle opaque type instantiation (which does not occur in a query) as a `TypeOp`. A new `ErrorInfo` associated type is used to determine what additional information is used during higher-ranked region error handling. * The body of `try_extract_error_from_fulfill_cx` has been moved out to a new function `try_extract_error_from_region_constraints`. This allows us to re-use the same error reporting code between canonicalized queries (which can extract region constraints directly from a fresh `InferCtxt`) and opaque type handling (which needs to take region constraints from the pre-existing `InferCtxt` that we use throughout MIR borrow checking).
2022-02-08Improve opaque type higher-ranked region error message under NLLAaron Hill-8/+20
Currently, any higher-ranked region errors involving opaque types fall back to a generic "higher-ranked subtype error" message when run under NLL. This PR adds better error message handling for this case, giving us the same kinds of error messages that we currently get without NLL: ``` error: implementation of `MyTrait` is not general enough --> $DIR/opaque-hrtb.rs:12:13 | LL | fn foo() -> impl for<'a> MyTrait<&'a str> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ implementation of `MyTrait` is not general enough | = note: `impl MyTrait<&'2 str>` must implement `MyTrait<&'1 str>`, for any lifetime `'1`... = note: ...but it actually implements `MyTrait<&'2 str>`, for some specific lifetime `'2` error: aborting due to previous error ``` To accomplish this, several different refactoring needed to be made: * We now have a dedicated `InstantiateOpaqueType` struct which implements `TypeOp`. This is used to invoke `instantiate_opaque_types` during MIR type checking. * `TypeOp` is refactored to pass around a `MirBorrowckCtxt`, which is needed to report opaque type region errors. * We no longer assume that all `TypeOp`s correspond to canonicalized queries. This allows us to properly handle opaque type instantiation (which does not occur in a query) as a `TypeOp`. A new `ErrorInfo` associated type is used to determine what additional information is used during higher-ranked region error handling. * The body of `try_extract_error_from_fulfill_cx` has been moved out to a new function `try_extract_error_from_region_constraints`. This allows us to re-use the same error reporting code between canonicalized queries (which can extract region constraints directly from a fresh `InferCtxt`) and opaque type handling (which needs to take region constraints from the pre-existing `InferCtxt` that we use throughout MIR borrow checking).
2022-02-08Fix regression from lazy opaque typesOli Scherer-2/+94
2022-02-07Print opaque types from type aliases via their pathOli Scherer-7/+7
2022-02-02Only prevent TAITs from defining each other, RPIT and async are fine, they ↵Oli Scherer-20/+2
only ever have one defining site, and it is ordered correctly around expected and actual type in type comparisons
2022-02-02Prevent two opaque types in their defining scopes from being defined via the ↵Oli Scherer-13/+132
other
2022-02-02Ensure we error in case of non-higher-kinded lifetimesOli Scherer-1/+48
2022-02-02Avoid an ICE in the presence of HKLOli Scherer-0/+15
2022-02-02Make the error for opaque types that have no hidden types a bit informativeOli Scherer-6/+12
2022-02-02Hide further opaque type errors if items that could constrain the opaque ↵Oli Scherer-20/+6
type have errors
2022-02-02Add some tests to show what happens when you compare two opaque types that ↵Oli Scherer-0/+64
are both within the defining scope
2022-02-02Test recursive TAIT declarationsOli Scherer-0/+80
2022-02-02Eagerly merge hidden types.Oli Scherer-33/+55
2022-02-02Stop generating inference vars for nested impl trait and let type equality ↵Oli Scherer-8/+32
handle it. This means we stop supporting the case where a locally defined trait has only a single impl so we can always use that impl (see nested-tait-inference.rs).
2022-02-02Register member constraints on the final merged hidden typeOli Scherer-32/+2
Previously we did this per hidden type candiate, which didn't always have all the information available.
2022-02-02Lazily resolve type-alias-impl-trait defining usesOli Scherer-506/+429
by using an opaque type obligation to bubble up comparisons between opaque types and other types Also uses proper obligation causes so that the body id works, because out of some reason nll uses body ids for logic instead of just diagnostics.
2021-12-17Fix typo in "new region bound" suggestionEsteban Kuber-15/+15
The lifetime name shoud always appear in text surrounded by `.
2021-12-15update testslcnr-1/+6
2021-12-11Auto merge of #91769 - estebank:type-trait-bound-span-2, r=oli-obkbors-6/+23
Tweak assoc type obligation spans * Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors r? `@oli-obk` This is a(n uncontroversial) subset of #85799.
2021-12-11Tweak assoc type obligation spansEsteban Kuber-6/+23
* Point at RHS of associated type in obligation span * Point at `impl` assoc type on projection error * Reduce verbosity of recursive obligations * Point at source of binding lifetime obligation * Tweak "required bound" note * Tweak "expected... found opaque (return) type" labels * Point at set type in impl assoc type WF errors
2021-12-10Tweak wordingEsteban Kuber-12/+12
2021-12-10Use a more accurate `Span` for `'static` obligation from return typeEsteban Kuber-16/+16
2021-12-10Point at return type when it introduces `'static` obligationEsteban Kuber-0/+28
2021-12-10Clean up visual output logicEsteban Kuber-5/+5
2021-11-26Perform Sync check on static items in wf-check instead of during const checksOli Scherer-2/+2
2021-11-26Auto merge of #85102 - estebank:point-at-assignment, r=oli-obkbors-0/+3
Diagnostic tweaks * On type mismatch caused by assignment, point at the source of the expectation * Hide redundant errors * Suggest `while let` when `let` is missing in some cases
2021-11-25On type mismatch caused by assignment, point at assigneeEsteban Küber-0/+3
* Do not emit unnecessary E0308 after E0070 * Show fewer errors on `while let` missing `let` * Hide redundant E0308 on `while let` missing `let` * Point at binding definition when possible on invalid assignment * do not point at closure twice * do not suggest `if let` for literals in lhs * account for parameter types
2021-11-23Fix printing unit return ty, don't elaborate FnOnce unless we see itMichael Goulet-9/+9
2021-11-23Update test outputsMichael Goulet-17/+17
2021-11-20Point at bounds when comparing impl items to traitEsteban Kuber-2/+2
2021-11-18Print output ty for opaque future tyMichael Goulet-2/+2
2021-11-09Rollup merge of #90708 - NieDzejkob:feature-note, r=jackh726Yuki Okushi-0/+9
Add a note about feature(explicit_generic_args_with_impl_trait) to the relevant error message Fixes #90615
2021-11-09Auto merge of #87337 - jyn514:lint-error, r=oli-obk,flip1995bors-7/+16
Don't abort compilation after giving a lint error The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors. Closes https://github.com/rust-lang/rust/issues/82761. This is a WIP because I have a feeling it will exit with 0 even if there were lint errors; I don't have a computer that can build rustc locally at the moment.
2021-11-08Add a note about feature(explicit_generic_args_with_impl_trait) to the ↵Jakub Kądziołka-0/+9
relevant error message
2021-11-08Don't abort compilation after giving a lint errorJoshua Nelson-7/+16
The only reason to use `abort_if_errors` is when the program is so broken that either: 1. later passes get confused and ICE 2. any diagnostics from later passes would be noise This is never the case for lints, because the compiler has to be able to deal with `allow`-ed lints. So it can continue to lint and compile even if there are lint errors.
2021-11-06Move some tests to more reasonable directoriesCaio-0/+35
2021-10-25fix(rustc_typeck): report function argument errors on matching typeMichael Howell-4/+8
Fixes #90101
2021-10-24Always sort suggestions before emitting themEsteban Kuber-4/+4
2021-10-24Point at overlapping impls when type annotations are neededEsteban Kuber-3/+18
2021-10-18Remove regionck member constraint handling and leave it to mir borrowckOli Scherer-252/+67
2021-10-15simplify constrain_opaque_typesNiko Matsakis-123/+244
2021-10-13Bless nll testsOli Scherer-10/+12