Skip to content

Update auto-deref recursion_limit example #986

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
Mar 21, 2021
Merged

Conversation

nikic
Copy link
Contributor

@nikic nikic commented Mar 21, 2021

This updates the auto-deref recursion_limit example for rust-lang/rust#82834. Previously this actually hit the recursion limit while evaluating the Freeze bound, not during auto-deref. The current example only needs one level of deref to reach the argument type. This adds one more level of nesting, so that two derefs are actually needed, and recursion_limit is hit during auto-deref and not sometime later:

error[E0055]: reached the recursion limit while auto-dereferencing `&{integer}`
 --> test14.rs:5:19
  |
5 |     (|_: &u8| {})(&&&1);
  |                   ^^^^ deref recursion limit reached
  |
  = help: consider adding a `#![recursion_limit="2"]` attribute to your crate (`test14`)

Previously:

error[E0275]: overflow evaluating the requirement `(): marker::Freeze`
  |
  = help: consider adding a `#![recursion_limit="2"]` attribute to your crate (`test14`)
  = note: required because it appears within the type `[closure@test14.rs:5:5: 5:18]`

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Feel free to update the submodule in your PR, let me know if you need any help with that.

@ehuss ehuss merged commit d10a0af into rust-lang:master Mar 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants