-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression in usable type complexity: overflow representing the type ...
#71359
Comments
Maybe #70896? |
I've built cargo with current master (2dc5b60) with the commits ce8abc6, 2c4cffd, 8aac107 and 859b8da reverted. (Workflow, just to ensure I don't get things wrong methodically as this is the first time I build rust: Clone rust recursively, While on master the error is present, and vanishes with the reverts. [edit: For context, this confirms Jonas' assumption that #70896 caused the regression] |
Assigning |
cc @cuviper |
Reading up on the archived convesation, I've tried with an increased recursion limit. Setting the recursion limit inside the typed_html crate up did the trick; I'll bisect around a bit there to see how much the limit demands have raised. If this is deemed acceptable breakage, it might be helpful to have an error message in the overflow message that says which crate is being compiled, and that the recursion limit should be incremented there. |
For the case of the typed-html crate, the recursion limit transition is between
(Note I had to clean some This indicates that the usual recommendation to double the recursion limit is valid for this case (as was to be expected). One (not sure if relevant, but maybe) lesson learned from the process is that sometimes when you hit the limit edge-on (as it is with typed-html, where the limit of 128 was 2 short of working), you get short error outputs that don't indicate the large type (as was the original
when 10 below the limit, nesting deeper with greater depth). |
Changes[1] to the Rust standard library are affecting[2] the nesting size of types to the point where typed-html can not be built on nightly. This resolves the issue by increasing the acceptable recursion depth for the crate. [1]: rust-lang/rust#70896 [1]: rust-lang/rust#71359 Closes: bodil#112
Changes[1] to the Rust standard library are affecting[2] the nesting size of types to the point where typed-html can not be built on nightly. This resolves the issue by increasing the acceptable recursion depth for the crate. [1]: rust-lang/rust#70896 [2]: rust-lang/rust#71359 Closes: bodil#112
Wow, that's a big chain! It's constructed in impl<T: Send> Events<T> {
pub fn iter(&self) -> impl Iterator<Item = (&'static str, &T)> {
iter::empty()
$(
.chain(
self.$name.iter()
.map(|value| (stringify!($name), value))
)
)*
} And that macro is invoked here with 63 repetitions! Since #70896 added a new I'd be curious to know if the change had any positive effect on that mega- Or if they care to try avoiding such a huge chain, I expect it would work perfectly well for that method to just push to a local |
Using `vec::IntoIter` is much simpler than a deeply nested `Chain`, compiling faster and avoiding the deeper recursion limit reported in [rust#71359]. [rust#71359]: rust-lang/rust#71359.
Using `vec::IntoIter` is much simpler than a deeply nested `Chain`, compiling faster and avoiding the deeper recursion limit reported in [rust#71359](rust-lang/rust#71359).
I submitted this as bodil/typed-html#117. However, I also see that the repo declares it is not currently maintained. |
I won't speculate here about the vec improvements that could be made (that belongs in bodil/typed-html#117), but had a look at the change from 2020-04-09 to 2020-04-10 nightlies on an example I built into my application that actually uses the deeply nested chaining event iterator (as it was not actually used in any examples I found). Given that it fails to compile in finite time (well, 15 minutes) on the 2020-04-09 nightly and works well on the 2020-04-10 one, that's all I can report but is a pretty vast improvement. All I see fit to do from there is speculate that other crates affected by this might have unbuildable code inside them as well, which might be a small pointer in the direction of allowing the regression (possibly with an enhanced error message). |
Using `vec::IntoIter` is much simpler than a deeply nested `Chain`, compiling faster and avoiding the deeper recursion limit reported in [rust#71359](rust-lang/rust#71359).
That apparent hang may be akin to #70749. I'm happy that the new |
Closed the crater-found regression issue (#71764) in favor of this one, they seem to be the same, though it's not 100% clear. |
This is really a |
Have similar issue, but cannot solve it with It worked fine, when all structures and traits were in a single file, but does not work, if I split it into modules. Single file: https://github.com/rsbt/rsbt/blob/8322411dc2a219216eb92ae8a9a06dce690acea0/rsbt-app/src/experiments.rs (here is App and Handler structs are in the same module). Broken revision: rsbt/rsbt@93f0073 (IncommingConnectionsManager is basically same idea as Handler before). I was able to make it working by removing Debug requirement. I do not need any specific recursion_limit if it is in the same file or does not have Debug requirement. |
@kilork is yours a regression, or a more general occurrence of that error? This specific issue was associated with a change in the |
@cuviper I do not think so. Checked with 1.40, it is the same error. I think it is just coincedence and another issue. |
The new |
I tried importing almost every version that was release. Every damn single one of them fails, for one reason or another. Is there any version that I can safely import while retaining html! macro? Could you recommend an alternative module? |
Started a Zulip thread here to discuss what to do with this issue: https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Type.20complexity.20regression/near/249126680 |
Reassigning from compiler, as there's not much we can do in the library. We'll leave it up to the compiler team to decide on a possible solution, or close otherwise. |
I tried building the iron example of typed-html (version 810fc820, but it's not changing frequently) the code is heavy with (partially recursive) generic types.
With the latest beta (1.43) or stable (1.42), builds succeed; with nightly, they fail with:
The iron example is comparatively simple typed-html usage. I've originally observed the same kind of regression in a game that uses typed-html.
Meta
This might be an occurrence of #32498; the behavior changing from stable/beta to nightly indicates a new issue and is thus reported anew.
rustc +nightly --version --verbose
:(Running with RUST_BACKTRACE does not change the output.)
Bisection results
I'm running
cargo bisect-rustc
on the code, which has narrowed it down to a regression in nightly-2020-04-10. I'll update this with a more detailled bisection result when it's ready, but that might be a while.The text was updated successfully, but these errors were encountered: