Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4331852

Browse files
committedApr 3, 2020
Auto merge of rust-lang#70742 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum
[beta] backport 4 PRs This backports the following PRs: * parse_and_disallow_postfix_after_cast: account for `ExprKind::Err`. rust-lang#70556 * Account for bad placeholder types in where clauses rust-lang#70294 * Fix "since" field for `Once::is_complete`'s `#[stable]` attribute rust-lang#70018 * Ensure HAS_FREE_LOCAL_NAMES is set for ReFree rust-lang#69956 All commits cherry picked cleanly.
2 parents 4c587bb + 223e1b5 commit 4331852

13 files changed

+234
-113
lines changed
 

‎src/librustc/ty/mod.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -554,24 +554,26 @@ bitflags! {
554554
/// Does this have [ConstKind::Placeholder]?
555555
const HAS_CT_PLACEHOLDER = 1 << 8;
556556

557+
/// `true` if there are "names" of regions and so forth
558+
/// that are local to a particular fn/inferctxt
559+
const HAS_FREE_LOCAL_REGIONS = 1 << 9;
560+
557561
/// `true` if there are "names" of types and regions and so forth
558562
/// that are local to a particular fn
559563
const HAS_FREE_LOCAL_NAMES = TypeFlags::HAS_TY_PARAM.bits
560-
| TypeFlags::HAS_RE_PARAM.bits
561564
| TypeFlags::HAS_CT_PARAM.bits
562565
| TypeFlags::HAS_TY_INFER.bits
563-
| TypeFlags::HAS_RE_INFER.bits
564566
| TypeFlags::HAS_CT_INFER.bits
565567
| TypeFlags::HAS_TY_PLACEHOLDER.bits
566-
| TypeFlags::HAS_RE_PLACEHOLDER.bits
567-
| TypeFlags::HAS_CT_PLACEHOLDER.bits;
568+
| TypeFlags::HAS_CT_PLACEHOLDER.bits
569+
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits;
568570

569571
/// Does this have [Projection] or [UnnormalizedProjection]?
570-
const HAS_TY_PROJECTION = 1 << 9;
572+
const HAS_TY_PROJECTION = 1 << 10;
571573
/// Does this have [Opaque]?
572-
const HAS_TY_OPAQUE = 1 << 10;
574+
const HAS_TY_OPAQUE = 1 << 11;
573575
/// Does this have [ConstKind::Unevaluated]?
574-
const HAS_CT_PROJECTION = 1 << 11;
576+
const HAS_CT_PROJECTION = 1 << 12;
575577

576578
/// Could this type be normalized further?
577579
const HAS_PROJECTION = TypeFlags::HAS_TY_PROJECTION.bits
@@ -580,21 +582,21 @@ bitflags! {
580582

581583
/// Present if the type belongs in a local type context.
582584
/// Set for placeholders and inference variables that are not "Fresh".
583-
const KEEP_IN_LOCAL_TCX = 1 << 12;
585+
const KEEP_IN_LOCAL_TCX = 1 << 13;
584586

585587
/// Is an error type reachable?
586-
const HAS_TY_ERR = 1 << 13;
588+
const HAS_TY_ERR = 1 << 14;
587589

588590
/// Does this have any region that "appears free" in the type?
589591
/// Basically anything but [ReLateBound] and [ReErased].
590-
const HAS_FREE_REGIONS = 1 << 14;
592+
const HAS_FREE_REGIONS = 1 << 15;
591593

592594
/// Does this have any [ReLateBound] regions? Used to check
593595
/// if a global bound is safe to evaluate.
594-
const HAS_RE_LATE_BOUND = 1 << 15;
596+
const HAS_RE_LATE_BOUND = 1 << 16;
595597

596598
/// Does this have any [ReErased] regions?
597-
const HAS_RE_ERASED = 1 << 16;
599+
const HAS_RE_ERASED = 1 << 17;
598600

599601
/// Flags representing the nominal content of a type,
600602
/// computed by FlagsComputation. If you add a new nominal
@@ -608,6 +610,7 @@ bitflags! {
608610
| TypeFlags::HAS_TY_PLACEHOLDER.bits
609611
| TypeFlags::HAS_RE_PLACEHOLDER.bits
610612
| TypeFlags::HAS_CT_PLACEHOLDER.bits
613+
| TypeFlags::HAS_FREE_LOCAL_REGIONS.bits
611614
| TypeFlags::HAS_TY_PROJECTION.bits
612615
| TypeFlags::HAS_TY_OPAQUE.bits
613616
| TypeFlags::HAS_CT_PROJECTION.bits

‎src/librustc/ty/sty.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -1743,42 +1743,42 @@ impl RegionKind {
17431743
}
17441744
}
17451745

1746-
pub fn keep_in_local_tcx(&self) -> bool {
1747-
if let ty::ReVar(..) = self { true } else { false }
1748-
}
1749-
17501746
pub fn type_flags(&self) -> TypeFlags {
17511747
let mut flags = TypeFlags::empty();
17521748

1753-
if self.keep_in_local_tcx() {
1754-
flags = flags | TypeFlags::KEEP_IN_LOCAL_TCX;
1755-
}
1756-
17571749
match *self {
17581750
ty::ReVar(..) => {
17591751
flags = flags | TypeFlags::HAS_FREE_REGIONS;
1752+
flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS;
17601753
flags = flags | TypeFlags::HAS_RE_INFER;
1754+
flags = flags | TypeFlags::KEEP_IN_LOCAL_TCX;
17611755
}
17621756
ty::RePlaceholder(..) => {
17631757
flags = flags | TypeFlags::HAS_FREE_REGIONS;
1758+
flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS;
17641759
flags = flags | TypeFlags::HAS_RE_PLACEHOLDER;
17651760
}
1766-
ty::ReLateBound(..) => {
1767-
flags = flags | TypeFlags::HAS_RE_LATE_BOUND;
1768-
}
17691761
ty::ReEarlyBound(..) => {
17701762
flags = flags | TypeFlags::HAS_FREE_REGIONS;
1763+
flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS;
17711764
flags = flags | TypeFlags::HAS_RE_PARAM;
17721765
}
1773-
ty::ReEmpty(_) | ty::ReStatic | ty::ReFree { .. } | ty::ReScope { .. } => {
1766+
ty::ReFree { .. } | ty::ReScope { .. } => {
17741767
flags = flags | TypeFlags::HAS_FREE_REGIONS;
1768+
flags = flags | TypeFlags::HAS_FREE_LOCAL_REGIONS;
17751769
}
1776-
ty::ReErased => {
1777-
flags = flags | TypeFlags::HAS_RE_ERASED;
1770+
ty::ReEmpty(_) | ty::ReStatic => {
1771+
flags = flags | TypeFlags::HAS_FREE_REGIONS;
17781772
}
17791773
ty::ReClosureBound(..) => {
17801774
flags = flags | TypeFlags::HAS_FREE_REGIONS;
17811775
}
1776+
ty::ReLateBound(..) => {
1777+
flags = flags | TypeFlags::HAS_RE_LATE_BOUND;
1778+
}
1779+
ty::ReErased => {
1780+
flags = flags | TypeFlags::HAS_RE_ERASED;
1781+
}
17821782
}
17831783

17841784
debug!("type_flags({:?}) = {:?}", self, flags);

‎src/librustc_parse/parser/expr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ impl<'a> Parser<'a> {
638638
ExprKind::MethodCall(_, _) => "a method call",
639639
ExprKind::Call(_, _) => "a function call",
640640
ExprKind::Await(_) => "`.await`",
641+
ExprKind::Err => return Ok(with_postfix),
641642
_ => unreachable!("parse_dot_or_call_expr_with_ shouldn't produce this"),
642643
}
643644
);

‎src/librustc_typeck/astconv.rs

+14-20
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticId};
2323
use rustc_hir as hir;
2424
use rustc_hir::def::{CtorOf, DefKind, Namespace, Res};
2525
use rustc_hir::def_id::DefId;
26-
use rustc_hir::intravisit::Visitor;
26+
use rustc_hir::intravisit::{walk_generics, Visitor};
2727
use rustc_hir::print;
2828
use rustc_hir::{Constness, ExprKind, GenericArg, GenericArgs};
2929
use rustc_infer::traits;
@@ -838,18 +838,6 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
838838
}
839839
},
840840
);
841-
if !inferred_params.is_empty() {
842-
// We always collect the spans for placeholder types when evaluating `fn`s, but we
843-
// only want to emit an error complaining about them if infer types (`_`) are not
844-
// allowed. `allow_ty_infer` gates this behavior.
845-
crate::collect::placeholder_type_error(
846-
tcx,
847-
inferred_params[0],
848-
&[],
849-
inferred_params,
850-
false,
851-
);
852-
}
853841

