review comments
This commit is contained in:
parent
7d1e47aeb0
commit
165efabbee
20 changed files with 96 additions and 98 deletions
|
@ -34,7 +34,6 @@ infer_source_kind_subdiag_let = {$kind ->
|
||||||
[const] the value of the constant
|
[const] the value of the constant
|
||||||
} `{$arg_name}` is specified
|
} `{$arg_name}` is specified
|
||||||
[underscore] , where the placeholders `_` are specified
|
[underscore] , where the placeholders `_` are specified
|
||||||
[anon] , where the placeholder `Type` is specified
|
|
||||||
*[empty] {""}
|
*[empty] {""}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,11 +77,9 @@ impl InferenceDiagnosticsData {
|
||||||
!(self.name == "_" && matches!(self.kind, UnderspecifiedArgKind::Type { .. }))
|
!(self.name == "_" && matches!(self.kind, UnderspecifiedArgKind::Type { .. }))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn where_x_is_kind(&self, in_type: Ty<'_>, is_collect: bool) -> &'static str {
|
fn where_x_is_kind(&self, in_type: Ty<'_>) -> &'static str {
|
||||||
if is_collect {
|
if in_type.is_ty_infer() {
|
||||||
"empty"
|
""
|
||||||
} else if in_type.is_ty_infer() {
|
|
||||||
"anon"
|
|
||||||
} else if self.name == "_" {
|
} else if self.name == "_" {
|
||||||
// FIXME: Consider specializing this message if there is a single `_`
|
// FIXME: Consider specializing this message if there is a single `_`
|
||||||
// in the type.
|
// in the type.
|
||||||
|
@ -185,14 +183,20 @@ fn fmt_printer<'a, 'tcx>(infcx: &'a InferCtxt<'tcx>, ns: Namespace) -> FmtPrinte
|
||||||
printer
|
printer
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ty_to_string<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
fn ty_to_string<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>, def_id: Option<DefId>) -> String {
|
||||||
let printer = fmt_printer(infcx, Namespace::TypeNS);
|
let printer = fmt_printer(infcx, Namespace::TypeNS);
|
||||||
let ty = infcx.resolve_vars_if_possible(ty);
|
let ty = infcx.resolve_vars_if_possible(ty);
|
||||||
match ty.kind() {
|
match (ty.kind(), def_id) {
|
||||||
// We don't want the regular output for `fn`s because it includes its path in
|
// We don't want the regular output for `fn`s because it includes its path in
|
||||||
// invalid pseudo-syntax, we want the `fn`-pointer output instead.
|
// invalid pseudo-syntax, we want the `fn`-pointer output instead.
|
||||||
ty::FnDef(..) => ty.fn_sig(infcx.tcx).print(printer).unwrap().into_buffer(),
|
(ty::FnDef(..), _) => ty.fn_sig(infcx.tcx).print(printer).unwrap().into_buffer(),
|
||||||
_ if ty.is_ty_infer() => "Type".to_string(),
|
(_, Some(def_id))
|
||||||
|
if ty.is_ty_infer()
|
||||||
|
&& infcx.tcx.get_diagnostic_item(sym::iterator_collect_fn) == Some(def_id) =>
|
||||||
|
{
|
||||||
|
"Vec<_>".to_string()
|
||||||
|
}
|
||||||
|
_ if ty.is_ty_infer() => "/* Type */".to_string(),
|
||||||
// FIXME: The same thing for closures, but this only works when the closure
|
// FIXME: The same thing for closures, but this only works when the closure
|
||||||
// does not capture anything.
|
// does not capture anything.
|
||||||
//
|
//
|
||||||
|
@ -216,7 +220,7 @@ fn closure_as_fn_str<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
||||||
.map(|args| {
|
.map(|args| {
|
||||||
args.tuple_fields()
|
args.tuple_fields()
|
||||||
.iter()
|
.iter()
|
||||||
.map(|arg| ty_to_string(infcx, arg))
|
.map(|arg| ty_to_string(infcx, arg, None))
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join(", ")
|
.join(", ")
|
||||||
})
|
})
|
||||||
|
@ -224,7 +228,7 @@ fn closure_as_fn_str<'tcx>(infcx: &InferCtxt<'tcx>, ty: Ty<'tcx>) -> String {
|
||||||
let ret = if fn_sig.output().skip_binder().is_unit() {
|
let ret = if fn_sig.output().skip_binder().is_unit() {
|
||||||
String::new()
|
String::new()
|
||||||
} else {
|
} else {
|
||||||
format!(" -> {}", ty_to_string(infcx, fn_sig.output().skip_binder()))
|
format!(" -> {}", ty_to_string(infcx, fn_sig.output().skip_binder(), None))
|
||||||
};
|
};
|
||||||
format!("fn({}){}", args, ret)
|
format!("fn({}){}", args, ret)
|
||||||
}
|
}
|
||||||
|
@ -410,32 +414,28 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
let mut infer_subdiags = Vec::new();
|
let mut infer_subdiags = Vec::new();
|
||||||
let mut multi_suggestions = Vec::new();
|
let mut multi_suggestions = Vec::new();
|
||||||
match kind {
|
match kind {
|
||||||
InferSourceKind::LetBinding { insert_span, pattern_name, ty, is_collect } => {
|
InferSourceKind::LetBinding { insert_span, pattern_name, ty, def_id } => {
|
||||||
infer_subdiags.push(SourceKindSubdiag::LetLike {
|
infer_subdiags.push(SourceKindSubdiag::LetLike {
|
||||||
span: insert_span,
|
span: insert_span,
|
||||||
name: pattern_name.map(|name| name.to_string()).unwrap_or_else(String::new),
|
name: pattern_name.map(|name| name.to_string()).unwrap_or_else(String::new),
|
||||||
x_kind: arg_data.where_x_is_kind(ty, is_collect),
|
x_kind: arg_data.where_x_is_kind(ty),
|
||||||
prefix_kind: arg_data.kind.clone(),
|
prefix_kind: arg_data.kind.clone(),
|
||||||
prefix: arg_data.kind.try_get_prefix().unwrap_or_default(),
|
prefix: arg_data.kind.try_get_prefix().unwrap_or_default(),
|
||||||
arg_name: arg_data.name,
|
arg_name: arg_data.name,
|
||||||
kind: if pattern_name.is_some() { "with_pattern" } else { "other" },
|
kind: if pattern_name.is_some() { "with_pattern" } else { "other" },
|
||||||
type_name: if is_collect {
|
type_name: ty_to_string(self, ty, def_id),
|
||||||
"Vec<_>".to_string()
|
|
||||||
} else {
|
|
||||||
ty_to_string(self, ty)
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
InferSourceKind::ClosureArg { insert_span, ty } => {
|
InferSourceKind::ClosureArg { insert_span, ty } => {
|
||||||
infer_subdiags.push(SourceKindSubdiag::LetLike {
|
infer_subdiags.push(SourceKindSubdiag::LetLike {
|
||||||
span: insert_span,
|
span: insert_span,
|
||||||
name: String::new(),
|
name: String::new(),
|
||||||
x_kind: arg_data.where_x_is_kind(ty, false),
|
x_kind: arg_data.where_x_is_kind(ty),
|
||||||
prefix_kind: arg_data.kind.clone(),
|
prefix_kind: arg_data.kind.clone(),
|
||||||
prefix: arg_data.kind.try_get_prefix().unwrap_or_default(),
|
prefix: arg_data.kind.try_get_prefix().unwrap_or_default(),
|
||||||
arg_name: arg_data.name,
|
arg_name: arg_data.name,
|
||||||
kind: "closure",
|
kind: "closure",
|
||||||
type_name: ty_to_string(self, ty),
|
type_name: ty_to_string(self, ty, None),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
InferSourceKind::GenericArg {
|
InferSourceKind::GenericArg {
|
||||||
|
@ -534,7 +534,7 @@ impl<'tcx> TypeErrCtxt<'_, 'tcx> {
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
InferSourceKind::ClosureReturn { ty, data, should_wrap_expr } => {
|
InferSourceKind::ClosureReturn { ty, data, should_wrap_expr } => {
|
||||||
let ty_info = ty_to_string(self, ty);
|
let ty_info = ty_to_string(self, ty, None);
|
||||||
multi_suggestions.push(SourceKindMultiSuggestion::new_closure_return(
|
multi_suggestions.push(SourceKindMultiSuggestion::new_closure_return(
|
||||||
ty_info,
|
ty_info,
|
||||||
data,
|
data,
|
||||||
|
@ -622,7 +622,7 @@ enum InferSourceKind<'tcx> {
|
||||||
insert_span: Span,
|
insert_span: Span,
|
||||||
pattern_name: Option<Ident>,
|
pattern_name: Option<Ident>,
|
||||||
ty: Ty<'tcx>,
|
ty: Ty<'tcx>,
|
||||||
is_collect: bool,
|
def_id: Option<DefId>,
|
||||||
},
|
},
|
||||||
ClosureArg {
|
ClosureArg {
|
||||||
insert_span: Span,
|
insert_span: Span,
|
||||||
|
@ -677,7 +677,7 @@ impl<'tcx> InferSourceKind<'tcx> {
|
||||||
if ty.is_closure() {
|
if ty.is_closure() {
|
||||||
("closure", closure_as_fn_str(infcx, ty))
|
("closure", closure_as_fn_str(infcx, ty))
|
||||||
} else if !ty.is_ty_infer() {
|
} else if !ty.is_ty_infer() {
|
||||||
("normal", ty_to_string(infcx, ty))
|
("normal", ty_to_string(infcx, ty, None))
|
||||||
} else {
|
} else {
|
||||||
("other", String::new())
|
("other", String::new())
|
||||||
}
|
}
|
||||||
|
@ -807,14 +807,13 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
|
||||||
let cost = self.source_cost(&new_source) + self.attempt;
|
let cost = self.source_cost(&new_source) + self.attempt;
|
||||||
debug!(?cost);
|
debug!(?cost);
|
||||||
self.attempt += 1;
|
self.attempt += 1;
|
||||||
if let Some(InferSource { kind: InferSourceKind::GenericArg { def_id, ..}, .. }) = self.infer_source
|
if let Some(InferSource { kind: InferSourceKind::GenericArg { def_id: did, ..}, .. }) = self.infer_source
|
||||||
&& self.infcx.tcx.get_diagnostic_item(sym::iterator_collect_fn) == Some(def_id)
|
&& let InferSourceKind::LetBinding { ref ty, ref mut def_id, ..} = new_source.kind
|
||||||
&& let InferSourceKind::LetBinding { ref ty, ref mut is_collect, ..} = new_source.kind
|
|
||||||
&& ty.is_ty_infer()
|
&& ty.is_ty_infer()
|
||||||
{
|
{
|
||||||
// Customize the output so we talk about `let x: Vec<_> = iter.collect();` instead of
|
// Customize the output so we talk about `let x: Vec<_> = iter.collect();` instead of
|
||||||
// `let x: _ = iter.collect();`, as this is a very common case.
|
// `let x: _ = iter.collect();`, as this is a very common case.
|
||||||
*is_collect = true;
|
*def_id = Some(did);
|
||||||
}
|
}
|
||||||
if cost < self.infer_source_cost {
|
if cost < self.infer_source_cost {
|
||||||
self.infer_source_cost = cost;
|
self.infer_source_cost = cost;
|
||||||
|
@ -1113,7 +1112,7 @@ impl<'a, 'tcx> Visitor<'tcx> for FindInferSourceVisitor<'a, 'tcx> {
|
||||||
insert_span: local.pat.span.shrink_to_hi(),
|
insert_span: local.pat.span.shrink_to_hi(),
|
||||||
pattern_name: local.pat.simple_ident(),
|
pattern_name: local.pat.simple_ident(),
|
||||||
ty,
|
ty,
|
||||||
is_collect: false,
|
def_id: None,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let [_, _] = a.into();
|
LL | let [_, _] = a.into();
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
help: consider giving this pattern a type, where the placeholder `Type` is specified
|
help: consider giving this pattern a type
|
||||||
|
|
|
|
||||||
LL | let [_, _]: Type = a.into();
|
LL | let [_, _]: /* Type */ = a.into();
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | with_closure(|x: u32, y| {});
|
LL | with_closure(|x: u32, y| {});
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | with_closure(|x: u32, y: Type| {});
|
LL | with_closure(|x: u32, y: /* Type */| {});
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ error[E0282]: type annotations needed
|
||||||
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
|
LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | [(); &(&'static: loop { |x: Type| {}; }) as *const _ as usize]
|
LL | [(); &(&'static: loop { |x: /* Type */| {}; }) as *const _ as usize]
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let _ = foo([0; 1]);
|
LL | let _ = foo([0; 1]);
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this pattern a type, where the placeholder `Type` is specified
|
help: consider giving this pattern a type
|
||||||
|
|
|
|
||||||
LL | let _: Type = foo([0; 1]);
|
LL | let _: /* Type */ = foo([0; 1]);
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -18,10 +18,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |_| true
|
LL | |_| true
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |_: Type| true
|
LL | |_: /* Type */| true
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -30,10 +30,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |x| String::from("x".as_ref());
|
LL | |x| String::from("x".as_ref());
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |x: Type| String::from("x".as_ref());
|
LL | |x: /* Type */| String::from("x".as_ref());
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0283]: type annotations needed
|
error[E0283]: type annotations needed
|
||||||
--> $DIR/issue-72690.rs:12:26
|
--> $DIR/issue-72690.rs:12:26
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let x;
|
LL | let x;
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving `x` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `x` an explicit type
|
||||||
|
|
|
|
||||||
LL | let x: Type;
|
LL | let x: /* Type */;
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -6,10 +6,10 @@ LL | let x = panic!();
|
||||||
LL | x.clone();
|
LL | x.clone();
|
||||||
| - type must be known at this point
|
| - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving `x` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `x` an explicit type
|
||||||
|
|
|
|
||||||
LL | let x: Type = panic!();
|
LL | let x: /* Type */ = panic!();
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -17,10 +17,10 @@ error[E0282]: type annotations needed
|
||||||
LL | 1 => |c| c + 1,
|
LL | 1 => |c| c + 1,
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | 1 => |c: Type| c + 1,
|
LL | 1 => |c: /* Type */| c + 1,
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |s| s.len()
|
LL | |s| s.len()
|
||||||
| ^ - type must be known at this point
|
| ^ - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |s: Type| s.len()
|
LL | |s: /* Type */| s.len()
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/branches3.rs:15:10
|
--> $DIR/branches3.rs:15:10
|
||||||
|
@ -15,10 +15,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |s| s.len()
|
LL | |s| s.len()
|
||||||
| ^ - type must be known at this point
|
| ^ - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |s: Type| s.len()
|
LL | |s: /* Type */| s.len()
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/branches3.rs:23:10
|
--> $DIR/branches3.rs:23:10
|
||||||
|
@ -26,10 +26,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |s| s.len()
|
LL | |s| s.len()
|
||||||
| ^ - type must be known at this point
|
| ^ - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |s: Type| s.len()
|
LL | |s: /* Type */| s.len()
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/branches3.rs:30:10
|
--> $DIR/branches3.rs:30:10
|
||||||
|
@ -37,10 +37,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |s| s.len()
|
LL | |s| s.len()
|
||||||
| ^ - type must be known at this point
|
| ^ - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |s: Type| s.len()
|
LL | |s: /* Type */| s.len()
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let x = match () {
|
LL | let x = match () {
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving `x` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `x` an explicit type
|
||||||
|
|
|
|
||||||
LL | let x: Type = match () {
|
LL | let x: /* Type */ = match () {
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@ LL | let x;
|
||||||
LL | (..) => {}
|
LL | (..) => {}
|
||||||
| ---- type must be known at this point
|
| ---- type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving `x` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `x` an explicit type
|
||||||
|
|
|
|
||||||
LL | let x: Type;
|
LL | let x: /* Type */;
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0308]: mismatched types
|
error[E0308]: mismatched types
|
||||||
--> $DIR/pat-tuple-bad-type.rs:10:9
|
--> $DIR/pat-tuple-bad-type.rs:10:9
|
||||||
|
|
|
@ -191,10 +191,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let x @ ..;
|
LL | let x @ ..;
|
||||||
| ^^^^^^
|
| ^^^^^^
|
||||||
|
|
|
|
||||||
help: consider giving this pattern a type, where the placeholder `Type` is specified
|
help: consider giving this pattern a type
|
||||||
|
|
|
|
||||||
LL | let x @ ..: Type;
|
LL | let x @ ..: /* Type */;
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 23 previous errors
|
error: aborting due to 23 previous errors
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let mut N;
|
LL | let mut N;
|
||||||
| ^^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
help: consider giving `N` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `N` an explicit type
|
||||||
|
|
|
|
||||||
LL | let mut N: Type;
|
LL | let mut N: /* Type */;
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
|
|
@ -7,10 +7,10 @@ LL |
|
||||||
LL | x.0;
|
LL | x.0;
|
||||||
| - type must be known at this point
|
| - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving `x` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `x` an explicit type
|
||||||
|
|
|
|
||||||
LL | let mut x: Type = Default::default();
|
LL | let mut x: /* Type */ = Default::default();
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/method-and-field-eager-resolution.rs:11:9
|
--> $DIR/method-and-field-eager-resolution.rs:11:9
|
||||||
|
@ -21,10 +21,10 @@ LL |
|
||||||
LL | x[0];
|
LL | x[0];
|
||||||
| - type must be known at this point
|
| - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving `x` an explicit type, where the placeholder `Type` is specified
|
help: consider giving `x` an explicit type
|
||||||
|
|
|
|
||||||
LL | let mut x: Type = Default::default();
|
LL | let mut x: /* Type */ = Default::default();
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |x| x.len()
|
LL | |x| x.len()
|
||||||
| ^ - type must be known at this point
|
| ^ - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |x: Type| x.len()
|
LL | |x: /* Type */| x.len()
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/closures_in_branches.rs:21:10
|
--> $DIR/closures_in_branches.rs:21:10
|
||||||
|
@ -15,10 +15,10 @@ error[E0282]: type annotations needed
|
||||||
LL | |x| x.len()
|
LL | |x| x.len()
|
||||||
| ^ - type must be known at this point
|
| ^ - type must be known at this point
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | |x: Type| x.len()
|
LL | |x: /* Type */| x.len()
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let x = |_| {};
|
LL | let x = |_| {};
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | let x = |_: Type| {};
|
LL | let x = |_: /* Type */| {};
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error[E0282]: type annotations needed
|
error[E0282]: type annotations needed
|
||||||
--> $DIR/unknown_type_for_closure.rs:10:14
|
--> $DIR/unknown_type_for_closure.rs:10:14
|
||||||
|
|
|
@ -28,10 +28,10 @@ error[E0282]: type annotations needed
|
||||||
LL | let _ = |a, b: _| -> _ { 0 };
|
LL | let _ = |a, b: _| -> _ { 0 };
|
||||||
| ^
|
| ^
|
||||||
|
|
|
|
||||||
help: consider giving this closure parameter an explicit type, where the placeholder `Type` is specified
|
help: consider giving this closure parameter an explicit type
|
||||||
|
|
|
|
||||||
LL | let _ = |a: Type, b: _| -> _ { 0 };
|
LL | let _ = |a: /* Type */, b: _| -> _ { 0 };
|
||||||
| ++++++
|
| ++++++++++++
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue