11error[E0308]: mismatched types
22 --> $DIR/non_zero_assigned_something.rs:2:37
33 |
4+ LL | let _: std::num::NonZero<u64> = 0;
5+ | ---------------------- ^ expected `NonZero<u64>`, found integer
6+ | |
7+ | expected due to this
8+ |
9+ = note: expected struct `NonZero<u64>`
10+ found type `{integer}`
11+ help: consider calling `NonZero::new`
12+ |
13+ LL | let _: std::num::NonZero<u64> = NonZero::new(0).unwrap();
14+ | +++++++++++++ ++++++++++
15+
16+ error[E0308]: mismatched types
17+ --> $DIR/non_zero_assigned_something.rs:6:45
18+ |
19+ LL | let _: Option<std::num::NonZero<u64>> = 0;
20+ | ------------------------------ ^ expected `Option<NonZero<u64>>`, found integer
21+ | |
22+ | expected due to this
23+ |
24+ = note: expected enum `Option<NonZero<u64>>`
25+ found type `{integer}`
26+ help: consider calling `NonZero::new`
27+ |
28+ LL | let _: Option<std::num::NonZero<u64>> = NonZero::new(0);
29+ | +++++++++++++ +
30+
31+ error[E0308]: mismatched types
32+ --> $DIR/non_zero_assigned_something.rs:10:37
33+ |
434LL | let _: std::num::NonZero<u64> = 1;
535 | ---------------------- ^ expected `NonZero<u64>`, found integer
636 | |
@@ -14,7 +44,153 @@ LL | let _: std::num::NonZero<u64> = NonZero::new(1).unwrap();
1444 | +++++++++++++ ++++++++++
1545
1646error[E0308]: mismatched types
17- --> $DIR/non_zero_assigned_something.rs:6:45
47+ --> $DIR/non_zero_assigned_something.rs:13:37
48+ |
49+ LL | let _: std::num::NonZero<u64> = 1u8;
50+ | ---------------------- ^^^ expected `NonZero<u64>`, found `u8`
51+ | |
52+ | expected due to this
53+ |
54+ = note: expected struct `NonZero<u64>`
55+ found type `u8`
56+
57+ error[E0308]: mismatched types
58+ --> $DIR/non_zero_assigned_something.rs:15:37
59+ |
60+ LL | let _: std::num::NonZero<u64> = 1u64;
61+ | ---------------------- ^^^^ expected `NonZero<u64>`, found `u64`
62+ | |
63+ | expected due to this
64+ |
65+ = note: expected struct `NonZero<u64>`
66+ found type `u64`
67+ help: consider calling `NonZero::new`
68+ |
69+ LL | let _: std::num::NonZero<u64> = NonZero::new(1u64).unwrap();
70+ | +++++++++++++ ++++++++++
71+
72+ error[E0308]: mismatched types
73+ --> $DIR/non_zero_assigned_something.rs:19:36
74+ |
75+ LL | let _: std::num::NonZero<u8> = 255;
76+ | --------------------- ^^^ expected `NonZero<u8>`, found integer
77+ | |
78+ | expected due to this
79+ |
80+ = note: expected struct `NonZero<u8>`
81+ found type `{integer}`
82+ help: consider calling `NonZero::new`
83+ |
84+ LL | let _: std::num::NonZero<u8> = NonZero::new(255).unwrap();
85+ | +++++++++++++ ++++++++++
86+
87+ error[E0308]: mismatched types
88+ --> $DIR/non_zero_assigned_something.rs:22:36
89+ |
90+ LL | let _: std::num::NonZero<u8> = 256;
91+ | --------------------- ^^^ expected `NonZero<u8>`, found integer
92+ | |
93+ | expected due to this
94+ |
95+ = note: expected struct `NonZero<u8>`
96+ found type `{integer}`
97+ help: consider calling `NonZero::new`
98+ |
99+ LL | let _: std::num::NonZero<u8> = NonZero::new(256).unwrap();
100+ | +++++++++++++ ++++++++++
101+
102+ error[E0308]: mismatched types
103+ --> $DIR/non_zero_assigned_something.rs:26:36
104+ |
105+ LL | let _: std::num::NonZero<u8> = -10;
106+ | --------------------- ^^^ expected `NonZero<u8>`, found integer
107+ | |
108+ | expected due to this
109+ |
110+ = note: expected struct `NonZero<u8>`
111+ found type `{integer}`
112+ help: consider calling `NonZero::new`
113+ |
114+ LL | let _: std::num::NonZero<u8> = NonZero::new(-10).unwrap();
115+ | +++++++++++++ ++++++++++
116+
117+ error[E0308]: mismatched types
118+ --> $DIR/non_zero_assigned_something.rs:30:36
119+ |
120+ LL | let _: std::num::NonZero<i8> = -128;
121+ | --------------------- ^^^^ expected `NonZero<i8>`, found integer
122+ | |
123+ | expected due to this
124+ |
125+ = note: expected struct `NonZero<i8>`
126+ found type `{integer}`
127+ help: consider calling `NonZero::new`
128+ |
129+ LL | let _: std::num::NonZero<i8> = NonZero::new(-128).unwrap();
130+ | +++++++++++++ ++++++++++
131+
132+ error[E0308]: mismatched types
133+ --> $DIR/non_zero_assigned_something.rs:33:36
134+ |
135+ LL | let _: std::num::NonZero<i8> = -129;
136+ | --------------------- ^^^^ expected `NonZero<i8>`, found integer
137+ | |
138+ | expected due to this
139+ |
140+ = note: expected struct `NonZero<i8>`
141+ found type `{integer}`
142+ help: consider calling `NonZero::new`
143+ |
144+ LL | let _: std::num::NonZero<i8> = NonZero::new(-129).unwrap();
145+ | +++++++++++++ ++++++++++
146+
147+ error[E0308]: mismatched types
148+ --> $DIR/non_zero_assigned_something.rs:36:36
149+ |
150+ LL | let _: std::num::NonZero<i8> = -1;
151+ | --------------------- ^^ expected `NonZero<i8>`, found integer
152+ | |
153+ | expected due to this
154+ |
155+ = note: expected struct `NonZero<i8>`
156+ found type `{integer}`
157+ help: consider calling `NonZero::new`
158+ |
159+ LL | let _: std::num::NonZero<i8> = NonZero::new(-1).unwrap();
160+ | +++++++++++++ ++++++++++
161+
162+ error[E0308]: mismatched types
163+ --> $DIR/non_zero_assigned_something.rs:39:36
164+ |
165+ LL | let _: std::num::NonZero<i8> = 0;
166+ | --------------------- ^ expected `NonZero<i8>`, found integer
167+ | |
168+ | expected due to this
169+ |
170+ = note: expected struct `NonZero<i8>`
171+ found type `{integer}`
172+ help: consider calling `NonZero::new`
173+ |
174+ LL | let _: std::num::NonZero<i8> = NonZero::new(0).unwrap();
175+ | +++++++++++++ ++++++++++
176+
177+ error[E0308]: mismatched types
178+ --> $DIR/non_zero_assigned_something.rs:42:36
179+ |
180+ LL | let _: std::num::NonZero<i8> = 1;
181+ | --------------------- ^ expected `NonZero<i8>`, found integer
182+ | |
183+ | expected due to this
184+ |
185+ = note: expected struct `NonZero<i8>`
186+ found type `{integer}`
187+ help: consider calling `NonZero::new`
188+ |
189+ LL | let _: std::num::NonZero<i8> = NonZero::new(1).unwrap();
190+ | +++++++++++++ ++++++++++
191+
192+ error[E0308]: mismatched types
193+ --> $DIR/non_zero_assigned_something.rs:46:45
18194 |
19195LL | let _: Option<std::num::NonZero<u64>> = 1;
20196 | ------------------------------ ^ expected `Option<NonZero<u64>>`, found integer
@@ -28,6 +204,6 @@ help: consider calling `NonZero::new`
28204LL | let _: Option<std::num::NonZero<u64>> = NonZero::new(1);
29205 | +++++++++++++ +
30206
31- error: aborting due to 2 previous errors
207+ error: aborting due to 14 previous errors
32208
33209For more information about this error, try `rustc --explain E0308`.
0 commit comments