Rollup of 2 pull requests - #161582
Merged
Merged
Conversation
Writing the type of each element inside a tuple pattern like `let (a: bool, b: u8) = ...` isn't valid, but the current error doesn't really tell you that. It just says "expected one of `)`, `,`, `@`, `if`, or `|`, found `:`" and leaves you to work it out. A let pattern can be followed by a type, so we can suggest the fix: move the types out into a tuple type after the pattern, so `(a: bool, b: u8)` becomes `(a, b): (bool, u8)`. Elements without a type just get `_`. Parsing then keeps going with the types dropped, so you only get the one error.
Rework the recovery to happen in a single parse instead of parsing the tuple pattern, resetting on failure, and parsing again. The element closure now eats an optional `: <ty>` directly, so there's no parser snapshot on the happy path. Only treat the colon as a type annotation when it is followed by whitespace, so `(m:C,)` keeps the existing "maybe write a path separator here" suggestion for `m::C` and only `(m: C,)` gets the tuple-type suggestion.
nodelay() passed a null ControlOption to GetModeData, so it always failed with Unsupported, and it returned the Nagle flag instead of its negation. The timeout setters accepted a zero Duration that every other backend rejects.
…ascription, r=fmease Recover from tuple patterns with inline element types If you write the element types inside a tuple pattern: ```rust let (a: bool, b: u8) = (true, 1); ``` the error you get doesn't really explain the problem: ``` error: expected one of `)`, `,`, `@`, `if`, or `|`, found `:` --> src/main.rs:2:11 | 2 | let (a: bool, b: u8) = (true, 1); | ^ expected one of `)`, `,`, `@`, `if`, or `|` ``` A let pattern can have a type after it, so now we point out what to do instead: ``` help: to annotate the types of a tuple's elements, write them as a tuple type after the pattern | 2 - let (a: bool, b: u8) = (true, 1); 2 + let (a, b): (bool, u8) = (true, 1); | ``` If an element doesn't have a type written, it just gets `_`, so `(a: bool, b)` turns into `(a, b): (bool, _)`. I kept this to let bindings only. That's the case where the pattern doesn't need a type of its own, so once the types move into the suggestion the rest of the statement parses fine and you get a single error instead of a pile of follow-up ones. Match arms, nested patterns and function parameters are left alone. Closes rust-lang#149246
std::net: uefi: fix TcpStream::nodelay and reject zero timeouts nodelay() passed a null ControlOption to GetModeData, so it always failed with Unsupported, and it returned the Nagle flag instead of its negation. The timeout setters accepted a zero Duration that every other backend rejects.
Member
Author
|
@bors r+ p=4 |
Contributor
This comment has been minimized.
This comment has been minimized.
Contributor
Contributor
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing be0ea33 (parent) -> 9a4ad59 (this PR) Test differencesShow 5 test diffsStage 1
Stage 2
Additionally, 1 doctest diff were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 9a4ad59ae3073b013cd62f53f8349ddc61a012e8 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
r? @ghost
Create a similar rollup