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

librustc: Change the syntax of subslice matching to use postfix .. #17054

Merged
merged 1 commit into from
Sep 9, 2014

Conversation

pcwalton
Copy link
Contributor

@pcwalton pcwalton commented Sep 6, 2014

instead of prefix ...

This breaks code that looked like:

match foo {
    [ first, ..middle, last ] => { ... }
}

Change this code to:

match foo {
    [ first, middle.., last ] => { ... }
}

RFC #55.

Closes #16967.

[breaking-change]

r? @brson

@alexcrichton
Copy link
Member

r=me with a test for the new syntax and a test for the old syntax printing an error

"another `mod` import appears here");
for &other_span in other.iter() {
self.session.span_note(other_span,
if mod_spans.len() > 2 {
Copy link

Choose a reason for hiding this comment

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

This should be mod_spans.len() >= 2 or > 1.

Which is arguably why I'd consider the older version a little clearer in that regard.

instead of prefix `..`.

This breaks code that looked like:

    match foo {
        [ first, ..middle, last ] => { ... }
    }

Change this code to:

    match foo {
        [ first, middle.., last ] => { ... }
    }

RFC rust-lang#55.

Closes rust-lang#16967.

[breaking-change]
alexcrichton added a commit to alexcrichton/rust that referenced this pull request Sep 9, 2014
@bors bors merged commit eb678ff into rust-lang:master Sep 9, 2014
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2024
Revert "fix: set the right postfix snippets competion source range"

This reverts commit c5686c8.

Fix rust-lang#17036. See rust-lang/rust-analyzer#17036 (comment)
lnicola pushed a commit to lnicola/rust that referenced this pull request Apr 20, 2024
Revert "fix: set the right postfix snippets competion source range"

This reverts commit c5686c8.

Fix rust-lang#17036. See rust-lang/rust-analyzer#17036 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Futureproof subslice syntax
3 participants