Skip to content

Commit 2c7ede8

Browse files
committed
update tests
1 parent a788be0 commit 2c7ede8

16 files changed

+68
-68
lines changed

tests/ui/coherence/occurs-check/associated-type.next.stderr

-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
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) }
2-
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) }
32
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) }
4-
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) }
53
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) }
6-
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) }
74
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) }
8-
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) }
95
error[E0119]: conflicting implementations of trait `Overlap<for<'a> fn(&'a (), ())>` for type `for<'a> fn(&'a (), ())`
106
--> $DIR/associated-type.rs:31:1
117
|

tests/ui/coherence/occurs-check/opaques.next.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
error[E0119]: conflicting implementations of trait `Trait<Alias<_>>` for type `Alias<_>`
1+
error[E0119]: conflicting implementations of trait `Trait<_>`
22
--> $DIR/opaques.rs:30:1
33
|
44
LL | impl<T> Trait<T> for T {
55
| ---------------------- first implementation here
66
...
77
LL | impl<T> Trait<T> for defining_scope::Alias<T> {
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `Alias<_>`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
99

1010
error[E0282]: type annotations needed
1111
--> $DIR/opaques.rs:13:20
1212
|
1313
LL | pub fn cast<T>(x: Container<Alias<T>, T>) -> Container<T, T> {
14-
| ^ cannot infer type for struct `Container<Alias<T>, T>`
14+
| ^ cannot infer type for struct `Container<T, T>`
1515

1616
error: aborting due to 2 previous errors
1717

tests/ui/impl-trait/auto-trait-coherence.next.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
1+
error[E0119]: conflicting implementations of trait `AnotherTrait` for type `D<_>`
22
--> $DIR/auto-trait-coherence.rs:24:1
33
|
44
LL | impl<T: Send> AnotherTrait for T {}
55
| -------------------------------- first implementation here
66
...
77
LL | impl AnotherTrait for D<OpaqueType> {
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<OpaqueType>`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `D<_>`
99

1010
error: aborting due to 1 previous error
1111

tests/ui/impl-trait/auto-trait-coherence.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ impl<T: Send> AnotherTrait for T {}
2222
// (We treat opaque types as "foreign types" that could grow more impls
2323
// in the future.)
2424
impl AnotherTrait for D<OpaqueType> {
25-
//~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
25+
//[old]~^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<OpaqueType>`
26+
//[next]~^^ ERROR conflicting implementations of trait `AnotherTrait` for type `D<_>`
2627
}
2728

2829
fn main() {}

tests/ui/impl-trait/two_tait_defining_each_other2.current.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ LL | type A = impl Foo;
77
= note: `A` must be used in combination with a concrete type within the same module
88

99
error: opaque type's hidden type cannot be another opaque type from the same scope
10-
--> $DIR/two_tait_defining_each_other2.rs:11:5
10+
--> $DIR/two_tait_defining_each_other2.rs:12:5
1111
|
1212
LL | x // B's hidden type is A (opaquely)
1313
| ^ one of the two opaque types used here has to be outside its defining scope

tests/ui/impl-trait/two_tait_defining_each_other2.next.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0284]: type annotations needed: cannot satisfy `A == B`
2-
--> $DIR/two_tait_defining_each_other2.rs:11:5
1+
error[E0284]: type annotations needed: cannot satisfy `_ == A`
2+
--> $DIR/two_tait_defining_each_other2.rs:10:8
33
|
4-
LL | x // B's hidden type is A (opaquely)
5-
| ^ cannot satisfy `A == B`
4+
LL | fn muh(x: A) -> B {
5+
| ^ cannot satisfy `_ == A`
66

77
error: aborting due to 1 previous error
88

tests/ui/impl-trait/two_tait_defining_each_other2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ type B = impl Foo;
88
trait Foo {}
99

1010
fn muh(x: A) -> B {
11+
//[next]~^ ERROR type annotations needed: cannot satisfy `_ == A`
1112
x // B's hidden type is A (opaquely)
1213
//[current]~^ ERROR opaque type's hidden type cannot be another opaque type
13-
//[next]~^^ ERROR type annotations needed: cannot satisfy `A == B`
1414
}
1515

1616
struct Bar;

tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ trait Trait {}
1616
impl<T: Copy> Trait for T {}
1717
struct LocalTy;
1818
impl Trait for <LocalTy as Overflow>::Assoc {}
19-
//~^ ERROR conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
19+
//~^ ERROR conflicting implementations of trait `Trait`
2020

2121
fn main() {}

tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-norm-overflow.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0119]: conflicting implementations of trait `Trait` for type `<LocalTy as Overflow>::Assoc`
1+
error[E0119]: conflicting implementations of trait `Trait`
22
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:18:1
33
|
44
LL | impl<T: Copy> Trait for T {}
55
| ------------------------- first implementation here
66
LL | struct LocalTy;
77
LL | impl Trait for <LocalTy as Overflow>::Assoc {}
8-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation for `<LocalTy as Overflow>::Assoc`
8+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ conflicting implementation
99

1010
error[E0275]: overflow evaluating the requirement `<T as Overflow>::Assoc: Sized`
1111
--> $DIR/trait_ref_is_knowable-norm-overflow.rs:10:18

tests/ui/traits/next-solver/coherence/trait_ref_is_knowable-normalization-3.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ impl<T> Id for T {
99
}
1010

1111

12-
// Coherence should be able to reason that `(): PartialEq<<T as Id>::Assoc>>`
12+
// Coherence should be able to reason that `(): PartialEq<<LocalTy as Id>::Assoc>>`
1313
// does not hold.
1414
//
1515
// See https://github.com/rust-lang/trait-system-refactor-initiative/issues/51

tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//@ compile-flags: -Znext-solver
2-
//@ known-bug: trait-system-refactor-initiative#60
2+
//@ check-pass
33

44
// Generalizing a projection containing an inference variable
5-
// which cannot be named by the `root_vid` can result in ambiguity.
5+
// which cannot be named by the `root_vid` previously resulted in ambiguity.
66
//
77
// Because we do not decrement the universe index when exiting a forall,
88
// this can cause unexpected failures.

tests/ui/traits/next-solver/generalize/generalize-proj-new-universe-index-2.stderr

-19
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//@ compile-flags: -Znext-solver
2+
//@ check-pass
3+
4+
// With #119106 generalization now results in `AliasRelate` if the generalized
5+
// alias contains an inference variable which is not nameable.
6+
//
7+
// We previously proved alias-relate after canonicalization, which does not keep track
8+
// of universe indices, so all inference vars were nameable inside of `AliasRelate`.
9+
//
10+
// If we now have a rigid projection containing an unnameable inference variable,
11+
// we should emit an alias-relate obligation, which constrains the type of `x` to
12+
// an alias. This caused us to emit yet another equivalent alias-relate obligation
13+
// when trying to instantiate the query result, resulting in overflow.
14+
trait Trait<'a> {
15+
type Assoc: Default;
16+
}
17+
18+
fn takes_alias<'a, T: Trait<'a>>(_: <T as Trait<'a>>::Assoc) {}
19+
20+
fn foo<T: for<'a> Trait<'a>>() {
21+
let x = Default::default();
22+
23+
let _incr_universe: for<'a, 'b> fn(&'a (), &'b ()) =
24+
(|&(), &()| ()) as for<'a> fn(&'a (), &'a ());
25+
26+
takes_alias::<T>(x);
27+
}
28+
29+
fn main() {}

tests/ui/traits/next-solver/generalize/occurs-check-nested-alias.next.stderr

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
//@ revisions: old next
2-
//@[old] check-pass
3-
4-
// Currently always fails to generalize the outer alias, even if it
5-
// is treated as rigid by `alias-relate`.
62
//@[next] compile-flags: -Znext-solver
7-
//@[next] known-bug: trait-system-refactor-initiative#8
3+
//@ check-pass
4+
5+
// case 3 of https://github.com/rust-lang/trait-system-refactor-initiative/issues/8.
86
#![crate_type = "lib"]
97
#![allow(unused)]
108
trait Unnormalizable {
@@ -14,8 +12,8 @@ trait Unnormalizable {
1412
trait Id<T> {
1513
type Id;
1614
}
17-
impl<T, U> Id<T> for U {
18-
type Id = U;
15+
impl<T, U> Id<U> for T {
16+
type Id = T;
1917
}
2018

2119
struct Inv<T>(*mut T);
@@ -24,15 +22,23 @@ fn unconstrained<T>() -> T {
2422
todo!()
2523
}
2624

27-
fn create<T, U: Unnormalizable>(
28-
x: &U,
29-
) -> (Inv<T>, Inv<<<U as Id<T>>::Id as Unnormalizable>::Assoc>) {
25+
fn create<T: Unnormalizable, U>(
26+
x: &T,
27+
) -> (Inv<U>, Inv<<<T as Id<U>>::Id as Unnormalizable>::Assoc>) {
3028
todo!()
3129
}
3230

3331
fn foo<T: Unnormalizable>() {
34-
let q = unconstrained();
35-
let (mut x, y) = create::<_, _>(&q);
36-
x = y;
37-
drop::<T>(q);
32+
let t = unconstrained();
33+
let (mut u, assoc) = create::<_, _>(&t);
34+
u = assoc;
35+
// Instantiating `?u` with `<<?t as Id<?u>>::Id as Unnormalizable>::Assoc` would
36+
// result in a cyclic type. However, we can still unify these types by first
37+
// normalizing the inner associated type. Emitting an error here would be incomplete.
38+
drop::<T>(t);
39+
40+
// FIXME(-Znext-solver): This line is necessary due to an unrelated solver bug
41+
// and should get removed in the future.
42+
// https://github.com/rust-lang/trait-system-refactor-initiative/issues/96
43+
drop::<Inv<<T as Unnormalizable>::Assoc>>(u);
3844
}

tests/ui/traits/next-solver/issue-118950-root-region.stderr

-4
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,9 @@ LL | #![feature(lazy_type_alias)]
1414
= note: `#[warn(incomplete_features)]` on by default
1515

1616
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) }
17-
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) }
1817
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) }
19-
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) }
2018
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) }
21-
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) }
2219
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) }
23-
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) }
2420
error[E0119]: conflicting implementations of trait `Overlap<fn(_)>` for type `fn(_)`
2521
--> $DIR/issue-118950-root-region.rs:19:1
2622
|

0 commit comments

Comments
 (0)