Skip to content

Add support for half-open range patterns #13739

Closed
@jplatte

Description

@jplatte
fn main() {
    match 5 {
        ..=1 => {}
        _ => {}
    }
}
Currently produces three syntax errors
[{
	"resource": "/home/jplatte/code/playground/src/lib.rs",
	"owner": "rustc",
	"code": {
		"value": "syntax-error",
		"target": {
			"$mid": 1,
			"external": "https://rust-analyzer.github.io/manual.html#syntax-error",
			"path": "/manual.html",
			"scheme": "https",
			"authority": "rust-analyzer.github.io",
			"fragment": "syntax-error"
		}
	},
	"severity": 8,
	"message": "Syntax Error: expected FAT_ARROW",
	"source": "rust-analyzer",
	"startLineNumber": 3,
	"startColumn": 11,
	"endLineNumber": 3,
	"endColumn": 11
}]

[{
	"resource": "/home/jplatte/code/playground/src/lib.rs",
	"owner": "rustc",
	"code": {
		"value": "syntax-error",
		"target": {
			"$mid": 1,
			"external": "https://rust-analyzer.github.io/manual.html#syntax-error",
			"path": "/manual.html",
			"scheme": "https",
			"authority": "rust-analyzer.github.io",
			"fragment": "syntax-error"
		}
	},
	"severity": 8,
	"message": "Syntax Error: expected expression",
	"source": "rust-analyzer",
	"startLineNumber": 3,
	"startColumn": 11,
	"endLineNumber": 3,
	"endColumn": 11
}]

[{
	"resource": "/home/jplatte/code/playground/src/lib.rs",
	"owner": "rustc",
	"code": {
		"value": "syntax-error",
		"target": {
			"$mid": 1,
			"external": "https://rust-analyzer.github.io/manual.html#syntax-error",
			"path": "/manual.html",
			"scheme": "https",
			"authority": "rust-analyzer.github.io",
			"fragment": "syntax-error"
		}
	},
	"severity": 8,
	"message": "Syntax Error: expected `,`",
	"source": "rust-analyzer",
	"startLineNumber": 3,
	"startColumn": 12,
	"endLineNumber": 3,
	"endColumn": 12
}]

Half-open range patterns were stabilized for 1.66 in rust-lang/rust#102275.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-parserparser issuesA-tytype system / type inference / traits / method resolutionC-featureCategory: feature requestE-has-instructionsIssue has some instructions and pointers to code to get startedS-actionableSomeone could pick this issue up and work on it right now

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions