-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Unsupported cyclic reference when implementing CoerceUnsized for pointer to wrapper #41936
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Labels
A-type-system
Area: Type system
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
Comments
This might be fixed by #41913, do you know if the latest nightly contains it? EDIT: yes so it didn't get fixed. cc @nikomatsakis |
Present in latest nightly on playpen, |
Still repro. Error message, same as OP'serror: main function not found
error[E0391]: unsupported cyclic reference between types/traits detected
--> 1.rs:7:19
|
7 | struct LogDataBuf([u8;8]);
| ^^^^^^^ cyclic reference
|
note: the cycle begins when processing `LogDataBuf::0`...
--> 1.rs:7:19
|
7 | struct LogDataBuf([u8;8]);
| ^^^^^^^
note: ...which then requires const-evaluating `LogDataBuf::{{initializer}}`...
--> 1.rs:7:23
|
7 | struct LogDataBuf([u8;8]);
| ^
note: ...which then requires processing `LogDataBuf::{{initializer}}`...
--> 1.rs:7:23
|
7 | struct LogDataBuf([u8;8]);
| ^
note: ...which then requires coherence checking all impls of trait `std::ops::CoerceUnsized`...
note: ...which then requires processing `<impl at 1.rs:14:1: 14:90>`...
--> 1.rs:14:1
|
14| impl<T: ?Sized + marker::Unsize<U>, U: ?Sized> ops::CoerceUnsized<Aref<U>> for Aref<T> {}
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
note: ...which then requires processing `ArefInner`...
--> 1.rs:16:1
|
16| / struct ArefInner<T: ?Sized>
17| | {
18| | // Even with this field commented out, the error is raised.
19| | data: T,
20| | }
| |_^
note: ...which then requires computing the variances for items in this crate...
= note: ...which then again requires processing `LogDataBuf::0`, completing the cycle.
error: aborting due to previous error $ rustc -vV
rustc 1.19.0-nightly (e40beb3af 2017-05-11)
binary: rustc
commit-hash: e40beb3af162e676e40704854dd6547ee8d4cf60
commit-date: 2017-05-11
host: x86_64-apple-darwin
release: 1.19.0-nightly
LLVM version: 4.0 |
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
May 12, 2017
This seems both to be a safe, conservative choice, and it sidesteps the cycle in rust-lang#41936. Fixes rust-lang#41936.
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
May 12, 2017
…oerce-unsized-cycle, r=eddyb use equality in the coerce-unsized check This seems both to be a safe, conservative choice, and it sidesteps the cycle in rust-lang#41849. Note that, before I converted variance into proper queries, we were using a hybrid of subtyping and equality, due to the presence of a flag that forced invariance if variance had not yet been computed. (Also, Coerce Unsized is unstable.) Fixes rust-lang#41936. r? @eddyb
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
May 12, 2017
…oerce-unsized-cycle, r=eddyb use equality in the coerce-unsized check This seems both to be a safe, conservative choice, and it sidesteps the cycle in rust-lang#41849. Note that, before I converted variance into proper queries, we were using a hybrid of subtyping and equality, due to the presence of a flag that forced invariance if variance had not yet been computed. (Also, Coerce Unsized is unstable.) Fixes rust-lang#41936. r? @eddyb
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
May 15, 2017
This seems both to be a safe, conservative choice, and it sidesteps the cycle in rust-lang#41936. Fixes rust-lang#41936.
Mark-Simulacrum
added a commit
to Mark-Simulacrum/rust
that referenced
this issue
May 16, 2017
…oerce-unsized-cycle, r=eddyb use equality in the coerce-unsized check This seems both to be a safe, conservative choice, and it sidesteps the cycle in rust-lang#41849. Note that, before I converted variance into proper queries, we were using a hybrid of subtyping and equality, due to the presence of a flag that forced invariance if variance had not yet been computed. (Also, Coerce Unsized is unstable.) Fixes rust-lang#41936. r? @eddyb
nikomatsakis
added a commit
to nikomatsakis/rust
that referenced
this issue
May 23, 2017
This seems both to be a safe, conservative choice, and it sidesteps the cycle in rust-lang#41936. Fixes rust-lang#41936.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
Labels
A-type-system
Area: Type system
regression-from-stable-to-beta
Performance or correctness regression from stable to beta.
Encountered when forward-porting my kernel to latest nightly.
Implementing
CoerceUnsized
on a type that wraps a pointer to a wrapping type errors when there is also a struct that wraps an array in the same crate.Playground version
https://play.rust-lang.org/?gist=854452b1dea1fc197d3bd9d6b1848eed&version=nightly&backtrace=0
The text was updated successfully, but these errors were encountered: