mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 06:44:35 +00:00
Rollup merge of #113421 - spastorino:new-rpitit-29, r=compiler-errors
Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys Fixes #113403 Assert on collect_return_position_impl_trait_in_trait_tys is not correct when we call it from type_of(GAT). The included test is an example of a situation that collector collects 0 types. r? `@compiler-errors`
This commit is contained in:
commit
45cb1ba9d3
@ -669,11 +669,13 @@ pub(super) fn collect_return_position_impl_trait_in_trait_tys<'tcx>(
|
||||
)
|
||||
.fold_with(&mut collector);
|
||||
|
||||
debug_assert_ne!(
|
||||
collector.types.len(),
|
||||
0,
|
||||
"expect >1 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`"
|
||||
);
|
||||
if !unnormalized_trait_sig.output().references_error() {
|
||||
debug_assert_ne!(
|
||||
collector.types.len(),
|
||||
0,
|
||||
"expect >1 RPITITs in call to `collect_return_position_impl_trait_in_trait_tys`"
|
||||
);
|
||||
}
|
||||
|
||||
let trait_sig = ocx.normalize(&norm_cause, param_env, unnormalized_trait_sig);
|
||||
trait_sig.error_reported()?;
|
||||
|
@ -0,0 +1,9 @@
|
||||
error[E0412]: cannot find type `Missing` in this scope
|
||||
--> $DIR/return-not-existing-type-wrapping-rpitit.rs:10:25
|
||||
|
|
||||
LL | fn bar() -> Wrapper<Missing<impl Sized>>;
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
@ -0,0 +1,9 @@
|
||||
error[E0412]: cannot find type `Missing` in this scope
|
||||
--> $DIR/return-not-existing-type-wrapping-rpitit.rs:10:25
|
||||
|
|
||||
LL | fn bar() -> Wrapper<Missing<impl Sized>>;
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0412`.
|
@ -0,0 +1,20 @@
|
||||
// edition:2021
|
||||
// [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty
|
||||
// revisions: current next
|
||||
|
||||
#![feature(return_position_impl_trait_in_trait)]
|
||||
|
||||
struct Wrapper<T>(T);
|
||||
|
||||
trait Foo {
|
||||
fn bar() -> Wrapper<Missing<impl Sized>>;
|
||||
//~^ ERROR: cannot find type `Missing` in this scope [E0412]
|
||||
}
|
||||
|
||||
impl Foo for () {
|
||||
fn bar() -> Wrapper<i32> {
|
||||
Wrapper(0)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
Loading…
Reference in New Issue
Block a user