Skip to content

Commit 1bbd4fd

Browse files
committed
Add span label to E0044
1 parent bfc66da commit 1bbd4fd

File tree

4 files changed

+4
-2
lines changed

4 files changed

+4
-2
lines changed

src/librustc_typeck/check/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1222,6 +1222,7 @@ pub fn check_item_type<'a,'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item
12221222
if !generics.types.is_empty() {
12231223
let mut err = struct_span_err!(tcx.sess, item.span, E0044,
12241224
"foreign items may not have type parameters");
1225+
err.span_label(item.span, "can't have type parameters");
12251226
// FIXME: once we start storing spans for type arguments, turn this into a
12261227
// suggestion.
12271228
err.help("use specialization instead of type parameters by replacing them \

src/test/ui/closure-move-sync.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@ LL | thread::spawn(|| tx.send(()).unwrap());
2222

2323
error: aborting due to 2 previous errors
2424

25-
If you want more information on this error, try using "rustc --explain E0277"
25+
For more information about this error, try `rustc --explain E0277`.

src/test/ui/error-codes/E0044.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ extern {
1212
fn sqrt<T>(f: T) -> T;
1313
//~^ ERROR foreign items may not have type parameters [E0044]
1414
//~| HELP use specialization instead of type parameters by replacing them with concrete types
15+
//~| NOTE can't have type parameters
1516
}
1617

1718
fn main() {

src/test/ui/error-codes/E0044.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ error[E0044]: foreign items may not have type parameters
22
--> $DIR/E0044.rs:12:5
33
|
44
LL | fn sqrt<T>(f: T) -> T;
5-
| ^^^^^^^^^^^^^^^^^^^^^^
5+
| ^^^^^^^^^^^^^^^^^^^^^^ can't have type parameters
66
|
77
= help: use specialization instead of type parameters by replacing them with concrete types like `u32`
88

0 commit comments

Comments
 (0)