Skip to content

increase AUTODEREF_RECURSION_LIMIT to 20 #19004

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

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

teoxoy
Copy link
Contributor

@teoxoy teoxoy commented Jan 22, 2025

The limit was introduced in #1408 (comment) to avoid infinite cycles but it effectively caps the number of derefs to 10. Types like ID3D12Device14 from the windows crate run into this because it derefs to ID3D12Device13, 13 to 12 and so on. Increasing it to 20 is a quick fix; a better cycle detection method would be nicer long term.

The limit was introduced in rust-lang#1408 (comment) to avoid infinite cycles but it effectively caps the number of derefs to 10. Types like `ID3D12Device14` from the `windows` crate run into this because it derefs to `ID3D12Device13`, 13 to 12 and so on. Increasing it to 20 is a quick fix; a better cycle detection method would be nicer long term.
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jan 22, 2025
@ChayimFriedman2
Copy link
Contributor

The compiler also doesn't detect cycles and instead has a limit, although the compiler's limit is configurable.

@ChayimFriedman2
Copy link
Contributor

Thanks!

@teoxoy
Copy link
Contributor Author

teoxoy commented Jan 22, 2025

Hm, the compiler's limit seems to be 128 by default: https://github.com/rust-lang/rust/blob/dee7d0e730a3a3ed98c89dd33c4ac16edc82de8a/compiler/rustc_middle/src/middle/limits.rs#L39

20 is probably fine for now, if others run into this it can be increased further.

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Jan 22, 2025
Merged via the queue into rust-lang:master with commit 582af7e Jan 22, 2025
9 checks passed
@teoxoy teoxoy deleted the patch-1 branch January 23, 2025 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants