Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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 @@ -2596,6 +2596,8 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
trait_def_id != *def_id
&& trait_name == self.tcx.item_name(def_id)
&& trait_has_same_params(*def_id)
// Skip `PointeeSized` here to avoid creating `PointeeSized` solver obligations during error reporting.
&& !self.tcx.is_lang_item(*def_id, LangItem::PointeeSized)
&& self.predicate_must_hold_modulo_regions(&Obligation::new(
self.tcx,
obligation.cause.clone(),
Expand Down
20 changes: 20 additions & 0 deletions tests/ui/cycle-trait/pointee-sized-next-solver-ice.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//@ compile-flags: -Znext-solver=globally

// Regression test for #151957

trait PointeeSized {
type Undefined;
}

struct T;

impl PointeeSized for T
//~^ ERROR not all trait items implemented, missing: `Undefined`
//~| ERROR the trait bound `T: PointeeSized` is not satisfied
where
<T as PointeeSized>::Undefined: PointeeSized,
//~^ ERROR the trait bound `T: PointeeSized` is not satisfied
//~| ERROR the trait bound `T: PointeeSized` is not satisfied
{}

fn main() {}
92 changes: 92 additions & 0 deletions tests/ui/cycle-trait/pointee-sized-next-solver-ice.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
error[E0046]: not all trait items implemented, missing: `Undefined`
--> $DIR/pointee-sized-next-solver-ice.rs:11:1
|
LL | type Undefined;
| -------------- `Undefined` from trait
...
LL | / impl PointeeSized for T
LL | |
LL | |
LL | | where
LL | | <T as PointeeSized>::Undefined: PointeeSized,
| |_________________________________________________^ missing `Undefined` in implementation

error[E0277]: the trait bound `T: PointeeSized` is not satisfied
--> $DIR/pointee-sized-next-solver-ice.rs:15:5
|
LL | <T as PointeeSized>::Undefined: PointeeSized,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `PointeeSized` is not implemented for `T`
--> $DIR/pointee-sized-next-solver-ice.rs:9:1
|
LL | struct T;
| ^^^^^^^^
help: the trait `PointeeSized` is implemented for `T`
--> $DIR/pointee-sized-next-solver-ice.rs:11:1
|
LL | / impl PointeeSized for T
LL | |
LL | |
LL | | where
LL | | <T as PointeeSized>::Undefined: PointeeSized,
| |_________________________________________________^
= help: see issue #48214
help: add `#![feature(trivial_bounds)]` to the crate attributes to enable
|
LL + #![feature(trivial_bounds)]
|

error[E0277]: the trait bound `T: PointeeSized` is not satisfied
--> $DIR/pointee-sized-next-solver-ice.rs:11:23
|
LL | impl PointeeSized for T
| ^ unsatisfied trait bound
|
help: the trait `PointeeSized` is not implemented for `T`
--> $DIR/pointee-sized-next-solver-ice.rs:9:1
|
LL | struct T;
| ^^^^^^^^
help: the trait `PointeeSized` is implemented for `T`
--> $DIR/pointee-sized-next-solver-ice.rs:11:1
|
LL | / impl PointeeSized for T
LL | |
LL | |
LL | | where
LL | | <T as PointeeSized>::Undefined: PointeeSized,
| |_________________________________________________^

error[E0277]: the trait bound `T: PointeeSized` is not satisfied
--> $DIR/pointee-sized-next-solver-ice.rs:15:37
|
LL | <T as PointeeSized>::Undefined: PointeeSized,
| ^^^^^^^^^^^^ unsatisfied trait bound
|
help: the trait `PointeeSized` is not implemented for `T`
--> $DIR/pointee-sized-next-solver-ice.rs:9:1
|
LL | struct T;
| ^^^^^^^^
help: the trait `PointeeSized` is implemented for `T`
--> $DIR/pointee-sized-next-solver-ice.rs:11:1
|
LL | / impl PointeeSized for T
LL | |
LL | |
LL | | where
LL | | <T as PointeeSized>::Undefined: PointeeSized,
| |_________________________________________________^
note: required by a bound in `PointeeSized`
--> $DIR/pointee-sized-next-solver-ice.rs:5:1
|
LL | / trait PointeeSized {
LL | | type Undefined;
LL | | }
| |_^ required by this bound in `PointeeSized`

error: aborting due to 4 previous errors

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