Skip to content

Conversation

stepancheg
Copy link
Contributor

@stepancheg stepancheg commented Sep 17, 2025

Fixes #145561.

r? @Noratrieb

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

rustbot commented Sep 17, 2025

Noratrieb is not on the review rotation at the moment.
They may take a while to respond.

@rustbot rustbot assigned ibraheemdev and unassigned Noratrieb Sep 17, 2025
@Noratrieb
Copy link
Member

r? libs-api

@rustbot rustbot added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Sep 23, 2025
@rustbot rustbot assigned dtolnay and unassigned ibraheemdev Sep 23, 2025
Comment on lines 26 to 27
/// `Display` for an error should not typically include information from `Error::source()`:
/// error stack can be printed by external utilities.
Copy link
Member

Choose a reason for hiding this comment

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

Standard library documentation should articulate how the standard library is intended to be used. To me "error stack can be printed by external utilities" reads like "authors of external utilities will intuit the intended way to work with this API" which is less than clear if the reader is the person wanting to write external utilities, and less than correct in implying that the use of an external utility is necessary for anyone to whom the correct way is not intuitive.

Maybe something along these lines: "In error types that wrap an underlying error, the underlying error should either be returned by the outer error's Error::source(), or rendered by the outer error's Display, but not both. Doing both will cause duplication of that error message by code that traverse the chain of causes of an error to print each one, which is typical in error reporting utilities."

@rustbot rustbot 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 Sep 23, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@stepancheg stepancheg requested a review from dtolnay September 24, 2025 19:04
@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 Sep 24, 2025
@dtolnay
Copy link
Member

dtolnay commented Sep 24, 2025

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Sep 24, 2025

📌 Commit a9554b4 has been approved by dtolnay

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 Sep 24, 2025
bors added a commit that referenced this pull request Sep 24, 2025
Rollup of 7 pull requests

Successful merges:

 - #146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - #146679 (Clarify Display for error should not include source)
 - #146753 (Improve the pretty print of UnstableFeature clause)
 - #146894 (Improve derive suggestion of const param)
 - #146950 (core: simplify `CStr::default()`)
 - #146958 (Fix infinite recursion in Path::eq with String)
 - #146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Sep 25, 2025
Rollup of 7 pull requests

Successful merges:

 - #146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - #146679 (Clarify Display for error should not include source)
 - #146753 (Improve the pretty print of UnstableFeature clause)
 - #146894 (Improve derive suggestion of const param)
 - #146950 (core: simplify `CStr::default()`)
 - #146958 (Fix infinite recursion in Path::eq with String)
 - #146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 0ab9386 into rust-lang:master Sep 25, 2025
10 checks passed
@rustbot rustbot added this to the 1.92.0 milestone Sep 25, 2025
rust-timer added a commit that referenced this pull request Sep 25, 2025
Rollup merge of #146679 - stepancheg:error-display-source, r=dtolnay

Clarify Display for error should not include source

Fixes #145561.

r? `@Noratrieb`
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Sep 29, 2025
Rollup of 7 pull requests

Successful merges:

 - rust-lang/rust#146556 (Fix duration_since panic on unix when std is built with integer overflow checks)
 - rust-lang/rust#146679 (Clarify Display for error should not include source)
 - rust-lang/rust#146753 (Improve the pretty print of UnstableFeature clause)
 - rust-lang/rust#146894 (Improve derive suggestion of const param)
 - rust-lang/rust#146950 (core: simplify `CStr::default()`)
 - rust-lang/rust#146958 (Fix infinite recursion in Path::eq with String)
 - rust-lang/rust#146971 (fix ICE in writeback due to bound regions)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should Display for Error include source?
6 participants