Skip to content

Conflict about Some(1|2) in 1.53 #86408

@kkonghao

Description

@kkonghao

hi when i use rust 1.53 version some code about pattern match below make me confused,and i think this is a bug or a problem that cannot be ignored.

	let x = Some(2);
	assert!(matches!(x,Some(1 | 2)));//ok x is Some(2)
	assert!(matches!(Some(1),Some(1|2)));//ok
	assert!(matches!(Some(2),Some(1|2)));//ok

	let y = Some(1 | 2);//y is Some(3)
	// assert!(matches!(Some(3),Some(1|2)));// error, Some(1|2) =>is Some(1) | Some(2) or Some(3)?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions