Fixing bad suggestion for _
in const
type when a function #81885
This commit is contained in:
parent
921ec4b3fc
commit
09d5d0766e
9 changed files with 54 additions and 150 deletions
|
@ -2327,6 +2327,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||||
&generics.params[..],
|
&generics.params[..],
|
||||||
visitor.0,
|
visitor.0,
|
||||||
true,
|
true,
|
||||||
|
true
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -141,6 +141,7 @@ crate fn placeholder_type_error(
|
||||||
generics: &[hir::GenericParam<'_>],
|
generics: &[hir::GenericParam<'_>],
|
||||||
placeholder_types: Vec<Span>,
|
placeholder_types: Vec<Span>,
|
||||||
suggest: bool,
|
suggest: bool,
|
||||||
|
is_fn: bool,
|
||||||
) {
|
) {
|
||||||
if placeholder_types.is_empty() {
|
if placeholder_types.is_empty() {
|
||||||
return;
|
return;
|
||||||
|
@ -171,7 +172,9 @@ crate fn placeholder_type_error(
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut err = bad_placeholder_type(tcx, placeholder_types);
|
let mut err = bad_placeholder_type(tcx, placeholder_types);
|
||||||
if suggest {
|
|
||||||
|
// Suggest, but only if it is not a function
|
||||||
|
if suggest && !is_fn {
|
||||||
err.multipart_suggestion(
|
err.multipart_suggestion(
|
||||||
"use type parameters instead",
|
"use type parameters instead",
|
||||||
sugg,
|
sugg,
|
||||||
|
@ -198,7 +201,14 @@ fn reject_placeholder_type_signatures_in_item(tcx: TyCtxt<'tcx>, item: &'tcx hir
|
||||||
let mut visitor = PlaceholderHirTyCollector::default();
|
let mut visitor = PlaceholderHirTyCollector::default();
|
||||||
visitor.visit_item(item);
|
visitor.visit_item(item);
|
||||||
|
|
||||||
placeholder_type_error(tcx, Some(generics.span), &generics.params[..], visitor.0, suggest);
|
placeholder_type_error(
|
||||||
|
tcx,
|
||||||
|
Some(generics.span),
|
||||||
|
&generics.params[..],
|
||||||
|
visitor.0,
|
||||||
|
suggest,
|
||||||
|
false
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
|
||||||
|
@ -743,7 +753,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
|
||||||
// Account for `const C: _;`.
|
// Account for `const C: _;`.
|
||||||
let mut visitor = PlaceholderHirTyCollector::default();
|
let mut visitor = PlaceholderHirTyCollector::default();
|
||||||
visitor.visit_trait_item(trait_item);
|
visitor.visit_trait_item(trait_item);
|
||||||
placeholder_type_error(tcx, None, &[], visitor.0, false);
|
placeholder_type_error(tcx, None, &[], visitor.0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::TraitItemKind::Type(_, Some(_)) => {
|
hir::TraitItemKind::Type(_, Some(_)) => {
|
||||||
|
@ -752,7 +762,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
|
||||||
// Account for `type T = _;`.
|
// Account for `type T = _;`.
|
||||||
let mut visitor = PlaceholderHirTyCollector::default();
|
let mut visitor = PlaceholderHirTyCollector::default();
|
||||||
visitor.visit_trait_item(trait_item);
|
visitor.visit_trait_item(trait_item);
|
||||||
placeholder_type_error(tcx, None, &[], visitor.0, false);
|
placeholder_type_error(tcx, None, &[], visitor.0, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
hir::TraitItemKind::Type(_, None) => {
|
hir::TraitItemKind::Type(_, None) => {
|
||||||
|
@ -761,7 +771,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
|
||||||
// even if there is no concrete type.
|
// even if there is no concrete type.
|
||||||
let mut visitor = PlaceholderHirTyCollector::default();
|
let mut visitor = PlaceholderHirTyCollector::default();
|
||||||
visitor.visit_trait_item(trait_item);
|
visitor.visit_trait_item(trait_item);
|
||||||
placeholder_type_error(tcx, None, &[], visitor.0, false);
|
placeholder_type_error(tcx, None, &[], visitor.0, false, false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -782,7 +792,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::HirId) {
|
||||||
// Account for `type T = _;`
|
// Account for `type T = _;`
|
||||||
let mut visitor = PlaceholderHirTyCollector::default();
|
let mut visitor = PlaceholderHirTyCollector::default();
|
||||||
visitor.visit_impl_item(impl_item);
|
visitor.visit_impl_item(impl_item);
|
||||||
placeholder_type_error(tcx, None, &[], visitor.0, false);
|
placeholder_type_error(tcx, None, &[], visitor.0, false, false);
|
||||||
}
|
}
|
||||||
hir::ImplItemKind::Const(..) => {}
|
hir::ImplItemKind::Const(..) => {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,33 +129,18 @@ LL | fn foo<X: K<_, _>>(x: X) {}
|
||||||
| ^ ^ not allowed in type signatures
|
| ^ ^ not allowed in type signatures
|
||||||
| |
|
| |
|
||||||
| not allowed in type signatures
|
| not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn foo<X: K<T, T>, T>(x: X) {}
|
|
||||||
| ^ ^ ^^^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/bad-assoc-ty.rs:52:34
|
--> $DIR/bad-assoc-ty.rs:52:34
|
||||||
|
|
|
|
||||||
LL | fn bar<F>(_: F) where F: Fn() -> _ {}
|
LL | fn bar<F>(_: F) where F: Fn() -> _ {}
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn bar<F, T>(_: F) where F: Fn() -> T {}
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/bad-assoc-ty.rs:55:19
|
--> $DIR/bad-assoc-ty.rs:55:19
|
||||||
|
|
|
|
||||||
LL | fn baz<F: Fn() -> _>(_: F) {}
|
LL | fn baz<F: Fn() -> _>(_: F) {}
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn baz<F: Fn() -> T, T>(_: F) {}
|
|
||||||
| ^^^^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/bad-assoc-ty.rs:58:33
|
--> $DIR/bad-assoc-ty.rs:58:33
|
||||||
|
@ -217,11 +202,6 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
|
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn foo<F, T>(_: F) where F: Fn() -> T {}
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error: aborting due to 28 previous errors
|
error: aborting due to 28 previous errors
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,7 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
--> $DIR/issue-74086.rs:2:20
|
--> $DIR/issue-74086.rs:2:20
|
||||||
|
|
|
|
||||||
LL | static BUG: fn(_) -> u8 = |_| 8;
|
LL | static BUG: fn(_) -> u8 = |_| 8;
|
||||||
| ^
|
| ^ not allowed in type signatures
|
||||||
| |
|
|
||||||
| not allowed in type signatures
|
|
||||||
| help: use type parameters instead: `T`
|
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
10
src/test/ui/issues/issue-81885.rs
Normal file
10
src/test/ui/issues/issue-81885.rs
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
const TEST4: fn() -> _ = 42;
|
||||||
|
//~^ ERROR the type placeholder `_` is not allowed within types on item
|
||||||
|
//signatures
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
const TEST5: fn() -> _ = 42;
|
||||||
|
//~^ ERROR the type placeholder `_` is not allowed within types on item
|
||||||
|
//signatures
|
||||||
|
|
||||||
|
}
|
15
src/test/ui/issues/issue-81885.stderr
Normal file
15
src/test/ui/issues/issue-81885.stderr
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
|
--> $DIR/issue-81885.rs:1:22
|
||||||
|
|
|
||||||
|
LL | const TEST4: fn() -> _ = 42;
|
||||||
|
| ^ not allowed in type signatures
|
||||||
|
|
||||||
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
|
--> $DIR/issue-81885.rs:6:26
|
||||||
|
|
|
||||||
|
LL | const TEST5: fn() -> _ = 42;
|
||||||
|
| ^ not allowed in type signatures
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0121`.
|
|
@ -3,22 +3,12 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn f(self: _) {}
|
LL | fn f(self: _) {}
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn f<T>(self: T) {}
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/self-infer.rs:5:17
|
--> $DIR/self-infer.rs:5:17
|
||||||
|
|
|
|
||||||
LL | fn g(self: &_) {}
|
LL | fn g(self: &_) {}
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn g<T>(self: &T) {}
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -92,64 +92,36 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn test6(_: _) { }
|
LL | fn test6(_: _) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn test6<T>(_: T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:24:18
|
--> $DIR/typeck_type_placeholder_item.rs:24:18
|
||||||
|
|
|
|
||||||
LL | fn test6_b<T>(_: _, _: T) { }
|
LL | fn test6_b<T>(_: _, _: T) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn test6_b<T, U>(_: U, _: T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:27:30
|
--> $DIR/typeck_type_placeholder_item.rs:27:30
|
||||||
|
|
|
|
||||||
LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
|
LL | fn test6_c<T, K, L, A, B>(_: _, _: (T, K, L, A, B)) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn test6_c<T, K, L, A, B, U>(_: U, _: (T, K, L, A, B)) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:30:13
|
--> $DIR/typeck_type_placeholder_item.rs:30:13
|
||||||
|
|
|
|
||||||
LL | fn test7(x: _) { let _x: usize = x; }
|
LL | fn test7(x: _) { let _x: usize = x; }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn test7<T>(x: T) { let _x: usize = x; }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:33:22
|
|
||||||
|
|
|
||||||
LL | fn test8(_f: fn() -> _) { }
|
|
||||||
| ^
|
|
||||||
| |
|
|
||||||
| not allowed in type signatures
|
|
||||||
| help: use type parameters instead: `T`
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:33:22
|
--> $DIR/typeck_type_placeholder_item.rs:33:22
|
||||||
|
|
|
|
||||||
LL | fn test8(_f: fn() -> _) { }
|
LL | fn test8(_f: fn() -> _) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
||||||
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
|
--> $DIR/typeck_type_placeholder_item.rs:33:22
|
||||||
|
|
|
|
||||||
help: use type parameters instead
|
LL | fn test8(_f: fn() -> _) { }
|
||||||
|
|
| ^ not allowed in type signatures
|
||||||
LL | fn test8<T>(_f: fn() -> T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:47:26
|
--> $DIR/typeck_type_placeholder_item.rs:47:26
|
||||||
|
@ -257,42 +229,24 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn fn_test6(_: _) { }
|
LL | fn fn_test6(_: _) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn fn_test6<T>(_: T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:97:20
|
--> $DIR/typeck_type_placeholder_item.rs:97:20
|
||||||
|
|
|
|
||||||
LL | fn fn_test7(x: _) { let _x: usize = x; }
|
LL | fn fn_test7(x: _) { let _x: usize = x; }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn fn_test7<T>(x: T) { let _x: usize = x; }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:100:29
|
|
||||||
|
|
|
||||||
LL | fn fn_test8(_f: fn() -> _) { }
|
|
||||||
| ^
|
|
||||||
| |
|
|
||||||
| not allowed in type signatures
|
|
||||||
| help: use type parameters instead: `T`
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:100:29
|
--> $DIR/typeck_type_placeholder_item.rs:100:29
|
||||||
|
|
|
|
||||||
LL | fn fn_test8(_f: fn() -> _) { }
|
LL | fn fn_test8(_f: fn() -> _) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
||||||
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
|
--> $DIR/typeck_type_placeholder_item.rs:100:29
|
||||||
|
|
|
|
||||||
help: use type parameters instead
|
LL | fn fn_test8(_f: fn() -> _) { }
|
||||||
|
|
| ^ not allowed in type signatures
|
||||||
LL | fn fn_test8<T>(_f: fn() -> T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:123:12
|
--> $DIR/typeck_type_placeholder_item.rs:123:12
|
||||||
|
@ -415,11 +369,6 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn method_test1(&self, x: _);
|
LL | fn method_test1(&self, x: _);
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn method_test1<T>(&self, x: T);
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:142:31
|
--> $DIR/typeck_type_placeholder_item.rs:142:31
|
||||||
|
@ -428,33 +377,18 @@ LL | fn method_test2(&self, x: _) -> _;
|
||||||
| ^ ^ not allowed in type signatures
|
| ^ ^ not allowed in type signatures
|
||||||
| |
|
| |
|
||||||
| not allowed in type signatures
|
| not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn method_test2<T>(&self, x: T) -> T;
|
|
||||||
| ^^^ ^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:144:31
|
--> $DIR/typeck_type_placeholder_item.rs:144:31
|
||||||
|
|
|
|
||||||
LL | fn method_test3(&self) -> _;
|
LL | fn method_test3(&self) -> _;
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn method_test3<T>(&self) -> T;
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:146:26
|
--> $DIR/typeck_type_placeholder_item.rs:146:26
|
||||||
|
|
|
|
||||||
LL | fn assoc_fn_test1(x: _);
|
LL | fn assoc_fn_test1(x: _);
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn assoc_fn_test1<T>(x: T);
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:148:26
|
--> $DIR/typeck_type_placeholder_item.rs:148:26
|
||||||
|
@ -463,22 +397,12 @@ LL | fn assoc_fn_test2(x: _) -> _;
|
||||||
| ^ ^ not allowed in type signatures
|
| ^ ^ not allowed in type signatures
|
||||||
| |
|
| |
|
||||||
| not allowed in type signatures
|
| not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn assoc_fn_test2<T>(x: T) -> T;
|
|
||||||
| ^^^ ^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:150:28
|
--> $DIR/typeck_type_placeholder_item.rs:150:28
|
||||||
|
|
|
|
||||||
LL | fn assoc_fn_test3() -> _;
|
LL | fn assoc_fn_test3() -> _;
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn assoc_fn_test3<T>() -> T;
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:190:14
|
--> $DIR/typeck_type_placeholder_item.rs:190:14
|
||||||
|
@ -521,11 +445,6 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn test10(&self, _x : _) { }
|
LL | fn test10(&self, _x : _) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn test10<T>(&self, _x : T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:58:24
|
--> $DIR/typeck_type_placeholder_item.rs:58:24
|
||||||
|
@ -541,11 +460,6 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:107:31
|
--> $DIR/typeck_type_placeholder_item.rs:107:31
|
||||||
|
@ -561,11 +475,6 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn fn_test10(&self, _x : _) { }
|
LL | fn fn_test10(&self, _x : _) { }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn fn_test10<T>(&self, _x : T) { }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:115:28
|
--> $DIR/typeck_type_placeholder_item.rs:115:28
|
||||||
|
@ -581,11 +490,6 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
|
|
|
|
||||||
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||||
| ^ not allowed in type signatures
|
| ^ not allowed in type signatures
|
||||||
|
|
|
||||||
help: use type parameters instead
|
|
||||||
|
|
|
||||||
LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; }
|
|
||||||
| ^^^ ^
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item.rs:201:14
|
--> $DIR/typeck_type_placeholder_item.rs:201:14
|
||||||
|
|
|
@ -29,10 +29,7 @@ error[E0121]: the type placeholder `_` is not allowed within types on item signa
|
||||||
--> $DIR/typeck_type_placeholder_item_help.rs:13:22
|
--> $DIR/typeck_type_placeholder_item_help.rs:13:22
|
||||||
|
|
|
|
||||||
LL | const TEST4: fn() -> _ = 42;
|
LL | const TEST4: fn() -> _ = 42;
|
||||||
| ^
|
| ^ not allowed in type signatures
|
||||||
| |
|
|
||||||
| not allowed in type signatures
|
|
||||||
| help: use type parameters instead: `T`
|
|
||||||
|
|
||||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||||
--> $DIR/typeck_type_placeholder_item_help.rs:17:18
|
--> $DIR/typeck_type_placeholder_item_help.rs:17:18
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue