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

Enable ELIDED_LIFETIMES_IN_PATHS lint in doctests for the compiler/libstd #106086

Closed
jyn514 opened this issue Dec 23, 2022 · 11 comments · Fixed by #106621
Closed

Enable ELIDED_LIFETIMES_IN_PATHS lint in doctests for the compiler/libstd #106086

jyn514 opened this issue Dec 23, 2022 · 11 comments · Fixed by #106621
Assignees
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@jyn514
Copy link
Member

jyn514 commented Dec 23, 2022

We should enable https://doc.rust-lang.org/beta/nightly-rustc/rustc_lint/builtin/static.ELIDED_LIFETIMES_IN_PATHS.html globally in rustc, I would be a fan of that change to make sure we enforce LabelText<'_> over LabelText.

rust/src/bootstrap/builder.rs

Lines 1662 to 1667 in f94c926

// When extending this list, add the new lints to the RUSTFLAGS of the
// build_bootstrap function of src/bootstrap/bootstrap.py as well as
// some code doesn't go through this `rustc` wrapper.
lint_flags.push("-Wrust_2018_idioms");
lint_flags.push("-Wunused_lifetimes");
lint_flags.push("-Wsemicolon_in_expressions_from_macros");
would be the place to add that.

Originally posted by @compiler-errors in #105975 (comment)

@jyn514 jyn514 added E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels Dec 23, 2022
@atamakahere-git
Copy link

I'll try to do it, It'll take some time to understand, though a little more explanation would be helpful.

@jyn514
Copy link
Member Author

jyn514 commented Dec 24, 2022

@tanveerraza789 what sort of explanation are you looking for? There's an overview of bootstrap and what it does on https://rustc-dev-guide.rust-lang.org/building/bootstrapping.html, but you don't need to know everything to start working on this issue :)

The important context for this issue is that bootstrap is a build system that wraps cargo and builds the compiler and standard library; I think we should set this lint for both, which happens automatically if you put it next to the other lints I linked. I expect the hardest part to be actually fixing the lints, there will be a lot of different places to update.

@atamakahere-git
Copy link

Okay I understood, Thanks.

@dmezh
Copy link

dmezh commented Dec 27, 2022

@tanveerraza789 I was wondering if you'd like to claim this issue or if it's free to work on. Thanks 😄

@atamakahere-git
Copy link

@dmezh Sure, you can claim.
I've been experimenting with the lints but I'm not able to get desired results right now. Maybe you can get a lead.

@dmezh
Copy link

dmezh commented Dec 27, 2022

@rustbot claim

@compiler-errors
Copy link
Member

Actually, this lint is already enabled because we have -Wrust_2018_idioms, and it's a member of that lint group. The only reason the code in the issue that @jyn514 had linked didn't trigger was because it was in a doc block.

I don't think this issue is actionable.

@dmezh
Copy link

dmezh commented Dec 27, 2022

@compiler-errors I did enable it and there were no new warnings at all, so that makes sense.

@atamakahere-git
Copy link

Same happened with me, so ya.

@jyn514
Copy link
Member Author

jyn514 commented Dec 27, 2022

Hmm, ok - there's another attribute you can pass to enable warnings in doctests:
https://doc.rust-lang.org/nightly/rustdoc/write-documentation/documentation-tests.html#showing-warnings-in-doctests

but yeah this is less important if it's only in doctests and not the compiler proper.

@jyn514 jyn514 changed the title Enable ELIDED_LIFETIMES_IN_PATHS lint globally in rustc Enable ELIDED_LIFETIMES_IN_PATHS lint in doctests for the compiler/libstd Jan 4, 2023
@onur-ozkan
Copy link
Member

@rustbot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-cleanup Category: PRs that clean code up or issues documenting cleanup. E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants