update tests

This commit is contained in:
lcnr 2024-02-26 10:19:11 +01:00
parent a788be0aae
commit 2c7ede8f52
16 changed files with 68 additions and 68 deletions

View File

@ -1,11 +1,7 @@
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [*const ?1t, RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:27 ~ associated_type[f554]::{impl#3}::'a#1), 'a) })], def_id: DefId(0:5 ~ associated_type[f554]::ToUnit::Unit) }
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())` error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
--> $DIR/associated-type.rs:31:1 --> $DIR/associated-type.rs:31:1
| |

View File

@ -1,17 +1,17 @@
error[E0119]: conflicting implementations of trait `Trait<Alias<_>>` for type `Alias<_>` error[E0119]: conflicting implementations of trait `Trait<_>`
--> $DIR/opaques.rs:30:1 --> $DIR/opaques.rs:30:1
| |
LL | impl<T> Trait<T> for T { LL | impl<T> Trait<T> for T {
| ---------------------- first implementation here | ---------------------- first implementation here
... ...
LL | impl<T> Trait<T> for defining_scope::Alias<T> { LL | impl<T> Trait<T> for defining_scope::Alias<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Alias<_>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0282]: type annotations needed error[E0282]: type annotations needed
--> $DIR/opaques.rs:13:20 --> $DIR/opaques.rs:13:20
| |
LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> { LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
| ^ cannot infer type for struct `Container<Alias<T>, T>` | ^ cannot infer type for struct `Container<T, T>`
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View File

@ -1,11 +1,11 @@
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
--> $DIR/auto-trait-coherence.rs:24:1 --> $DIR/auto-trait-coherence.rs:24:1
| |
LL | impl<T: Send> AnotherTrait for T {} LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here | -------------------------------- first implementation here
... ...
LL | impl AnotherTrait for D<OpaqueType> { LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -22,7 +22,8 @@ impl<T: Send> AnotherTrait for T {}
// (We treat opaque types as "foreign types" that could grow more impls // (We treat opaque types as "foreign types" that could grow more impls
// in the future.) // in the future.)
impl AnotherTrait for D<OpaqueType> { impl AnotherTrait for D<OpaqueType> {
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>` //[old]~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
//[next]~^^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<_>`
} }
fn main() {} fn main() {}

View File

@ -7,7 +7,7 @@ LL | type A = impl Foo;
= note: `A` must be used in combination with a concrete type within the same module = note: `A` must be used in combination with a concrete type within the same module
error: opaque type's hidden type cannot be another opaque type from the same scope error: opaque type's hidden type cannot be another opaque type from the same scope
--> $DIR/two_tait_defining_each_other2.rs:11:5 --> $DIR/two_tait_defining_each_other2.rs:12:5
| |
LL | x // B's hidden type is A (opaquely) LL | x // B's hidden type is A (opaquely)
| ^ one of the two opaque types used here has to be outside its defining scope | ^ one of the two opaque types used here has to be outside its defining scope

View File

@ -1,8 +1,8 @@
error[E0284]: type annotations needed: cannot satisfy `A == B` error[E0284]: type annotations needed: cannot satisfy `_ == A`
--> $DIR/two_tait_defining_each_other2.rs:11:5 --> $DIR/two_tait_defining_each_other2.rs:10:8
| |
LL | x // B's hidden type is A (opaquely) LL | fn muh(x: A) -> B {
| ^ cannot satisfy `A == B` | ^ cannot satisfy `_ == A`
error: aborting due to 1 previous error error: aborting due to 1 previous error

View File

@ -8,9 +8,9 @@
trait Foo {} trait Foo {}
fn muh(x: A) -> B { fn muh(x: A) -> B {
//[next]~^ ERROR type annotations needed: cannot satisfy `_ == A`
x // B's hidden type is A (opaquely) x // B's hidden type is A (opaquely)
//[current]~^ ERROR opaque type's hidden type cannot be another opaque type //[current]~^ ERROR opaque type's hidden type cannot be another opaque type
//[next]~^^ ERROR type annotations needed: cannot satisfy `A == B`
} }
struct Bar; struct Bar;

View File

@ -16,6 +16,6 @@ trait Trait {}
impl<T: Copy> Trait for T {} impl<T: Copy> Trait for T {}
struct LocalTy; struct LocalTy;
impl Trait for <LocalTy as Overflow>::Assoc {} impl Trait for <LocalTy as Overflow>::Assoc {}
//~^ ERROR conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc` //~^ ERROR conflicting implementations of trait `Trait`
fn main() {} fn main() {}

View File

@ -1,11 +1,11 @@
error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc` error[E0119]: conflicting implementations of trait `Trait`
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1 --> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1
| |
LL | impl<T: Copy> Trait for T {} LL | impl<T: Copy> Trait for T {}
| ------------------------- first implementation here | ------------------------- first implementation here
LL | struct LocalTy; LL | struct LocalTy;
LL | impl Trait for <LocalTy as Overflow>::Assoc {} LL | impl Trait for <LocalTy as Overflow>::Assoc {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc` | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc: Sized` error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc: Sized`
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18 --> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18

View File

@ -9,7 +9,7 @@ impl<T> Id for T {
} }
// Coherence should be able to reason that `(): PartialEq<<T as Id>::Assoc>>` // Coherence should be able to reason that `(): PartialEq<<LocalTy as Id>::Assoc>>`
// does not hold. // does not hold.
// //
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51 // See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51

View File

@ -1,8 +1,8 @@
//@ compile-flags: -Znext-solver //@ compile-flags: -Znext-solver
//@ known-bug: trait-system-refactor-initiative#60 //@ check-pass
// Generalizing a projection containing an inference variable // Generalizing a projection containing an inference variable
// which cannot be named by the `root_vid` can result in ambiguity. // which cannot be named by the `root_vid` previously resulted in ambiguity.
// //
// Because we do not decrement the universe index when exiting a forall, // Because we do not decrement the universe index when exiting a forall,
// this can cause unexpected failures. // this can cause unexpected failures.

