Skip to content

std docs: strange notation in std::pin docs #59832

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

Closed
ehuss opened this issue Apr 9, 2019 · 4 comments · Fixed by #59900
Closed

std docs: strange notation in std::pin docs #59832

ehuss opened this issue Apr 9, 2019 · 4 comments · Fixed by #59900
Labels
A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools C-enhancement Category: An issue proposing an enhancement or a PR with one.

Comments

@ehuss
Copy link
Contributor

ehuss commented Apr 9, 2019

The std::pin module uses strange [mut] notation. For example, Pin<&[mut] Self>). I cannot discern what it is trying to say. I think it should probably not use the brackets, or explain what the syntax means?

@jonas-schievink jonas-schievink added C-enhancement Category: An issue proposing an enhancement or a PR with one. A-docs Area: Documentation for any part of the project, including the compiler, standard library, and tools labels Apr 9, 2019
@Centril
Copy link
Contributor

Centril commented Apr 10, 2019

It is trying to say &Self / &mut Self. IOW mut?

@steveklabnik
Copy link
Member

steveklabnik commented Apr 11, 2019 via email

@czipperz
Copy link
Contributor

It is used in other places inside rustc. The syntax makes sense to me personally.

File: src/librustc/mir/mod.rs
622:50:    /// Some((None, ..)) in the case of and `let [mut] x = ...` because
File: src/librustc_mir/transform/add_retag.rs
174:61:                    // to update tags.  This includes `x = &[mut] ...` and hence
File: src/librustc_mir/borrow_check/move_errors.rs
127:56:                    // opt_match_place is None for let [mut] x = ... statements,
File: src/libcore/pin.rs
163:71://! in your type (for example by implementing some operation on `Pin<&[mut] Self>`)
176:37://! an operation with type `fn(Pin<&[mut] Struct>) -> Pin<&[mut] Field>`?
178:42://! have an operation with type `fn(Pin<&[mut] Wrapper<T>>) -> Pin<&[mut] T>`?
182:59://! After all, the pinning projection lets us get a `Pin<&[mut] Field>`.

@czipperz
Copy link
Contributor

I'm going to open a pr for this...

Centril added a commit to Centril/rust that referenced this issue Apr 14, 2019
…in-pin-docs, r=RalfJung

Remove [mut] syntax in pin docs

Resolves rust-lang#59832
Centril added a commit to Centril/rust that referenced this issue Apr 14, 2019
…in-pin-docs, r=RalfJung

Remove [mut] syntax in pin docs

Resolves rust-lang#59832
Centril added a commit to Centril/rust that referenced this issue Apr 14, 2019
…in-pin-docs, r=RalfJung

Remove [mut] syntax in pin docs

Resolves rust-lang#59832
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 C-enhancement Category: An issue proposing an enhancement or a PR with one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants