Closed Mark-Simulacrum closed 5 years ago
A fix for conch-runtime
has been published to crates.io, but build times will suffer due to #60846
I've been told that this is due to #60444. What's strange about the fuzzy-pickles regression is that it only appears when running rustdoc. Why would running rustdoc have different behavior for evaluating these bounds?
Maybe it arises from rustdoc's attempt to determine what traits to list as implemented? I don't think rustc
itself will attempt to check if a type implements Send
/Sync
until you actually try to use a type in a context requiring one of those, but rustdoc
certainly does check that for every struct/enum/union definition it documents, right?
Update: of course, if that is indeed the case, then that is a not-great failure mode for rustdoc
vs rustc
...
Update 2: I think I have validated the above hypothesis for the cause. I tried adding the line below to ast.rs
in fuzzy-pickles:
const _ASSERT_FILE_IS_SEND: () = { struct S<T: Send>(Option<T>); S::<File>(None); () };
which acts as a way to force rustc
to check up front whether a type is Send
.
(BTW adding #![recursion_limit="128"]
, as suggested by the diagnostic, does at least seem to address the problem for fuzzy-pickles
....)
@shepmaster rustdoc does some different access patterns, especially around traits -- for example, it wants to print out whether or not a type is Send
, even if there is no need for that (i.e., the crate doesn't ever do anything that would require Send
).
So: I'm working on addressing the performance hurdles here, but I think that the "correctness side" is correct, and we ought not to revert it. The only real question is whether to issue a warning period. I'm not really sure how to go about doing that -- it may be possible, I'd have to think on it. I'd prefer to focus on improving the performance, however.
Creating a sequence of 63 nested structs triggers this problem:
N=63; (echo "struct S0;"; for i in $(seq 0 $N); do echo "struct S$(( $i + 1 ))(S${i});"; done; echo "fn is_send<T: Send>() {}"; echo "fn main() { is_send::<S${N}>(); }") > long.rs
$ rustc +nightly long.rs
error[E0275]: overflow evaluating the requirement `S0: std::marker::Send`
--> long.rs:67:13
|
67 | fn main() { is_send::<S63>(); }
| ^^^^^^^^^^^^^^
|
= help: consider adding a `#![recursion_limit="128"]` attribute to your crate
= note: required because it appears within the type `S1`
= note: required because it appears within the type `S2`
= note: required because it appears within the type `S3`
= note: required because it appears within the type `S4`
= note: ... blah blah blah ...
= note: required because it appears within the type `S61`
= note: required because it appears within the type `S62`
= note: required because it appears within the type `S63`
note: required by `is_send`
--> long.rs:66:1
|
66 | fn is_send<T: Send>() {}
| ^^^^^^^^^^^^^^^^^^^^^
(This may be an instance of the umbrella issue #61960 .)
I have confirmed that that the fuzzy-pickles issue was resolved somewhere between nightly-2019-06-16 (0dc9e9c10) and nightly-2019-06-17 (4edff843d) which is enough to convince me that PR #61754 probably resolved the problem here for fuzzy-pickles.
@shepmaster By the way, I'm not sure your long.rs
demonstrates the regression here. From what I can tell, that code does not involve a cyclic structure that we end up throwing out (and would not have previously thrown out).
did you double-check that your long.rs
actually compiles on stable? From what I can tell, the stable rustc
(rustc 1.35.0 (3c235d560 2019-05-20)) issues the same overflow error diagnostic.
I have confirmed that that the conch-runtime issue was resolved somewhere between nightly-2019-06-16 (0dc9e9c) and nightly-2019-06-17 (4edff84) which is enough to convince me that PR #61754 probably resolved the problem here for conch-runtime
did you double-check that your
long.rs
actually compiles on stable
😞 I did not. I apologize for the noise!
I have confirmed that the lang-c crate issue was resolved between nightly-2019-06-16 and nightly-2019-06-17.
I am not able to reproduce the problems from kailua_langsvr -- everything seems to build fine when I checkout the particular commit, both with today's nightly and with nightly-2019-06-16. I tried doing: carog check, cargo build, and cargo doc.
This all seems like evidence that the regression is addressed by #61754.
(So the only question remaining is whether to backport, a question which will be addressed this week; see discussion on the PR itself)
(I'm going to close this as resolved, as the bug is fixed on nightly, and the decision of whether to backport PR #61754 will be made independently of whether this issue is closed or open.)
I think you meant #61754
root: fuzzy-pickles - 1 detected crates which regressed due to this; cc @shepmaster -- resolved
root: lang-c - 1 detected crates which regressed due to this; cc @vickenty -- resolved
root: conch-runtime - 1 detected crates which regressed due to this; cc @ipetkov -- resolved
root: kailua_langsvr - 1 detected crates which regressed due to this; cc @lifthrasiir -- cannot reproduce, appears fixed?