Skip to content
Permalink
Browse files

Remove subtle Default impl for Value

  • Loading branch information...
Zoxc committed Apr 5, 2019
1 parent ae8975c commit e77096b08ccb276a938fafa7eadb87f9dac309d9
@@ -14,12 +14,6 @@ impl<'tcx, T> Value<'tcx> for T {
}
}

impl<'tcx, T: Default> Value<'tcx> for T {
default fn from_cycle_error<'a>(_: TyCtxt<'a, 'tcx, 'tcx>) -> T {
T::default()
}
}

impl<'tcx> Value<'tcx> for Ty<'tcx> {
fn from_cycle_error<'a>(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Ty<'tcx> {
tcx.types.err
@@ -7,7 +7,6 @@ pub trait T2 { }
#[cfg(cfail2)]
pub trait T2: T1 { }
//[cfail2]~^ ERROR cycle detected when computing the supertraits of `T2`
//[cfail2]~| ERROR cycle detected when computing the supertraits of `T2`

pub trait T1: T2 { }

@@ -16,7 +16,6 @@ struct A<T>
where T : Trait,
T : Add<T::Item>
//~^ ERROR cycle detected
//~| ERROR associated type `Item` not found for `T`
{
data: T
}
@@ -11,13 +11,6 @@ note: cycle used when processing `A`
LL | T : Add<T::Item>
| ^^^^^^^

error[E0220]: associated type `Item` not found for `T`
--> $DIR/cycle-projection-based-on-where-clause.rs:17:19
|
LL | T : Add<T::Item>
| ^^^^^^^ associated type `Item` not found

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors have detailed explanations: E0220, E0391.
For more information about an error, try `rustc --explain E0220`.
For more information about this error, try `rustc --explain E0391`.
@@ -1,6 +1,5 @@
trait T : Iterator<Item=Self::Item>
//~^ ERROR cycle detected
//~| ERROR associated type `Item` not found for `Self`
{}

fn main() {}
@@ -3,7 +3,6 @@ error[E0391]: cycle detected when computing the supertraits of `T`
|
LL | / trait T : Iterator<Item=Self::Item>
LL | |
LL | |
LL | | {}
| |__^
|
@@ -13,17 +12,9 @@ note: cycle used when collecting item types in top-level module
|
LL | / trait T : Iterator<Item=Self::Item>
LL | |
LL | |
LL | | {}
| |__^

error[E0220]: associated type `Item` not found for `Self`
--> $DIR/issue-20772.rs:1:25
|
LL | trait T : Iterator<Item=Self::Item>
| ^^^^^^^^^^ associated type `Item` not found

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors have detailed explanations: E0220, E0391.
For more information about an error, try `rustc --explain E0220`.
For more information about this error, try `rustc --explain E0391`.
@@ -5,6 +5,5 @@ trait Trait {

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

fn main() { }
@@ -11,13 +11,6 @@ note: cycle used when processing `foo`
LL | fn foo<T: Trait<A = T::B>>() { }
| ^^^^

error[E0220]: associated type `B` not found for `T`
--> $DIR/issue-21177.rs:6:21
|
LL | fn foo<T: Trait<A = T::B>>() { }
| ^^^^ associated type `B` not found

error: aborting due to 2 previous errors
error: aborting due to previous error

Some errors have detailed explanations: E0220, E0391.
For more information about an error, try `rustc --explain E0220`.
For more information about this error, try `rustc --explain E0391`.
@@ -1,5 +1,4 @@
const A: i32 = B; //~ ERROR cycle detected
//~^ ERROR cycle detected

const B: i32 = A;

@@ -10,36 +10,18 @@ note: ...which requires checking which parts of `A` are promotable to static...
LL | const A: i32 = B;
| ^
note: ...which requires const checking if rvalue is promotable to static `B`...
--> $DIR/issue-23302-3.rs:4:1
--> $DIR/issue-23302-3.rs:3:1
|
LL | const B: i32 = A;
| ^^^^^^^^^^^^^^^^^
note: ...which requires checking which parts of `B` are promotable to static...
--> $DIR/issue-23302-3.rs:4:16
--> $DIR/issue-23302-3.rs:3:16
|
LL | const B: i32 = A;
| ^
= note: ...which again requires const checking if rvalue is promotable to static `A`, completing the cycle
= note: cycle used when running analysis passes on this crate

error[E0391]: cycle detected when processing `A`
--> $DIR/issue-23302-3.rs:1:16
|
LL | const A: i32 = B;
| ^
|
note: ...which requires processing `B`...
--> $DIR/issue-23302-3.rs:4:16
|
LL | const B: i32 = A;
| ^
= note: ...which again requires processing `A`, completing the cycle
note: cycle used when processing `A`
--> $DIR/issue-23302-3.rs:1:1
|
LL | const A: i32 = B;
| ^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
error: aborting due to previous error

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

0 comments on commit e77096b

Please sign in to comment.
You can’t perform that action at this time.