about summary refs log tree commit diff
path: root/src/test/ui/impl-trait
AgeCommit message (Collapse)AuthorLines
2022-04-04Mention implementers of unsatisfied traitEsteban Kuber-4/+13
When encountering an unsatisfied trait bound, if there are no other suggestions, mention all the types that *do* implement that trait: ``` error[E0277]: the trait bound `f32: Foo` is not satisfied --> $DIR/impl_wf.rs:22:6 | LL | impl Baz<f32> for f32 { } | ^^^^^^^^ the trait `Foo` is not implemented for `f32` | = help: the following other types implement trait `Foo`: Option<T> i32 str note: required by a bound in `Baz` --> $DIR/impl_wf.rs:18:31 | LL | trait Baz<U: ?Sized> where U: Foo { } | ^^^ required by this bound in `Baz` ``` Mention implementers of traits in `ImplObligation`s. Do not mention other `impl`s for closures, ranges and `?`.
2022-04-04diagnostics: use correct span for const genericsMichael Howell-2/+2
Fixes #95616
2022-04-02Fix late-bound ICE in unsized return suggestionMichael Goulet-28/+51
2022-03-30Restore `impl Future<Output = Type>` to async blocksMichael Goulet-4/+4
2022-03-30Auto merge of #95466 - Dylan-DPC:rollup-g7ddr8y, r=Dylan-DPCbors-1/+1
Rollup of 5 pull requests Successful merges: - #95294 (Document Linux kernel handoff in std::io::copy and std::fs::copy) - #95443 (Clarify how `src/tools/x` searches for python) - #95452 (fix since field version for termination stabilization) - #95460 (Spellchecking compiler code) - #95461 (Spellchecking some comments) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2022-03-30Spellchecking some commentsYuri Astrakhan-1/+1
This PR attempts to clean up some minor spelling mistakes in comments
2022-03-28Also use the RPIT back compat hack in trait projectionOli Scherer-35/+5
2022-03-28Show that the behaviour is the same for RPIT and TAITOli Scherer-0/+230
2022-03-28Add a test showing that a similar example compilesOli Scherer-0/+20
2022-03-28Fix mixing lazy TAIT and RPIT in their defining scopesOli Scherer-0/+28
2022-03-28Add regression testOli Scherer-0/+60
2022-03-28Add another regression testOli Scherer-0/+27
2022-03-28Test that TAIT and RPIT are in syncOli Scherer-2/+31
2022-03-28Add regression testsOli Scherer-0/+494
2022-03-28Remove opaque type obligation and just register opaque types as they are ↵Oli Scherer-16/+48
encountered. This also registers obligations for the hidden type immediately.
2022-03-28Revert to inference variable based hidden type computation for RPITOli Scherer-134/+287
2022-03-28Special case the situation where the previous span is the same as the new oneOli Scherer-6/+3
2022-03-28Have the spans of TAIT type conflict errors point to the actual site instead ↵Oli Scherer-7/+7
of the owning function
2022-03-28Normalize all projections in mir validation againOli Scherer-0/+29
2022-03-28Don't bind hidden types when searching for matching implsOli Scherer-39/+73
2022-03-28Revert "Auto merge of #93893 - oli-obk:sad_revert, r=oli-obk"Oli Scherer-504/+848
This reverts commit 6499c5e7fc173a3f55b7a3bd1e6a50e9edef782d, reversing changes made to 78450d2d602b06d9b94349aaf8cece1a4acaf3a8.
2022-03-27Rollup merge of #95364 - GuillaumeGomez:long-error-explanation-e0667, ↵Dylan DPC-1/+3
r=Dylan-DPC Add long error explanation for E0667 Part of #61137.
2022-03-27Update ui test outputGuillaume Gomez-1/+3
2022-03-27Rollup merge of #93469 - compiler-errors:issue-93450, r=estebankDylan DPC-18/+3
Skip pointing out ambiguous impls in alloc/std crates too in inference errors This generalizes the logic in `annotate_source_of_ambiguity` to skip printing ambiguity errors traits in `alloc` and `std` as well, not just `core`. While this does spot-fix the issue mentioned below, it would be nicer to generalize this logic, for example to detect when the trait predicate's `self_ty` has any numerical inference variables. Is it worthwhile to scrap this solution for one like that? Fixes #93450 r? `@estebank` feel free to reassign
2022-03-22remove [async output] from impl FutureMichael Goulet-4/+4
2022-03-16resolve the conflict in compiler/rustc_session/src/parse.rscodehorseman-1/+1
Signed-off-by: codehorseman <cricis@yeah.net>
2022-03-07diagnostics: only talk about `Cargo.toml` if running under CargoMichael Howell-1/+1
Fixes #94646
2022-03-03Cleanup feature gates.Camille GILLOT-3/+1
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-17skip pointing out ambuguous impls in alloc/std crates tooMichael Goulet-18/+3
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