Closed
Description
Prior to rustc 1.19.0-nightly (f1140a331 2017-05-08)
, rusttype 0.2.1 could compile okay. Now it gives the following error:
Compiling rusttype v0.2.1
error[E0391]: unsupported cyclic reference between types/traits detected
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:5
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^^^^^^^^^^^^ cyclic reference
|
note: the cycle begins when processing `support::bst::node::LeafNode::keys`...
# ... full output in the Details section below ...
Steps to reproduce:
cargo init mytest
cd mytest
echo 'rusttype = "0.2.1"' >> Cargo.toml
cargo build
A minimal example that reproduces this (playpen's nightly is still on f4209651e 2017-05-05
so it compiles):
use std::ops::Mul;
const C: usize = 1;
const CAPACITY: usize = 1 * C;
struct A<X> {
f: [X; CAPACITY],
}
struct B<T> {
f: T,
}
impl<T> Mul for B<T> {
type Output = Self;
fn mul(self, _rhs: B<T>) -> Self::Output {
self
}
}
impl<T> Mul<usize> for B<T> {
type Output = Self;
fn mul(self, _rhs: usize) -> Self::Output {
self
}
}
fn main() {
let a = A { f: [1] };
let _ = B { f: a };
}
I have no idea why that reproduces it; I broke my brain coming up with that code.
My rustc version:
$ rustc --version --verbose
rustc 1.19.0-nightly (f1140a331 2017-05-08)
binary: rustc
commit-hash: f1140a33176a5fb2e91e26ea3ae42a834dd9bfdf
commit-date: 2017-05-08
host: x86_64-pc-windows-msvc
release: 1.19.0-nightly
LLVM version: 4.0
This is also seen on linux and OS X, such as in this travis build
$ cargo build
Updating registry `https://github.com/rust-lang/crates.io-index`
Compiling odds v0.2.25
Compiling linked-hash-map v0.0.10
Compiling byteorder v0.4.2
Compiling stb_truetype v0.2.1
Compiling nodrop v0.1.9
Compiling arrayvec v0.3.23
Compiling rusttype v0.2.1
error[E0391]: unsupported cyclic reference between types/traits detected
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:5
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^^^^^^^^^^^^ cyclic reference
|
note: the cycle begins when processing `support::bst::node::LeafNode::keys`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:5
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^^^^^^^^^^^^
note: ...which then requires const-evaluating `support::bst::node::LeafNode::{{initializer}}`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:15
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^
note: ...which then requires processing `support::bst::node::LeafNode::{{initializer}}`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:15
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^
note: ...which then requires processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:15
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^
note: ...which then requires processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:44:1
|
44 | pub const CAPACITY: usize = 2 * B - 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:44:1
|
44 | pub const CAPACITY: usize = 2 * B - 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires coherence checking all impls of trait `std::ops::Mul`...
note: ...which then requires processing `geometry::Vector`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\geometry.rs:27:1
|
27 | / pub struct Vector<N> {
28 | | pub x: N,
29 | | pub y: N
30 | | }
| |_^
note: ...which then requires computing the variances for items in this crate...
= note: ...which then again requires processing `support::bst::node::LeafNode::keys`, completing the cycle.
error[E0391]: unsupported cyclic reference between types/traits detected
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:15
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^ cyclic reference
|
note: the cycle begins when processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:47:15
|
47 | keys: [K; CAPACITY],
| ^^^^^^^^
note: ...which then requires processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:44:1
|
44 | pub const CAPACITY: usize = 2 * B - 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:44:1
|
44 | pub const CAPACITY: usize = 2 * B - 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires coherence checking all impls of trait `std::ops::Mul`...
note: ...which then requires processing `geometry::Vector`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\geometry.rs:27:1
|
27 | / pub struct Vector<N> {
28 | | pub x: N,
29 | | pub y: N
30 | | }
| |_^
note: ...which then requires computing the variances for items in this crate...
note: ...which then requires processing `support::bst::node::LeafNode::vals`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:5
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^^^^^^^^^^^^
note: ...which then requires const-evaluating `support::bst::node::LeafNode::{{initializer}}`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:15
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^
note: ...which then requires processing `support::bst::node::LeafNode::{{initializer}}`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:15
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^
= note: ...which then again requires processing `support::bst::node::CAPACITY`, completing the cycle.
error[E0391]: unsupported cyclic reference between types/traits detected
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:44:1
|
44 | pub const CAPACITY: usize = 2 * B - 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ cyclic reference
|
note: the cycle begins when processing `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:44:1
|
44 | pub const CAPACITY: usize = 2 * B - 1;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires coherence checking all impls of trait `std::ops::Mul`...
note: ...which then requires processing `geometry::Vector`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\geometry.rs:27:1
|
27 | / pub struct Vector<N> {
28 | | pub x: N,
29 | | pub y: N
30 | | }
| |_^
note: ...which then requires computing the variances for items in this crate...
note: ...which then requires processing `support::bst::node::LeafNode::vals`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:5
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^^^^^^^^^^^^
note: ...which then requires const-evaluating `support::bst::node::LeafNode::{{initializer}}`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:15
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^
note: ...which then requires const-evaluating `support::bst::node::CAPACITY`...
--> C:\Users\azrie\.cargo\registry\src\github.com-1ecc6299db9ec823\rusttype-0.2.1\src\support\bst\node.rs:48:15
|
48 | vals: [V; CAPACITY],
| ^^^^^^^^
= note: ...which then again requires processing `support::bst::node::CAPACITY`, completing the cycle.
error: aborting due to 3 previous errors
error: Could not compile `rusttype`.
To learn more, run the command again with --verbose.