854842
self.complain_about_missing_type_params(
855843
missing_type_params,
@@ -2734,7 +2722,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
27342722
}
27352723
hir::TyKind::BareFn(ref bf) => {
27362724
require_c_abi_if_c_variadic(tcx, &bf.decl, bf.abi, ast_ty.span);
2737-
tcx.mk_fn_ptr(self.ty_of_fn(bf.unsafety, bf.abi, &bf.decl, &[], None))
2725+
tcx.mk_fn_ptr(self.ty_of_fn(
2726+
bf.unsafety,
2727+
bf.abi,
2728+
&bf.decl,
2729+
&hir::Generics::empty(),
2730+
None,
2731+
))
27382732
}
27392733
hir::TyKind::TraitObject(ref bounds, ref lifetime) => {
27402734
self.conv_object_ty_poly_trait_ref(ast_ty.span, bounds, lifetime)
@@ -2917,7 +2911,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29172911
unsafety: hir::Unsafety,
29182912
abi: abi::Abi,
29192913
decl: &hir::FnDecl<'_>,
2920-
generic_params: &[hir::GenericParam<'_>],
2914+
generics: &hir::Generics<'_>,
29212915
ident_span: Option<Span>,
29222916
) -> ty::PolyFnSig<'tcx> {
29232917
debug!("ty_of_fn");
@@ -2929,6 +2923,8 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29292923
for ty in decl.inputs {
29302924
visitor.visit_ty(ty);
29312925
}
2926+
walk_generics(&mut visitor, generics);
2927+
29322928
let input_tys = decl.inputs.iter().map(|a| self.ty_of_arg(a, None));
29332929
let output_ty = match decl.output {
29342930
hir::FnRetTy::Return(ref output) => {
@@ -2950,7 +2946,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29502946
crate::collect::placeholder_type_error(
29512947
tcx,
29522948
ident_span.map(|sp| sp.shrink_to_hi()).unwrap_or(DUMMY_SP),
2953-
generic_params,
2949+
&generics.params[..],
29542950
visitor.0,
29552951
ident_span.is_some(),
29562952
);
@@ -2976,8 +2972,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29762972
tcx.sess,
29772973
decl.output.span(),
29782974
E0581,
2979-
"return type references {} \
2980-
which is not constrained by the fn input types",
2975+
"return type references {} which is not constrained by the fn input types",
29812976
lifetime_name
29822977
);
29832978
if let ty::BrAnon(_) = *br {
@@ -2988,8 +2983,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
29882983
// though we can easily give a hint that ought to be
29892984
// relevant.
29902985
err.note(
2991-
"lifetimes appearing in an associated type \
2992-
are not considered constrained",
2986+
"lifetimes appearing in an associated type are not considered constrained",
29932987
);
29942988
}
29952989
err.emit();

‎src/librustc_typeck/check/mod.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,14 @@ fn typeck_tables_of_with_fallback<'tcx>(
10041004
let fcx = if let (Some(header), Some(decl)) = (fn_header, fn_decl) {
10051005
let fn_sig = if crate::collect::get_infer_ret_ty(&decl.output).is_some() {
10061006
let fcx = FnCtxt::new(&inh, param_env, body.value.hir_id);
1007-
AstConv::ty_of_fn(&fcx, header.unsafety, header.abi, decl, &[], None)
1007+
AstConv::ty_of_fn(
1008+
&fcx,
1009+
header.unsafety,
1010+
header.abi,
1011+
decl,
1012+
&hir::Generics::empty(),
1013+
None,
1014+
)
10081015
} else {
10091016
tcx.fn_sig(def_id)
10101017
};

‎src/librustc_typeck/collect.rs

+12-10
Original file line numberDiff line numberDiff line change
@@ -1467,7 +1467,7 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
14671467
sig.header.unsafety,
14681468
sig.header.abi,
14691469
&sig.decl,
1470-
&generics.params[..],
1470+
&generics,
14711471
Some(ident.span),
14721472
),
14731473
}
@@ -1478,14 +1478,9 @@ fn fn_sig(tcx: TyCtxt<'_>, def_id: DefId) -> ty::PolyFnSig<'_> {
14781478
ident,
14791479
generics,
14801480
..
1481-
}) => AstConv::ty_of_fn(
1482-
&icx,
1483-
header.unsafety,
1484-
header.abi,
1485-
decl,
1486-
&generics.params[..],
1487-
Some(ident.span),
1488-
),
1481+
}) => {
1482+
AstConv::ty_of_fn(&icx, header.unsafety, header.abi, decl, &generics, Some(ident.span))
1483+
}
14891484