View File

@ -1,19 +0,0 @@
error[E0284]: type annotations needed
--> $DIR/generalize-proj-new-universe-index-2.rs:74:5
|
LL | bound::<<Rigid as IdHigherRankedBound>::Assoc, <Wrapper<Leaf> as Id>::Assoc, _>()
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cannot infer type of the type parameter `V` declared on the function `bound`
|
= note: cannot satisfy `<<Rigid as IdHigherRankedBound>::Assoc as WithAssoc<<Wrapper<Leaf> as Id>::Assoc>>::Assoc == _`
note: required by a bound in `bound`
--> $DIR/generalize-proj-new-universe-index-2.rs:69:21
|
LL | fn bound<T: ?Sized, U: ?Sized, V: ?Sized>()
| ----- required by a bound in this function
LL | where
LL | T: WithAssoc<U, Assoc = V>,
| ^^^^^^^^^ required by this bound in `bound`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0284`.

View File

@ -0,0 +1,29 @@
//@ compile-flags: -Znext-solver
//@ check-pass
// With #119106 generalization now results in `AliasRelate` if the generalized
// alias contains an inference variable which is not nameable.
//
// We previously proved alias-relate after canonicalization, which does not keep track
// of universe indices, so all inference vars were nameable inside of `AliasRelate`.
//
// If we now have a rigid projection containing an unnameable inference variable,
// we should emit an alias-relate obligation, which constrains the type of `x` to
// an alias. This caused us to emit yet another equivalent alias-relate obligation
// when trying to instantiate the query result, resulting in overflow.
trait Trait<'a> {
type Assoc: Default;
}
fn takes_alias<'a, T: Trait<'a>>(_: <T as Trait<'a>>::Assoc) {}
fn foo<T: for<'a> Trait<'a>>() {
let x = Default::default();
let _incr_universe: for<'a, 'b> fn(&'a (), &'b ()) =
(|&(), &()| ()) as for<'a> fn(&'a (), &'a ());
takes_alias::<T>(x);
}
fn main() {}

View File

@ -1,9 +0,0 @@
error[E0284]: type annotations needed: cannot satisfy `_ == <<T as Id<_>>::Id as Unnormalizable>::Assoc`
--> $DIR/occurs-check-nested-alias.rs:36:9
|
LL | x = y;
| ^ cannot satisfy `_ == <<T as Id<_>>::Id as Unnormalizable>::Assoc`
error: aborting due to 1 previous error
For more information about this error, try `rustc --explain E0284`.

View File

@ -1,10 +1,8 @@
//@ revisions: old next //@ revisions: old next
//@[old] check-pass
// Currently always fails to generalize the outer alias, even if it
// is treated as rigid by `alias-relate`.
//@[next] compile-flags: -Znext-solver //@[next] compile-flags: -Znext-solver
//@[next] known-bug: trait-system-refactor-initiative#8 //@ check-pass
// case 3 of https://github.com/rust-lang/trait-system-refactor-initiative/issues/8.
#![crate_type = "lib"] #![crate_type = "lib"]
#![allow(unused)] #![allow(unused)]
trait Unnormalizable { trait Unnormalizable {
@ -14,8 +12,8 @@ trait Unnormalizable {
trait Id<T> { trait Id<T> {
type Id; type Id;
} }
impl<T, U> Id<T> for U { impl<T, U> Id<U> for T {
type Id = U; type Id = T;
} }
struct Inv<T>(*mut T); struct Inv<T>(*mut T);
@ -24,15 +22,23 @@ fn unconstrained<T>() -> T {
todo!() todo!()
} }
fn create<T, U: Unnormalizable>( fn create<T: Unnormalizable, U>(
x: &U, x: &T,
) -> (Inv<T>, Inv<<<U as Id<T>>::Id as Unnormalizable>::Assoc>) { ) -> (Inv<U>, Inv<<<T as Id<U>>::Id as Unnormalizable>::Assoc>) {
todo!() todo!()
} }
fn foo<T: Unnormalizable>() { fn foo<T: Unnormalizable>() {
let q = unconstrained(); let t = unconstrained();
let (mut x, y) = create::<_, _>(&q); let (mut u, assoc) = create::<_, _>(&t);
x = y; u = assoc;
drop::<T>(q); // Instantiating `?u` with `<<?t as Id<?u>>::Id as Unnormalizable>::Assoc` would
// result in a cyclic type. However, we can still unify these types by first
// normalizing the inner associated type. Emitting an error here would be incomplete.
drop::<T>(t);
// FIXME(-Znext-solver): This line is necessary due to an unrelated solver bug
// and should get removed in the future.
// https://github.com/rust-lang/trait-system-refactor-initiative/issues/96
drop::<Inv<<T as Unnormalizable>::Assoc>>(u);
} }

View File

@ -14,13 +14,9 @@ LL | #![feature(lazy_type_alias)]
= note: `#[warn(incomplete_features)]` on by default = note: `#[warn(incomplete_features)]` on by default
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) } WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [ReBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
WARN rustc_infer::infer::relate::generalize may incompletely handle alias type: AliasTy { args: [RePlaceholder(!1_BoundRegion { var: 0, kind: BrNamed(DefId(0:15 ~ issue_118950_root_region[d54f]::{impl#1}::'a), 'a) }), ?1t], def_id: DefId(0:8 ~ issue_118950_root_region[d54f]::Assoc) }
error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)` error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)`
--> $DIR/issue-118950-root-region.rs:19:1 --> $DIR/issue-118950-root-region.rs:19:1
| |