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

Document the Termination trait's impls #96819

Closed

Conversation

mattheww
Copy link
Contributor

@mattheww mattheww commented May 7, 2022

The library docs should be describing what its implementations of Termination::report do, because this is behaviour we intend users to rely on.

There is some related discussion in rust-lang/reference#1196.

@rust-highfive
Copy link
Collaborator

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 r? rust-lang/libs-api @rustbot label +T-libs-api -T-libs to request review from a libs-api team reviewer. 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

@rustbot rustbot added the T-libs Relevant to the library team, which will review and decide on the PR/issue. label May 7, 2022
@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @kennytm (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 7, 2022
/// If the result is `Ok`, returns `ExitCode::SUCCESS`.
///
/// If the result is `Err`, writes the [`fmt::Debug`] representation of
/// the error value to [`io::stderr`] and returns `ExitCode::FAILURE`.
Copy link
Member

Choose a reason for hiding this comment

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

I don't want to guarantee this behavior, because I expect us to change it in the future.

In particular, if we add the "generic member access" mechanism, we could then change this trait implementation to attempt to retrieve an ExitCode from E, and use that if available.

Comment on lines +2147 to +2148
/// Writes the [`fmt::Debug`] representation of the error value to
/// [`io::stderr`] and returns `ExitCode::FAILURE`.
Copy link
Member

Choose a reason for hiding this comment

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

As above, I expect us to change this in the future.

Comment on lines +2163 to +2164
/// Writes the [`fmt::Debug`] representation of the error value to
/// [`io::stderr`] and returns `ExitCode::FAILURE`.
Copy link
Member

Choose a reason for hiding this comment

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

As above, I expect us to change this in the future.

@joshtriplett
Copy link
Member

cc @yaahc

@mattheww
Copy link
Contributor Author

mattheww commented May 7, 2022

I'd recommend that someone should document this lack of guarantee, then, otherwise it seems likely that people will rely on the current behaviour.

(Well, to be honest I think people will rely on the current behaviour whatever the documentation says.)

@mattheww mattheww closed this May 7, 2022
@joshtriplett
Copy link
Member

@mattheww I'd actually like to see a form of this PR go in; I just think it needs a little bit more information suggesting that the behavior may change. Would you be up for adding that language?

@joshtriplett joshtriplett reopened this May 8, 2022
@mattheww
Copy link
Contributor Author

mattheww commented May 8, 2022

I would not. That text will have to be written by someone who knows what the intended semantics are, and I see no value in it passing through my fingers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants