1
Fork 0

typeck: report placeholder type error w/out span

This commit fixes a regression introduced in rust-lang/rust#70369 which
meant that an error was not being emitted for invalid placeholder types
when there wasn't a span available.

Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
David Wood 2020-07-12 16:40:22 +01:00
parent 346aec9b02
commit 5afbc5201c
No known key found for this signature in database
GPG key ID: 2592E76C87381FD9
6 changed files with 103 additions and 63 deletions

View file

@ -3049,14 +3049,14 @@ 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 let (false, Some(ident_span)) = (self.allow_ty_infer(), ident_span) {
if !self.allow_ty_infer() {
// 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. 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.shrink_to_hi(),
ident_span.map(|sp| sp.shrink_to_hi()),
&generics.params[..],
visitor.0,
true,

View file

@ -129,7 +129,7 @@ struct CollectItemTypesVisitor<'tcx> {
/// all already existing generic type parameters to avoid suggesting a name that is already in use.
crate fn placeholder_type_error(
tcx: TyCtxt<'tcx>,
span: Span,
span: Option<Span>,
generics: &[hir::GenericParam<'_>],
placeholder_types: Vec<Span>,
suggest: bool,
@ -137,12 +137,15 @@ crate fn placeholder_type_error(
if placeholder_types.is_empty() {
return;
}
let type_name = generics.next_type_param_name(None);
let type_name = generics.next_type_param_name(None);
let mut sugg: Vec<_> =
placeholder_types.iter().map(|sp| (*sp, (*type_name).to_string())).collect();
if generics.is_empty() {
sugg.push((span, format!("<{}>", type_name)));
if let Some(span) = span {
sugg.push((span, format!("<{}>", type_name)));
}
} else if let Some(arg) = generics.iter().find(|arg| match arg.name {
hir::ParamName::Plain(Ident { name: kw::Underscore, .. }) => true,
_ => false,
@ -158,6 +161,7 @@ crate fn placeholder_type_error(
format!(", {}", type_name),
));
}
let mut err = bad_placeholder_type(tcx, placeholder_types);
if suggest {
err.multipart_suggestion(
@ -186,7 +190,7 @@ fn reject_placeholder_type_signatures_in_item(tcx: TyCtxt<'tcx>, item: &'tcx hir
let mut visitor = PlaceholderHirTyCollector::default();
visitor.visit_item(item);
placeholder_type_error(tcx, generics.span, &generics.params[..], visitor.0, suggest);
placeholder_type_error(tcx, Some(generics.span), &generics.params[..], visitor.0, suggest);
}
impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
@ -722,7 +726,7 @@ fn convert_trait_item(tcx: TyCtxt<'_>, trait_item_id: hir::HirId) {
// Account for `const C: _;` and `type T = _;`.
let mut visitor = PlaceholderHirTyCollector::default();
visitor.visit_trait_item(trait_item);
placeholder_type_error(tcx, DUMMY_SP, &[], visitor.0, false);
placeholder_type_error(tcx, None, &[], visitor.0, false);
}
hir::TraitItemKind::Type(_, None) => {}
@ -745,7 +749,7 @@ fn convert_impl_item(tcx: TyCtxt<'_>, impl_item_id: hir::HirId) {
// Account for `type T = _;`
let mut visitor = PlaceholderHirTyCollector::default();
visitor.visit_impl_item(impl_item);
placeholder_type_error(tcx, DUMMY_SP, &[], visitor.0, false);
placeholder_type_error(tcx, None, &[], visitor.0, false);
}
hir::ImplItemKind::Const(..) => {}
}

View file

@ -0,0 +1,4 @@
fn main() {
static BUG: fn(_) -> u8 = |_| 8;
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures [E0121]
}

View file

@ -0,0 +1,12 @@
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/issue-74086.rs:2:20
|
LL | static BUG: fn(_) -> u8 = |_| 8;
| ^
| |
| not allowed in type signatures
| help: use type parameters instead: `T`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0121`.

View file

@ -32,6 +32,7 @@ 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;
@ -98,6 +99,7 @@ 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;

View file

@ -1,35 +1,35 @@
error: expected identifier, found reserved identifier `_`
--> $DIR/typeck_type_placeholder_item.rs:152:18
--> $DIR/typeck_type_placeholder_item.rs:154:18
|
LL | struct BadStruct<_>(_);
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> $DIR/typeck_type_placeholder_item.rs:155:16
--> $DIR/typeck_type_placeholder_item.rs:157:16
|
LL | trait BadTrait<_> {}
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> $DIR/typeck_type_placeholder_item.rs:165:19
--> $DIR/typeck_type_placeholder_item.rs:167:19
|
LL | struct BadStruct1<_, _>(_);
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> $DIR/typeck_type_placeholder_item.rs:165:22
--> $DIR/typeck_type_placeholder_item.rs:167:22
|
LL | struct BadStruct1<_, _>(_);
| ^ expected identifier, found reserved identifier
error: expected identifier, found reserved identifier `_`
--> $DIR/typeck_type_placeholder_item.rs:170:19
--> $DIR/typeck_type_placeholder_item.rs:172:19
|
LL | struct BadStruct2<_, T>(_, T);
| ^ expected identifier, found reserved identifier
error: associated constant in `impl` without body
--> $DIR/typeck_type_placeholder_item.rs:201:5
--> $DIR/typeck_type_placeholder_item.rs:203: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:165:22
--> $DIR/typeck_type_placeholder_item.rs:167:22
|
LL | struct BadStruct1<_, _>(_);
| - ^ already used
@ -131,6 +131,15 @@ 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
--> $DIR/typeck_type_placeholder_item.rs:33:22
|
@ -143,7 +152,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:46:26
--> $DIR/typeck_type_placeholder_item.rs:47:26
|
LL | fn test11(x: &usize) -> &_ {
| -^
@ -152,7 +161,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:51:52
--> $DIR/typeck_type_placeholder_item.rs:52:52
|
LL | unsafe fn test12(x: *const usize) -> *const *const _ {
| --------------^
@ -161,7 +170,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:65:8
--> $DIR/typeck_type_placeholder_item.rs:66:8
|
LL | a: _,
| ^ not allowed in type signatures
@ -180,13 +189,13 @@ LL | b: (T, T),
|
error: missing type for `static` item
--> $DIR/typeck_type_placeholder_item.rs:71:12
--> $DIR/typeck_type_placeholder_item.rs:72: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:73:15
--> $DIR/typeck_type_placeholder_item.rs:74:15
|
LL | static B: _ = 42;
| ^
@ -195,13 +204,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:75:15
--> $DIR/typeck_type_placeholder_item.rs:76: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:78:21
--> $DIR/typeck_type_placeholder_item.rs:79:21
|
LL | fn fn_test() -> _ { 5 }
| ^
@ -210,7 +219,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:81:23
--> $DIR/typeck_type_placeholder_item.rs:82:23
|
LL | fn fn_test2() -> (_, _) { (5, 5) }
| -^--^-
@ -220,7 +229,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:84:22
--> $DIR/typeck_type_placeholder_item.rs:85:22
|
LL | static FN_TEST3: _ = "test";
| ^
@ -229,7 +238,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:87:22
--> $DIR/typeck_type_placeholder_item.rs:88:22
|
LL | static FN_TEST4: _ = 145;
| ^
@ -238,13 +247,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:90:22
--> $DIR/typeck_type_placeholder_item.rs:91: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:93:20
--> $DIR/typeck_type_placeholder_item.rs:94:20
|
LL | fn fn_test6(_: _) { }
| ^ not allowed in type signatures
@ -255,7 +264,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:96:20
--> $DIR/typeck_type_placeholder_item.rs:97:20
|
LL | fn fn_test7(x: _) { let _x: usize = x; }
| ^ not allowed in type signatures
@ -266,7 +275,16 @@ 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:99:29
--> $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
--> $DIR/typeck_type_placeholder_item.rs:100:29
|
LL | fn fn_test8(_f: fn() -> _) { }
| ^ not allowed in type signatures
@ -277,7 +295,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:121:12
--> $DIR/typeck_type_placeholder_item.rs:123:12
|
LL | a: _,
| ^ not allowed in type signatures
@ -296,13 +314,13 @@ LL | b: (T, T),
|
error[E0282]: type annotations needed
--> $DIR/typeck_type_placeholder_item.rs:126:18
--> $DIR/typeck_type_placeholder_item.rs:128: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:126:28
--> $DIR/typeck_type_placeholder_item.rs:128:28
|
LL | fn fn_test11(_: _) -> (_, _) { panic!() }
| ^ ^ not allowed in type signatures
@ -310,7 +328,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:130:30
--> $DIR/typeck_type_placeholder_item.rs:132:30
|
LL | fn fn_test12(x: i32) -> (_, _) { (x, x) }
| -^--^-
@ -320,7 +338,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:133:33
--> $DIR/typeck_type_placeholder_item.rs:135:33
|
LL | fn fn_test13(x: _) -> (i32, _) { (x, x) }
| ------^-
@ -329,7 +347,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:152:21
--> $DIR/typeck_type_placeholder_item.rs:154:21
|
LL | struct BadStruct<_>(_);
| ^ not allowed in type signatures
@ -340,7 +358,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:157:15
--> $DIR/typeck_type_placeholder_item.rs:159:15
|
LL | impl BadTrait<_> for BadStruct<_> {}
| ^ ^ not allowed in type signatures
@ -353,13 +371,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:160:34
--> $DIR/typeck_type_placeholder_item.rs:162: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:165:25
--> $DIR/typeck_type_placeholder_item.rs:167:25
|
LL | struct BadStruct1<_, _>(_);
| ^ not allowed in type signatures
@ -370,7 +388,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:170:25
--> $DIR/typeck_type_placeholder_item.rs:172:25
|
LL | struct BadStruct2<_, T>(_, T);
| ^ not allowed in type signatures
@ -381,13 +399,13 @@ LL | struct BadStruct2<U, T>(U, T);
| ^ ^
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
--> $DIR/typeck_type_placeholder_item.rs:174:14
--> $DIR/typeck_type_placeholder_item.rs:176: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:42:27
--> $DIR/typeck_type_placeholder_item.rs:43:27
|
LL | fn test10(&self, _x : _) { }
| ^ not allowed in type signatures
@ -398,7 +416,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:138:31
--> $DIR/typeck_type_placeholder_item.rs:140:31
|
LL | fn method_test1(&self, x: _);
| ^ not allowed in type signatures
@ -409,7 +427,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:140:31
--> $DIR/typeck_type_placeholder_item.rs:142:31
|
LL | fn method_test2(&self, x: _) -> _;
| ^ ^ not allowed in type signatures
@ -422,7 +440,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:142:31
--> $DIR/typeck_type_placeholder_item.rs:144:31
|
LL | fn method_test3(&self) -> _;
| ^ not allowed in type signatures
@ -433,7 +451,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:144:26
--> $DIR/typeck_type_placeholder_item.rs:146:26
|
LL | fn assoc_fn_test1(x: _);
| ^ not allowed in type signatures
@ -444,7 +462,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:146:26
--> $DIR/typeck_type_placeholder_item.rs:148:26
|
LL | fn assoc_fn_test2(x: _) -> _;
| ^ ^ not allowed in type signatures
@ -457,7 +475,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:148:28
--> $DIR/typeck_type_placeholder_item.rs:150:28
|
LL | fn assoc_fn_test3() -> _;
| ^ not allowed in type signatures
@ -468,7 +486,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:60:37
--> $DIR/typeck_type_placeholder_item.rs:61:37
|
LL | fn clone_from(&mut self, other: _) { *self = Test9; }
| ^ not allowed in type signatures
@ -479,7 +497,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:108:34
--> $DIR/typeck_type_placeholder_item.rs:110:34
|
LL | fn fn_test10(&self, _x : _) { }
| ^ not allowed in type signatures
@ -490,7 +508,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:116:41
--> $DIR/typeck_type_placeholder_item.rs:118:41
|
LL | fn clone_from(&mut self, other: _) { *self = FnTest9; }
| ^ not allowed in type signatures
@ -501,25 +519,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:180:21
--> $DIR/typeck_type_placeholder_item.rs:182: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:188:14
--> $DIR/typeck_type_placeholder_item.rs:190: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:190:14
--> $DIR/typeck_type_placeholder_item.rs:192: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:192:14
--> $DIR/typeck_type_placeholder_item.rs:194:14
|
LL | const D: _ = 42;
| ^
@ -528,7 +546,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:39:24
--> $DIR/typeck_type_placeholder_item.rs:40:24
|
LL | fn test9(&self) -> _ { () }
| ^
@ -537,7 +555,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:57:24
--> $DIR/typeck_type_placeholder_item.rs:58:24
|
LL | fn clone(&self) -> _ { Test9 }
| ^
@ -546,7 +564,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:105:31
--> $DIR/typeck_type_placeholder_item.rs:107:31
|
LL | fn fn_test9(&self) -> _ { () }
| ^
@ -555,7 +573,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:113:28
--> $DIR/typeck_type_placeholder_item.rs:115:28
|
LL | fn clone(&self) -> _ { FnTest9 }
| ^
@ -564,25 +582,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:197:14
--> $DIR/typeck_type_placeholder_item.rs:199: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:199:14
--> $DIR/typeck_type_placeholder_item.rs:201: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:201:14
--> $DIR/typeck_type_placeholder_item.rs:203: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:204:14
--> $DIR/typeck_type_placeholder_item.rs:206:14
|
LL | const D: _ = 42;
| ^
@ -590,7 +608,7 @@ LL | const D: _ = 42;
| not allowed in type signatures
| help: replace `_` with the correct type: `i32`
error: aborting due to 64 previous errors
error: aborting due to 66 previous errors
Some errors have detailed explanations: E0121, E0282, E0403.
For more information about an error, try `rustc --explain E0121`.