Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ fn get_impl_args(
}

let assumed_wf_types = ocx.assumed_wf_types_and_report_errors(param_env, impl1_def_id)?;
let _ = ocx.resolve_regions_and_report_errors(impl1_def_id, param_env, assumed_wf_types);
ocx.resolve_regions_and_report_errors(impl1_def_id, param_env, assumed_wf_types)?;
let Ok(impl2_args) = infcx.fully_resolve(impl2_args) else {
let span = tcx.def_span(impl1_def_id);
let guar = tcx.dcx().emit_err(GenericArgsOnOverriddenImpl { span });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//@ compile-flags: -Znext-solver=globally
// Regression test for https://github.com/rust-lang/rust/issues/151327

#![feature(min_specialization)]

trait Foo {
type Item;
}

trait Baz {}

impl<'a, T> Foo for &'a T //~ ERROR not all trait items implemented, missing: `Item`
//~| ERROR the trait bound `&'a T: Foo` is not satisfied
where
Self::Item: 'a, //~ ERROR the trait bound `&'a T: Foo` is not satisfied
{
}

impl<'a, T> Foo for &T //~ ERROR not all trait items implemented, missing: `Item`
//~| ERROR cannot normalize `<&_ as Foo>::Item: '_`
where
Self::Item: Baz,
{
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
error[E0046]: not all trait items implemented, missing: `Item`
--> $DIR/next-solver-region-resolution.rs:12:1
|
LL | type Item;
| --------- `Item` from trait
...
LL | / impl<'a, T> Foo for &'a T
LL | |
LL | | where
LL | | Self::Item: 'a,
| |___________________^ missing `Item` in implementation

error[E0277]: the trait bound `&'a T: Foo` is not satisfied
--> $DIR/next-solver-region-resolution.rs:12:21
|
LL | impl<'a, T> Foo for &'a T
| ^^^^^ the trait `Foo` is not implemented for `&'a T`
|
help: the trait `Foo` is not implemented for `&'a _`
but it is implemented for `&_`
--> $DIR/next-solver-region-resolution.rs:12:1
|
LL | / impl<'a, T> Foo for &'a T
LL | |
LL | | where
LL | | Self::Item: 'a,
| |___________________^

error[E0277]: the trait bound `&'a T: Foo` is not satisfied
--> $DIR/next-solver-region-resolution.rs:15:17
|
LL | Self::Item: 'a,
| ^^ the trait `Foo` is not implemented for `&'a T`
|
help: the trait `Foo` is not implemented for `&'a _`
but it is implemented for `&_`
--> $DIR/next-solver-region-resolution.rs:12:1
|
LL | / impl<'a, T> Foo for &'a T
LL | |
LL | | where
LL | | Self::Item: 'a,
| |___________________^

error[E0046]: not all trait items implemented, missing: `Item`
--> $DIR/next-solver-region-resolution.rs:19:1
|
LL | type Item;
| --------- `Item` from trait
...
LL | / impl<'a, T> Foo for &T
LL | |
LL | | where
LL | | Self::Item: Baz,
| |____________________^ missing `Item` in implementation

error: cannot normalize `<&_ as Foo>::Item: '_`
--> $DIR/next-solver-region-resolution.rs:19:1
|
LL | / impl<'a, T> Foo for &T
LL | |
LL | | where
LL | | Self::Item: Baz,
| |____________________^

error: aborting due to 5 previous errors

Some errors have detailed explanations: E0046, E0277.
For more information about an error, try `rustc --explain E0046`.
Loading