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

fix indefinite article in cell.rs #79983

Merged
merged 1 commit into from
Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ impl<T: ?Sized + fmt::Display> fmt::Display for RefMut<'_, T> {
/// `UnsafeCell<T>` is a type that wraps some `T` and indicates unsafe interior operations on the
/// wrapped type. Types with an `UnsafeCell<T>` field are considered to have an 'unsafe interior'.
/// The `UnsafeCell<T>` type is the only legal way to obtain aliasable data that is considered
/// mutable. In general, transmuting an `&T` type into an `&mut T` is considered undefined behavior.
Copy link
Member

@jyn514 jyn514 Dec 13, 2020

Choose a reason for hiding this comment

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

This depends how you pronounce &T. I say "a reference type", but it sounds like the original author pronounced it "and-t".

Git says the author was @alexcrichton (e5da6a7) - Alex, what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That could be true...but couple of lines later you can see it being written the way i did it.

/// - If you create a safe reference with lifetime `'a` (either a `&T` or `&mut T`

Copy link
Member

Choose a reason for hiding this comment

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

And then below again, it uses an:

/// accesses (_e.g._, through an `&mut UnsafeCell<_>`): neither the cell nor the wrapped value

I think either they should all be consistent (and probably this would need a tracking issue because there's so many places it's inconsistent now), or it's not worth changing. I don't think it makes sense to just change this one article.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you create an issue, I can go for it.

Copy link
Member

Choose a reason for hiding this comment

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

Sounds good, but we should decide whether to use 'a' or 'an' first. @steveklabnik do you have an opinion?

Copy link
Member

Choose a reason for hiding this comment

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

I indeed pronounce this "and-t" and "and-mute-t", but I do not have an opinion on whether it's right or not.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah it's tricky because it technically depends on how you pronounce it. I do what @alexcrichton does most of the time, though often "amp" and not "and," not that that changes the rules here.

https://github.com/rust-lang/rfcs/blob/master/text/1574-more-api-documentation-conventions.md is the canonical reference for how we word things. It does not directly address this issue, though it does contain the phrase "an &str," probably because of "string slice" rather than &T where T = str."

words are hard.

Copy link
Contributor Author

@petar-dambovaliev petar-dambovaliev Dec 16, 2020

Choose a reason for hiding this comment

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

I indeed pronounce this "and-t" and "and-mute-t", but I do not have an opinion on whether it's right or not.

I honestly couldn't imagine how you are pronouncing this and it being correct.
Sorry but can you write out the an exact phrase? The only thing I have in my head is an reference type and an mutable reference type which are obviously wrong.

/// mutable. In general, transmuting a `&T` type into a `&mut T` is considered undefined behavior.
///
/// If you have a reference `&SomeStruct`, then normally in Rust all fields of `SomeStruct` are
/// immutable. The compiler makes optimizations based on the knowledge that `&T` is not mutably
Expand Down