Uh oh!
There was an error while loading. Please reload this page.
Implement Termination for Option<()> - #61360
Conversation
rust-highfive
commented
May 30, 2019
(rust_highfive has picked a reviewer for you, use r? to override) |
jonas-schievink
commented
May 30, 2019
This seems like more of a libs/lang issue than compiler, no? |
ollie27
commented
May 30, 2019
The fact that that is even a question suggests that we shouldn't add this impl. See also rust-lang/rfcs#1937 (comment). |
cramertj
commented
May 30, 2019
IMO it's non-obvious what |
Centril
commented
May 30, 2019
This seems like a matter primarily for the language team. |
GuillaumeGomez
commented
May 30, 2019
Oh yes it is, sorry! @cramertj: Absolutely. I first thought than in any case, we should just return |
llogiq
commented
May 30, 2019
@cramertj we have |
cramertj
commented
May 30, 2019
I'm not confused by |
There was a problem hiding this comment.
why only () rather than anything implementing Termination?
There was a problem hiding this comment.
Would that flatten the Option? I'm afraid this could lead to too clever code like fn main -> Option<Option<Result<(), _>>> { .. }.
llogiq
commented
May 31, 2019
I'd expect |
63a8cd1 to
24c1b73CompareGuillaumeGomez
commented
May 31, 2019
@llogiq So the current code (with the update) is how you would do it? That's convenient. :) What the others are thinking about it? |
We had a conversation about specific impls and such in the first stabilization issue, #48453, and the RFC (https://github.com/rust-lang/rfcs/blob/master/text/1937-ques-in-main.md) had I, of course, agree with @ollie27's comment 😄 Additionally, I don't want
I consider that a good reason to not implement Termination here. |
We discussed this in the @rust-lang/lang team meeting today, though notably @scottmcm was not present. The consensus was that we were "not opposed" (some mildly in favor, some neutral, some mildly opposed but not enough to block). Speaking personally, I found the idea of returning Ultimately, we decided we'd rather defer the final details to the @rust-lang/libs team. If someone from that team wants to move to FCP, it would be approved by the lang team (modulo the fact that not everyone was present). But if they have doubts and would prefer to wait, that seems ok. |
dtolnay
commented
Jun 6, 2019
I would prefer not to do this. I agree with Niko that in
Nope, just use unwrap in tests. Then you even get to find out which step failed. Writing The main justifiable use case I see for this impl is in doc tests with a hidden function signature. These allow the doc test to be rendered by rustdoc with /// ```/// # fn main() -> Option<()> {/// let x = f()?;/// let y = g(x)?;/// # Some(())/// # }/// ```But for these it seems fine to recommend something like: /// ```/// # try {/// let x = f()?;/// let y = g(x)?;/// # }.unwrap()/// ``` |
llogiq
commented
Jun 7, 2019
@dtolnay in current nightly, you can just add |
QuietMisdreavus
commented
Jun 10, 2019
I'm late to the party, but if the libs team decides to close this, i would prefer #61279 be reverted. I left a longer comment over there: #61279 (comment) |
GuillaumeGomez
commented
Jun 11, 2019
👍 |
Centril
commented
Jun 30, 2019
@QuietMisdreavus@GuillaumeGomez Should we revert #61279 until such time that an affirmative decision to support |
GuillaumeGomez
commented
Jul 1, 2019
Fine by me. |
Closing this based on #61360 (comment). Let's terminate the termination |
QuietMisdreavus
commented
Jul 15, 2019
My comment was more of an "if this gets closed" - i was not calling for its closure myself, just deferring to libs team, which was pinged up-thread as the responsible party. |
After a question about this here, I decided to open this PR. However, is this how we should implement it? Should we consider
Noneas a failure (because that's how I implemented it)?Anyway, I think having this PR open is a good place to discuss about it (and closing it if we don't want it of course).
cc @ollie27 @rust-lang/compiler