14901485
ForeignItem(&hir::ForeignItem { kind: ForeignItemKind::Fn(ref fn_decl, _, _), .. }) => {
14911486
let abi = tcx.hir().get_foreign_abi(hir_id);
@@ -2110,7 +2105,14 @@ fn compute_sig_of_foreign_fn_decl<'tcx>(
21102105
} else {
21112106
hir::Unsafety::Unsafe
21122107
};
2113-
let fty = AstConv::ty_of_fn(&ItemCtxt::new(tcx, def_id), unsafety, abi, decl, &[], None);
2108+
let fty = AstConv::ty_of_fn(
2109+
&ItemCtxt::new(tcx, def_id),
2110+
unsafety,
2111+
abi,
2112+
decl,
2113+
&hir::Generics::empty(),
2114+
None,
2115+
);
21142116

21152117
// Feature gate SIMD types in FFI, since I am not sure that the
21162118
// ABIs are handled at all correctly. -huonw

‎src/libstd/sync/once.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ impl Once {
363363
/// assert!(handle.join().is_err());
364364
/// assert_eq!(INIT.is_completed(), false);
365365
/// ```
366-
#[stable(feature = "once_is_completed", since = "1.44.0")]
366+
#[stable(feature = "once_is_completed", since = "1.43.0")]
367367
#[inline]
368368
pub fn is_completed(&self) -> bool {
369369
// An `Acquire` load is enough because that makes all the initialization

‎src/test/ui/did_you_mean/bad-assoc-ty.rs

+32
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,36 @@ trait K<A, B> {}
4949
fn foo<X: K<_, _>>(x: X) {}
5050
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
5151

52+
fn bar<F>(_: F) where F: Fn() -> _ {}
53+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
54+
55+
fn baz<F: Fn() -> _>(_: F) {}
56+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
57+
58+
struct L<F>(F) where F: Fn() -> _;
59+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
60+
struct M<F> where F: Fn() -> _ {
61+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
62+
a: F,
63+
}
64+
enum N<F> where F: Fn() -> _ {
65+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
66+
Foo(F),
67+
}
68+
69+
union O<F> where F: Fn() -> _ {
70+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
71+
//~| ERROR unions with non-`Copy` fields are unstable
72+
foo: F,
73+
}
74+
75+
trait P<F> where F: Fn() -> _ {
76+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
77+
}
78+
79+
trait Q {
80+
fn foo<F>(_: F) where F: Fn() -> _ {}
81+
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
82+
}
83+
5284
fn main() {}

‎src/test/ui/did_you_mean/bad-assoc-ty.stderr

+108-2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,19 @@ LL | type J = ty!(u8);
5757
|
5858
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
5959

60+
error[E0658]: unions with non-`Copy` fields are unstable
61+
--> $DIR/bad-assoc-ty.rs:69:1
62+
|
63+
LL | / union O<F> where F: Fn() -> _ {
64+
LL | |
65+
LL | |
66+
LL | | foo: F,
67+
LL | | }
68+
| |_^
69+
|
70+
= note: see issue #55149 <https://github.com/rust-lang/rust/issues/55149> for more information
71+
= help: add `#![feature(untagged_unions)]` to the crate attributes to enable
72+
6073
error[E0223]: ambiguous associated type
6174
--> $DIR/bad-assoc-ty.rs:1:10
6275
|
@@ -129,8 +142,101 @@ LL | fn foo<X: K<_, _>>(x: X) {}
129142
| ^ ^ not allowed in type signatures
130143
| |
131144
| not allowed in type signatures
145+
|
146+
help: use type parameters instead
147+
|
148+
LL | fn foo<X, T: K<T, T>>(x: X) {}
149+
| ^^^ ^ ^
150+
151+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
152+
--> $DIR/bad-assoc-ty.rs:52:34
153+
|
154+
LL | fn bar<F>(_: F) where F: Fn() -> _ {}
155+
| ^ not allowed in type signatures
156+
|
157+
help: use type parameters instead
158+
|
159+
LL | fn bar<F, T>(_: F) where F: Fn() -> T {}
160+
| ^^^ ^
161+
162+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
163+
--> $DIR/bad-assoc-ty.rs:55:19
164+
|
165+
LL | fn baz<F: Fn() -> _>(_: F) {}
166+
| ^ not allowed in type signatures
167+
|
168+
help: use type parameters instead
169+
|
170+
LL | fn baz<F, T: Fn() -> T>(_: F) {}
171+
| ^^^ ^
172+
173+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
174+
--> $DIR/bad-assoc-ty.rs:58:33
175+
|
176+
LL | struct L<F>(F) where F: Fn() -> _;
177+
| ^ not allowed in type signatures
178+
|
179+
help: use type parameters instead
180+
|
181+
LL | struct L<F, T>(F) where F: Fn() -> T;
182+
| ^^^ ^
183+
184+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
185+
--> $DIR/bad-assoc-ty.rs:60:30
186+
|
187+
LL | struct M<F> where F: Fn() -> _ {
188+
| ^ not allowed in type signatures
189+
|
190+
help: use type parameters instead
191+
|
192+
LL | struct M<F, T> where F: Fn() -> T {
193+
| ^^^ ^
194+
195+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
196+
--> $DIR/bad-assoc-ty.rs:64:28
197+
|
198+
LL | enum N<F> where F: Fn() -> _ {
199+
| ^ not allowed in type signatures
200+
|
201+
help: use type parameters instead
202+
|
203+
LL | enum N<F, T> where F: Fn() -> T {
204+
| ^^^ ^
205+
206+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
207+
--> $DIR/bad-assoc-ty.rs:69:29
208+
|
209+
LL | union O<F> where F: Fn() -> _ {
210+
| ^ not allowed in type signatures
211+
|
212+
help: use type parameters instead
213+
|
214+
LL | union O<F, T> where F: Fn() -> T {
215+
| ^^^ ^
216+
217+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
218+
--> $DIR/bad-assoc-ty.rs:75:29
219+
|
220+
LL | trait P<F> where F: Fn() -> _ {
221+
| ^ not allowed in type signatures
222+
|
223+
help: use type parameters instead
224+
|
225+
LL | trait P<F, T> where F: Fn() -> T {
226+
| ^^^ ^
227+
228+
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
229+
--> $DIR/bad-assoc-ty.rs:80:38
230+
|
231+
LL | fn foo<F>(_: F) where F: Fn() -> _ {}
232+
| ^ not allowed in type signatures
233+
|
234+
help: use type parameters instead
235+
|
236+
LL | fn foo<F, T>(_: F) where F: Fn() -> T {}
237+
| ^^^ ^
132238

133-
error: aborting due to 20 previous errors
239+
error: aborting due to 29 previous errors
134240

135-
Some errors have detailed explanations: E0121, E0223.
241+
Some errors have detailed explanations: E0121, E0223, E0658.
136242
For more information about an error, try `rustc --explain E0121`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
fn main() {
2+
expr as fun()(:); //~ ERROR expected expression
3+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected expression, found `:`
2+
--> $DIR/issue-70552-ascription-in-parens-after-call.rs:2:19
3+
|
4+
LL | expr as fun()(:);
5+
| ^ expected expression
6+
7+
error: aborting due to previous error
8+

‎src/test/ui/typeck/typeck_type_placeholder_item.rs

-5
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,9 @@ trait BadTrait<_> {}
158158
//~^ ERROR expected identifier, found reserved identifier `_`
159159
impl BadTrait<_> for BadStruct<_> {}
160160
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
161-
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
162-
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
163161

164162
fn impl_trait() -> impl BadTrait<_> {
165163
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
166-
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
167164
unimplemented!()
168165
}
169166

@@ -178,14 +175,12 @@ struct BadStruct2<_, T>(_, T);
178175

179176
type X = Box<_>;
180177
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
181-
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
182178

183179
struct Struct;
184180
trait Trait<T> {}
185181
impl Trait<usize> for Struct {}
186182
type Y = impl Trait<_>;
187183
//~^ ERROR the type placeholder `_` is not allowed within types on item signatures
188-
//~| ERROR the type placeholder `_` is not allowed within types on item signatures
189184
fn foo() -> Y {
190185
Struct
191186
}

‎src/test/ui/typeck/typeck_type_placeholder_item.stderr

+18-48
Original file line numberDiff line numberDiff line change
@@ -11,33 +11,33 @@ LL | trait BadTrait<_> {}
1111
| ^ expected identifier, found reserved identifier
1212

1313
error: expected identifier, found reserved identifier `_`
14-
--> $DIR/typeck_type_placeholder_item.rs:170:19
14+
--> $DIR/typeck_type_placeholder_item.rs:167:19
1515
|
1616
LL | struct BadStruct1<_, _>(_);
1717
| ^ expected identifier, found reserved identifier
1818

1919
error: expected identifier, found reserved identifier `_`
20-
--> $DIR/typeck_type_placeholder_item.rs:170:22
20+
--> $DIR/typeck_type_placeholder_item.rs:167:22
2121
|
2222
LL | struct BadStruct1<_, _>(_);
2323
| ^ expected identifier, found reserved identifier
2424

2525
error: expected identifier, found reserved identifier `_`
26-
--> $DIR/typeck_type_placeholder_item.rs:175:19
26+
--> $DIR/typeck_type_placeholder_item.rs:172:19
2727
|
2828
LL | struct BadStruct2<_, T>(_, T);
2929
| ^ expected identifier, found reserved identifier
3030

3131
error: associated constant in `impl` without body
32-
--> $DIR/typeck_type_placeholder_item.rs:208:5
32+
--> $DIR/typeck_type_placeholder_item.rs:203:5
3333
|
3434
LL | const C: _;
3535
| ^^^^^^^^^^-
3636
| |
3737
| help: provide a definition for the constant: `= <expr>;`
3838

3939
error[E0403]: the name `_` is already used for a generic parameter in this item's generic parameters
40-
--> $DIR/typeck_type_placeholder_item.rs:170:22
40+
--> $DIR/typeck_type_placeholder_item.rs:167:22
4141
|
4242
LL | struct BadStruct1<_, _>(_);
4343
| - ^ already used
@@ -351,18 +351,6 @@ help: use type parameters instead
351351
LL | struct BadStruct<T>(T);
352352
| ^ ^
353353

354-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
355-
--> $DIR/typeck_type_placeholder_item.rs:159:32
356-
|
357-
LL | impl BadTrait<_> for BadStruct<_> {}
358-
| ^ not allowed in type signatures
359-
360-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
361-
--> $DIR/typeck_type_placeholder_item.rs:159:15
362-
|
363-
LL | impl BadTrait<_> for BadStruct<_> {}
364-
| ^ not allowed in type signatures
365-
366354
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
367355
--> $DIR/typeck_type_placeholder_item.rs:159:15
368356
|
@@ -377,13 +365,13 @@ LL | impl<T> BadTrait<T> for BadStruct<T> {}
377365
| ^^^ ^ ^
378366

379367
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
380-
--> $DIR/typeck_type_placeholder_item.rs:164:34
368+
--> $DIR/typeck_type_placeholder_item.rs:162:34
381369
|
382370
LL | fn impl_trait() -> impl BadTrait<_> {
383371
| ^ not allowed in type signatures
384372

385373
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
386-
--> $DIR/typeck_type_placeholder_item.rs:170:25
374+
--> $DIR/typeck_type_placeholder_item.rs:167:25
387375
|
388376
LL | struct BadStruct1<_, _>(_);
389377
| ^ not allowed in type signatures
@@ -394,7 +382,7 @@ LL | struct BadStruct1<T, _>(T);
394382
| ^ ^
395383

396384
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
397-
--> $DIR/typeck_type_placeholder_item.rs:175:25
385+
--> $DIR/typeck_type_placeholder_item.rs:172:25
398386
|
399387
LL | struct BadStruct2<_, T>(_, T);
400388
| ^ not allowed in type signatures
@@ -405,13 +393,7 @@ LL | struct BadStruct2<K, T>(K, T);
405393
| ^ ^
406394

407395
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
408-
--> $DIR/typeck_type_placeholder_item.rs:179:14
409-
|
410-
LL | type X = Box<_>;
411-
| ^ not allowed in type signatures
412-
413-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
414-
--> $DIR/typeck_type_placeholder_item.rs:179:14
396+
--> $DIR/typeck_type_placeholder_item.rs:176:14
415397
|
416398
LL | type X = Box<_>;
417399
| ^ not allowed in type signatures
@@ -531,37 +513,25 @@ LL | fn clone_from<T>(&mut self, other: T) { *self = FnTest9; }
531513
| ^^^ ^
532514

533515
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
534-
--> $DIR/typeck_type_placeholder_item.rs:164:34
535-
|
536-
LL | fn impl_trait() -> impl BadTrait<_> {
537-
| ^ not allowed in type signatures
538-
539-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
540-
--> $DIR/typeck_type_placeholder_item.rs:186:21
541-
|
542-
LL | type Y = impl Trait<_>;
543-
| ^ not allowed in type signatures
544-
545-
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
546-
--> $DIR/typeck_type_placeholder_item.rs:186:21
516+
--> $DIR/typeck_type_placeholder_item.rs:182:21
547517
|
548518
LL | type Y = impl Trait<_>;
549519
| ^ not allowed in type signatures
550520

551521
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
552-
--> $DIR/typeck_type_placeholder_item.rs:195:14
522+
--> $DIR/typeck_type_placeholder_item.rs:190:14
553523
|
554524
LL | type B = _;
555525
| ^ not allowed in type signatures
556526

557527
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
558-
--> $DIR/typeck_type_placeholder_item.rs:197:14
528+
--> $DIR/typeck_type_placeholder_item.rs:192:14
559529
|
560530
LL | const C: _;
561531
| ^ not allowed in type signatures
562532

563533
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
564-
--> $DIR/typeck_type_placeholder_item.rs:199:14
534+
--> $DIR/typeck_type_placeholder_item.rs:194:14
565535
|
566536
LL | const D: _ = 42;
567537
| ^
@@ -606,33 +576,33 @@ LL | fn clone(&self) -> _ { FnTest9 }
606576
| help: replace with the correct return type: `main::FnTest9`
607577

608578
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
609-
--> $DIR/typeck_type_placeholder_item.rs:204:14
579+
--> $DIR/typeck_type_placeholder_item.rs:199:14
610580
|
611581
LL | type A = _;
612582
| ^ not allowed in type signatures
613583

614584
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
615-
--> $DIR/typeck_type_placeholder_item.rs:206:14
585+
--> $DIR/typeck_type_placeholder_item.rs:201:14
616586
|
617587
LL | type B = _;
618588
| ^ not allowed in type signatures
619589

620590
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
621-
--> $DIR/typeck_type_placeholder_item.rs:208:14
591+
--> $DIR/typeck_type_placeholder_item.rs:203:14
622592
|
623593
LL | const C: _;
624594
| ^ not allowed in type signatures
625595

626596
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
627-
--> $DIR/typeck_type_placeholder_item.rs:211:14
597+
--> $DIR/typeck_type_placeholder_item.rs:206:14
628598
|
629599
LL | const D: _ = 42;
630600
| ^
631601
| |
632602
| not allowed in type signatures
633603
| help: replace `_` with the correct type: `i32`
634604

635-
error: aborting due to 71 previous errors
605+
error: aborting due to 66 previous errors
636606

637607
Some errors have detailed explanations: E0121, E0282, E0403.
638608
For more information about an error, try `rustc --explain E0121`.

0 commit comments

Comments
 (0)
Please sign in to comment.