Skip to content

Commit 85e77ed

Browse files
authored
Rollup merge of #77371 - camelid:remove-extra-space-in-diagnostic, r=varkor
Remove trailing space in error message - Add test for error message - Remove trailing space in error message
2 parents cc1513b + b2ce3e5 commit 85e77ed

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

compiler/rustc_middle/src/ty/error.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ impl<'tcx> ty::TyS<'tcx> {
232232
let n = tcx.lift(&n).unwrap();
233233
match n.try_eval_usize(tcx, ty::ParamEnv::empty()) {
234234
_ if t.is_simple_ty() => format!("array `{}`", self).into(),
235-
Some(n) => format!("array of {} element{} ", n, pluralize!(n)).into(),
235+
Some(n) => format!("array of {} element{}", n, pluralize!(n)).into(),
236236
None => "array".into(),
237237
}
238238
}
+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn main() {
2+
let a = &[];
3+
let b: &Vec<u8> = &vec![];
4+
a > b;
5+
//~^ ERROR mismatched types
6+
}
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error[E0308]: mismatched types
2+
--> $DIR/slice-to-vec-comparison.rs:4:9
3+
|
4+
LL | a > b;
5+
| ^ expected array of 0 elements, found struct `Vec`
6+
|
7+
= note: expected reference `&[_; 0]`
8+
found reference `&Vec<u8>`
9+
10+
error: aborting due to previous error
11+
12+
For more information about this error, try `rustc --explain E0308`.

0 commit comments

Comments
 (0)