Fully rework the algorithm and its explanation
This commit is contained in:
parent
d744aecabf
commit
cc6936d577
4 changed files with 857 additions and 740 deletions
|
|
@ -9,9 +9,10 @@ macro_rules! m {
|
|||
$t2 => {}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[rustfmt::skip]
|
||||
fn main() {
|
||||
m!(0u8, 42, 41);
|
||||
m!(0u8, 42, 42); //~ ERROR unreachable pattern
|
||||
|
|
@ -85,7 +86,7 @@ fn main() {
|
|||
match 'a' {
|
||||
'\u{0}'..='\u{D7FF}' => {},
|
||||
'\u{E000}'..='\u{10_FFFF}' => {},
|
||||
'\u{D7FF}'..='\u{E000}' => {}, // FIXME should be unreachable
|
||||
'\u{D7FF}'..='\u{E000}' => {}, //~ ERROR unreachable pattern
|
||||
}
|
||||
|
||||
match (0u8, true) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:17:17
|
||||
--> $DIR/reachability.rs:18:17
|
||||
|
|
||||
LL | m!(0u8, 42, 42);
|
||||
| ^^
|
||||
|
|
@ -11,127 +11,127 @@ LL | #![deny(unreachable_patterns)]
|
|||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:21:22
|
||||
--> $DIR/reachability.rs:22:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 20);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:22:22
|
||||
--> $DIR/reachability.rs:23:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 21);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:23:22
|
||||
--> $DIR/reachability.rs:24:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 25);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:24:22
|
||||
--> $DIR/reachability.rs:25:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 29);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:25:22
|
||||
--> $DIR/reachability.rs:26:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 30);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:28:21
|
||||
--> $DIR/reachability.rs:29:21
|
||||
|
|
||||
LL | m!(0u8, 20..30, 20);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:29:21
|
||||
--> $DIR/reachability.rs:30:21
|
||||
|
|
||||
LL | m!(0u8, 20..30, 21);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:30:21
|
||||
--> $DIR/reachability.rs:31:21
|
||||
|
|
||||
LL | m!(0u8, 20..30, 25);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:31:21
|
||||
--> $DIR/reachability.rs:32:21
|
||||
|
|
||||
LL | m!(0u8, 20..30, 29);
|
||||
| ^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:35:22
|
||||
--> $DIR/reachability.rs:36:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 20..=30);
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:36:22
|
||||
--> $DIR/reachability.rs:37:22
|
||||
|
|
||||
LL | m!(0u8, 20.. 30, 20.. 30);
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:37:22
|
||||
--> $DIR/reachability.rs:38:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 20.. 30);
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:39:22
|
||||
--> $DIR/reachability.rs:40:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 21..=30);
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:40:22
|
||||
--> $DIR/reachability.rs:41:22
|
||||
|
|
||||
LL | m!(0u8, 20..=30, 20..=29);
|
||||
| ^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:42:24
|
||||
--> $DIR/reachability.rs:43:24
|
||||
|
|
||||
LL | m!('a', 'A'..='z', 'a'..='z');
|
||||
| ^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:49:9
|
||||
--> $DIR/reachability.rs:50:9
|
||||
|
|
||||
LL | 5..=8 => {},
|
||||
| ^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:55:9
|
||||
--> $DIR/reachability.rs:56:9
|
||||
|
|
||||
LL | 5..15 => {},
|
||||
| ^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:62:9
|
||||
--> $DIR/reachability.rs:63:9
|
||||
|
|
||||
LL | 5..25 => {},
|
||||
| ^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:70:9
|
||||
--> $DIR/reachability.rs:71:9
|
||||
|
|
||||
LL | 5..25 => {},
|
||||
| ^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:76:9
|
||||
--> $DIR/reachability.rs:77:9
|
||||
|
|
||||
LL | 5..15 => {},
|
||||
| ^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:83:9
|
||||
--> $DIR/reachability.rs:84:9
|
||||
|
|
||||
LL | _ => {},
|
||||
| - matches any value
|
||||
|
|
@ -139,16 +139,22 @@ LL | '\u{D7FF}'..='\u{E000}' => {},
|
|||
| ^^^^^^^^^^^^^^^^^^^^^^^ unreachable pattern
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:104:9
|
||||
--> $DIR/reachability.rs:89:9
|
||||
|
|
||||
LL | '\u{D7FF}'..='\u{E000}' => {},
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:105:9
|
||||
|
|
||||
LL | &FOO => {}
|
||||
| ^^^^
|
||||
|
||||
error: unreachable pattern
|
||||
--> $DIR/reachability.rs:105:9
|
||||
--> $DIR/reachability.rs:106:9
|
||||
|
|
||||
LL | BAR => {}
|
||||
| ^^^
|
||||
|
||||
error: aborting due to 24 previous errors
|
||||
error: aborting due to 25 previous errors
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue