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, 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, 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, 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, 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 (), ())`
--> $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
|
LL | impl<T> Trait<T> for T {
| ---------------------- first implementation here
...
LL | impl<T> Trait<T> for defining_scope::Alias<T> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Alias<_>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
error[E0282]: type annotations needed
--> $DIR/opaques.rs:13:20
|
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

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
|
LL | impl<T: Send> AnotherTrait for T {}
| -------------------------------- first implementation here
...
LL | impl AnotherTrait for D<OpaqueType> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
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
// in the future.)
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() {}

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

View File

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

View File

@ -16,6 +16,6 @@ trait Trait {}
impl<T: Copy> Trait for T {}
struct LocalTy;
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() {}

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
|
LL | impl<T: Copy> Trait for T {}
| ------------------------- first implementation here
LL | struct LocalTy;
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`
--> $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.
//
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51

View File

@ -1,8 +1,8 @@
//@ compile-flags: -Znext-solver
//@ known-bug: trait-system-refactor-initiative#60
//@ check-pass
// 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,
// 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
//@[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] 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"]
#![allow(unused)]
trait Unnormalizable {
@ -14,8 +12,8 @@ trait Unnormalizable {
trait Id<T> {
type Id;
}
impl<T, U> Id<T> for U {
type Id = U;
impl<T, U> Id<U> for T {
type Id = T;
}
struct Inv<T>(*mut T);
@ -24,15 +22,23 @@ fn unconstrained<T>() -> T {
todo!()
}
fn create<T, U: Unnormalizable>(
x: &U,
) -> (Inv<T>, Inv<<<U as Id<T>>::Id as Unnormalizable>::Assoc>) {
fn create<T: Unnormalizable, U>(
x: &T,
) -> (Inv<U>, Inv<<<T as Id<U>>::Id as Unnormalizable>::Assoc>) {
todo!()
}
fn foo<T: Unnormalizable>() {
let q = unconstrained();
let (mut x, y) = create::<_, _>(&q);
x = y;
drop::<T>(q);
let t = unconstrained();
let (mut u, assoc) = create::<_, _>(&t);
u = assoc;
// 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
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: [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: [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: [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(_)`
--> $DIR/issue-118950-root-region.rs:19:1
|