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 rust_2018_idioms lint group for doctests #106621

Merged

Conversation

onur-ozkan
Copy link
Member

@onur-ozkan onur-ozkan commented Jan 9, 2023

With this change, rust_2018_idioms lint group will be enabled for compiler/libstd doctests.

Resolves #106086
Resolves #99144

Signed-off-by: ozkanonur [email protected]

@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2023

r? @m-ou-se

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 9, 2023
@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2023

Hey! It looks like you've submitted a new PR for the library teams!

If this PR contains changes to any rust-lang/rust public library APIs then please comment with @rustbot label +T-libs-api -T-libs to tag it appropriately. If this PR contains changes to any unstable APIs please edit the PR description to add a link to the relevant API Change Proposal or create one if you haven't already. If you're unsure where your change falls no worries, just leave it as is and the reviewer will take a look and make a decision to forward on if necessary.

Examples of T-libs-api changes:

  • Stabilizing library features
  • Introducing insta-stable changes such as new implementations of existing stable traits on existing stable types
  • Introducing new or changing existing unstable library APIs (excluding permanently unstable features / features without a tracking issue)
  • Changing public documentation in ways that create new stability guarantees
  • Changing observable runtime behavior of library APIs

src/librustdoc/doctest.rs Outdated Show resolved Hide resolved
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Jan 9, 2023
@onur-ozkan onur-ozkan force-pushed the enable-elided-lifetimes-for-doctests branch from c25110c to 91178d2 Compare January 9, 2023 15:03
src/librustdoc/doctest.rs Outdated Show resolved Hide resolved
@rust-log-analyzer

This comment has been minimized.

@onur-ozkan

This comment was marked as resolved.

@jyn514
Copy link
Member

jyn514 commented Jan 9, 2023

@ozkanonur you should fix the warnings - if it's a lot of effort, we can split it up by crate on the original issue and ask for volunteers to help fix the issues.

@jyn514 jyn514 assigned jyn514 and unassigned m-ou-se Jan 9, 2023
@jyn514 jyn514 added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 9, 2023
@onur-ozkan onur-ozkan force-pushed the enable-elided-lifetimes-for-doctests branch from 4580785 to 910829f Compare January 10, 2023 07:00
@onur-ozkan onur-ozkan requested review from mejrs and jyn514 and removed request for Noratrieb and mejrs January 10, 2023 07:23
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

The compiler changes look good to me, but we should probably have someone from libs sign off on the changes to the public docs.

src/bootstrap/compile.rs Outdated Show resolved Hide resolved
@jyn514 jyn514 added A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools and removed T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 10, 2023
@jyn514
Copy link
Member

jyn514 commented Jan 10, 2023

r? libs

@cuviper Do the changes to the standard library documentation look like an improvement?

@rustbot rustbot assigned cuviper and unassigned jyn514 Jan 10, 2023
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-blocked Status: Marked as blocked ❌ on something else such as an RFC or other implementation work. labels Apr 27, 2023
/// fn test<'a, T: Debug>(x: &'a T) -> impl Debug + 'a {
/// x
/// }
/// ```
///
/// we will create a TAIT definition in the HIR like
///
/// ```
/// ```rust,ignore (pseudo-Rust)
Copy link
Member

Choose a reason for hiding this comment

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

If it was compiling before, why not add a hidden import instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

why not add a hidden import instead?

There are multiple errors, and one of them was:

error: unconstrained opaque type
 --> src/lib.rs:1488:30
  |
4 | type TestReturn<'a, 'x, T> = impl Debug + 'x;
  |                              ^^^^^^^^^^^^^^^
  |
  = note: `TestReturn` must be used in combination with a concrete type within the same item

/// type TestReturn<'a, T, 'x> = impl Debug + 'x
/// ```
///
/// and return a type like `TestReturn<'static, T, 'a>`, so that the function looks like:
///
/// ```rust
/// ```rust,ignore (pseudo-Rust)
Copy link
Member

Choose a reason for hiding this comment

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

If it was compiling before, why not add a hidden import instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's using dummy type defined on the previous doc-comment which is also ignored.

@@ -1038,7 +1038,7 @@ impl<'a> MethodDef<'a> {
/// `&self.x` because that might cause an unaligned ref. So for any trait
/// method that takes a reference, we use a local block to force a copy.
/// This requires that the field impl `Copy`.
/// ```
/// ```rust,ignore (example)
Copy link
Member

Choose a reason for hiding this comment

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

Why ignoring this one?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Mark-Simulacrum Mark-Simulacrum added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2023
@onur-ozkan onur-ozkan force-pushed the enable-elided-lifetimes-for-doctests branch from 9e811dd to 4e7c14f Compare May 6, 2023 21:12
@onur-ozkan
Copy link
Member Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels May 6, 2023
@Mark-Simulacrum
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented May 6, 2023

📌 Commit 4e7c14f has been approved by Mark-Simulacrum

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 6, 2023
@bors
Copy link
Contributor

bors commented May 8, 2023

⌛ Testing commit 4e7c14f with merge ea0c22e...

@bors
Copy link
Contributor

bors commented May 8, 2023

☀️ Test successful - checks-actions
Approved by: Mark-Simulacrum
Pushing ea0c22e to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label May 8, 2023
@bors bors merged commit ea0c22e into rust-lang:master May 8, 2023
@rustbot rustbot added this to the 1.71.0 milestone May 8, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (ea0c22e): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
4.5% [4.1%, 5.3%] 3
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-2.7% [-2.7%, -2.7%] 1
Improvements ✅
(secondary)
-3.5% [-5.5%, -2.4%] 4
All ❌✅ (primary) 2.7% [-2.7%, 5.3%] 4

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: missing data

@onur-ozkan onur-ozkan deleted the enable-elided-lifetimes-for-doctests branch May 8, 2023 09:16
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 15, 2023
Update doc for `PhantomData` to match code example

After rust-lang#106621, there is no longer a `T: 'a` annotation in the doc example, so update the text to match the code.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request May 15, 2023
Update doc for `PhantomData` to match code example

After rust-lang#106621, there is no longer a `T: 'a` annotation in the doc example, so update the text to match the code.
thomcc pushed a commit to tcdi/postgrestd that referenced this pull request Jul 18, 2023
Update doc for `PhantomData` to match code example

After rust-lang/rust#106621, there is no longer a `T: 'a` annotation in the doc example, so update the text to match the code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-docs Area: documentation for any part of the project, including the compiler, standard library, and tools merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Enable ELIDED_LIFETIMES_IN_PATHS lint in doctests for the compiler/libstd Run compiler doctests in CI