Skip to content
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

Items defined in a function inherit the stability of the function and trigger lint checker #17488

Closed
elinorbgr opened this issue Sep 23, 2014 · 1 comment · Fixed by #19029
Closed

Comments

@elinorbgr
Copy link
Contributor

Example code:

#[deprecated = "You shouldn't double 42"]
fn double_of_42() -> uint {

    fn compute_42() -> uint {
        42u
    }

    2*compute_42()
}

generates the warning:

<anon>:8:7: 8:17 warning: use of deprecated item: You shouldn't double 42, #[warn(deprecated)] on by default
<anon>:8     2*compute_42()
               ^~~~~~~~~~

Which is quite confusing as the warning message is hardly related to the code warned against.
And I would not expect a warning being generated in such a case.

@alexcrichton
Copy link
Member

Interesting! It appears that the inheritance of stability levels does... interesting things here! cc @aturon

lnicola pushed a commit to lnicola/rust that referenced this issue Jul 11, 2024
…=alibektas

minor : Fix duplicate snippets showing up on hover.

With each `config::apply_change` duplicate configs were being added.
Now we first drain the vec that holds these and then start adding. This fixes rust-lang#17485
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 a pull request may close this issue.

2 participants