Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tys

This commit is contained in:
Santiago Pastorino 2023-07-06 16:40:50 -03:00
parent c4c84df3b3
commit 07a230b5a5
No known key found for this signature in database
GPG Key ID: 8131A24E0C79EFAF
4 changed files with 45 additions and 5 deletions

View File

@ -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()?;

View File

@ -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`.

View File

@ -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`.

View File

@ -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() {}