File: recover-pat-issues.stderr

package info (click to toggle)
rustc 1.87.0%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 925,564 kB
  • sloc: xml: 158,127; python: 36,039; javascript: 19,761; sh: 19,737; cpp: 18,981; ansic: 13,133; asm: 4,376; makefile: 710; perl: 29; lisp: 28; ruby: 19; sql: 11
file content (122 lines) | stat: -rw-r--r-- 4,642 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
error: expected a pattern, found an expression
  --> $DIR/recover-pat-issues.rs:6:13
   |
LL |         Foo("hi".to_owned()) => true,
   |             ^^^^^^^^^^^^^^^ not a pattern
   |
   = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
help: consider moving the expression to a match arm guard
   |
LL -         Foo("hi".to_owned()) => true,
LL +         Foo(val) if val == "hi".to_owned() => true,
   |
help: consider extracting the expression into a `const`
   |
LL +     const VAL: /* Type */ = "hi".to_owned();
LL ~     match foo {
LL ~         Foo(VAL) => true,
   |
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
   |
LL |         Foo(const { "hi".to_owned() }) => true,
   |             +++++++                 +

error: expected a pattern, found an expression
  --> $DIR/recover-pat-issues.rs:14:20
   |
LL |         Bar { baz: "hi".to_owned() } => true,
   |                    ^^^^^^^^^^^^^^^ not a pattern
   |
   = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
help: consider moving the expression to a match arm guard
   |
LL -         Bar { baz: "hi".to_owned() } => true,
LL +         Bar { baz } if baz == "hi".to_owned() => true,
   |
help: consider extracting the expression into a `const`
   |
LL +     const BAZ: /* Type */ = "hi".to_owned();
LL ~     match bar {
LL ~         Bar { baz: BAZ } => true,
   |
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
   |
LL |         Bar { baz: const { "hi".to_owned() } } => true,
   |                    +++++++                 +

error: expected a pattern, found an expression
  --> $DIR/recover-pat-issues.rs:25:11
   |
LL |         &["foo".to_string()] => {}
   |           ^^^^^^^^^^^^^^^^^ not a pattern
   |
   = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
help: consider moving the expression to a match arm guard
   |
LL -         &["foo".to_string()] => {}
LL +         &[val] if val == "foo".to_string() => {}
   |
help: consider extracting the expression into a `const`
   |
LL +     const VAL: /* Type */ = "foo".to_string();
LL ~     match foo.as_slice() {
LL ~         &[VAL] => {}
   |
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
   |
LL |         &[const { "foo".to_string() }] => {}
   |           +++++++                   +

error: expected a pattern, found an expression
  --> $DIR/recover-pat-issues.rs:36:17
   |
LL |     if let Some(MAGIC.0 as usize) = None::<usize> {}
   |                 ^^^^^^^^^^^^^^^^ not a pattern
   |
   = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
help: consider extracting the expression into a `const`
   |
LL +     const VAL: /* Type */ = MAGIC.0 as usize;
LL ~     if let Some(VAL) = None::<usize> {}
   |
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
   |
LL |     if let Some(const { MAGIC.0 as usize }) = None::<usize> {}
   |                 +++++++                  +

error: expected a pattern, found an expression
  --> $DIR/recover-pat-issues.rs:41:13
   |
LL |     if let (-1.some(4)) = (0, Some(4)) {}
   |             ^^^^^^^^^^ not a pattern
   |
   = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
help: consider extracting the expression into a `const`
   |
LL +     const VAL: /* Type */ = -1.some(4);
LL ~     if let (VAL) = (0, Some(4)) {}
   |
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
   |
LL |     if let (const { -1.some(4) }) = (0, Some(4)) {}
   |             +++++++            +

error: expected a pattern, found an expression
  --> $DIR/recover-pat-issues.rs:44:13
   |
LL |     if let (-1.Some(4)) = (0, Some(4)) {}
   |             ^^^^^^^^^^ not a pattern
   |
   = note: arbitrary expressions are not allowed in patterns: <https://doc.rust-lang.org/book/ch19-00-patterns.html>
help: consider extracting the expression into a `const`
   |
LL +     const VAL: /* Type */ = -1.Some(4);
LL ~     if let (VAL) = (0, Some(4)) {}
   |
help: consider wrapping the expression in an inline `const` (requires `#![feature(inline_const_pat)]`)
   |
LL |     if let (const { -1.Some(4) }) = (0, Some(4)) {}
   |             +++++++            +

error: aborting due to 6 previous errors