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

Add missing examples for panicking objects #38123

Merged
merged 1 commit into from
Dec 7, 2016

Conversation

GuillaumeGomez
Copy link
Member

#[stable(feature = "panic_hooks", since = "1.10.0")]
pub fn location(&self) -> Option<&Location> {
Some(&self.location)
}
}

/// A struct containing information about the location of a panic.
///
/// You can get this object by using the [`location()`] method from the
Copy link
Member

Choose a reason for hiding this comment

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

method of the

@@ -159,6 +159,22 @@ pub fn take_hook() -> Box<Fn(&PanicInfo) + 'static + Sync + Send> {
}

/// A struct providing information about a panic.
///
/// You can get this object from the [`set_hook()`] function.
Copy link
Member

@nagisa nagisa Dec 2, 2016

Choose a reason for hiding this comment

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

Firstly this statement sounds like something that might get out of date quickly once we start adding more functions related to PanicInfo.

Secondly, I feel like phrasing of this could be improved. For example:

An instance of PanicInfo is passed to a panic hook set by set_hook()

or

PanicInfo is an argument to the panic hook (see set_hook()).

Copy link
Member

Choose a reason for hiding this comment

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

Firstly this statement sounds like something that might get out of date quickly once we start adding more functions related to PanicInfo.

Even if more methods related to PanicInfo get added in the future, it doesn't mean this comment will be inaccurate. I also don't think it's a huge task to update this comment once that happens.

Secondly, I feel like phrasing of this could be improved. For example:
...

Agreed, I like your examples. 👍

#[stable(feature = "panic_hooks", since = "1.10.0")]
pub fn location(&self) -> Option<&Location> {
Some(&self.location)
}
}

/// A struct containing information about the location of a panic.
///
/// You can get this object by using the [`location()`] method from the
/// [`PanicInfo`] object.
Copy link
Member

Choose a reason for hiding this comment

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

Rust doesn't have 'objects', so this should be 'struct' or 'structure'.

@frewsxcv frewsxcv removed their assignment Dec 4, 2016
@GuillaumeGomez
Copy link
Member Author

Updated.

@@ -159,6 +159,23 @@ pub fn take_hook() -> Box<Fn(&PanicInfo) + 'static + Sync + Send> {
}

/// A struct providing information about a panic.
///
/// `PanicInfo` object is passed to a panic hook set by the [`set_hook()`]
Copy link
Member

Choose a reason for hiding this comment

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

This comment also applies here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah damn.

Copy link
Member

Choose a reason for hiding this comment

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

It still says 'object' in the latest push

#[stable(feature = "panic_hooks", since = "1.10.0")]
pub fn location(&self) -> Option<&Location> {
Some(&self.location)
}
}

/// A struct containing information about the location of a panic.
///
/// You can get a `Location` by using the [`location()`] method of the
/// [`PanicInfo`] structure.
Copy link
Member

@frewsxcv frewsxcv Dec 4, 2016

Choose a reason for hiding this comment

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

Nit: I consider 'you' to be informal and it doesn't seem necessary to directly address the reader when we can just write:

This structure is created by the [`location()`] method on [`PanicInfo`].

@GuillaumeGomez
Copy link
Member Author

Updated (and for good this time!).

@frewsxcv
Copy link
Member

frewsxcv commented Dec 5, 2016

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Dec 5, 2016

📌 Commit d9b5ae9 has been approved by frewsxcv

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Dec 7, 2016
bors added a commit that referenced this pull request Dec 7, 2016
Rollup of 9 pull requests

- Successful merges: #38085, #38123, #38151, #38153, #38158, #38163, #38186, #38189, #38208
- Failed merges:
@bors bors merged commit d9b5ae9 into rust-lang:master Dec 7, 2016
@GuillaumeGomez GuillaumeGomez deleted the panic_doc branch December 7, 2016 23:09
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 this pull request may close these issues.

4 participants