simplify test case and add revisions for both solvers

remove *
This commit is contained in:
Takayuki Maeda
2026-03-02 17:41:36 +09:00
parent 6cda9bfafc
commit ca74063cea
5 changed files with 58 additions and 109 deletions
@@ -2633,7 +2633,7 @@ fn check_same_name_different_path(
&& trait_name == self.tcx.item_name(def_id)
&& trait_has_same_params(def_id)
// `PointeeSized` is removed during lowering.
&& !self.tcx.is_lang_item(*def_id, LangItem::PointeeSized)
&& !self.tcx.is_lang_item(def_id, LangItem::PointeeSized)
&& self.predicate_must_hold_modulo_regions(&Obligation::new(
self.tcx,
obligation.cause.clone(),
@@ -0,0 +1,20 @@
error[E0277]: the trait bound `i32: PointeeSized` is not satisfied
--> $DIR/pointee-sized-next-solver-ice.rs:19:21
|
LL | require_trait::<i32>();
| ^^^ the trait `PointeeSized` is not implemented for `i32`
|
help: this trait has no implementations, consider adding one
--> $DIR/pointee-sized-next-solver-ice.rs:14:1
|
LL | trait PointeeSized {}
| ^^^^^^^^^^^^^^^^^^
note: required by a bound in `require_trait`
--> $DIR/pointee-sized-next-solver-ice.rs:16:21
|
LL | fn require_trait<T: PointeeSized>() {}
| ^^^^^^^^^^^^ required by this bound in `require_trait`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.
@@ -0,0 +1,20 @@
error[E0277]: the trait bound `i32: PointeeSized` is not satisfied
--> $DIR/pointee-sized-next-solver-ice.rs:19:21
|
LL | require_trait::<i32>();
| ^^^ the trait `PointeeSized` is not implemented for `i32`
|
help: this trait has no implementations, consider adding one
--> $DIR/pointee-sized-next-solver-ice.rs:14:1
|
LL | trait PointeeSized {}
| ^^^^^^^^^^^^^^^^^^
note: required by a bound in `require_trait`
--> $DIR/pointee-sized-next-solver-ice.rs:16:21
|
LL | fn require_trait<T: PointeeSized>() {}
| ^^^^^^^^^^^^ required by this bound in `require_trait`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0277`.
@@ -1,20 +1,21 @@
//@ compile-flags: -Znext-solver=globally
//@ revisions: current next
//@[next] compile-flags: -Znext-solver
//@ ignore-compare-mode-next-solver (explicit revisions)
// Regression test for https://github.com/rust-lang/rust/issues/151957
//
// When a user-defined trait shares the name `PointeeSized` with
// `core::marker::PointeeSized`, error reporting tries to check whether
// the type implements the lang-item `PointeeSized` trait via
// `predicate_must_hold_modulo_regions`. This creates a `PointeeSized`
// solver obligation which causes an ICE. We avoid this by skipping the
// `PointeeSized` lang item during the "similarly named trait" suggestion.
trait PointeeSized {
type Undefined;
trait PointeeSized {}
fn require_trait<T: PointeeSized>() {}
fn main() {
require_trait::<i32>();
//~^ ERROR the trait bound `i32: PointeeSized` is not satisfied
}
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() {}
@@ -1,92 +0,0 @@
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`.