-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
check_type_length_limit
is broken
#125460
Labels
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
May 23, 2024
Only checking this for instances in monomorphization seems also insufficient to handle all cases where this causes issues. |
lcnr
added
the
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
label
May 24, 2024
rustbot
added
the
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
label
May 24, 2024
This regressed in 1.47 |
lcnr
added
P-medium
Medium priority
and removed
I-prioritize
Issue: Indicates that prioritization has been requested for this issue.
labels
May 24, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 24, 2024
…=<try> Re-implement a type-size based limit r? lcnr Fixes rust-lang#125460
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 24, 2024
…=<try> Re-implement a type-size based limit r? lcnr Fixes rust-lang#125460
saethlin
added
T-types
Relevant to the types team, which will review and decide on the PR/issue.
C-bug
Category: This is a bug.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
May 24, 2024
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
May 31, 2024
…=<try> Re-implement a type-size based limit r? lcnr Fixes rust-lang#125460
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 12, 2024
…=<try> Re-implement a type-size based limit r? lcnr Fixes rust-lang#125460
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 12, 2024
…=<try> Re-implement a type-size based limit r? lcnr Fixes rust-lang#125460
flip1995
pushed a commit
to flip1995/rust
that referenced
this issue
Jul 11, 2024
…=lcnr Re-implement a type-size based limit r? lcnr This PR reintroduces the type length limit added in rust-lang#37789, which was accidentally made practically useless by the caching changes to `Ty::walk` in rust-lang#72412, which caused the `walk` function to no longer walk over identical elements. Hitting this length limit is not fatal unless we are in codegen -- so it shouldn't affect passes like the mir inliner which creates potentially very large types (which we observed, for example, when the new trait solver compiles `itertools` in `--release` mode). This also increases the type length limit from `1048576 == 2 ** 20` to `2 ** 24`, which covers all of the code that can be reached with craterbot-check. Individual crates can increase the length limit further if desired. Perf regression is mild and I think we should accept it -- reinstating this limit is important for the new trait solver and to make sure we don't accidentally hit more type-size related regressions in the future. Fixes rust-lang#125460
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jul 14, 2024
…, r=jackh726 Gate the type length limit check behind a nightly flag Effectively disables the type length limit by introducing a `-Zenforce-type-length-limit` which defaults to **`false`**, since making the length limit actually be enforced ended up having a worse fallout than expected. We still keep the code around, but the type length limit attr is now a noop (except for its usage in some diagnostics code?). r? `@lcnr` -- up to you to decide what team consensus we need here since this reverses an FCP decision. Reopens rust-lang#125460 (if we decide to reopen it or keep it closed) Effectively reverses the decision FCP'd in rust-lang#125507 Closes rust-lang#127346
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-bug
Category: This is a bug.
P-medium
Medium priority
regression-from-stable-to-stable
Performance or correctness regression from one stable version to another.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
The function was added to prevent hangs during codegen if there are infinite expansions which result in exponential blowup. It does that by computing an estimate of the complexity of the type and checking whether it's above a limit:
rust/compiler/rustc_monomorphize/src/collector.rs
Lines 632 to 641 in 9c8a58f
This worked quite well, until we changed the
walk
to use caching in #72412. It looks like nobody noticed its effect on the type length limit in this PR.With this the type length estimate grows linearly while the "true" size of the type is still exponential, causing the limit to never be reached in the cases it's intended for. The only remaining test which hits the limit arbitrarily sets it to
8
and uses a linearly recursive type:rust/tests/ui/type_length_limit.rs
Lines 10 to 30 in 9c8a58f
The text was updated successfully, but these errors were encountered: