Skip to content

Commit

Permalink
Add span label to E0044
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Mar 15, 2018
1 parent bfc66da commit 1bbd4fd
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/librustc_typeck/check/mod.rs
Expand Up @@ -1222,6 +1222,7 @@ pub fn check_item_type<'a,'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, it: &'tcx hir::Item
if !generics.types.is_empty() {
let mut err = struct_span_err!(tcx.sess, item.span, E0044,
"foreign items may not have type parameters");
err.span_label(item.span, "can't have type parameters");
// FIXME: once we start storing spans for type arguments, turn this into a
// suggestion.
err.help("use specialization instead of type parameters by replacing them \
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/closure-move-sync.stderr
Expand Up @@ -22,4 +22,4 @@ LL | thread::spawn(|| tx.send(()).unwrap());

error: aborting due to 2 previous errors

If you want more information on this error, try using "rustc --explain E0277"
For more information about this error, try `rustc --explain E0277`.
1 change: 1 addition & 0 deletions src/test/ui/error-codes/E0044.rs
Expand Up @@ -12,6 +12,7 @@ extern {
fn sqrt<T>(f: T) -> T;
//~^ ERROR foreign items may not have type parameters [E0044]
//~| HELP use specialization instead of type parameters by replacing them with concrete types
//~| NOTE can't have type parameters
}

fn main() {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/error-codes/E0044.stderr
Expand Up @@ -2,7 +2,7 @@ error[E0044]: foreign items may not have type parameters
--> $DIR/E0044.rs:12:5
|
LL | fn sqrt<T>(f: T) -> T;
| ^^^^^^^^^^^^^^^^^^^^^^
| ^^^^^^^^^^^^^^^^^^^^^^ can't have type parameters
|
= help: use specialization instead of type parameters by replacing them with concrete types like `u32`

Expand Down

0 comments on commit 1bbd4fd

Please sign in to comment.