-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Rust Guide: incorrect explanation of Result.ok() / Option.expect() #17676
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
Comments
I thought this was already fixed :/ |
lnicola
pushed a commit
to lnicola/rust
that referenced
this issue
Jul 28, 2024
feat: add preliminary support for `+ use<..>` `precise_capturing` syntax ## Summary This PR adds basic support for the following syntax. ```rs fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {} // ~~~~~~~~~~~~~~~~~~~~~~~ // This opaque type does not capture `'a`. fn outlives<'o, T: 'o>(_: T) {} fn caller<'o, 'a, 'b: 'o, T: 'o>() { // ~~ // ^ Note that we don't need `'a: 'o`. outlives::<'o>(captures::<'a, 'b, T>()); } ``` Related to rust-lang#17598
RalfJung
pushed a commit
to RalfJung/rust
that referenced
this issue
Aug 1, 2024
feat: add preliminary support for `+ use<..>` `precise_capturing` syntax ## Summary This PR adds basic support for the following syntax. ```rs fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {} // ~~~~~~~~~~~~~~~~~~~~~~~ // This opaque type does not capture `'a`. fn outlives<'o, T: 'o>(_: T) {} fn caller<'o, 'a, 'b: 'o, T: 'o>() { // ~~ // ^ Note that we don't need `'a: 'o`. outlives::<'o>(captures::<'a, 'b, T>()); } ``` Related to rust-lang#17598
RalfJung
pushed a commit
to RalfJung/rust
that referenced
this issue
Aug 1, 2024
feat: add preliminary support for `+ use<..>` `precise_capturing` syntax ## Summary This PR adds basic support for the following syntax. ```rs fn captures<'a: 'a, 'b: 'b, T>() -> impl Sized + use<'b, T> {} // ~~~~~~~~~~~~~~~~~~~~~~~ // This opaque type does not capture `'a`. fn outlives<'o, T: 'o>(_: T) {} fn caller<'o, 'a, 'b: 'o, T: 'o>() { // ~~ // ^ Note that we don't need `'a: 'o`. outlives::<'o>(captures::<'a, 'b, T>()); } ``` Related to rust-lang#17598
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If I'm not mistaken,
ok()
just turns theIoResult
into anOption
. It won't terminate the program. It'sexpect()
which fails or unwraps the value.Also, wouldn't a call to the IoResult's
unwrap()
be more direct? Although the custom failure message would be lost.The text was updated successfully, but these errors were encountered: