Skip to content

Commit ef3db91

Browse files
committed
Remove subtle Default impl for Value
1 parent 2d8bea3 commit ef3db91

10 files changed

+9
-61
lines changed

src/librustc/ty/query/values.rs

-6
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,6 @@ impl<'tcx, T> Value<'tcx> for T {
1414
}
1515
}
1616

17-
impl<'tcx, T: Default> Value<'tcx> for T {
18-
default fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> T {
19-
T::default()
20-
}
21-
}
22-
2317
impl<'tcx> Value<'tcx> for Ty<'tcx> {
2418
fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> {
2519
tcx.types.err

src/test/incremental/cyclic-trait-hierarchy.rs

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub trait T2 { }
77
#[cfg(cfail2)]
88
pub trait T2: T1 { }
99
//[cfail2]~^ ERROR cycle detected when computing the supertraits of `T2`
10-
//[cfail2]~| ERROR cycle detected when computing the supertraits of `T2`
1110

1211
pub trait T1: T2 { }
1312

src/test/ui/cycle-projection-based-on-where-clause.rs

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ struct A<T>
1616
where T : Trait,
1717
T : Add<T::Item>
1818
//~^ ERROR cycle detected
19-
//~| ERROR associated type `Item` not found for `T`
2019
{
2120
data: T
2221
}

src/test/ui/cycle-projection-based-on-where-clause.stderr

+2-9
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ note: cycle used when processing `A`
1111
LL | T : Add<T::Item>
1212
| ^^^^^^^
1313

14-
error[E0220]: associated type `Item` not found for `T`
15-
--> $DIR/cycle-projection-based-on-where-clause.rs:17:19
16-
|
17-
LL | T : Add<T::Item>
18-
| ^^^^^^^ associated type `Item` not found
19-
20-
error: aborting due to 2 previous errors
14+
error: aborting due to previous error
2115

22-
Some errors have detailed explanations: E0220, E0391.
23-
For more information about an error, try `rustc --explain E0220`.
16+
For more information about this error, try `rustc --explain E0391`.

src/test/ui/issues/issue-20772.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
trait T : Iterator<Item=Self::Item>
22
//~^ ERROR cycle detected
3-
//~| ERROR associated type `Item` not found for `Self`
43
{}
54

65
fn main() {}

src/test/ui/issues/issue-20772.stderr

+2-11
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ error[E0391]: cycle detected when computing the supertraits of `T`
33
|
44
LL | / trait T : Iterator<Item=Self::Item>
55
LL | |
6-
LL | |
76
LL | | {}
87
| |__^
98
|
@@ -13,17 +12,9 @@ note: cycle used when collecting item types in top-level module
1312
|
1413
LL | / trait T : Iterator<Item=Self::Item>
1514
LL | |
16-
LL | |
1715
LL | | {}
1816
| |__^
1917

20-
error[E0220]: associated type `Item` not found for `Self`
21-
--> $DIR/issue-20772.rs:1:25
22-
|
23-
LL | trait T : Iterator<Item=Self::Item>
24-
| ^^^^^^^^^^ associated type `Item` not found
25-
26-
error: aborting due to 2 previous errors
18+
error: aborting due to previous error
2719

28-
Some errors have detailed explanations: E0220, E0391.
29-
For more information about an error, try `rustc --explain E0220`.
20+
For more information about this error, try `rustc --explain E0391`.

src/test/ui/issues/issue-21177.rs

-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,5 @@ trait Trait {
55

66
fn foo<T: Trait<A = T::B>>() { }
77
//~^ ERROR cycle detected
8-
//~| ERROR associated type `B` not found for `T`
98

109
fn main() { }

src/test/ui/issues/issue-21177.stderr

+2-9
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,6 @@ note: cycle used when processing `foo`
1111
LL | fn foo<T: Trait<A = T::B>>() { }
1212
| ^^^^
1313

14-
error[E0220]: associated type `B` not found for `T`
15-
--> $DIR/issue-21177.rs:6:21
16-
|
17-
LL | fn foo<T: Trait<A = T::B>>() { }
18-
| ^^^^ associated type `B` not found
19-
20-
error: aborting due to 2 previous errors
14+
error: aborting due to previous error
2115

22-
Some errors have detailed explanations: E0220, E0391.
23-
For more information about an error, try `rustc --explain E0220`.
16+
For more information about this error, try `rustc --explain E0391`.

src/test/ui/issues/issue-23302-3.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const A: i32 = B; //~ ERROR cycle detected
2-
//~^ ERROR cycle detected
32

43
const B: i32 = A;
54

src/test/ui/issues/issue-23302-3.stderr

+3-21
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,18 @@ note: ...which requires checking which parts of `A` are promotable to static...
1010
LL | const A: i32 = B;
1111
| ^
1212
note: ...which requires const checking if rvalue is promotable to static `B`...
13-
--> $DIR/issue-23302-3.rs:4:1
13+
--> $DIR/issue-23302-3.rs:3:1
1414
|
1515
LL | const B: i32 = A;
1616
| ^^^^^^^^^^^^^^^^^
1717
note: ...which requires checking which parts of `B` are promotable to static...
18-
--> $DIR/issue-23302-3.rs:4:16
18+
--> $DIR/issue-23302-3.rs:3:16
1919
|
2020
LL | const B: i32 = A;
2121
| ^
2222
= note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle
2323
= note: cycle used when running analysis passes on this crate
2424

25-
error[E0391]: cycle detected when processing `A`
26-
--> $DIR/issue-23302-3.rs:1:16
27-
|
28-
LL | const A: i32 = B;
29-
| ^
30-
|
31-
note: ...which requires processing `B`...
32-
--> $DIR/issue-23302-3.rs:4:16
33-
|
34-
LL | const B: i32 = A;
35-
| ^
36-
= note: ...which again requires processing `A`, completing the cycle
37-
note: cycle used when processing `A`
38-
--> $DIR/issue-23302-3.rs:1:1
39-
|
40-
LL | const A: i32 = B;
41-
| ^^^^^^^^^^^^^^^^^
42-
43-
error: aborting due to 2 previous errors
25+
error: aborting due to previous error
4426

4527
For more information about this error, try `rustc --explain E0391`.

0 commit comments

Comments
 (0)