mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-28 02:57:37 +00:00
Auto merge of #87915 - estebank:fancy-spans, r=oli-obk
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts
This commit is contained in:
commit
9bb77da74d
@ -304,6 +304,21 @@ impl Diagnostic {
|
||||
)
|
||||
}
|
||||
|
||||
/// Show a suggestion that has multiple parts to it, always as it's own subdiagnostic.
|
||||
/// In other words, multiple changes need to be applied as part of this suggestion.
|
||||
pub fn multipart_suggestion_verbose(
|
||||
&mut self,
|
||||
msg: &str,
|
||||
suggestion: Vec<(Span, String)>,
|
||||
applicability: Applicability,
|
||||
) -> &mut Self {
|
||||
self.multipart_suggestion_with_style(
|
||||
msg,
|
||||
suggestion,
|
||||
applicability,
|
||||
SuggestionStyle::ShowAlways,
|
||||
)
|
||||
}
|
||||
/// [`Diagnostic::multipart_suggestion()`] but you can set the [`SuggestionStyle`].
|
||||
pub fn multipart_suggestion_with_style(
|
||||
&mut self,
|
||||
|
@ -258,6 +258,20 @@ impl<'a> DiagnosticBuilder<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// See [`Diagnostic::multipart_suggestion()`].
|
||||
pub fn multipart_suggestion_verbose(
|
||||
&mut self,
|
||||
msg: &str,
|
||||
suggestion: Vec<(Span, String)>,
|
||||
applicability: Applicability,
|
||||
) -> &mut Self {
|
||||
if !self.0.allow_suggestions {
|
||||
return self;
|
||||
}
|
||||
self.0.diagnostic.multipart_suggestion_verbose(msg, suggestion, applicability);
|
||||
self
|
||||
}
|
||||
|
||||
/// See [`Diagnostic::tool_only_multipart_suggestion()`].
|
||||
pub fn tool_only_multipart_suggestion(
|
||||
&mut self,
|
||||
|
@ -1633,50 +1633,57 @@ impl<'a> Parser<'a> {
|
||||
{
|
||||
let rfc_note = "anonymous parameters are removed in the 2018 edition (see RFC 1685)";
|
||||
|
||||
let (ident, self_sugg, param_sugg, type_sugg) = match pat.kind {
|
||||
PatKind::Ident(_, ident, _) => (
|
||||
ident,
|
||||
format!("self: {}", ident),
|
||||
format!("{}: TypeName", ident),
|
||||
format!("_: {}", ident),
|
||||
),
|
||||
// Also catches `fn foo(&a)`.
|
||||
PatKind::Ref(ref pat, mutab)
|
||||
if matches!(pat.clone().into_inner().kind, PatKind::Ident(..)) =>
|
||||
{
|
||||
match pat.clone().into_inner().kind {
|
||||
PatKind::Ident(_, ident, _) => {
|
||||
let mutab = mutab.prefix_str();
|
||||
(
|
||||
ident,
|
||||
format!("self: &{}{}", mutab, ident),
|
||||
format!("{}: &{}TypeName", ident, mutab),
|
||||
format!("_: &{}{}", mutab, ident),
|
||||
)
|
||||
let (ident, self_sugg, param_sugg, type_sugg, self_span, param_span, type_span) =
|
||||
match pat.kind {
|
||||
PatKind::Ident(_, ident, _) => (
|
||||
ident,
|
||||
"self: ".to_string(),
|
||||
": TypeName".to_string(),
|
||||
"_: ".to_string(),
|
||||
pat.span.shrink_to_lo(),
|
||||
pat.span.shrink_to_hi(),
|
||||
pat.span.shrink_to_lo(),
|
||||
),
|
||||
// Also catches `fn foo(&a)`.
|
||||
PatKind::Ref(ref inner_pat, mutab)
|
||||
if matches!(inner_pat.clone().into_inner().kind, PatKind::Ident(..)) =>
|
||||
{
|
||||
match inner_pat.clone().into_inner().kind {
|
||||
PatKind::Ident(_, ident, _) => {
|
||||
let mutab = mutab.prefix_str();
|
||||
(
|
||||
ident,
|
||||
"self: ".to_string(),
|
||||
format!("{}: &{}TypeName", ident, mutab),
|
||||
"_: ".to_string(),
|
||||
pat.span.shrink_to_lo(),
|
||||
pat.span,
|
||||
pat.span.shrink_to_lo(),
|
||||
)
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
_ => unreachable!(),
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
// Otherwise, try to get a type and emit a suggestion.
|
||||
if let Some(ty) = pat.to_ty() {
|
||||
err.span_suggestion_verbose(
|
||||
pat.span,
|
||||
"explicitly ignore the parameter name",
|
||||
format!("_: {}", pprust::ty_to_string(&ty)),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
err.note(rfc_note);
|
||||
}
|
||||
_ => {
|
||||
// Otherwise, try to get a type and emit a suggestion.
|
||||
if let Some(ty) = pat.to_ty() {
|
||||
err.span_suggestion_verbose(
|
||||
pat.span,
|
||||
"explicitly ignore the parameter name",
|
||||
format!("_: {}", pprust::ty_to_string(&ty)),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
err.note(rfc_note);
|
||||
}
|
||||
|
||||
return None;
|
||||
}
|
||||
};
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
// `fn foo(a, b) {}`, `fn foo(a<x>, b<y>) {}` or `fn foo(usize, usize) {}`
|
||||
if first_param {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
self_span,
|
||||
"if this is a `self` type, give it a parameter name",
|
||||
self_sugg,
|
||||
Applicability::MaybeIncorrect,
|
||||
@ -1686,14 +1693,14 @@ impl<'a> Parser<'a> {
|
||||
// `fn foo(HashMap: TypeName<u32>)`.
|
||||
if self.token != token::Lt {
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
param_span,
|
||||
"if this is a parameter name, give it a type",
|
||||
param_sugg,
|
||||
Applicability::HasPlaceholders,
|
||||
);
|
||||
}
|
||||
err.span_suggestion(
|
||||
pat.span,
|
||||
type_span,
|
||||
"if this is a type, explicitly ignore the parameter name",
|
||||
type_sugg,
|
||||
Applicability::MachineApplicable,
|
||||
|
@ -12,7 +12,7 @@ use rustc_ast::{
|
||||
};
|
||||
use rustc_ast_pretty::pprust::path_segment_to_string;
|
||||
use rustc_data_structures::fx::FxHashSet;
|
||||
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder, SuggestionStyle};
|
||||
use rustc_errors::{pluralize, struct_span_err, Applicability, DiagnosticBuilder};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::Namespace::{self, *};
|
||||
use rustc_hir::def::{self, CtorKind, CtorOf, DefKind};
|
||||
@ -1960,11 +1960,10 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||
introduce_suggestion.push((*span, formatter(<_name)));
|
||||
}
|
||||
}
|
||||
err.multipart_suggestion_with_style(
|
||||
err.multipart_suggestion_verbose(
|
||||
&msg,
|
||||
introduce_suggestion,
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
}
|
||||
|
||||
@ -1976,14 +1975,13 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||
})
|
||||
.map(|(formatter, span)| (*span, formatter(name)))
|
||||
.collect();
|
||||
err.multipart_suggestion_with_style(
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!(
|
||||
"consider using the `{}` lifetime",
|
||||
lifetime_names.iter().next().unwrap()
|
||||
),
|
||||
spans_suggs,
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
};
|
||||
let suggest_new = |err: &mut DiagnosticBuilder<'_>, suggs: Vec<Option<String>>| {
|
||||
@ -2074,11 +2072,10 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||
};
|
||||
spans_suggs.push((span, sugg.to_string()));
|
||||
}
|
||||
err.multipart_suggestion_with_style(
|
||||
err.multipart_suggestion_verbose(
|
||||
"consider using the `'static` lifetime",
|
||||
spans_suggs,
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@ -2163,11 +2160,10 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||
.unwrap_or((span, sugg));
|
||||
introduce_suggestion.push((span, sugg.to_string()));
|
||||
}
|
||||
err.multipart_suggestion_with_style(
|
||||
err.multipart_suggestion_verbose(
|
||||
&msg,
|
||||
introduce_suggestion,
|
||||
Applicability::MaybeIncorrect,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
if should_break {
|
||||
break;
|
||||
@ -2243,11 +2239,10 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
|
||||
if spans_suggs.len() > 0 {
|
||||
// This happens when we have `Foo<T>` where we point at the space before `T`,
|
||||
// but this can be confusing so we give a suggestion with placeholders.
|
||||
err.multipart_suggestion_with_style(
|
||||
err.multipart_suggestion_verbose(
|
||||
"consider using one of the available lifetimes here",
|
||||
spans_suggs,
|
||||
Applicability::HasPlaceholders,
|
||||
SuggestionStyle::ShowAlways,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1687,14 +1687,13 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
|
||||
constraint=constraint,
|
||||
));
|
||||
} else {
|
||||
err.span_suggestion(
|
||||
span,
|
||||
err.span_suggestion_verbose(
|
||||
span.with_hi(assoc_name.span.lo()),
|
||||
"use fully qualified syntax to disambiguate",
|
||||
format!(
|
||||
"<{} as {}>::{}",
|
||||
"<{} as {}>::",
|
||||
ty_param_name(),
|
||||
bound.print_only_trait_path(),
|
||||
assoc_name,
|
||||
),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
@ -17,7 +17,6 @@ use rustc_span::{BytePos, Span};
|
||||
|
||||
use super::method::probe;
|
||||
|
||||
use std::fmt;
|
||||
use std::iter;
|
||||
|
||||
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
@ -772,9 +771,10 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
// For now, don't suggest casting with `as`.
|
||||
let can_cast = false;
|
||||
|
||||
let prefix = if let Some(hir::Node::Expr(hir::Expr {
|
||||
kind: hir::ExprKind::Struct(_, fields, _),
|
||||
..
|
||||
let mut sugg = vec![];
|
||||
|
||||
if let Some(hir::Node::Expr(hir::Expr {
|
||||
kind: hir::ExprKind::Struct(_, fields, _), ..
|
||||
})) = self.tcx.hir().find(self.tcx.hir().get_parent_node(expr.hir_id))
|
||||
{
|
||||
// `expr` is a literal field for a struct, only suggest if appropriate
|
||||
@ -783,12 +783,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.find(|field| field.expr.hir_id == expr.hir_id && field.is_shorthand)
|
||||
{
|
||||
// This is a field literal
|
||||
Some(field) => format!("{}: ", field.ident),
|
||||
Some(field) => {
|
||||
sugg.push((field.ident.span.shrink_to_lo(), format!("{}: ", field.ident)));
|
||||
}
|
||||
// Likely a field was meant, but this field wasn't found. Do not suggest anything.
|
||||
None => return false,
|
||||
}
|
||||
} else {
|
||||
String::new()
|
||||
};
|
||||
|
||||
if let hir::ExprKind::Call(path, args) = &expr.kind {
|
||||
@ -843,28 +843,38 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
checked_ty, expected_ty,
|
||||
);
|
||||
|
||||
let with_opt_paren: fn(&dyn fmt::Display) -> String =
|
||||
if expr.precedence().order() < PREC_POSTFIX {
|
||||
|s| format!("({})", s)
|
||||
} else {
|
||||
|s| s.to_string()
|
||||
};
|
||||
let close_paren = if expr.precedence().order() < PREC_POSTFIX {
|
||||
sugg.push((expr.span.shrink_to_lo(), "(".to_string()));
|
||||
")"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
|
||||
let cast_suggestion = format!("{}{} as {}", prefix, with_opt_paren(&src), expected_ty);
|
||||
let into_suggestion = format!("{}{}.into()", prefix, with_opt_paren(&src));
|
||||
let suffix_suggestion = with_opt_paren(&format_args!(
|
||||
"{}{}",
|
||||
let mut cast_suggestion = sugg.clone();
|
||||
cast_suggestion
|
||||
.push((expr.span.shrink_to_hi(), format!("{} as {}", close_paren, expected_ty)));
|
||||
let mut into_suggestion = sugg.clone();
|
||||
into_suggestion.push((expr.span.shrink_to_hi(), format!("{}.into()", close_paren)));
|
||||
let mut suffix_suggestion = sugg.clone();
|
||||
suffix_suggestion.push((
|
||||
if matches!(
|
||||
(&expected_ty.kind(), &checked_ty.kind()),
|
||||
(ty::Int(_) | ty::Uint(_), ty::Float(_))
|
||||
) {
|
||||
// Remove fractional part from literal, for example `42.0f32` into `42`
|
||||
let src = src.trim_end_matches(&checked_ty.to_string());
|
||||
src.split('.').next().unwrap()
|
||||
let len = src.split('.').next().unwrap().len();
|
||||
expr.span.with_lo(expr.span.lo() + BytePos(len as u32))
|
||||
} else {
|
||||
src.trim_end_matches(&checked_ty.to_string())
|
||||
let len = src.trim_end_matches(&checked_ty.to_string()).len();
|
||||
expr.span.with_lo(expr.span.lo() + BytePos(len as u32))
|
||||
},
|
||||
if expr.precedence().order() < PREC_POSTFIX {
|
||||
// Readd `)`
|
||||
format!("{})", expected_ty)
|
||||
} else {
|
||||
expected_ty.to_string()
|
||||
},
|
||||
expected_ty,
|
||||
));
|
||||
let literal_is_ty_suffixed = |expr: &hir::Expr<'_>| {
|
||||
if let hir::ExprKind::Lit(lit) = &expr.kind { lit.node.is_suffixed() } else { false }
|
||||
@ -891,22 +901,32 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
.ok()
|
||||
.map(|src| (expr, src))
|
||||
});
|
||||
let (span, msg, suggestion) = if let (Some((lhs_expr, lhs_src)), false) =
|
||||
let (msg, suggestion) = if let (Some((lhs_expr, lhs_src)), false) =
|
||||
(lhs_expr_and_src, exp_to_found_is_fallible)
|
||||
{
|
||||
let msg = format!(
|
||||
"you can convert `{}` from `{}` to `{}`, matching the type of `{}`",
|
||||
lhs_src, expected_ty, checked_ty, src
|
||||
);
|
||||
let suggestion = format!("{}::from({})", checked_ty, lhs_src);
|
||||
(lhs_expr.span, msg, suggestion)
|
||||
let suggestion = vec![
|
||||
(lhs_expr.span.shrink_to_lo(), format!("{}::from(", checked_ty)),
|
||||
(lhs_expr.span.shrink_to_hi(), ")".to_string()),
|
||||
];
|
||||
(msg, suggestion)
|
||||
} else {
|
||||
let msg = format!("{} and panic if the converted value doesn't fit", msg);
|
||||
let suggestion =
|
||||
format!("{}{}.try_into().unwrap()", prefix, with_opt_paren(&src));
|
||||
(expr.span, msg, suggestion)
|
||||
let mut suggestion = sugg.clone();
|
||||
suggestion.push((
|
||||
expr.span.shrink_to_hi(),
|
||||
format!("{}.try_into().unwrap()", close_paren),
|
||||
));
|
||||
(msg, suggestion)
|
||||
};
|
||||
err.span_suggestion(span, &msg, suggestion, Applicability::MachineApplicable);
|
||||
err.multipart_suggestion_verbose(
|
||||
&msg,
|
||||
suggestion,
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
};
|
||||
|
||||
let suggest_to_change_suffix_or_into =
|
||||
@ -944,7 +964,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
} else {
|
||||
into_suggestion.clone()
|
||||
};
|
||||
err.span_suggestion(expr.span, msg, suggestion, Applicability::MachineApplicable);
|
||||
err.multipart_suggestion_verbose(msg, suggestion, Applicability::MachineApplicable);
|
||||
};
|
||||
|
||||
match (&expected_ty.kind(), &checked_ty.kind()) {
|
||||
@ -998,16 +1018,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
if found.bit_width() < exp.bit_width() {
|
||||
suggest_to_change_suffix_or_into(err, false, true);
|
||||
} else if literal_is_ty_suffixed(expr) {
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&lit_msg,
|
||||
suffix_suggestion,
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else if can_cast {
|
||||
// Missing try_into implementation for `f64` to `f32`
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!("{}, producing the closest possible value", cast_msg),
|
||||
cast_suggestion,
|
||||
Applicability::MaybeIncorrect, // lossy conversion
|
||||
@ -1017,16 +1035,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
}
|
||||
(&ty::Uint(_) | &ty::Int(_), &ty::Float(_)) => {
|
||||
if literal_is_ty_suffixed(expr) {
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&lit_msg,
|
||||
suffix_suggestion,
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else if can_cast {
|
||||
// Missing try_into implementation for `{float}` to `{integer}`
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!("{}, rounding the float towards zero", msg),
|
||||
cast_suggestion,
|
||||
Applicability::MaybeIncorrect, // lossy conversion
|
||||
@ -1037,8 +1053,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
(&ty::Float(ref exp), &ty::Uint(ref found)) => {
|
||||
// if `found` is `None` (meaning found is `usize`), don't suggest `.into()`
|
||||
if exp.bit_width() > found.bit_width().unwrap_or(256) {
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!(
|
||||
"{}, producing the floating point representation of the integer",
|
||||
msg,
|
||||
@ -1047,16 +1062,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else if literal_is_ty_suffixed(expr) {
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&lit_msg,
|
||||
suffix_suggestion,
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else {
|
||||
// Missing try_into implementation for `{integer}` to `{float}`
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!(
|
||||
"{}, producing the floating point representation of the integer,
|
||||
rounded if necessary",
|
||||
@ -1071,8 +1084,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
(&ty::Float(ref exp), &ty::Int(ref found)) => {
|
||||
// if `found` is `None` (meaning found is `isize`), don't suggest `.into()`
|
||||
if exp.bit_width() > found.bit_width().unwrap_or(256) {
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!(
|
||||
"{}, producing the floating point representation of the integer",
|
||||
&msg,
|
||||
@ -1081,16 +1093,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else if literal_is_ty_suffixed(expr) {
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&lit_msg,
|
||||
suffix_suggestion,
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
} else {
|
||||
// Missing try_into implementation for `{integer}` to `{float}`
|
||||
err.span_suggestion(
|
||||
expr.span,
|
||||
err.multipart_suggestion_verbose(
|
||||
&format!(
|
||||
"{}, producing the floating point representation of the integer, \
|
||||
rounded if necessary",
|
||||
|
@ -450,9 +450,9 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
|
||||
let suggestions = vec![
|
||||
(lt_sp, sugg),
|
||||
(
|
||||
span,
|
||||
span.with_hi(item_segment.ident.span.lo()),
|
||||
format!(
|
||||
"{}::{}",
|
||||
"{}::",
|
||||
// Replace the existing lifetimes with a new named lifetime.
|
||||
self.tcx
|
||||
.replace_late_bound_regions(poly_trait_ref, |_| {
|
||||
@ -465,7 +465,6 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
|
||||
))
|
||||
})
|
||||
.0,
|
||||
item_segment.ident
|
||||
),
|
||||
),
|
||||
];
|
||||
@ -487,14 +486,13 @@ impl AstConv<'tcx> for ItemCtxt<'tcx> {
|
||||
| hir::Node::ForeignItem(_)
|
||||
| hir::Node::TraitItem(_)
|
||||
| hir::Node::ImplItem(_) => {
|
||||
err.span_suggestion(
|
||||
span,
|
||||
err.span_suggestion_verbose(
|
||||
span.with_hi(item_segment.ident.span.lo()),
|
||||
"use a fully qualified path with inferred lifetimes",
|
||||
format!(
|
||||
"{}::{}",
|
||||
"{}::",
|
||||
// Erase named lt, we want `<A as B<'_>::C`, not `<A as B<'a>::C`.
|
||||
self.tcx.anonymize_late_bound_regions(poly_trait_ref).skip_binder(),
|
||||
item_segment.ident
|
||||
),
|
||||
Applicability::MaybeIncorrect,
|
||||
);
|
||||
|
@ -101,9 +101,9 @@ impl<'a, 'tcx> SyntaxChecker<'a, 'tcx> {
|
||||
);
|
||||
} else if empty_block {
|
||||
diag.span_suggestion(
|
||||
sp.from_inner(InnerSpan::new(0, 3)),
|
||||
sp.from_inner(InnerSpan::new(0, 3)).shrink_to_hi(),
|
||||
explanation,
|
||||
String::from("```text"),
|
||||
String::from("text"),
|
||||
Applicability::MachineApplicable,
|
||||
);
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ LL | | /// ```
|
||||
help: mark blocks that do not contain Rust code as text
|
||||
|
|
||||
LL | /// ```text
|
||||
| ~~~~~~~
|
||||
| ++++
|
||||
|
||||
warning: could not parse code block as Rust code
|
||||
--> $DIR/invalid-syntax.rs:9:5
|
||||
@ -32,7 +32,7 @@ LL | | /// ```
|
||||
help: mark blocks that do not contain Rust code as text
|
||||
|
|
||||
LL | /// ```text
|
||||
| ~~~~~~~
|
||||
| ++++
|
||||
|
||||
warning: could not parse code block as Rust code
|
||||
--> $DIR/invalid-syntax.rs:21:5
|
||||
@ -47,7 +47,7 @@ LL | | /// ```
|
||||
help: mark blocks that do not contain Rust code as text
|
||||
|
|
||||
LL | /// ```text
|
||||
| ~~~~~~~
|
||||
| ++++
|
||||
|
||||
warning: could not parse code block as Rust code
|
||||
--> $DIR/invalid-syntax.rs:35:5
|
||||
@ -123,7 +123,7 @@ LL | | /// ```
|
||||
help: mark blocks that do not contain Rust code as text
|
||||
|
|
||||
LL | /// ```text
|
||||
| ~~~~~~~
|
||||
| ++++
|
||||
|
||||
warning: could not parse code block as Rust code
|
||||
--> $DIR/invalid-syntax.rs:92:9
|
||||
@ -148,7 +148,7 @@ LL | | /// ```
|
||||
help: mark blocks that do not contain Rust code as text
|
||||
|
|
||||
LL | /// ```text
|
||||
| ~~~~~~~
|
||||
| ++++
|
||||
|
||||
warning: 12 warnings emitted
|
||||
|
||||
|
@ -8,15 +8,15 @@ LL | fn foo(i32);
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn foo(self: i32);
|
||||
| ~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn foo(i32: TypeName);
|
||||
| ~~~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo(_: i32);
|
||||
| ~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:9:29
|
||||
@ -28,7 +28,7 @@ LL | fn foo_with_ref(&mut i32);
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn foo_with_ref(self: &mut i32);
|
||||
| ~~~~~~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn foo_with_ref(i32: &mut TypeName);
|
||||
@ -36,7 +36,7 @@ LL | fn foo_with_ref(i32: &mut TypeName);
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo_with_ref(_: &mut i32);
|
||||
| ~~~~~~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `(`, `...`, `..=`, `..`, `::`, `:`, `{`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:12:47
|
||||
@ -96,15 +96,15 @@ LL | fn bar_with_default_impl(String, String) {}
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn bar_with_default_impl(self: String, String) {}
|
||||
| ~~~~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn bar_with_default_impl(String: TypeName, String) {}
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn bar_with_default_impl(_: String, String) {}
|
||||
| ~~~~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `)`
|
||||
--> $DIR/anon-params-denied-2018.rs:22:44
|
||||
@ -116,11 +116,11 @@ LL | fn bar_with_default_impl(String, String) {}
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn bar_with_default_impl(String, String: TypeName) {}
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn bar_with_default_impl(String, _: String) {}
|
||||
| ~~~~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `,`
|
||||
--> $DIR/anon-params-denied-2018.rs:27:22
|
||||
@ -132,11 +132,11 @@ LL | fn baz(a:usize, b, c: usize) -> usize {
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn baz(a:usize, b: TypeName, c: usize) -> usize {
|
||||
| ~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn baz(a:usize, _: b, c: usize) -> usize {
|
||||
| ~~~~
|
||||
| ++
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
|
@ -13,11 +13,11 @@ LL | fn a<C:Vehicle+Box>(_: C::Color) {
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn a<C:Vehicle+Box>(_: <C as Box>::Color) {
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn a<C:Vehicle+Box>(_: <C as Vehicle>::Color) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `C`
|
||||
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:20:12
|
||||
@ -34,11 +34,11 @@ LL | fn b<C>(_: C::Color) where C : Vehicle+Box {
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn b<C>(_: <C as Box>::Color) where C : Vehicle+Box {
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn b<C>(_: <C as Vehicle>::Color) where C : Vehicle+Box {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `C`
|
||||
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:24:12
|
||||
@ -55,11 +55,11 @@ LL | fn c<C>(_: C::Color) where C : Vehicle, C : Box {
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn c<C>(_: <C as Box>::Color) where C : Vehicle, C : Box {
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn c<C>(_: <C as Vehicle>::Color) where C : Vehicle, C : Box {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `X`
|
||||
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:35:20
|
||||
@ -76,11 +76,11 @@ LL | fn e(&self, _: X::Color) where X : Box;
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn e(&self, _: <X as Box>::Color) where X : Box;
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn e(&self, _: <X as Vehicle>::Color) where X : Box;
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `X`
|
||||
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:38:20
|
||||
@ -97,11 +97,11 @@ LL | fn f(&self, _: X::Color) where X : Box { }
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn f(&self, _: <X as Box>::Color) where X : Box { }
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn f(&self, _: <X as Vehicle>::Color) where X : Box { }
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0221]: ambiguous associated type `Color` in bounds of `X`
|
||||
--> $DIR/associated-type-projection-ambig-between-bound-and-where-clause.rs:30:20
|
||||
@ -118,11 +118,11 @@ LL | fn d(&self, _: X::Color) where X : Box { }
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn d(&self, _: <X as Box>::Color) where X : Box { }
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn d(&self, _: <X as Vehicle>::Color) where X : Box { }
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -21,11 +21,11 @@ LL | fn dent<C:BoxCar>(c: C, color: C::Color) {
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn dent<C:BoxCar>(c: C, color: <C as Vehicle>::Color) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn dent<C:BoxCar>(c: C, color: <C as Box>::Color) {
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
|
||||
error[E0222]: ambiguous associated type `Color` in bounds of `BoxCar`
|
||||
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:23:37
|
||||
@ -74,11 +74,11 @@ LL | fn paint<C:BoxCar>(c: C, d: C::Color) {
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn paint<C:BoxCar>(c: C, d: <C as Vehicle>::Color) {
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | fn paint<C:BoxCar>(c: C, d: <C as Box>::Color) {
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
|
||||
error[E0191]: the value of the associated types `Color` (from trait `Box`), `Color` (from trait `Vehicle`) must be specified
|
||||
--> $DIR/associated-type-projection-from-multiple-supertraits.rs:32:32
|
||||
|
@ -19,11 +19,11 @@ LL | pub fn f2<T: Foo + Bar>(a: T, x: T::A) {}
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Bar>::A) {}
|
||||
| ~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | pub fn f2<T: Foo + Bar>(a: T, x: <T as Foo>::A) {}
|
||||
| ~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | f1(2i32, 4i32);
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | f1(2i32, 4u32);
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0277]: the trait bound `u32: Foo` is not satisfied
|
||||
--> $DIR/associated-types-path-2.rs:29:5
|
||||
@ -56,7 +56,7 @@ LL | let _: i32 = f2(2i32);
|
||||
help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | let _: i32 = f2(2i32).try_into().unwrap();
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -2,7 +2,12 @@ error[E0212]: cannot use the associated type of a trait with uninferred generic
|
||||
--> $DIR/associated-types-project-from-hrtb-in-fn.rs:13:8
|
||||
|
|
||||
LL | x: I::A)
|
||||
| ^^^^ help: use a fully qualified path with inferred lifetimes: `<I as Foo<&isize>>::A`
|
||||
| ^^^^
|
||||
|
|
||||
help: use a fully qualified path with inferred lifetimes
|
||||
|
|
||||
LL | x: <I as Foo<&isize>>::A)
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,13 +2,23 @@ error[E0212]: cannot use the associated type of a trait with uninferred generic
|
||||
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:13:32
|
||||
|
|
||||
LL | fn some_method(&self, arg: I::A);
|
||||
| ^^^^ help: use a fully qualified path with inferred lifetimes: `<I as Foo<&isize>>::A`
|
||||
| ^^^^
|
||||
|
|
||||
help: use a fully qualified path with inferred lifetimes
|
||||
|
|
||||
LL | fn some_method(&self, arg: <I as Foo<&isize>>::A);
|
||||
| ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0212]: cannot use the associated type of a trait with uninferred generic parameters
|
||||
--> $DIR/associated-types-project-from-hrtb-in-trait-method.rs:32:24
|
||||
|
|
||||
LL | fn mango(&self) -> X::Assoc {
|
||||
| ^^^^^^^^ help: use a fully qualified path with inferred lifetimes: `<X as Banana<'_>>::Assoc`
|
||||
| ^^^^^^^^
|
||||
|
|
||||
help: use a fully qualified path with inferred lifetimes
|
||||
|
|
||||
LL | fn mango(&self) -> <X as Banana<'_>>::Assoc {
|
||||
| ~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | assert_eq!(R.method::<1u16>(), 1);
|
||||
help: change the type of the numeric literal from `u16` to `u8`
|
||||
|
|
||||
LL | assert_eq!(R.method::<1u8>(), 1);
|
||||
| ~~~
|
||||
| ~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | assert_eq!(R.method::<1u16>(), 1);
|
||||
help: change the type of the numeric literal from `u16` to `u8`
|
||||
|
|
||||
LL | assert_eq!(R.method::<1u8>(), 1);
|
||||
| ~~~
|
||||
| ~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | OhNo = 0_u8,
|
||||
help: change the type of the numeric literal from `u8` to `i8`
|
||||
|
|
||||
LL | OhNo = 0_i8,
|
||||
| ~~~~
|
||||
| ~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:28:16
|
||||
@ -18,7 +18,7 @@ LL | OhNo = 0_i8,
|
||||
help: change the type of the numeric literal from `i8` to `u8`
|
||||
|
|
||||
LL | OhNo = 0_u8,
|
||||
| ~~~~
|
||||
| ~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:41:16
|
||||
@ -29,7 +29,7 @@ LL | OhNo = 0_u16,
|
||||
help: change the type of the numeric literal from `u16` to `i16`
|
||||
|
|
||||
LL | OhNo = 0_i16,
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:54:16
|
||||
@ -40,7 +40,7 @@ LL | OhNo = 0_i16,
|
||||
help: change the type of the numeric literal from `i16` to `u16`
|
||||
|
|
||||
LL | OhNo = 0_u16,
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:67:16
|
||||
@ -51,7 +51,7 @@ LL | OhNo = 0_u32,
|
||||
help: change the type of the numeric literal from `u32` to `i32`
|
||||
|
|
||||
LL | OhNo = 0_i32,
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:80:16
|
||||
@ -62,7 +62,7 @@ LL | OhNo = 0_i32,
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | OhNo = 0_u32,
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:93:16
|
||||
@ -73,7 +73,7 @@ LL | OhNo = 0_u64,
|
||||
help: change the type of the numeric literal from `u64` to `i64`
|
||||
|
|
||||
LL | OhNo = 0_i64,
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/discrim-ill-typed.rs:106:16
|
||||
@ -84,7 +84,7 @@ LL | OhNo = 0_i64,
|
||||
help: change the type of the numeric literal from `i64` to `u64`
|
||||
|
|
||||
LL | OhNo = 0_u64,
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
|
||||
|
@ -13,11 +13,11 @@ LL | let _: Self::A;
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | let _: <Self as Foo>::A;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | let _: <Self as Bar>::A;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ~~~~~~~~~~~~~~~
|
||||
|
||||
error[E0221]: ambiguous associated type `Err` in bounds of `Self`
|
||||
--> $DIR/E0221.rs:21:16
|
||||
@ -26,12 +26,13 @@ LL | type Err: T3;
|
||||
| ------------- ambiguous `Err` from `My`
|
||||
LL | fn test() {
|
||||
LL | let _: Self::Err;
|
||||
| ^^^^^^^^^
|
||||
| |
|
||||
| ambiguous associated type `Err`
|
||||
| help: use fully qualified syntax to disambiguate: `<Self as My>::Err`
|
||||
| ^^^^^^^^^ ambiguous associated type `Err`
|
||||
|
|
||||
= note: associated type `Self` could derive from `FromStr`
|
||||
help: use fully qualified syntax to disambiguate
|
||||
|
|
||||
LL | let _: <Self as My>::Err;
|
||||
| ~~~~~~~~~~~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -19,7 +19,7 @@ LL | let y: f32 = 1f64;
|
||||
help: change the type of the numeric literal from `f64` to `f32`
|
||||
|
|
||||
LL | let y: f32 = 1f32;
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -16,7 +16,7 @@ LL | bar::<isize>(i); // i should not be re-coerced back to an isize
|
||||
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | bar::<isize>(i.try_into().unwrap()); // i should not be re-coerced back to an isize
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | id_i8(a16);
|
||||
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(a16.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:41:11
|
||||
@ -18,7 +18,7 @@ LL | id_i8(a32);
|
||||
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(a32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:44:11
|
||||
@ -29,7 +29,7 @@ LL | id_i8(a64);
|
||||
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(a64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:47:11
|
||||
@ -40,16 +40,18 @@ LL | id_i8(asize);
|
||||
help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(asize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:51:12
|
||||
|
|
||||
LL | id_i16(a8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `i16`, found `i8`
|
||||
| help: you can convert an `i8` to an `i16`: `a8.into()`
|
||||
| ^^ expected `i16`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `i16`
|
||||
|
|
||||
LL | id_i16(a8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:55:12
|
||||
@ -60,7 +62,7 @@ LL | id_i16(a32);
|
||||
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i16(a32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:58:12
|
||||
@ -71,7 +73,7 @@ LL | id_i16(a64);
|
||||
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i16(a64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:61:12
|
||||
@ -82,25 +84,29 @@ LL | id_i16(asize);
|
||||
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i16(asize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:65:12
|
||||
|
|
||||
LL | id_i32(a8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `i32`, found `i8`
|
||||
| help: you can convert an `i8` to an `i32`: `a8.into()`
|
||||
| ^^ expected `i32`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `i32`
|
||||
|
|
||||
LL | id_i32(a8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:68:12
|
||||
|
|
||||
LL | id_i32(a16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i32`, found `i16`
|
||||
| help: you can convert an `i16` to an `i32`: `a16.into()`
|
||||
| ^^^ expected `i32`, found `i16`
|
||||
|
|
||||
help: you can convert an `i16` to an `i32`
|
||||
|
|
||||
LL | id_i32(a16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:72:12
|
||||
@ -111,7 +117,7 @@ LL | id_i32(a64);
|
||||
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i32(a64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:75:12
|
||||
@ -122,34 +128,40 @@ LL | id_i32(asize);
|
||||
help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i32(asize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:79:12
|
||||
|
|
||||
LL | id_i64(a8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `i64`, found `i8`
|
||||
| help: you can convert an `i8` to an `i64`: `a8.into()`
|
||||
| ^^ expected `i64`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `i64`
|
||||
|
|
||||
LL | id_i64(a8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:82:12
|
||||
|
|
||||
LL | id_i64(a16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i64`, found `i16`
|
||||
| help: you can convert an `i16` to an `i64`: `a16.into()`
|
||||
| ^^^ expected `i64`, found `i16`
|
||||
|
|
||||
help: you can convert an `i16` to an `i64`
|
||||
|
|
||||
LL | id_i64(a16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:85:12
|
||||
|
|
||||
LL | id_i64(a32);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i64`, found `i32`
|
||||
| help: you can convert an `i32` to an `i64`: `a32.into()`
|
||||
| ^^^ expected `i64`, found `i32`
|
||||
|
|
||||
help: you can convert an `i32` to an `i64`
|
||||
|
|
||||
LL | id_i64(a32.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:89:12
|
||||
@ -160,25 +172,29 @@ LL | id_i64(asize);
|
||||
help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i64(asize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:93:14
|
||||
|
|
||||
LL | id_isize(a8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `isize`, found `i8`
|
||||
| help: you can convert an `i8` to an `isize`: `a8.into()`
|
||||
| ^^ expected `isize`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `isize`
|
||||
|
|
||||
LL | id_isize(a8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:96:14
|
||||
|
|
||||
LL | id_isize(a16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `isize`, found `i16`
|
||||
| help: you can convert an `i16` to an `isize`: `a16.into()`
|
||||
| ^^^ expected `isize`, found `i16`
|
||||
|
|
||||
help: you can convert an `i16` to an `isize`
|
||||
|
|
||||
LL | id_isize(a16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:99:14
|
||||
@ -189,7 +205,7 @@ LL | id_isize(a32);
|
||||
help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_isize(a32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:102:14
|
||||
@ -200,7 +216,7 @@ LL | id_isize(a64);
|
||||
help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_isize(a64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:108:11
|
||||
@ -211,7 +227,7 @@ LL | id_i8(c16);
|
||||
help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(c16.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:111:11
|
||||
@ -222,7 +238,7 @@ LL | id_i8(c32);
|
||||
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(c32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:114:11
|
||||
@ -233,16 +249,18 @@ LL | id_i8(c64);
|
||||
help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i8(c64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:118:12
|
||||
|
|
||||
LL | id_i16(c8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `i16`, found `i8`
|
||||
| help: you can convert an `i8` to an `i16`: `c8.into()`
|
||||
| ^^ expected `i16`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `i16`
|
||||
|
|
||||
LL | id_i16(c8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:122:12
|
||||
@ -253,7 +271,7 @@ LL | id_i16(c32);
|
||||
help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i16(c32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:125:12
|
||||
@ -264,25 +282,29 @@ LL | id_i16(c64);
|
||||
help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i16(c64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:129:12
|
||||
|
|
||||
LL | id_i32(c8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `i32`, found `i8`
|
||||
| help: you can convert an `i8` to an `i32`: `c8.into()`
|
||||
| ^^ expected `i32`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `i32`
|
||||
|
|
||||
LL | id_i32(c8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:132:12
|
||||
|
|
||||
LL | id_i32(c16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i32`, found `i16`
|
||||
| help: you can convert an `i16` to an `i32`: `c16.into()`
|
||||
| ^^^ expected `i32`, found `i16`
|
||||
|
|
||||
help: you can convert an `i16` to an `i32`
|
||||
|
|
||||
LL | id_i32(c16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:136:12
|
||||
@ -293,34 +315,40 @@ LL | id_i32(c64);
|
||||
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_i32(c64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:140:12
|
||||
|
|
||||
LL | id_i64(a8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `i64`, found `i8`
|
||||
| help: you can convert an `i8` to an `i64`: `a8.into()`
|
||||
| ^^ expected `i64`, found `i8`
|
||||
|
|
||||
help: you can convert an `i8` to an `i64`
|
||||
|
|
||||
LL | id_i64(a8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:143:12
|
||||
|
|
||||
LL | id_i64(a16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i64`, found `i16`
|
||||
| help: you can convert an `i16` to an `i64`: `a16.into()`
|
||||
| ^^^ expected `i64`, found `i16`
|
||||
|
|
||||
help: you can convert an `i16` to an `i64`
|
||||
|
|
||||
LL | id_i64(a16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:146:12
|
||||
|
|
||||
LL | id_i64(a32);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `i64`, found `i32`
|
||||
| help: you can convert an `i32` to an `i64`: `a32.into()`
|
||||
| ^^^ expected `i64`, found `i32`
|
||||
|
|
||||
help: you can convert an `i32` to an `i64`
|
||||
|
|
||||
LL | id_i64(a32.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:152:11
|
||||
@ -331,7 +359,7 @@ LL | id_u8(b16);
|
||||
help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u8(b16.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:155:11
|
||||
@ -342,7 +370,7 @@ LL | id_u8(b32);
|
||||
help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u8(b32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:158:11
|
||||
@ -353,7 +381,7 @@ LL | id_u8(b64);
|
||||
help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u8(b64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:161:11
|
||||
@ -364,16 +392,18 @@ LL | id_u8(bsize);
|
||||
help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u8(bsize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:165:12
|
||||
|
|
||||
LL | id_u16(b8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `u16`, found `u8`
|
||||
| help: you can convert a `u8` to a `u16`: `b8.into()`
|
||||
| ^^ expected `u16`, found `u8`
|
||||
|
|
||||
help: you can convert a `u8` to a `u16`
|
||||
|
|
||||
LL | id_u16(b8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:169:12
|
||||
@ -384,7 +414,7 @@ LL | id_u16(b32);
|
||||
help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u16(b32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:172:12
|
||||
@ -395,7 +425,7 @@ LL | id_u16(b64);
|
||||
help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u16(b64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:175:12
|
||||
@ -406,25 +436,29 @@ LL | id_u16(bsize);
|
||||
help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u16(bsize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:179:12
|
||||
|
|
||||
LL | id_u32(b8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `u32`, found `u8`
|
||||
| help: you can convert a `u8` to a `u32`: `b8.into()`
|
||||
| ^^ expected `u32`, found `u8`
|
||||
|
|
||||
help: you can convert a `u8` to a `u32`
|
||||
|
|
||||
LL | id_u32(b8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:182:12
|
||||
|
|
||||
LL | id_u32(b16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `u32`, found `u16`
|
||||
| help: you can convert a `u16` to a `u32`: `b16.into()`
|
||||
| ^^^ expected `u32`, found `u16`
|
||||
|
|
||||
help: you can convert a `u16` to a `u32`
|
||||
|
|
||||
LL | id_u32(b16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:186:12
|
||||
@ -435,7 +469,7 @@ LL | id_u32(b64);
|
||||
help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u32(b64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:189:12
|
||||
@ -446,34 +480,40 @@ LL | id_u32(bsize);
|
||||
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u32(bsize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:193:12
|
||||
|
|
||||
LL | id_u64(b8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `u64`, found `u8`
|
||||
| help: you can convert a `u8` to a `u64`: `b8.into()`
|
||||
| ^^ expected `u64`, found `u8`
|
||||
|
|
||||
help: you can convert a `u8` to a `u64`
|
||||
|
|
||||
LL | id_u64(b8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:196:12
|
||||
|
|
||||
LL | id_u64(b16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `u64`, found `u16`
|
||||
| help: you can convert a `u16` to a `u64`: `b16.into()`
|
||||
| ^^^ expected `u64`, found `u16`
|
||||
|
|
||||
help: you can convert a `u16` to a `u64`
|
||||
|
|
||||
LL | id_u64(b16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:199:12
|
||||
|
|
||||
LL | id_u64(b32);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `u64`, found `u32`
|
||||
| help: you can convert a `u32` to a `u64`: `b32.into()`
|
||||
| ^^^ expected `u64`, found `u32`
|
||||
|
|
||||
help: you can convert a `u32` to a `u64`
|
||||
|
|
||||
LL | id_u64(b32.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:203:12
|
||||
@ -484,25 +524,29 @@ LL | id_u64(bsize);
|
||||
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_u64(bsize.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:207:14
|
||||
|
|
||||
LL | id_usize(b8);
|
||||
| ^^
|
||||
| |
|
||||
| expected `usize`, found `u8`
|
||||
| help: you can convert a `u8` to a `usize`: `b8.into()`
|
||||
| ^^ expected `usize`, found `u8`
|
||||
|
|
||||
help: you can convert a `u8` to a `usize`
|
||||
|
|
||||
LL | id_usize(b8.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:210:14
|
||||
|
|
||||
LL | id_usize(b16);
|
||||
| ^^^
|
||||
| |
|
||||
| expected `usize`, found `u16`
|
||||
| help: you can convert a `u16` to a `usize`: `b16.into()`
|
||||
| ^^^ expected `usize`, found `u16`
|
||||
|
|
||||
help: you can convert a `u16` to a `usize`
|
||||
|
|
||||
LL | id_usize(b16.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:213:14
|
||||
@ -513,7 +557,7 @@ LL | id_usize(b32);
|
||||
help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_usize(b32.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/integer-literal-suffix-inference.rs:216:14
|
||||
@ -524,7 +568,7 @@ LL | id_usize(b64);
|
||||
help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | id_usize(b64.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 52 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | foo(1*(1 as isize));
|
||||
help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | foo((1*(1 as isize)).try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| + +++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-13359.rs:10:9
|
||||
@ -18,7 +18,7 @@ LL | bar(1*(1 as usize));
|
||||
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | bar((1*(1 as usize)).try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| + +++++++++++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | let x: u32 = 20i32;
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | let x: u32 = 20u32;
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | println!("{}", foo(10i32));
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | println!("{}", foo(10u32));
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | A = 1i64,
|
||||
help: change the type of the numeric literal from `i64` to `isize`
|
||||
|
|
||||
LL | A = 1isize,
|
||||
| ~~~~~~
|
||||
| ~~~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/issue-8761.rs:5:9
|
||||
@ -18,7 +18,7 @@ LL | B = 2u8
|
||||
help: change the type of the numeric literal from `u8` to `isize`
|
||||
|
|
||||
LL | B = 2isize
|
||||
| ~~~~~~
|
||||
| ~~~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | let x: u32 = 22_usize;
|
||||
help: change the type of the numeric literal from `usize` to `u32`
|
||||
|
|
||||
LL | let x: u32 = 22_u32;
|
||||
| ~~~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | let x: u32 = 22_usize;
|
||||
help: change the type of the numeric literal from `usize` to `u32`
|
||||
|
|
||||
LL | let x: u32 = 22_u32;
|
||||
| ~~~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -17,7 +17,7 @@ LL | let y: usize = x.foo();
|
||||
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | let y: usize = x.foo().try_into().unwrap();
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -11,7 +11,7 @@ LL | write!(hello);
|
||||
help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | ($arr.len() * size_of($arr[0])).try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| + +++++++++++++++++++++
|
||||
|
||||
error[E0605]: non-primitive cast: `{integer}` as `()`
|
||||
--> $DIR/issue-26480.rs:22:19
|
||||
|
@ -7,7 +7,7 @@ LL | foo(1u8);
|
||||
help: change the type of the numeric literal from `u8` to `u16`
|
||||
|
|
||||
LL | foo(1u16);
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-literal-cast.rs:8:10
|
||||
@ -18,7 +18,7 @@ LL | foo1(2f32);
|
||||
help: change the type of the numeric literal from `f32` to `f64`
|
||||
|
|
||||
LL | foo1(2f64);
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-literal-cast.rs:10:10
|
||||
@ -29,7 +29,7 @@ LL | foo2(3i16);
|
||||
help: change the type of the numeric literal from `i16` to `i32`
|
||||
|
|
||||
LL | foo2(3i32);
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | const C: i32 = 1i8;
|
||||
help: change the type of the numeric literal from `i8` to `i32`
|
||||
|
|
||||
LL | const C: i32 = 1i32;
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-scope.rs:2:15
|
||||
@ -26,7 +26,7 @@ LL | let c: i32 = 1i8;
|
||||
help: change the type of the numeric literal from `i8` to `i32`
|
||||
|
|
||||
LL | let c: i32 = 1i32;
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-scope.rs:6:17
|
||||
@ -47,7 +47,7 @@ LL | let c: i32 = 1i8;
|
||||
help: change the type of the numeric literal from `i8` to `i32`
|
||||
|
|
||||
LL | let c: i32 = 1i32;
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/const-scope.rs:11:17
|
||||
@ -60,7 +60,7 @@ LL | let d: i8 = c;
|
||||
help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | let d: i8 = c.try_into().unwrap();
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | test(array.len());
|
||||
help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | test(array.len().try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,27 +9,33 @@ LL | let x: u16 = foo();
|
||||
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | let x: u16 = foo().try_into().unwrap();
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-2.rs:7:18
|
||||
|
|
||||
LL | let y: i64 = x + x;
|
||||
| --- ^^^^^
|
||||
| | |
|
||||
| | expected `i64`, found `u16`
|
||||
| | help: you can convert a `u16` to an `i64`: `(x + x).into()`
|
||||
| --- ^^^^^ expected `i64`, found `u16`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
help: you can convert a `u16` to an `i64`
|
||||
|
|
||||
LL | let y: i64 = (x + x).into();
|
||||
| + ++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-2.rs:9:18
|
||||
|
|
||||
LL | let z: i32 = x + x;
|
||||
| --- ^^^^^
|
||||
| | |
|
||||
| | expected `i32`, found `u16`
|
||||
| | help: you can convert a `u16` to an `i32`: `(x + x).into()`
|
||||
| --- ^^^^^ expected `i32`, found `u16`
|
||||
| |
|
||||
| expected due to this
|
||||
|
|
||||
help: you can convert a `u16` to an `i32`
|
||||
|
|
||||
LL | let z: i32 = (x + x).into();
|
||||
| + ++++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -47,7 +47,7 @@ LL | x_u8 > -1_isize;
|
||||
help: you can convert `x_u8` from `u8` to `isize`, matching the type of `-1_isize`
|
||||
|
|
||||
LL | isize::from(x_u8) > -1_isize;
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:23:15
|
||||
@ -74,7 +74,7 @@ LL | x_u64 > -1_i128;
|
||||
help: you can convert `x_u64` from `u64` to `i128`, matching the type of `-1_i128`
|
||||
|
|
||||
LL | i128::from(x_u64) > -1_i128;
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| +++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:29:13
|
||||
@ -85,7 +85,7 @@ LL | x_u32 > -1_i128;
|
||||
help: you can convert `x_u32` from `u32` to `i128`, matching the type of `-1_i128`
|
||||
|
|
||||
LL | i128::from(x_u32) > -1_i128;
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| +++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:31:13
|
||||
@ -96,7 +96,7 @@ LL | x_u16 > -1_i128;
|
||||
help: you can convert `x_u16` from `u16` to `i128`, matching the type of `-1_i128`
|
||||
|
|
||||
LL | i128::from(x_u16) > -1_i128;
|
||||
| ~~~~~~~~~~~~~~~~~
|
||||
| +++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:33:12
|
||||
@ -107,7 +107,7 @@ LL | x_u8 > -1_i128;
|
||||
help: you can convert `x_u8` from `u8` to `i128`, matching the type of `-1_i128`
|
||||
|
|
||||
LL | i128::from(x_u8) > -1_i128;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| +++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:36:15
|
||||
@ -142,7 +142,7 @@ LL | x_u32 > -1_i64;
|
||||
help: you can convert `x_u32` from `u32` to `i64`, matching the type of `-1_i64`
|
||||
|
|
||||
LL | i64::from(x_u32) > -1_i64;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:44:13
|
||||
@ -153,7 +153,7 @@ LL | x_u16 > -1_i64;
|
||||
help: you can convert `x_u16` from `u16` to `i64`, matching the type of `-1_i64`
|
||||
|
|
||||
LL | i64::from(x_u16) > -1_i64;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:46:12
|
||||
@ -164,7 +164,7 @@ LL | x_u8 > -1_i64;
|
||||
help: you can convert `x_u8` from `u8` to `i64`, matching the type of `-1_i64`
|
||||
|
|
||||
LL | i64::from(x_u8) > -1_i64;
|
||||
| ~~~~~~~~~~~~~~~
|
||||
| ++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:49:15
|
||||
@ -207,7 +207,7 @@ LL | x_u16 > -1_i32;
|
||||
help: you can convert `x_u16` from `u16` to `i32`, matching the type of `-1_i32`
|
||||
|
|
||||
LL | i32::from(x_u16) > -1_i32;
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:59:12
|
||||
@ -218,7 +218,7 @@ LL | x_u8 > -1_i32;
|
||||
help: you can convert `x_u8` from `u8` to `i32`, matching the type of `-1_i32`
|
||||
|
|
||||
LL | i32::from(x_u8) > -1_i32;
|
||||
| ~~~~~~~~~~~~~~~
|
||||
| ++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:62:15
|
||||
@ -269,7 +269,7 @@ LL | x_u8 > -1_i16;
|
||||
help: you can convert `x_u8` from `u8` to `i16`, matching the type of `-1_i16`
|
||||
|
|
||||
LL | i16::from(x_u8) > -1_i16;
|
||||
| ~~~~~~~~~~~~~~~
|
||||
| ++++++++++ +
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/numeric-cast-no-fix.rs:75:15
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -38,15 +38,15 @@ LL | fn fizz(i32) {}
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn fizz(self: i32) {}
|
||||
| ~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn fizz(i32: TypeName) {}
|
||||
| ~~~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn fizz(_: i32) {}
|
||||
| ~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `S`
|
||||
--> $DIR/inverted-parameters.rs:27:23
|
||||
|
@ -13,16 +13,16 @@ LL | fn test(&'a str) {
|
||||
= note: anonymous parameters are removed in the 2018 edition (see RFC 1685)
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn test(self: &str) {
|
||||
| ~~~~~~~~~~
|
||||
LL | fn test(self: &'a str) {
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn test(str: &TypeName) {
|
||||
| ~~~~~~~~~~~~~~
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn test(_: &str) {
|
||||
| ~~~~~~~
|
||||
LL | fn test(_: &'a str) {
|
||||
| ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -8,15 +8,15 @@ LL | fn foo(x) {
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn foo(self: x) {
|
||||
| ~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn foo(x: TypeName) {
|
||||
| ~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo(_: x) {
|
||||
| ~~~~
|
||||
| ++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -8,11 +8,11 @@ LL | fn a(B<) {}
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn a(self: B<) {}
|
||||
| ~~~~~~~
|
||||
| +++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn a(_: B<) {}
|
||||
| ~~~~
|
||||
| ++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | let_in(3u32, |i| { assert!(i == 3i32); });
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | let_in(3u32, |i| { assert!(i == 3u32); });
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/pptypedef.rs:8:37
|
||||
@ -18,7 +18,7 @@ LL | let_in(3i32, |i| { assert!(i == 3u32); });
|
||||
help: change the type of the numeric literal from `u32` to `i32`
|
||||
|
|
||||
LL | let_in(3i32, |i| { assert!(i == 3i32); });
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -18,7 +18,7 @@ LL | Some(x) => { return x },
|
||||
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | Some(x) => { return x.try_into().unwrap() },
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/span-preservation.rs:33:22
|
||||
|
@ -55,7 +55,7 @@ LL | let f = [0; 4u8];
|
||||
help: change the type of the numeric literal from `u8` to `usize`
|
||||
|
|
||||
LL | let f = [0; 4usize];
|
||||
| ~~~~~~
|
||||
| ~~~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/repeat_count.rs:31:17
|
||||
|
@ -8,15 +8,15 @@ LL | trait Trait2015 { fn foo(#[allow(C)] i32); }
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | trait Trait2015 { fn foo(#[allow(C)] self: i32); }
|
||||
| ~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | trait Trait2015 { fn foo(#[allow(C)] i32: TypeName); }
|
||||
| ~~~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | trait Trait2015 { fn foo(#[allow(C)] _: i32); }
|
||||
| ~~~~~~
|
||||
| ++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -33,7 +33,7 @@ LL | let _: i32 = 22_i64 >> 1_i32;
|
||||
help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | let _: i32 = (22_i64 >> 1_i32).try_into().unwrap();
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| + +++++++++++++++++++++
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
|
@ -8,11 +8,11 @@ LL | fn foo(Option<i32>, String) {}
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn foo(self: Option<i32>, String) {}
|
||||
| ~~~~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo(_: Option<i32>, String) {}
|
||||
| ~~~~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `)`
|
||||
--> $DIR/issue-34264.rs:1:27
|
||||
@ -24,11 +24,11 @@ LL | fn foo(Option<i32>, String) {}
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn foo(Option<i32>, String: TypeName) {}
|
||||
| ~~~~~~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn foo(Option<i32>, _: String) {}
|
||||
| ~~~~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `,`
|
||||
--> $DIR/issue-34264.rs:3:9
|
||||
@ -40,15 +40,15 @@ LL | fn bar(x, y: usize) {}
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn bar(self: x, y: usize) {}
|
||||
| ~~~~~~~
|
||||
| +++++
|
||||
help: if this is a parameter name, give it a type
|
||||
|
|
||||
LL | fn bar(x: TypeName, y: usize) {}
|
||||
| ~~~~~~~~~~~
|
||||
| ++++++++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn bar(_: x, y: usize) {}
|
||||
| ~~~~
|
||||
| ++
|
||||
|
||||
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
|
||||
--> $DIR/issue-34264.rs:7:5
|
||||
|
@ -8,11 +8,11 @@ LL | pub fn foo(Box<Self>) { }
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | pub fn foo(self: Box<Self>) { }
|
||||
| ~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | pub fn foo(_: Box<Self>) { }
|
||||
| ~~~~~~
|
||||
| ++
|
||||
|
||||
error: expected one of `:`, `@`, or `|`, found `<`
|
||||
--> $DIR/issue-64252-self-type.rs:10:15
|
||||
@ -24,11 +24,11 @@ LL | fn bar(Box<Self>) { }
|
||||
help: if this is a `self` type, give it a parameter name
|
||||
|
|
||||
LL | fn bar(self: Box<Self>) { }
|
||||
| ~~~~~~~~~
|
||||
| +++++
|
||||
help: if this is a type, explicitly ignore the parameter name
|
||||
|
|
||||
LL | fn bar(_: Box<Self>) { }
|
||||
| ~~~~~~
|
||||
| ++
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -2,19 +2,23 @@ error[E0308]: mismatched types
|
||||
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:19
|
||||
|
|
||||
LL | let _ = RGB { r, g, c };
|
||||
| ^
|
||||
| |
|
||||
| expected `f64`, found `f32`
|
||||
| help: you can convert an `f32` to an `f64`: `r: r.into()`
|
||||
| ^ expected `f64`, found `f32`
|
||||
|
|
||||
help: you can convert an `f32` to an `f64`
|
||||
|
|
||||
LL | let _ = RGB { r: r.into(), g, c };
|
||||
| ++ +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:22
|
||||
|
|
||||
LL | let _ = RGB { r, g, c };
|
||||
| ^
|
||||
| |
|
||||
| expected `f64`, found `f32`
|
||||
| help: you can convert an `f32` to an `f64`: `g: g.into()`
|
||||
| ^ expected `f64`, found `f32`
|
||||
|
|
||||
help: you can convert an `f32` to an `f64`
|
||||
|
|
||||
LL | let _ = RGB { r, g: g.into(), c };
|
||||
| ++ +++++++
|
||||
|
||||
error[E0560]: struct `RGB` has no field named `c`
|
||||
--> $DIR/type-mismatch-struct-field-shorthand-2.rs:5:25
|
||||
|
@ -2,28 +2,34 @@ error[E0308]: mismatched types
|
||||
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:19
|
||||
|
|
||||
LL | let _ = RGB { r, g, b };
|
||||
| ^
|
||||
| |
|
||||
| expected `f64`, found `f32`
|
||||
| help: you can convert an `f32` to an `f64`: `r: r.into()`
|
||||
| ^ expected `f64`, found `f32`
|
||||
|
|
||||
help: you can convert an `f32` to an `f64`
|
||||
|
|
||||
LL | let _ = RGB { r: r.into(), g, b };
|
||||
| ++ +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:22
|
||||
|
|
||||
LL | let _ = RGB { r, g, b };
|
||||
| ^
|
||||
| |
|
||||
| expected `f64`, found `f32`
|
||||
| help: you can convert an `f32` to an `f64`: `g: g.into()`
|
||||
| ^ expected `f64`, found `f32`
|
||||
|
|
||||
help: you can convert an `f32` to an `f64`
|
||||
|
|
||||
LL | let _ = RGB { r, g: g.into(), b };
|
||||
| ++ +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/type-mismatch-struct-field-shorthand.rs:8:25
|
||||
|
|
||||
LL | let _ = RGB { r, g, b };
|
||||
| ^
|
||||
| |
|
||||
| expected `f64`, found `f32`
|
||||
| help: you can convert an `f32` to an `f64`: `b: b.into()`
|
||||
| ^ expected `f64`, found `f32`
|
||||
|
|
||||
help: you can convert an `f32` to an `f64`
|
||||
|
|
||||
LL | let _ = RGB { r, g, b: b.into() };
|
||||
| ++ +++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | fn f() -> isize { return g(); }
|
||||
help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | fn f() -> isize { return g().try_into().unwrap(); }
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | test(22i32, 44i32);
|
||||
help: change the type of the numeric literal from `i32` to `u32`
|
||||
|
|
||||
LL | test(22i32, 44u32);
|
||||
| ~~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -10,7 +10,7 @@ LL | B::get_x()
|
||||
help: you can convert an `i32` to a `u8` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | B::get_x().try_into().unwrap()
|
||||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -2,10 +2,12 @@ error[E0308]: mismatched types
|
||||
--> $DIR/tutorial-suffix-inference-test.rs:9:18
|
||||
|
|
||||
LL | identity_u16(x);
|
||||
| ^
|
||||
| |
|
||||
| expected `u16`, found `u8`
|
||||
| help: you can convert a `u8` to a `u16`: `x.into()`
|
||||
| ^ expected `u16`, found `u8`
|
||||
|
|
||||
help: you can convert a `u8` to a `u16`
|
||||
|
|
||||
LL | identity_u16(x.into());
|
||||
| +++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/tutorial-suffix-inference-test.rs:12:18
|
||||
@ -16,7 +18,7 @@ LL | identity_u16(y);
|
||||
help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | identity_u16(y.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/tutorial-suffix-inference-test.rs:21:18
|
||||
@ -27,7 +29,7 @@ LL | identity_u16(a);
|
||||
help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | identity_u16(a.try_into().unwrap());
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -15,7 +15,7 @@ LL | let b: typeof(a) = 1i8;
|
||||
help: change the type of the numeric literal from `i8` to `u8`
|
||||
|
|
||||
LL | let b: typeof(a) = 1u8;
|
||||
| ~~~
|
||||
| ~~
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
@ -20,7 +20,7 @@ LL | <i32 as Add<i32>>::add(1u32, 2);
|
||||
help: change the type of the numeric literal from `u32` to `i32`
|
||||
|
|
||||
LL | <i32 as Add<i32>>::add(1i32, 2);
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error[E0308]: mismatched types
|
||||
--> $DIR/ufcs-qpath-self-mismatch.rs:8:31
|
||||
@ -31,7 +31,7 @@ LL | <i32 as Add<i32>>::add(1, 2u32);
|
||||
help: change the type of the numeric literal from `u32` to `i32`
|
||||
|
|
||||
LL | <i32 as Add<i32>>::add(1, 2i32);
|
||||
| ~~~~
|
||||
| ~~~
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
|
@ -7,7 +7,7 @@ LL | let z = f(1_usize, 2);
|
||||
help: change the type of the numeric literal from `usize` to `isize`
|
||||
|
|
||||
LL | let z = f(1_isize, 2);
|
||||
| ~~~~~~~
|
||||
| ~~~~~
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
@ -9,7 +9,7 @@ LL | fn mk_int() -> usize { let i: isize = 3; return i; }
|
||||
help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit
|
||||
|
|
||||
LL | fn mk_int() -> usize { let i: isize = 3; return i.try_into().unwrap(); }
|
||||
| ~~~~~~~~~~~~~~~~~~~~~
|
||||
| ++++++++++++++++++++
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user