mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Rollup merge of #70369 - estebank:bad-placeholder-in-where, r=Centril
Fix smaller issues with invalid placeholder type errors Follow up to #70294. - Fix placement of suggested generic param when bounds are present. - Reduce error duplication for invalid placeholder types in `fn` types. r? @Centril
This commit is contained in:
commit
cb17049b36
@ -2883,16 +2883,17 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
let bare_fn_ty =
|
||||
ty::Binder::bind(tcx.mk_fn_sig(input_tys, output_ty, decl.c_variadic, unsafety, abi));
|
||||
|
||||
if !self.allow_ty_infer() {
|
||||
if let (false, Some(ident_span)) = (self.allow_ty_infer(), ident_span) {
|
||||
// We always collect the spans for placeholder types when evaluating `fn`s, but we
|
||||
// only want to emit an error complaining about them if infer types (`_`) are not
|
||||
// allowed. `allow_ty_infer` gates this behavior.
|
||||
// allowed. `allow_ty_infer` gates this behavior. We check for the presence of
|
||||
// `ident_span` to not emit an error twice when we have `fn foo(_: fn() -> _)`.
|
||||
crate::collect::placeholder_type_error(
|
||||
tcx,
|
||||
ident_span.map(|sp| sp.shrink_to_hi()).unwrap_or(DUMMY_SP),
|
||||
ident_span.shrink_to_hi(),
|
||||
&generics.params[..],
|
||||
visitor.0,
|
||||
ident_span.is_some(),
|
||||
true,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -162,8 +162,10 @@ crate fn placeholder_type_error(
|
||||
// `struct S<T>(T);` instead of `struct S<_, T>(T);`.
|
||||
sugg.push((arg.span, (*type_name).to_string()));
|
||||
} else {
|
||||
let last = generics.iter().last().unwrap();
|
||||
sugg.push((
|
||||
generics.iter().last().unwrap().span.shrink_to_hi(),
|
||||
// Account for bounds, we want `fn foo<T: E, K>(_: K)` not `fn foo<T, K: E>(_: K)`.
|
||||
last.bounds_span().unwrap_or(last.span).shrink_to_hi(),
|
||||
format!(", {}", type_name),
|
||||
));
|
||||
}
|
||||
@ -1501,9 +1503,13 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
|
||||
AstConv::ty_of_fn(&icx, header.unsafety, header.abi, decl, &generics, Some(ident.span))
|
||||
}
|
||||
|
||||
ForeignItem(&hir::ForeignItem { kind: ForeignItemKind::Fn(ref fn_decl, _, _), .. }) => {
|
||||
ForeignItem(&hir::ForeignItem {
|
||||
kind: ForeignItemKind::Fn(ref fn_decl, _, _),
|
||||
ident,
|
||||
..
|
||||
}) => {
|
||||
let abi = tcx.hir().get_foreign_abi(hir_id);
|
||||
compute_sig_of_foreign_fn_decl(tcx, def_id, fn_decl, abi)
|
||||
compute_sig_of_foreign_fn_decl(tcx, def_id, fn_decl, abi, ident)
|
||||
}
|
||||
|
||||
Ctor(data) | Variant(hir::Variant { data, .. }) if data.ctor_hir_id().is_some() => {
|
||||
@ -2116,6 +2122,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
def_id: DefId,
|
||||
decl: &'tcx hir::FnDecl<'tcx>,
|
||||
abi: abi::Abi,
|
||||
ident: Ident,
|
||||
) -> ty::PolyFnSig<'tcx> {
|
||||
let unsafety = if abi == abi::Abi::RustIntrinsic {
|
||||
intrinsic_operation_unsafety(&tcx.item_name(def_id).as_str())
|
||||
@ -2128,7 +2135,7 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
|
||||
abi,
|
||||
decl,
|
||||
&hir::Generics::empty(),
|
||||
None,
|
||||
Some(ident.span),
|
||||
);
|
||||
|
||||
// Feature gate SIMD types in FFI, since I am not sure that the
|
||||
|
@ -145,8 +145,8 @@ LL | fn foo<X: K<_, _>>(x: X) {}
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | fn foo<X, T: K<T, T>>(x: X) {}
|
||||
| ^^^ ^ ^
|
||||
LL | fn foo<X: K<T, T>, T>(x: X) {}
|
||||
| ^ ^ ^^^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/bad-assoc-ty.rs:52:34
|
||||
@ -167,8 +167,8 @@ LL | fn baz<F: Fn() -> _>(_: F) {}
|
||||
|
|
||||
help: use type parameters instead
|
||||
|
|
||||
LL | fn baz<F, T: Fn() -> T>(_: F) {}
|
||||
| ^^^ ^
|
||||
LL | fn baz<F: Fn() -> T, T>(_: F) {}
|
||||
| ^^^^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/bad-assoc-ty.rs:58:33
|
||||
|
@ -32,7 +32,6 @@ fn test7(x: _) { let _x: usize = x; }
|
||||
|
||||
fn test8(_f: fn() -> _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
struct Test9;
|
||||
|
||||
@ -99,7 +98,6 @@ pub fn main() {
|
||||
|
||||
fn fn_test8(_f: fn() -> _) { }
|
||||
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
|
||||
|
||||
struct FnTest9;
|
||||
|
||||
|
@ -1,35 +1,35 @@
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:18
|
||||
--> $DIR/typeck_type_placeholder_item.rs:152:18
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:157:16
|
||||
--> $DIR/typeck_type_placeholder_item.rs:155:16
|
||||
|
|
||||
LL | trait BadTrait<_> {}
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:167:19
|
||||
--> $DIR/typeck_type_placeholder_item.rs:165:19
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:167:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:165:22
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: expected identifier, found reserved identifier `_`
|
||||
--> $DIR/typeck_type_placeholder_item.rs:172:19
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:19
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ expected identifier, found reserved identifier
|
||||
|
||||
error: associated constant in `impl` without body
|
||||
--> $DIR/typeck_type_placeholder_item.rs:203:5
|
||||
--> $DIR/typeck_type_placeholder_item.rs:201:5
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^^^^^^^^^^-
|
||||
@ -37,7 +37,7 @@ LL | const C: _;
|
||||
| help: provide a definition for the constant: `= <expr>;`
|
||||
|
||||
error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters
|
||||
--> $DIR/typeck_type_placeholder_item.rs:167:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:165:22
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| - ^ already used
|
||||
@ -131,12 +131,6 @@ 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
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:33:22
|
||||
|
|
||||
@ -149,7 +143,7 @@ LL | fn test8<T>(_f: fn() -> T) { }
|
||||
| ^^^ ^
|
||||
|
||||
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:46:26
|
||||
|
|
||||
LL | fn test11(x: &usize) -> &_ {
|
||||
| -^
|
||||
@ -158,7 +152,7 @@ LL | fn test11(x: &usize) -> &_ {
|
||||
| help: replace with the correct return type: `&&usize`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:52:52
|
||||
--> $DIR/typeck_type_placeholder_item.rs:51:52
|
||||
|
|
||||
LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
| --------------^
|
||||
@ -167,7 +161,7 @@ LL | unsafe fn test12(x: *const usize) -> *const *const _ {
|
||||
| help: replace with the correct return type: `*const *const usize`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:66:8
|
||||
--> $DIR/typeck_type_placeholder_item.rs:65:8
|
||||
|
|
||||
LL | a: _,
|
||||
| ^ not allowed in type signatures
|
||||
@ -186,13 +180,13 @@ LL | b: (T, T),
|
||||
|
|
||||
|
||||
error: missing type for `static` item
|
||||
--> $DIR/typeck_type_placeholder_item.rs:72:12
|
||||
--> $DIR/typeck_type_placeholder_item.rs:71:12
|
||||
|
|
||||
LL | static A = 42;
|
||||
| ^ help: provide a type for the item: `A: i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:74:15
|
||||
--> $DIR/typeck_type_placeholder_item.rs:73:15
|
||||
|
|
||||
LL | static B: _ = 42;
|
||||
| ^
|
||||
@ -201,13 +195,13 @@ LL | static B: _ = 42;
|
||||
| help: replace `_` with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:76:15
|
||||
--> $DIR/typeck_type_placeholder_item.rs:75:15
|
||||
|
|
||||
LL | static C: Option<_> = Some(42);
|
||||
| ^^^^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:79:21
|
||||
--> $DIR/typeck_type_placeholder_item.rs:78:21
|
||||
|
|
||||
LL | fn fn_test() -> _ { 5 }
|
||||
| ^
|
||||
@ -216,7 +210,7 @@ LL | fn fn_test() -> _ { 5 }
|
||||
| help: replace with the correct return type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:82:23
|
||||
--> $DIR/typeck_type_placeholder_item.rs:81:23
|
||||
|
|
||||
LL | fn fn_test2() -> (_, _) { (5, 5) }
|
||||
| -^--^-
|
||||
@ -226,7 +220,7 @@ LL | fn fn_test2() -> (_, _) { (5, 5) }
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:85:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:84:22
|
||||
|
|
||||
LL | static FN_TEST3: _ = "test";
|
||||
| ^
|
||||
@ -235,7 +229,7 @@ LL | static FN_TEST3: _ = "test";
|
||||
| help: replace `_` with the correct type: `&str`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:88:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:87:22
|
||||
|
|
||||
LL | static FN_TEST4: _ = 145;
|
||||
| ^
|
||||
@ -244,13 +238,13 @@ LL | static FN_TEST4: _ = 145;
|
||||
| help: replace `_` with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:91:22
|
||||
--> $DIR/typeck_type_placeholder_item.rs:90:22
|
||||
|
|
||||
LL | static FN_TEST5: (_, _) = (1, 2);
|
||||
| ^^^^^^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:94:20
|
||||
--> $DIR/typeck_type_placeholder_item.rs:93:20
|
||||
|
|
||||
LL | fn fn_test6(_: _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@ -261,7 +255,7 @@ LL | fn fn_test6<T>(_: T) { }
|
||||
| ^^^ ^
|
||||
|
||||
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:96:20
|
||||
|
|
||||
LL | fn fn_test7(x: _) { let _x: usize = x; }
|
||||
| ^ not allowed in type signatures
|
||||
@ -272,13 +266,7 @@ 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
|
||||
|
||||
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:99:29
|
||||
|
|
||||
LL | fn fn_test8(_f: fn() -> _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@ -289,7 +277,7 @@ LL | fn fn_test8<T>(_f: fn() -> T) { }
|
||||
| ^^^ ^
|
||||
|
||||
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:121:12
|
||||
|
|
||||
LL | a: _,
|
||||
| ^ not allowed in type signatures
|
||||
@ -308,13 +296,13 @@ LL | b: (T, T),
|
||||
|
|
||||
|
||||
error[E0282]: type annotations needed
|
||||
--> $DIR/typeck_type_placeholder_item.rs:128:18
|
||||
--> $DIR/typeck_type_placeholder_item.rs:126:18
|
||||
|
|
||||
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| ^ cannot infer type
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:128:28
|
||||
--> $DIR/typeck_type_placeholder_item.rs:126:28
|
||||
|
|
||||
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| ^ ^ not allowed in type signatures
|
||||
@ -322,7 +310,7 @@ LL | fn fn_test11(_: _) -> (_, _) { panic!() }
|
||||
| not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:132:30
|
||||
--> $DIR/typeck_type_placeholder_item.rs:130:30
|
||||
|
|
||||
LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
| -^--^-
|
||||
@ -332,7 +320,7 @@ LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:135:33
|
||||
--> $DIR/typeck_type_placeholder_item.rs:133:33
|
||||
|
|
||||
LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| ------^-
|
||||
@ -341,7 +329,7 @@ LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
|
||||
| help: replace with the correct return type: `(i32, i32)`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:154:21
|
||||
--> $DIR/typeck_type_placeholder_item.rs:152:21
|
||||
|
|
||||
LL | struct BadStruct<_>(_);
|
||||
| ^ not allowed in type signatures
|
||||
@ -352,7 +340,7 @@ LL | struct BadStruct<T>(T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:159:15
|
||||
--> $DIR/typeck_type_placeholder_item.rs:157:15
|
||||
|
|
||||
LL | impl BadTrait<_> for BadStruct<_> {}
|
||||
| ^ ^ not allowed in type signatures
|
||||
@ -365,13 +353,13 @@ LL | impl<T> BadTrait<T> for BadStruct<T> {}
|
||||
| ^^^ ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:162:34
|
||||
--> $DIR/typeck_type_placeholder_item.rs:160:34
|
||||
|
|
||||
LL | fn impl_trait() -> impl BadTrait<_> {
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:167:25
|
||||
--> $DIR/typeck_type_placeholder_item.rs:165:25
|
||||
|
|
||||
LL | struct BadStruct1<_, _>(_);
|
||||
| ^ not allowed in type signatures
|
||||
@ -382,7 +370,7 @@ LL | struct BadStruct1<T, _>(T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:172:25
|
||||
--> $DIR/typeck_type_placeholder_item.rs:170:25
|
||||
|
|
||||
LL | struct BadStruct2<_, T>(_, T);
|
||||
| ^ not allowed in type signatures
|
||||
@ -393,13 +381,13 @@ LL | struct BadStruct2<K, T>(K, T);
|
||||
| ^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:176:14
|
||||
--> $DIR/typeck_type_placeholder_item.rs:174:14
|
||||
|
|
||||
LL | type X = Box<_>;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:43:27
|
||||
--> $DIR/typeck_type_placeholder_item.rs:42:27
|
||||
|
|
||||
LL | fn test10(&self, _x : _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@ -410,7 +398,7 @@ LL | fn test10<T>(&self, _x : T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:140:31
|
||||
--> $DIR/typeck_type_placeholder_item.rs:138:31
|
||||
|
|
||||
LL | fn method_test1(&self, x: _);
|
||||
| ^ not allowed in type signatures
|
||||
@ -421,7 +409,7 @@ LL | fn method_test1<T>(&self, x: T);
|
||||
| ^^^ ^
|
||||
|
||||
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:140:31
|
||||
|
|
||||
LL | fn method_test2(&self, x: _) -> _;
|
||||
| ^ ^ not allowed in type signatures
|
||||
@ -434,7 +422,7 @@ LL | fn method_test2<T>(&self, x: T) -> T;
|
||||
| ^^^ ^ ^
|
||||
|
||||
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:142:31
|
||||
|
|
||||
LL | fn method_test3(&self) -> _;
|
||||
| ^ not allowed in type signatures
|
||||
@ -445,7 +433,7 @@ LL | fn method_test3<T>(&self) -> T;
|
||||
| ^^^ ^
|
||||
|
||||
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:144:26
|
||||
|
|
||||
LL | fn assoc_fn_test1(x: _);
|
||||
| ^ not allowed in type signatures
|
||||
@ -456,7 +444,7 @@ LL | fn assoc_fn_test1<T>(x: T);
|
||||
| ^^^ ^
|
||||
|
||||
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:146:26
|
||||
|
|
||||
LL | fn assoc_fn_test2(x: _) -> _;
|
||||
| ^ ^ not allowed in type signatures
|
||||
@ -469,7 +457,7 @@ LL | fn assoc_fn_test2<T>(x: T) -> T;
|
||||
| ^^^ ^ ^
|
||||
|
||||
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:148:28
|
||||
|
|
||||
LL | fn assoc_fn_test3() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
@ -480,7 +468,7 @@ LL | fn assoc_fn_test3<T>() -> T;
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:61:37
|
||||
--> $DIR/typeck_type_placeholder_item.rs:60:37
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
|
||||
| ^ not allowed in type signatures
|
||||
@ -491,7 +479,7 @@ LL | fn clone_from<T>(&mut self, other: T) { *self = Test9; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:110:34
|
||||
--> $DIR/typeck_type_placeholder_item.rs:108:34
|
||||
|
|
||||
LL | fn fn_test10(&self, _x : _) { }
|
||||
| ^ not allowed in type signatures
|
||||
@ -502,7 +490,7 @@ LL | fn fn_test10<T>(&self, _x : T) { }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:118:41
|
||||
--> $DIR/typeck_type_placeholder_item.rs:116:41
|
||||
|
|
||||
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
|
||||
| ^ not allowed in type signatures
|
||||
@ -513,25 +501,25 @@ LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; }
|
||||
| ^^^ ^
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:182:21
|
||||
--> $DIR/typeck_type_placeholder_item.rs:180:21
|
||||
|
|
||||
LL | type Y = impl Trait<_>;
|
||||
| ^ not allowed in type 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:188:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:192:14
|
||||
--> $DIR/typeck_type_placeholder_item.rs:190:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:194:14
|
||||
--> $DIR/typeck_type_placeholder_item.rs:192:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
@ -540,7 +528,7 @@ LL | const D: _ = 42;
|
||||
| help: replace `_` with the correct type: `i32`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:40:24
|
||||
--> $DIR/typeck_type_placeholder_item.rs:39:24
|
||||
|
|
||||
LL | fn test9(&self) -> _ { () }
|
||||
| ^
|
||||
@ -549,7 +537,7 @@ LL | fn test9(&self) -> _ { () }
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
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:57:24
|
||||
|
|
||||
LL | fn clone(&self) -> _ { Test9 }
|
||||
| ^
|
||||
@ -558,7 +546,7 @@ LL | fn clone(&self) -> _ { Test9 }
|
||||
| help: replace with the correct return type: `Test9`
|
||||
|
||||
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:105:31
|
||||
|
|
||||
LL | fn fn_test9(&self) -> _ { () }
|
||||
| ^
|
||||
@ -567,7 +555,7 @@ LL | fn fn_test9(&self) -> _ { () }
|
||||
| help: replace with the correct return type: `()`
|
||||
|
||||
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:113:28
|
||||
|
|
||||
LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| ^
|
||||
@ -576,25 +564,25 @@ LL | fn clone(&self) -> _ { FnTest9 }
|
||||
| help: replace with the correct return type: `main::FnTest9`
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:199:14
|
||||
--> $DIR/typeck_type_placeholder_item.rs:197:14
|
||||
|
|
||||
LL | type A = _;
|
||||
| ^ not allowed in type 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:199:14
|
||||
|
|
||||
LL | type B = _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:203:14
|
||||
--> $DIR/typeck_type_placeholder_item.rs:201:14
|
||||
|
|
||||
LL | const C: _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/typeck_type_placeholder_item.rs:206:14
|
||||
--> $DIR/typeck_type_placeholder_item.rs:204:14
|
||||
|
|
||||
LL | const D: _ = 42;
|
||||
| ^
|
||||
@ -602,7 +590,7 @@ LL | const D: _ = 42;
|
||||
| not allowed in type signatures
|
||||
| help: replace `_` with the correct type: `i32`
|
||||
|
||||
error: aborting due to 66 previous errors
|
||||
error: aborting due to 64 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0121, E0282, E0403.
|
||||
For more information about an error, try `rustc --explain E0121`.
|
||||
|
Loading…
Reference in New Issue
Block a user