diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index e61476bf23e1e..648cde600c765 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -307,6 +307,28 @@ impl Diagnostic { self } + /// Show a suggestion that has multiple parts to it, always as it's own subwindow. + /// 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.suggestions.push(CodeSuggestion { + substitutions: vec![Substitution { + parts: suggestion + .into_iter() + .map(|(span, snippet)| SubstitutionPart { snippet, span }) + .collect(), + }], + msg: msg.to_owned(), + style: SuggestionStyle::ShowAlways, + applicability, + }); + self + } + /// Show multiple suggestions that have multiple parts. /// See also [`Diagnostic::multipart_suggestion()`]. pub fn multipart_suggestions( diff --git a/compiler/rustc_errors/src/diagnostic_builder.rs b/compiler/rustc_errors/src/diagnostic_builder.rs index f165a60336a6a..8d93a866e9e4d 100644 --- a/compiler/rustc_errors/src/diagnostic_builder.rs +++ b/compiler/rustc_errors/src/diagnostic_builder.rs @@ -280,6 +280,20 @@ impl<'a> DiagnosticBuilder<'a> { self } + /// See [`Diagnostic::multipart_suggestion_verbose()`]. + 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::multipart_suggestions()`]. pub fn multipart_suggestions( &mut self, diff --git a/compiler/rustc_typeck/src/check/expr.rs b/compiler/rustc_typeck/src/check/expr.rs index 93eb2cfc72a80..1e6d590e74d8b 100644 --- a/compiler/rustc_typeck/src/check/expr.rs +++ b/compiler/rustc_typeck/src/check/expr.rs @@ -221,7 +221,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty } - fn check_expr_kind( + pub(super) fn check_expr_kind( &self, expr: &'tcx hir::Expr<'tcx>, expected: Expectation<'tcx>, diff --git a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs index 3e60924d6fcf8..a5afc449d69ce 100644 --- a/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs +++ b/compiler/rustc_typeck/src/check/fn_ctxt/checks.rs @@ -4,16 +4,17 @@ use crate::check::method::MethodCallee; use crate::check::Expectation::*; use crate::check::TupleArgumentsFlag::*; use crate::check::{ - potentially_plural_count, struct_span_err, BreakableCtxt, Diverges, Expectation, FnCtxt, - LocalTy, Needs, TupleArgumentsFlag, + struct_span_err, BreakableCtxt, Diverges, Expectation, FnCtxt, LocalTy, Needs, + TupleArgumentsFlag, }; use rustc_ast as ast; -use rustc_errors::{Applicability, DiagnosticBuilder, DiagnosticId}; +use rustc_errors::{Applicability, DiagnosticBuilder}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::DefId; use rustc_hir::{ExprKind, Node, QPath}; +use rustc_infer::infer::InferOk; use rustc_middle::ty::adjustment::AllowTwoPhase; use rustc_middle::ty::fold::TypeFoldable; use rustc_middle::ty::{self, Ty}; @@ -22,6 +23,7 @@ use rustc_span::symbol::{sym, Ident}; use rustc_span::{self, MultiSpan, Span}; use rustc_trait_selection::traits::{self, ObligationCauseCode, StatementAsExpression}; +use std::cmp; use std::mem::replace; use std::slice; @@ -92,141 +94,50 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { /// method calls and overloaded operators. pub(in super::super) fn check_argument_types( &self, - sp: Span, - expr: &'tcx hir::Expr<'tcx>, - fn_inputs: &[Ty<'tcx>], - expected_arg_tys: &[Ty<'tcx>], - args: &'tcx [hir::Expr<'tcx>], + // Span enclosing the call site + call_span: Span, + // Expression of the call site + call_expr: &'tcx hir::Expr<'tcx>, + // Types (as defined in the *signature* of the target function) + formal_input_tys: &[Ty<'tcx>], + // More specific expected types, after unifying with caller output types + expected_input_tys: &[Ty<'tcx>], + // The expressions for each provided argument + provided_args: &'tcx [hir::Expr<'tcx>], + // Whether the function is variadic, for example when imported from C c_variadic: bool, + // Whether the arguments have been bundled in a tuple (ex: closures) tuple_arguments: TupleArgumentsFlag, - def_id: Option, + // The DefId for the function being called, for better error messages + fn_def_id: Option, ) { let tcx = self.tcx; - // Grab the argument types, supplying fresh type variables - // if the wrong number of arguments were supplied - let supplied_arg_count = if tuple_arguments == DontTupleArguments { args.len() } else { 1 }; + + // Conceptually, we've got some number of expected inputs, and some number of provided aguments + // and we can form a grid of whether each argument could satisfy a given input: + // in1 | in2 | in3 | ... + // arg1 ? | | | + // arg2 | ? | | + // arg3 | | ? | + // ... + // Initially, we just check the diagonal, because in the case of correct code + // these are the only checks that matter + // However, in the unhappy path, we'll fill in this whole grid to attempt to provide + // better error messages about invalid method calls. // All the input types from the fn signature must outlive the call // so as to validate implied bounds. - for (&fn_input_ty, arg_expr) in fn_inputs.iter().zip(args.iter()) { + for (&fn_input_ty, arg_expr) in formal_input_tys.iter().zip(provided_args.iter()) { self.register_wf_obligation(fn_input_ty.into(), arg_expr.span, traits::MiscObligation); } - let expected_arg_count = fn_inputs.len(); - - let param_count_error = |expected_count: usize, - arg_count: usize, - error_code: &str, - c_variadic: bool, - sugg_unit: bool| { - let (span, start_span, args) = match &expr.kind { - hir::ExprKind::Call(hir::Expr { span, .. }, args) => (*span, *span, &args[..]), - hir::ExprKind::MethodCall(path_segment, span, args, _) => ( - *span, - // `sp` doesn't point at the whole `foo.bar()`, only at `bar`. - path_segment - .args - .and_then(|args| args.args.iter().last()) - // Account for `foo.bar::()`. - .map(|arg| { - // Skip the closing `>`. - tcx.sess - .source_map() - .next_point(tcx.sess.source_map().next_point(arg.span())) - }) - .unwrap_or(*span), - &args[1..], // Skip the receiver. - ), - k => span_bug!(sp, "checking argument types on a non-call: `{:?}`", k), - }; - let arg_spans = if args.is_empty() { - // foo() - // ^^^-- supplied 0 arguments - // | - // expected 2 arguments - vec![tcx.sess.source_map().next_point(start_span).with_hi(sp.hi())] - } else { - // foo(1, 2, 3) - // ^^^ - - - supplied 3 arguments - // | - // expected 2 arguments - args.iter().map(|arg| arg.span).collect::>() - }; - - let mut err = tcx.sess.struct_span_err_with_code( - span, - &format!( - "this function takes {}{} but {} {} supplied", - if c_variadic { "at least " } else { "" }, - potentially_plural_count(expected_count, "argument"), - potentially_plural_count(arg_count, "argument"), - if arg_count == 1 { "was" } else { "were" } - ), - DiagnosticId::Error(error_code.to_owned()), - ); - let label = format!("supplied {}", potentially_plural_count(arg_count, "argument")); - for (i, span) in arg_spans.into_iter().enumerate() { - err.span_label( - span, - if arg_count == 0 || i + 1 == arg_count { &label } else { "" }, - ); - } - - if let Some(def_id) = def_id { - if let Some(node) = tcx.hir().get_if_local(def_id) { - let mut spans: MultiSpan = node - .ident() - .map(|ident| ident.span) - .unwrap_or_else(|| tcx.hir().span(node.hir_id().unwrap())) - .into(); - - if let Some(id) = node.body_id() { - let body = tcx.hir().body(id); - for param in body.params { - spans.push_span_label(param.span, String::new()); - } - } - - let def_kind = tcx.def_kind(def_id); - err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id))); - } - } - - if sugg_unit { - let sugg_span = tcx.sess.source_map().end_point(expr.span); - // remove closing `)` from the span - let sugg_span = sugg_span.shrink_to_lo(); - err.span_suggestion( - sugg_span, - "expected the unit value `()`; create it with empty parentheses", - String::from("()"), - Applicability::MachineApplicable, - ); - } else { - err.span_label( - span, - format!( - "expected {}{}", - if c_variadic { "at least " } else { "" }, - potentially_plural_count(expected_count, "argument") - ), - ); - } - err.emit(); - }; - - let mut expected_arg_tys = expected_arg_tys.to_vec(); - - let formal_tys = if tuple_arguments == TupleArguments { - let tuple_type = self.structurally_resolved_type(sp, fn_inputs[0]); + let mut expected_input_tys = expected_input_tys.to_vec(); + // If the arguments should be wrapped in a tuple (ex: closures), unwrap them here + let formal_input_tys = if tuple_arguments == TupleArguments { + let tuple_type = self.structurally_resolved_type(call_span, formal_input_tys[0]); match tuple_type.kind() { - ty::Tuple(arg_types) if arg_types.len() != args.len() => { - param_count_error(arg_types.len(), args.len(), "E0057", false, false); - expected_arg_tys = vec![]; - self.err_args(args.len()) - } ty::Tuple(arg_types) => { - expected_arg_tys = match expected_arg_tys.get(0) { + expected_input_tys = match expected_input_tys.get(0) { Some(&ty) => match ty.kind() { ty::Tuple(ref tys) => tys.iter().map(|k| k.expect_ty()).collect(), _ => vec![], @@ -236,134 +147,701 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { arg_types.iter().map(|k| k.expect_ty()).collect() } _ => { - struct_span_err!( - tcx.sess, - sp, - E0059, - "cannot use call notation; the first type parameter \ - for the function trait is neither a tuple nor unit" - ) - .emit(); - expected_arg_tys = vec![]; - self.err_args(args.len()) + // Otherwise, there's a mismatch, so clear out what we're expecting, and set + // our input typs to err_args so we don't blow up the error messages + expected_input_tys = vec![]; + self.err_args(provided_args.len()) } } - } else if expected_arg_count == supplied_arg_count { - fn_inputs.to_vec() - } else if c_variadic { - if supplied_arg_count >= expected_arg_count { - fn_inputs.to_vec() - } else { - param_count_error(expected_arg_count, supplied_arg_count, "E0060", true, false); - expected_arg_tys = vec![]; - self.err_args(supplied_arg_count) - } } else { - // is the missing argument of type `()`? - let sugg_unit = if expected_arg_tys.len() == 1 && supplied_arg_count == 0 { - self.resolve_vars_if_possible(expected_arg_tys[0]).is_unit() - } else if fn_inputs.len() == 1 && supplied_arg_count == 0 { - self.resolve_vars_if_possible(fn_inputs[0]).is_unit() - } else { - false + formal_input_tys.to_vec() + }; + + // If there are no external expectations at the call site, just use the types from the function defn + let expected_input_tys = if !expected_input_tys.is_empty() { + expected_input_tys + } else { + formal_input_tys.clone() + }; + + let minimum_input_count = expected_input_tys.len(); + let provided_arg_count: usize = provided_args.len(); + + // Allocate a small grid; + // compatibility_matrix[i][j] will represent whether provided argument i could satisfy input j + let mut compatibility_matrix = vec![vec![false; minimum_input_count]; provided_arg_count]; + + // Keep track of whether we *could possibly* be satisfied, i.e. whether we're on the happy path + // if the wrong number of arguments were supplied, we CAN'T be satisfied, + // and if we're c_variadic, the supplied arguments must be >= the minimum count from the function + // otherwise, they need to be identical, because rust doesn't currently support variadic functions + let mut call_appears_satisfied = if c_variadic { + provided_arg_count >= minimum_input_count + } else { + provided_arg_count == minimum_input_count + }; + + // The type of any closure arguments we encounter may be subject to obligations imposed by later arguments, + // so we defer checking any closures until the end, when all of those obligations have been registered + let mut deferred_arguments: Vec = vec![]; + + // We'll also want to keep track of the fully coerced argument types, for an awkward hack near the end + let mut final_arg_types: Vec, Ty<'_>)>> = vec![None; provided_arg_count]; + + // We introduce a helper function to demand that a given argument satisfy a given input + // This is more complicated than just checking type equality, as arguments could be coerced + // This version writes those types back so further type checking uses the narrowed types + let demand_compatible = |arg_idx, input_idx| { + let formal_input_ty: Ty<'tcx> = formal_input_tys[input_idx]; + let expected_input_ty: Ty<'tcx> = expected_input_tys[input_idx]; + let provided_arg = &provided_args[arg_idx]; + + // We're on the happy path here, so we'll do a more involved check and write back types + // To check compatibility, we'll do 3 things: + // 1. Unify the provided argument with the expected type + let expectation = Expectation::rvalue_hint(self, expected_input_ty); + let checked_ty = self.check_expr_with_expectation(provided_arg, expectation); + + // 2. Find and check the most detailed coercible type + let coerced_ty = expectation.only_has_type(self).unwrap_or(formal_input_ty); + let coerced_ty = self.resolve_vars_with_obligations(coerced_ty); + + let coerce_error = + self.try_coerce(provided_arg, checked_ty, coerced_ty, AllowTwoPhase::Yes); + + // 3. Check if the formal type is a supertype of the checked one + // and register any such obligations for future type checks + let supertype_error = self + .at(&self.misc(provided_arg.span), self.param_env) + .sup(formal_input_ty, coerced_ty); + let is_supertype = match supertype_error { + Ok(InferOk { obligations, value: () }) => { + self.register_predicates(obligations); + true + } + _ => false, }; - param_count_error(expected_arg_count, supplied_arg_count, "E0061", false, sugg_unit); - expected_arg_tys = vec![]; - self.err_args(supplied_arg_count) + // If neither check failed, the types are compatible + (coerce_error.is_ok() && is_supertype, checked_ty, coerced_ty) }; - debug!( - "check_argument_types: formal_tys={:?}", - formal_tys.iter().map(|t| self.ty_to_string(*t)).collect::>() - ); + // A "softer" version of the helper above, which checks types without persisting them, + // and treats error types differently + // This will allow us to "probe" for other argument orders that would likely have been correct + let check_compatible = |arg_idx, input_idx| { + let formal_input_ty: Ty<'tcx> = formal_input_tys[input_idx]; + let expected_input_ty: Ty<'tcx> = expected_input_tys[input_idx]; + + // If either is an error type, we defy the usual convention and consider them to *not* be + // coercible. This prevents our error message heuristic from trying to pass errors into + // every argument. + if formal_input_ty.references_error() || expected_input_ty.references_error() { + return false; + } - // If there is no expectation, expect formal_tys. - let expected_arg_tys = - if !expected_arg_tys.is_empty() { expected_arg_tys } else { formal_tys.clone() }; - - let mut final_arg_types: Vec<(usize, Ty<'_>, Ty<'_>)> = vec![]; - - // Check the arguments. - // We do this in a pretty awful way: first we type-check any arguments - // that are not closures, then we type-check the closures. This is so - // that we have more information about the types of arguments when we - // type-check the functions. This isn't really the right way to do this. - for &check_closures in &[false, true] { - debug!("check_closures={}", check_closures); - - // More awful hacks: before we check argument types, try to do - // an "opportunistic" trait resolution of any trait bounds on - // the call. This helps coercions. - if check_closures { - self.select_obligations_where_possible(false, |errors| { - self.point_at_type_arg_instead_of_call_if_possible(errors, expr); - self.point_at_arg_instead_of_call_if_possible( - errors, - &final_arg_types[..], - sp, - &args, - ); - }) + let provided_arg: &hir::Expr<'tcx> = &provided_args[arg_idx]; + let expectation = Expectation::rvalue_hint(self, expected_input_ty); + // FIXME: check that this is safe; I don't believe this commits any of the obligations, but I can't be sure. + // + // I had another method of "soft" type checking before, + // but it was failing to find the type of some expressions (like "") + // so I prodded this method and made it pub(super) so I could call it, and it seems to work well. + let checked_ty = self.check_expr_kind(provided_arg, expectation); + + let coerced_ty = expectation.only_has_type(self).unwrap_or(formal_input_ty); + let can_coerce = self.can_coerce(checked_ty, coerced_ty); + + let is_super = self + .at(&self.misc(provided_arg.span), self.param_env) + .sup(formal_input_ty, coerced_ty) + .is_ok(); + // Same as above: if either the coerce type or the checked type is an error type, + // consider them *not* compatible. + return !coerced_ty.references_error() + && !checked_ty.references_error() + && can_coerce + && is_super; + }; + + // Check each argument, to satisfy the input it was provided for + // Visually, we're traveling down the diagonal of the compatibility matrix + for idx in 0..provided_arg_count { + // First, warn if this expression is unreachable + // ex: myFn(panic!(), 2 + 2) + // ^^^^^ + self.warn_if_unreachable( + provided_args[idx].hir_id, + provided_args[idx].span, + "expression", + ); + + // If we're past the end of the expected inputs, we won't have anything to check against + if idx >= minimum_input_count { + break; + } + + // If this argument is a closure, we defer this to a second pass, so we have more type information + if matches!(provided_args[idx].kind, ExprKind::Closure(..)) { + deferred_arguments.push(idx); + continue; + } + + // Demand that this argument satisfies the input in the slot it's in + let (compatible, checked_ty, coerced_ty) = demand_compatible(idx, idx); + // Keep track of these for below + final_arg_types[idx] = Some((checked_ty, coerced_ty)); + + // If we fail at some point, we'll want to provide better error messages, so hold onto this info + if compatible { + compatibility_matrix[idx][idx] = true; + } else { + call_appears_satisfied = false; } + } + + // Next, check any closures, since we have more type info at this point + // To help with type resolution, we can do an "opportunistic" vtable resolution + // on any trait bounds. This is considered by some to be a pretty awful hack. + self.select_obligations_where_possible(false, |errors| { + // Clean up the error messages a bit + self.point_at_type_arg_instead_of_call_if_possible(errors, call_expr); + self.point_at_arg_instead_of_call_if_possible( + errors, + &final_arg_types, + call_span, + &provided_args, + ); + }); - // For C-variadic functions, we don't have a declared type for all of - // the arguments hence we only do our usual type checking with - // the arguments who's types we do know. - let t = if c_variadic { - expected_arg_count - } else if tuple_arguments == TupleArguments { - args.len() + for idx in deferred_arguments { + let (compatible, _, _) = demand_compatible(idx, idx); + // Note that, unlike the first pass, we ignore the checked/coerced types, + // since we don't plan on running select_obligations_where_possible again + if compatible { + compatibility_matrix[idx][idx] = true; } else { - supplied_arg_count + call_appears_satisfied = false; + } + } + + // If something above didn't typecheck, we've fallen off the happy path + // and we should make some effort to provide better error messages + if !call_appears_satisfied { + // The algorithm here is inspired by levenshtein distance and longest common subsequence. + // We'll try to detect 4 different types of mistakes: + // - An extra parameter has been provided that doesn't satisfy *any* of the other inputs + // - An input is missing, which isn't satisfied by *any* of the other arguments + // - Some number of arguments have been provided in the wrong order + // - A type is straight up invalid + + // First, fill in the rest of our compatibility matrix + for i in 0..provided_arg_count { + for j in 0..minimum_input_count { + if i == j { + continue; + } + compatibility_matrix[i][j] = check_compatible(i, j); + } + } + + // Obviously, detecting exact user intention is impossible, so the goal here is to + // come up with as likely of a story as we can to be helpful. + // + // We'll iteratively removed "satisfied" input/argument paris, + // then check for the cases above, until we've eliminated the entire grid + // + // We'll want to know which arguments and inputs these rows and columns correspond to + // even after we delete them, so these lookups will keep track of that + let mut input_indexes: Vec = (0..minimum_input_count).collect(); + let mut arg_indexes: Vec = (0..provided_arg_count).collect(); + + // First, set up some utility functions for the algorithm below + // Remove a given input or argument from consideration + let eliminate_input = |mat: &mut Vec>, ii: &mut Vec, idx| { + ii.remove(idx); + for row in mat { + row.remove(idx); + } + }; + let eliminate_arg = |mat: &mut Vec>, ai: &mut Vec, idx| { + ai.remove(idx); + mat.remove(idx); + }; + // "satisfy" an input with a given arg, removing both from consideration + let satisfy_input = |mat: &mut Vec>, + ii: &mut Vec, + ai: &mut Vec, + input_idx, + arg_idx| { + eliminate_input(mat, ii, input_idx); + eliminate_arg(mat, ai, arg_idx); + }; + + let eliminate_satisfied = |mat: &mut Vec>, + ii: &mut Vec, + ai: &mut Vec| + -> Vec<(usize, usize)> { + let mut i = cmp::min(ii.len(), ai.len()); + let mut eliminated = vec![]; + while i > 0 { + let idx = i - 1; + if mat[idx][idx] { + eliminated.push((ai[idx], ii[idx])); + satisfy_input(mat, ii, ai, idx, idx); + } + i -= 1; + } + return eliminated; }; - for (i, arg) in args.iter().take(t).enumerate() { - // Warn only for the first loop (the "no closures" one). - // Closure arguments themselves can't be diverging, but - // a previous argument can, e.g., `foo(panic!(), || {})`. - if !check_closures { - self.warn_if_unreachable(arg.hir_id, arg.span, "expression"); + + // A list of the issues we might find + enum Issue { + // The given argument is the invalid type for the input + Invalid(usize), + // There is a missing input + Missing(usize), + // There's a superfluous argument + Extra(usize), + // Two arguments should be swapped + Swap(usize, usize), + // Several arguments should be reordered + Permutation(Vec>), + } + // Check for the above mismatch cases + let find_issue = |mat: &Vec>, ii: &Vec, ai: &Vec| { + for i in 0..cmp::max(ai.len(), ii.len()) { + // If we eliminate the last row, any left-over inputs are considered missing + if i >= mat.len() { + return Some(Issue::Missing(i)); + } + // If we eliminate the last column, any left-over arguments are extra + if mat[i].len() == 0 { + return Some(Issue::Extra(i)); + } + + // Make sure we don't pass the bounds of our matrix + let is_arg = i < ai.len(); + let is_input = i < ii.len(); + if is_arg && is_input && mat[i][i] { + // This is a satisfied input, so move along + continue; + } + + let mut useless = true; + let mut unsatisfiable = true; + if is_arg { + for j in 0..ii.len() { + // If we find at least one input this argument could satisfy + // this argument isn't completely useless + if mat[i][j] { + useless = false; + break; + } + } + } + if is_input { + for j in 0..ai.len() { + // If we find at least one argument that could satisfy this input + // this argument isn't unsatisfiable + if mat[j][i] { + unsatisfiable = false; + break; + } + } + } + + match (is_arg, is_input, useless, unsatisfiable) { + // If an input is unsatisfied, and the argument in its position is useless + // then the most likely explanation is that we just got the types wrong + (true, true, true, true) => return Some(Issue::Invalid(i)), + // Otherwise, if an input is useless, then indicate that this is an extra argument + (true, _, true, _) => return Some(Issue::Extra(i)), + // Otherwise, if an argument is unsatisfiable, indicate that it's missing + (_, true, _, true) => return Some(Issue::Missing(i)), + (true, true, _, _) => { + // The argument isn't useless, and the input isn't unsatisfied, + // so look for a parameter we might swap it with + // We look for swaps explicitly, instead of just falling back on permutations + // so that cases like (A,B,C,D) given (B,A,D,C) show up as two swaps, + // instead of a large permutation of 4 elements. + for j in 0..cmp::min(ai.len(), ii.len()) { + if i == j || mat[j][j] { + continue; + } + if mat[i][j] && mat[j][i] { + return Some(Issue::Swap(i, j)); + } + } + } + _ => { + continue; + } + }; } - let is_closure = matches!(arg.kind, ExprKind::Closure(..)); + // We didn't find any of the individual issues above, but + // there might be a larger permutation of parameters, so we now check for that + // by checking for cycles + // We use a double option at position i in this vec to represent: + // - None: We haven't computed anything about this argument yet + // - Some(None): This argument definitely doesn't participate in a cycle + // - Some(Some(x)): the i-th argument could permute to the x-th position + let mut permutation: Vec>> = vec![None; mat.len()]; + let mut permutation_found = false; + for i in 0..mat.len() { + if permutation[i].is_some() { + // We've already decided whether this argument is or is not in a loop + continue; + } - if is_closure != check_closures { - continue; + let mut stack = vec![]; + let mut j = i; + let mut last = i; + let mut is_cycle = true; + loop { + stack.push(j); + // Look for params this one could slot into + let compat: Vec<_> = mat[j] + .iter() + .enumerate() + .filter_map(|(i, &c)| if c { Some(i) } else { None }) + .collect(); + if compat.len() != 1 { + // this could go into multiple slots, don't bother exploring both + is_cycle = false; + break; + } + j = compat[0]; + if stack.contains(&j) { + last = j; + break; + } + } + if stack.len() <= 2 { + // If we encounter a cycle of 1 or 2 elements, we'll let the + // "satisfy" and "swap" code above handle those + is_cycle = false; + } + // We've built up some chain, some of which might be a cycle + // ex: [1,2,3,4]; last = 2; j = 2; + // So, we want to mark 4, 3, and 2 as part of a permutation + permutation_found = is_cycle; + while let Some(x) = stack.pop() { + if is_cycle { + permutation[x] = Some(Some(j)); + j = x; + if j == last { + // From here on out, we're a tail leading into a cycle, + // not the cycle itself + is_cycle = false; + } + } else { + // Some(None) ensures we save time by skipping this argument again + permutation[x] = Some(None); + } + } } - debug!("checking the argument"); - let formal_ty = formal_tys[i]; + if permutation_found { + // Map unwrap to remove the first layer of Some + let final_permutation: Vec> = + permutation.into_iter().map(|x| x.unwrap()).collect(); + return Some(Issue::Permutation(final_permutation)); + } + return None; + }; - // The special-cased logic below has three functions: - // 1. Provide as good of an expected type as possible. - let expected = Expectation::rvalue_hint(self, expected_arg_tys[i]); + // As we encounter issues, keep track of what we want to provide for the suggestion + let mut suggested_inputs: Vec> = vec![None; minimum_input_count]; + let mut labels = vec![]; + let mut suggestion_text = None; + let source_map = self.sess().source_map(); + + // Before we start looking for issues, eliminate any arguments that are already satisfied, + // so that an argument which is already spoken for by the input it's in doesn't + // spill over into another similarly typed input + // ex: + // fn some_func(_a: i32, _a: i32) {} + // some_func(1, ""); + // Without this elimination, the first argument causes the second argument + // to show up as both a missing input and extra argument, rather than + // just an invalid type. + for (arg, inp) in + eliminate_satisfied(&mut compatibility_matrix, &mut input_indexes, &mut arg_indexes) + { + let arg_span = provided_args[arg].span; + let arg_text = source_map.span_to_snippet(arg_span).unwrap(); + suggested_inputs[inp] = Some(arg_text); + } - let checked_ty = self.check_expr_with_expectation(&arg, expected); + // Until we've elimineated / satisfied all arguments/inputs + while input_indexes.len() > 0 || arg_indexes.len() > 0 { + // Check for the first relevant issue + match find_issue(&compatibility_matrix, &input_indexes, &arg_indexes) { + Some(Issue::Invalid(idx)) => { + // Eliminate the input and the arg, proposing a placeholder of the correct type + let input_idx = input_indexes[idx]; + let expected_ty = expected_input_tys[input_idx]; + let input_ty = self.resolve_vars_if_possible(expected_ty); + if input_ty.is_unit() { + suggested_inputs[input_idx] = Some("()".to_string()); + } else { + suggested_inputs[input_idx] = Some(format!("{{{}}}", input_ty)); + } + let provided_ty = if let Some((ty, _)) = final_arg_types[idx] { + format!(", found `{}`", ty) + } else { + "".into() + }; + labels.push(( + provided_args[idx].span, + format!("expected `{}`{}", expected_ty, provided_ty), + )); + suggestion_text = match suggestion_text { + None => Some("provide an argument of the correct type"), + Some(_) => Some("did you mean"), + }; + eliminate_input(&mut compatibility_matrix, &mut input_indexes, idx); + eliminate_arg(&mut compatibility_matrix, &mut arg_indexes, idx); + } + Some(Issue::Extra(idx)) => { + // Eliminate the argument (without touching any inputs) + let arg_type = if let Some((_, ty)) = final_arg_types[idx] { + format!(" of type {}", ty) + } else { + "".into() + }; + labels.push(( + provided_args[idx].span, + format!("argument{} unexpected", arg_type), + )); + suggestion_text = match suggestion_text { + None => Some("remove the extra argument"), + Some(_) => Some("did you mean"), + }; + eliminate_arg(&mut compatibility_matrix, &mut arg_indexes, idx); + } + Some(Issue::Missing(idx)) => { + let input_idx = input_indexes[idx]; + let expected_ty = expected_input_tys[input_idx]; + let input_ty = self.resolve_vars_if_possible(expected_ty); + if input_ty.is_unit() { + suggested_inputs[input_idx] = Some("()".to_string()); + } else { + suggested_inputs[input_idx] = Some(format!("{{{}}}", input_ty)); + } + // NOTE: Because we might be re-arranging arguments, might have extra arguments, etc. + // It's hard to *really* know where we should provide this error label, so this is a + // decent heuristic + let span = if input_idx < provided_arg_count { + let arg_span = provided_args[input_idx].span; + Span::new(arg_span.lo(), arg_span.hi(), arg_span.ctxt()) + } else { + // Otherwise just label the whole function + call_span + }; + labels.push((span, format!("an argument of type {} is missing", input_ty))); + suggestion_text = match suggestion_text { + None => Some("provide the argument"), + Some(_) => Some("did you mean"), + }; + eliminate_input(&mut compatibility_matrix, &mut input_indexes, idx); + } + Some(Issue::Swap(idx, other)) => { + let input_idx = input_indexes[idx]; + let other_input_idx = input_indexes[other]; + let arg_idx = arg_indexes[idx]; + let other_arg_idx = arg_indexes[other]; + let first_span = provided_args[arg_idx].span; + let second_span = provided_args[other_arg_idx].span; + let first_snippet = source_map.span_to_snippet(first_span).unwrap(); + let second_snippet = source_map.span_to_snippet(second_span).unwrap(); + suggested_inputs[input_idx] = Some(second_snippet); + suggested_inputs[other_input_idx] = Some(first_snippet); + + let first_expected_ty = + self.resolve_vars_if_possible(expected_input_tys[input_idx]); + let first_provided_ty = if let Some((ty, _)) = final_arg_types[arg_idx] { + format!(",found `{}`", ty) + } else { + "".into() + }; + labels.push(( + first_span, + format!("expected `{}`{}", first_expected_ty, first_provided_ty), + )); + let other_expected_ty = + self.resolve_vars_if_possible(expected_input_tys[other_input_idx]); + let other_provided_ty = + if let Some((ty, _)) = final_arg_types[other_arg_idx] { + format!(",found `{}`", ty) + } else { + "".into() + }; + labels.push(( + second_span, + format!("expected `{}`{}", other_expected_ty, other_provided_ty), + )); + suggestion_text = match suggestion_text { + None => Some("swap these arguments"), + Some(_) => Some("did you mean"), + }; + + let (min, max) = (cmp::min(idx, other), cmp::max(idx, other)); + satisfy_input( + &mut compatibility_matrix, + &mut input_indexes, + &mut arg_indexes, + min, + max, + ); + satisfy_input( + &mut compatibility_matrix, + &mut input_indexes, + &mut arg_indexes, + max - 1, // Subtract 1 because we already removed the "min" row + min, + ); + } + Some(Issue::Permutation(args)) => { + // FIXME: If satisfy_input ever did anything non-trivial (emit obligations to help type checking, for example) + // we'd want to call this function with the correct arg/input pairs, but for now, we just throw them in a bucket. + // This works because they force a cycle, so each row is guaranteed to also be a column + let mut idxs: Vec = args.iter().filter_map(|&a| a).collect(); + + let mut real_idxs = vec![None; provided_arg_count]; + for (src, dst) in args.iter().enumerate().filter(|(_, &a)| a.is_some()) { + let src_arg = arg_indexes[src]; + let dst_arg = arg_indexes[dst.unwrap()]; + let dest_input = input_indexes[dst.unwrap()]; + let src_span = provided_args[src_arg].span; + suggested_inputs[dest_input] = + Some(source_map.span_to_snippet(src_span).unwrap()); + + let expected_ty = + self.resolve_vars_if_possible(expected_input_tys[dest_input]); + let provided_ty = if let Some((ty, _)) = final_arg_types[dst_arg] { + format!(",found `{}`", ty) + } else { + "".into() + }; + labels.push(( + provided_args[dst_arg].span, + format!("expected `{}`{}", expected_ty, provided_ty), + )); + real_idxs[src_arg] = Some(dst_arg); + } + + suggestion_text = match suggestion_text { + None => Some("reorder these arguments"), + Some(_) => Some("did you mean"), + }; + + idxs.sort(); + idxs.reverse(); + for i in idxs { + satisfy_input( + &mut compatibility_matrix, + &mut input_indexes, + &mut arg_indexes, + i, + i, + ); + } + } + None => { + // We didn't find any issues, so we need to push the algorithm forward + // First, eliminate any arguments that currently satisfy their inputs + for (arg, inp) in eliminate_satisfied( + &mut compatibility_matrix, + &mut input_indexes, + &mut arg_indexes, + ) { + let arg_span = provided_args[arg].span; + let arg_text = source_map.span_to_snippet(arg_span).unwrap(); + suggested_inputs[inp] = Some(arg_text); + } + } + }; + } + + let issue_count = labels.len(); + if issue_count > 0 { + // Now construct our error from the various things we've labeled + let mut err = struct_span_err!( + tcx.sess, + call_span, + E0308, // FIXME: Choose a different code? + "arguments to this function are incorrect", + ); - // 2. Coerce to the most detailed type that could be coerced - // to, which is `expected_ty` if `rvalue_hint` returns an - // `ExpectHasType(expected_ty)`, or the `formal_ty` otherwise. - let coerce_ty = expected.only_has_type(self).unwrap_or(formal_ty); - // We're processing function arguments so we definitely want to use - // two-phase borrows. - self.demand_coerce(&arg, checked_ty, coerce_ty, None, AllowTwoPhase::Yes); - final_arg_types.push((i, checked_ty, coerce_ty)); + // If we have less than 5 things to say, it would be useful to call out exactly what's wrong + if issue_count <= 5 { + for (span, label) in labels { + err.span_label(span, label); + } + } + + // Call out where the function is defined + let mut fn_name: String = "".to_string(); + if let Some(def_id) = fn_def_id { + if let Some(node) = tcx.hir().get_if_local(def_id) { + let span = node + .ident() + .map(|ident| ident.span) + .unwrap_or_else(|| tcx.hir().span(node.hir_id().unwrap())); + fn_name = source_map.span_to_snippet(span).unwrap(); + let mut spans: MultiSpan = span.into(); + + if let Some(id) = node.body_id() { + let body = tcx.hir().body(id); + for param in body.params { + spans.push_span_label(param.span, String::new()); + } + } + let def_kind = tcx.def_kind(def_id); + err.span_note(spans, &format!("{} defined here", def_kind.descr(def_id))); + } + } - // 3. Relate the expected type and the formal one, - // if the expected type was used for the coercion. - self.demand_suptype(arg.span, formal_ty, coerce_ty); + // And add a suggestion block for all of the parameters + let mut suggestion = format!("{}(", fn_name).to_string(); + for (idx, input) in suggested_inputs.iter().enumerate() { + if let Some(sug) = input { + suggestion += sug; + } else { + suggestion += "??"; + } + if idx < minimum_input_count - 1 { + suggestion += ", "; + } + } + suggestion += ")"; + if let Some(suggestion_text) = suggestion_text { + err.span_suggestion_verbose( + call_span, + suggestion_text, + suggestion, + Applicability::HasPlaceholders, + ); + } + + err.emit(); } } - // We also need to make sure we at least write the ty of the other - // arguments which we skipped above. + // If the function is c-style variadic, we skipped a bunch of arguments + // so we need to check those, and write out the types + // Ideally this would be folded into the above, for uniform style + // but c-variadic is already a corner case if c_variadic { fn variadic_error<'tcx>(s: &Session, span: Span, t: Ty<'tcx>, cast_ty: &str) { use crate::structured_errors::{StructuredDiagnostic, VariadicError}; VariadicError::new(s, span, t, cast_ty).diagnostic().emit(); } - for arg in args.iter().skip(expected_arg_count) { + for arg in provided_args.iter().skip(minimum_input_count) { let arg_ty = self.check_expr(&arg); // There are a few types which get autopromoted when passed via varargs @@ -896,7 +1374,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { fn point_at_arg_instead_of_call_if_possible( &self, errors: &mut Vec>, - final_arg_types: &[(usize, Ty<'tcx>, Ty<'tcx>)], + final_arg_types: &[Option<(Ty<'tcx>, Ty<'tcx>)>], call_sp: Span, args: &'tcx [hir::Expr<'tcx>], ) { @@ -919,21 +1397,23 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { { // Collect the argument position for all arguments that could have caused this // `FulfillmentError`. - let mut referenced_in = final_arg_types - .iter() - .map(|&(i, checked_ty, _)| (i, checked_ty)) - .chain(final_arg_types.iter().map(|&(i, _, coerced_ty)| (i, coerced_ty))) - .flat_map(|(i, ty)| { - let ty = self.resolve_vars_if_possible(ty); - // We walk the argument type because the argument's type could have - // been `Option`, but the `FulfillmentError` references `T`. - if ty.walk().any(|arg| arg == predicate.self_ty().into()) { - Some(i) - } else { - None - } - }) - .collect::>(); + let mut checked_tys = vec![]; + let mut coerced_tys = vec![]; + for (i, &type_pair) in final_arg_types.iter().enumerate() { + if let Some((checked_ty, coerced_ty)) = type_pair { + checked_tys.push((i, checked_ty)); + coerced_tys.push((i, coerced_ty)); + } + } + let mut referenced_in = vec![]; + for &(i, ty) in checked_tys.iter().chain(coerced_tys.iter()) { + let ty = self.resolve_vars_if_possible(ty); + // We walk the argument type because the argument's type could have + // been `Option`, but the `FulfillmentError` references `T`. + if ty.walk().any(|arg| arg == predicate.self_ty().into()) { + referenced_in.push(i); + } + } // Both checked and coerced types could have matched, thus we need to remove // duplicates. diff --git a/src/test/ui/arg-count-mismatch.rs b/src/test/ui/arg-count-mismatch.rs deleted file mode 100644 index 18926f5daf71a..0000000000000 --- a/src/test/ui/arg-count-mismatch.rs +++ /dev/null @@ -1,5 +0,0 @@ -// error-pattern: arguments were supplied - -fn f(x: isize) { } - -fn main() { let i: (); i = f(); } diff --git a/src/test/ui/arg-count-mismatch.stderr b/src/test/ui/arg-count-mismatch.stderr deleted file mode 100644 index d0577e4864a78..0000000000000 --- a/src/test/ui/arg-count-mismatch.stderr +++ /dev/null @@ -1,17 +0,0 @@ -error[E0061]: this function takes 1 argument but 0 arguments were supplied - --> $DIR/arg-count-mismatch.rs:5:28 - | -LL | fn main() { let i: (); i = f(); } - | ^-- supplied 0 arguments - | | - | expected 1 argument - | -note: function defined here - --> $DIR/arg-count-mismatch.rs:3:4 - | -LL | fn f(x: isize) { } - | ^ -------- - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0061`. diff --git a/src/test/ui/arg-type-mismatch.rs b/src/test/ui/arg-type-mismatch.rs deleted file mode 100644 index 04ce2888785be..0000000000000 --- a/src/test/ui/arg-type-mismatch.rs +++ /dev/null @@ -1,5 +0,0 @@ -// error-pattern: mismatched types - -fn f(x: isize) { } - -fn main() { let i: (); i = f(()); } diff --git a/src/test/ui/arg-type-mismatch.stderr b/src/test/ui/arg-type-mismatch.stderr deleted file mode 100644 index 05b21efeecec4..0000000000000 --- a/src/test/ui/arg-type-mismatch.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0308]: mismatched types - --> $DIR/arg-type-mismatch.rs:5:30 - | -LL | fn main() { let i: (); i = f(()); } - | ^^ expected `isize`, found `()` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/basic.rs b/src/test/ui/argument-suggestions/basic.rs new file mode 100644 index 0000000000000..6846271ec07cf --- /dev/null +++ b/src/test/ui/argument-suggestions/basic.rs @@ -0,0 +1,25 @@ +// Some basic "obvious" cases for the heuristic error messages added for #65853 +// One for each of the detected cases + +enum E { X, Y } +enum F { X2, Y2 } +struct G {} +struct H {} +struct X {} +struct Y {} +struct Z {} + + +fn invalid(_i: u32) {} +fn extra() {} +fn missing(_i: u32) {} +fn swapped(_i: u32, _s: &str) {} +fn permuted(_x: X, _y: Y, _z: Z) {} + +fn main() { + invalid(1.0); //~ ERROR arguments to this function are incorrect + extra(""); //~ ERROR arguments to this function are incorrect + missing(); //~ ERROR arguments to this function are incorrect + swapped("", 1); //~ ERROR arguments to this function are incorrect + permuted(Y {}, Z {}, X {}); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/basic.stderr b/src/test/ui/argument-suggestions/basic.stderr new file mode 100644 index 0000000000000..d43f837080444 --- /dev/null +++ b/src/test/ui/argument-suggestions/basic.stderr @@ -0,0 +1,94 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/basic.rs:20:5 + | +LL | invalid(1.0); + | ^^^^^^^^---^ + | | + | expected `u32`, found `{float}` + | +note: function defined here + --> $DIR/basic.rs:13:4 + | +LL | fn invalid(_i: u32) {} + | ^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | invalid({u32}); + | ^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/basic.rs:21:5 + | +LL | extra(""); + | ^^^^^^--^ + | | + | argument unexpected + | +note: function defined here + --> $DIR/basic.rs:14:4 + | +LL | fn extra() {} + | ^^^^^ +help: remove the extra argument + | +LL | extra(); + | ^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/basic.rs:22:5 + | +LL | missing(); + | ^^^^^^^^^ an argument of type u32 is missing + | +note: function defined here + --> $DIR/basic.rs:15:4 + | +LL | fn missing(_i: u32) {} + | ^^^^^^^ ------- +help: provide the argument + | +LL | missing({u32}); + | ^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/basic.rs:23:5 + | +LL | swapped("", 1); + | ^^^^^^^^--^^-^ + | | | + | | expected `&str`,found `{integer}` + | expected `u32`,found `&'static str` + | +note: function defined here + --> $DIR/basic.rs:16:4 + | +LL | fn swapped(_i: u32, _s: &str) {} + | ^^^^^^^ ------- -------- +help: swap these arguments + | +LL | swapped(1, ""); + | ^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/basic.rs:24:5 + | +LL | permuted(Y {}, Z {}, X {}); + | ^^^^^^^^^----^^----^^----^ + | | | | + | | | expected `Z`,found `X` + | | expected `Y`,found `Z` + | expected `X`,found `Y` + | +note: function defined here + --> $DIR/basic.rs:17:4 + | +LL | fn permuted(_x: X, _y: Y, _z: Z) {} + | ^^^^^^^^ ----- ----- ----- +help: reorder these arguments + | +LL | permuted(X {}, Y {}, Z {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/complex.rs b/src/test/ui/argument-suggestions/complex.rs new file mode 100644 index 0000000000000..384cdca7e4fdc --- /dev/null +++ b/src/test/ui/argument-suggestions/complex.rs @@ -0,0 +1,16 @@ +// A complex case with mixed suggestions from #65853 + +enum E { X, Y } +enum F { X2, Y2 } +struct G {} +struct H {} +struct X {} +struct Y {} +struct Z {} + +fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {} + +fn main() { + complex(1.0, H {}, &"", G{}, F::X2, Z {}, X {}, Y {}); + //~^ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/complex.stderr b/src/test/ui/argument-suggestions/complex.stderr new file mode 100644 index 0000000000000..efea77c2ed40b --- /dev/null +++ b/src/test/ui/argument-suggestions/complex.stderr @@ -0,0 +1,19 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/complex.rs:14:3 + | +LL | complex(1.0, H {}, &"", G{}, F::X2, Z {}, X {}, Y {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | +note: function defined here + --> $DIR/complex.rs:11:4 + | +LL | fn complex(_i: u32, _s: &str, _e: E, _f: F, _g: G, _x: X, _y: Y, _z: Z ) {} + | ^^^^^^^ ------- -------- ----- ----- ----- ----- ----- ------ +help: did you mean + | +LL | complex({u32}, &"", {E}, F::X2, G{}, X {}, Y {}, Z {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/extra_arguments.rs b/src/test/ui/argument-suggestions/extra_arguments.rs new file mode 100644 index 0000000000000..b2bca4bdcc29a --- /dev/null +++ b/src/test/ui/argument-suggestions/extra_arguments.rs @@ -0,0 +1,35 @@ +fn empty() {} +fn one_arg(_a: i32) {} +fn two_arg_same(_a: i32, _b: i32) {} +fn two_arg_diff(_a: i32, _b: &str) {} + +fn main() { + empty(""); //~ ERROR arguments to this function are incorrect + + one_arg(1, 1); //~ ERROR arguments to this function are incorrect + one_arg(1, ""); //~ ERROR arguments to this function are incorrect + one_arg(1, "", 1.0); //~ ERROR arguments to this function are incorrect + + two_arg_same(1, 1, 1); //~ ERROR arguments to this function are incorrect + two_arg_same(1, 1, 1.0); //~ ERROR arguments to this function are incorrect + + two_arg_diff(1, 1, ""); //~ ERROR arguments to this function are incorrect + two_arg_diff(1, "", ""); //~ ERROR arguments to this function are incorrect + two_arg_diff(1, 1, "", ""); //~ ERROR arguments to this function are incorrect + two_arg_diff(1, "", 1, ""); //~ ERROR arguments to this function are incorrect + + // Check with weird spacing and newlines + two_arg_same(1, 1, ""); //~ ERROR arguments to this function are incorrect + two_arg_diff(1, 1, ""); //~ ERROR arguments to this function are incorrect + two_arg_same( //~ ERROR arguments to this function are incorrect + 1, + 1, + "" + ); + + two_arg_diff( //~ ERROR arguments to this function are incorrect + 1, + 1, + "" + ); +} diff --git a/src/test/ui/argument-suggestions/extra_arguments.stderr b/src/test/ui/argument-suggestions/extra_arguments.stderr new file mode 100644 index 0000000000000..be99da736550a --- /dev/null +++ b/src/test/ui/argument-suggestions/extra_arguments.stderr @@ -0,0 +1,264 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:7:3 + | +LL | empty(""); + | ^^^^^^--^ + | | + | argument unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:1:4 + | +LL | fn empty() {} + | ^^^^^ +help: remove the extra argument + | +LL | empty(); + | ^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:9:3 + | +LL | one_arg(1, 1); + | ^^^^^^^^-^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:2:4 + | +LL | fn one_arg(_a: i32) {} + | ^^^^^^^ ------- +help: remove the extra argument + | +LL | one_arg(1); + | ^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:10:3 + | +LL | one_arg(1, ""); + | ^^^^^^^^-^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:2:4 + | +LL | fn one_arg(_a: i32) {} + | ^^^^^^^ ------- +help: remove the extra argument + | +LL | one_arg(1); + | ^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:11:3 + | +LL | one_arg(1, "", 1.0); + | ^^^^^^^^-^^^^^^^^^^ + | | + | argument of type i32 unexpected + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:2:4 + | +LL | fn one_arg(_a: i32) {} + | ^^^^^^^ ------- +help: did you mean + | +LL | one_arg(1); + | ^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:13:3 + | +LL | two_arg_same(1, 1, 1); + | ^^^^^^^^^^^^^-^^^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:3:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL | two_arg_same(1, 1); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:14:3 + | +LL | two_arg_same(1, 1, 1.0); + | ^^^^^^^^^^^^^-^^^^^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:3:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL | two_arg_same(1, 1); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:16:3 + | +LL | two_arg_diff(1, 1, ""); + | ^^^^^^^^^^^^^-^^^^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:4:4 + | +LL | fn two_arg_diff(_a: i32, _b: &str) {} + | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:17:3 + | +LL | two_arg_diff(1, "", ""); + | ^^^^^^^^^^^^^-^^^^^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:4:4 + | +LL | fn two_arg_diff(_a: i32, _b: &str) {} + | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:18:3 + | +LL | two_arg_diff(1, 1, "", ""); + | ^^^^^^^^^^^^^-^^^^^^^^^^^^ + | | + | argument of type i32 unexpected + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:4:4 + | +LL | fn two_arg_diff(_a: i32, _b: &str) {} + | ^^^^^^^^^^^^ ------- -------- +help: did you mean + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:19:3 + | +LL | two_arg_diff(1, "", 1, ""); + | ^^^^^^^^^^^^^-^^^^^^^^^^^^ + | | + | argument of type i32 unexpected + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:4:4 + | +LL | fn two_arg_diff(_a: i32, _b: &str) {} + | ^^^^^^^^^^^^ ------- -------- +help: did you mean + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:22:3 + | +LL | two_arg_same(1, 1, ""); + | ^^^^^^^^^^^^^-^^^^^^^^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:3:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL | two_arg_same(1, 1); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:23:3 + | +LL | two_arg_diff(1, 1, ""); + | ^^^^^^^^^^^^^-^^^^^^^^^^^^ + | | + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/extra_arguments.rs:4:4 + | +LL | fn two_arg_diff(_a: i32, _b: &str) {} + | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:24:3 + | +LL | / two_arg_same( +LL | | 1, + | | - argument of type i32 unexpected +LL | | 1, +LL | | "" +LL | | ); + | |___^ + | +note: function defined here + --> $DIR/extra_arguments.rs:3:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: remove the extra argument + | +LL | two_arg_same(1, 1); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/extra_arguments.rs:30:3 + | +LL | / two_arg_diff( +LL | | 1, + | | - argument of type i32 unexpected +LL | | 1, +LL | | "" +LL | | ); + | |___^ + | +note: function defined here + --> $DIR/extra_arguments.rs:4:4 + | +LL | fn two_arg_diff(_a: i32, _b: &str) {} + | ^^^^^^^^^^^^ ------- -------- +help: remove the extra argument + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 14 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/invalid_arguments.rs b/src/test/ui/argument-suggestions/invalid_arguments.rs new file mode 100644 index 0000000000000..a8c159c43b163 --- /dev/null +++ b/src/test/ui/argument-suggestions/invalid_arguments.rs @@ -0,0 +1,43 @@ +// More nuanced test cases for invalid arguments #65853 + +struct X {} + +fn one_arg(_a: i32) {} +fn two_arg_same(_a: i32, _b: i32) {} +fn two_arg_diff(_a: i32, _b: f32) {} +fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} +fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + +fn main() { + // Providing an incorrect argument for a single parameter function + one_arg(1.0); //~ ERROR arguments to this function are incorrect + + // Providing one or two invalid arguments to a two parameter function + two_arg_same(1, ""); //~ ERROR arguments to this function are incorrect + two_arg_same("", 1); //~ ERROR arguments to this function are incorrect + two_arg_same("", ""); //~ ERROR arguments to this function are incorrect + two_arg_diff(1, ""); //~ ERROR arguments to this function are incorrect + two_arg_diff("", 1.0); //~ ERROR arguments to this function are incorrect + two_arg_diff("", ""); //~ ERROR arguments to this function are incorrect + + // Providing invalid arguments to a three parameter function + three_arg_diff(X{}, 1.0, ""); //~ ERROR arguments to this function are incorrect + three_arg_diff(1, X {}, ""); //~ ERROR arguments to this function are incorrect + three_arg_diff(1, 1.0, X {}); //~ ERROR arguments to this function are incorrect + + three_arg_diff(X {}, X {}, ""); //~ ERROR arguments to this function are incorrect + three_arg_diff(X {}, 1.0, X {}); //~ ERROR arguments to this function are incorrect + three_arg_diff(1, X {}, X {}); //~ ERROR arguments to this function are incorrect + + three_arg_diff(X {}, X {}, X {}); //~ ERROR arguments to this function are incorrect + + three_arg_repeat(X {}, 1, ""); //~ ERROR arguments to this function are incorrect + three_arg_repeat(1, X {}, ""); //~ ERROR arguments to this function are incorrect + three_arg_repeat(1, 1, X {}); //~ ERROR arguments to this function are incorrect + + three_arg_repeat(X {}, X {}, ""); //~ ERROR arguments to this function are incorrect + three_arg_repeat(X {}, 1, X {}); //~ ERROR arguments to this function are incorrect + three_arg_repeat(1, X {}, X{}); //~ ERROR arguments to this function are incorrect + + three_arg_repeat(X {}, X {}, X {}); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/invalid_arguments.stderr b/src/test/ui/argument-suggestions/invalid_arguments.stderr new file mode 100644 index 0000000000000..c82b6e0ec9df8 --- /dev/null +++ b/src/test/ui/argument-suggestions/invalid_arguments.stderr @@ -0,0 +1,393 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:13:3 + | +LL | one_arg(1.0); + | ^^^^^^^^---^ + | | + | expected `i32`, found `{float}` + | +note: function defined here + --> $DIR/invalid_arguments.rs:5:4 + | +LL | fn one_arg(_a: i32) {} + | ^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | one_arg({i32}); + | ^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:16:3 + | +LL | two_arg_same(1, ""); + | ^^^^^^^^^^^^^-^^^^^ + | | + | expected `i32`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:6:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: provide an argument of the correct type + | +LL | two_arg_same(1, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:17:3 + | +LL | two_arg_same("", 1); + | ^^^^^^^^^^^^^--^^^^ + | | + | expected `i32`, found `&'static str` + | +note: function defined here + --> $DIR/invalid_arguments.rs:6:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: provide an argument of the correct type + | +LL | two_arg_same({i32}, 1); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:18:3 + | +LL | two_arg_same("", ""); + | ^^^^^^^^^^^^^--^^^^^ + | | + | expected `i32`, found `&'static str` + | expected `i32`, found `&'static str` + | +note: function defined here + --> $DIR/invalid_arguments.rs:6:4 + | +LL | fn two_arg_same(_a: i32, _b: i32) {} + | ^^^^^^^^^^^^ ------- ------- +help: did you mean + | +LL | two_arg_same({i32}, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:19:3 + | +LL | two_arg_diff(1, ""); + | ^^^^^^^^^^^^^-^^^^^ + | | + | expected `f32`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:7:4 + | +LL | fn two_arg_diff(_a: i32, _b: f32) {} + | ^^^^^^^^^^^^ ------- ------- +help: provide an argument of the correct type + | +LL | two_arg_diff(1, {f32}); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:20:3 + | +LL | two_arg_diff("", 1.0); + | ^^^^^^^^^^^^^--^^^^^^ + | | + | expected `i32`, found `&'static str` + | +note: function defined here + --> $DIR/invalid_arguments.rs:7:4 + | +LL | fn two_arg_diff(_a: i32, _b: f32) {} + | ^^^^^^^^^^^^ ------- ------- +help: provide an argument of the correct type + | +LL | two_arg_diff({i32}, 1.0); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:21:3 + | +LL | two_arg_diff("", ""); + | ^^^^^^^^^^^^^--^^^^^ + | | + | expected `i32`, found `&'static str` + | expected `f32`, found `&'static str` + | +note: function defined here + --> $DIR/invalid_arguments.rs:7:4 + | +LL | fn two_arg_diff(_a: i32, _b: f32) {} + | ^^^^^^^^^^^^ ------- ------- +help: did you mean + | +LL | two_arg_diff({i32}, {f32}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:24:3 + | +LL | three_arg_diff(X{}, 1.0, ""); + | ^^^^^^^^^^^^^^^---^^^^^^^^^^ + | | + | expected `i32`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: provide an argument of the correct type + | +LL | three_arg_diff({i32}, 1.0, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:25:3 + | +LL | three_arg_diff(1, X {}, ""); + | ^^^^^^^^^^^^^^^-^^^^^^^^^^^ + | | + | expected `f32`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: provide an argument of the correct type + | +LL | three_arg_diff(1, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:26:3 + | +LL | three_arg_diff(1, 1.0, X {}); + | ^^^^^^^^^^^^^^^-^^^^^^^^^^^^ + | | + | expected `&str`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: provide an argument of the correct type + | +LL | three_arg_diff(1, 1.0, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:28:3 + | +LL | three_arg_diff(X {}, X {}, ""); + | ^^^^^^^^^^^^^^^----^^^^^^^^^^^ + | | + | expected `i32`, found `X` + | expected `f32`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_diff({i32}, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:29:3 + | +LL | three_arg_diff(X {}, 1.0, X {}); + | ^^^^^^^^^^^^^^^----^^^^^^^^^^^^ + | | + | expected `i32`, found `X` + | expected `&str`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_diff({i32}, 1.0, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:30:3 + | +LL | three_arg_diff(1, X {}, X {}); + | ^^^^^^^^^^^^^^^-^^^^^^^^^^^^^ + | | + | expected `f32`, found `i32` + | expected `&str`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_diff(1, {f32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:32:3 + | +LL | three_arg_diff(X {}, X {}, X {}); + | ^^^^^^^^^^^^^^^----^^^^^^^^^^^^^ + | | + | expected `i32`, found `X` + | expected `f32`, found `X` + | expected `&str`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:8:4 + | +LL | fn three_arg_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_diff({i32}, {f32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:34:3 + | +LL | three_arg_repeat(X {}, 1, ""); + | ^^^^^^^^^^^^^^^^^----^^^^^^^^ + | | + | expected `i32`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: provide an argument of the correct type + | +LL | three_arg_repeat({i32}, 1, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:35:3 + | +LL | three_arg_repeat(1, X {}, ""); + | ^^^^^^^^^^^^^^^^^-^^^^^^^^^^^ + | | + | expected `i32`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: provide an argument of the correct type + | +LL | three_arg_repeat(1, {i32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:36:3 + | +LL | three_arg_repeat(1, 1, X {}); + | ^^^^^^^^^^^^^^^^^-^^^^^^^^^^ + | | + | expected `&str`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: provide an argument of the correct type + | +LL | three_arg_repeat(1, 1, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:38:3 + | +LL | three_arg_repeat(X {}, X {}, ""); + | ^^^^^^^^^^^^^^^^^----^^^^^^^^^^^ + | | + | expected `i32`, found `X` + | expected `i32`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_repeat({i32}, {i32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:39:3 + | +LL | three_arg_repeat(X {}, 1, X {}); + | ^^^^^^^^^^^^^^^^^----^^^^^^^^^^ + | | + | expected `i32`, found `X` + | expected `&str`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_repeat({i32}, 1, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:40:3 + | +LL | three_arg_repeat(1, X {}, X{}); + | ^^^^^^^^^^^^^^^^^-^^^^^^^^^^^^ + | | + | expected `i32`, found `i32` + | expected `&str`, found `i32` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_repeat(1, {i32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/invalid_arguments.rs:42:3 + | +LL | three_arg_repeat(X {}, X {}, X {}); + | ^^^^^^^^^^^^^^^^^----^^^^^^^^^^^^^ + | | + | expected `i32`, found `X` + | expected `i32`, found `X` + | expected `&str`, found `X` + | +note: function defined here + --> $DIR/invalid_arguments.rs:9:4 + | +LL | fn three_arg_repeat(_a: i32, _b: i32, _c: &str) {} + | ^^^^^^^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_arg_repeat({i32}, {i32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 21 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/missing_arguments.rs b/src/test/ui/argument-suggestions/missing_arguments.rs new file mode 100644 index 0000000000000..73ff138dd993c --- /dev/null +++ b/src/test/ui/argument-suggestions/missing_arguments.rs @@ -0,0 +1,40 @@ +fn one_arg(_a: i32) {} +fn two_same(_a: i32, _b: i32) {} +fn two_diff(_a: i32, _b: f32) {} +fn three_same(_a: i32, _b: i32, _c: i32) {} +fn three_diff(_a: i32, _b: f32, _c: &str) {} +fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} +fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} + +fn main() { + one_arg(); //~ ERROR arguments to this function are incorrect + // The headers here show the types expected, + // with formatting to emphasize which arguments are missing + /* i32 f32 */ + two_same( ); //~ ERROR arguments to this function are incorrect + two_same( 1 ); //~ ERROR arguments to this function are incorrect + two_diff( ); //~ ERROR arguments to this function are incorrect + two_diff( 1 ); //~ ERROR arguments to this function are incorrect + two_diff( 1.0 ); //~ ERROR arguments to this function are incorrect + + /* i32 i32 i32 */ + three_same( ); //~ ERROR arguments to this function are incorrect + three_same( 1 ); //~ ERROR arguments to this function are incorrect + three_same( 1, 1 ); //~ ERROR arguments to this function are incorrect + + /* i32 f32 &str */ + three_diff( 1.0, "" ); //~ ERROR arguments to this function are incorrect + three_diff( 1, "" ); //~ ERROR arguments to this function are incorrect + three_diff( 1, 1.0 ); //~ ERROR arguments to this function are incorrect + three_diff( "" ); //~ ERROR arguments to this function are incorrect + three_diff( 1.0 ); //~ ERROR arguments to this function are incorrect + three_diff( 1 ); //~ ERROR arguments to this function are incorrect + + /* i32 f32 f32 &str */ + four_repeated( ); //~ ERROR arguments to this function are incorrect + four_repeated( 1, "" ); //~ ERROR arguments to this function are incorrect + + /* i32 f32 i32 f32 &str */ + complex( ); //~ ERROR arguments to this function are incorrect + complex( 1, "" ); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/missing_arguments.stderr b/src/test/ui/argument-suggestions/missing_arguments.stderr new file mode 100644 index 0000000000000..30cbcc08ed7e2 --- /dev/null +++ b/src/test/ui/argument-suggestions/missing_arguments.stderr @@ -0,0 +1,353 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:10:3 + | +LL | one_arg(); + | ^^^^^^^^^ an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:1:4 + | +LL | fn one_arg(_a: i32) {} + | ^^^^^^^ ------- +help: provide the argument + | +LL | one_arg({i32}); + | ^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:14:3 + | +LL | two_same( ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:2:4 + | +LL | fn two_same(_a: i32, _b: i32) {} + | ^^^^^^^^ ------- ------- +help: did you mean + | +LL | two_same({i32}, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:15:3 + | +LL | two_same( 1 ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:2:4 + | +LL | fn two_same(_a: i32, _b: i32) {} + | ^^^^^^^^ ------- ------- +help: provide the argument + | +LL | two_same(1, {i32}); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:16:3 + | +LL | two_diff( ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | an argument of type f32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:3:4 + | +LL | fn two_diff(_a: i32, _b: f32) {} + | ^^^^^^^^ ------- ------- +help: did you mean + | +LL | two_diff({i32}, {f32}); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:17:3 + | +LL | two_diff( 1 ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^ an argument of type f32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:3:4 + | +LL | fn two_diff(_a: i32, _b: f32) {} + | ^^^^^^^^ ------- ------- +help: provide the argument + | +LL | two_diff(1, {f32}); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:18:3 + | +LL | two_diff( 1.0 ); + | ^^^^^^^^^^^^^^^^^^^---^^^ + | | + | an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:3:4 + | +LL | fn two_diff(_a: i32, _b: f32) {} + | ^^^^^^^^ ------- ------- +help: provide the argument + | +LL | two_diff({i32}, 1.0); + | ^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:21:3 + | +LL | three_same( ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | an argument of type i32 is missing + | an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:4:4 + | +LL | fn three_same(_a: i32, _b: i32, _c: i32) {} + | ^^^^^^^^^^ ------- ------- ------- +help: did you mean + | +LL | three_same({i32}, {i32}, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:22:3 + | +LL | three_same( 1 ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:4:4 + | +LL | fn three_same(_a: i32, _b: i32, _c: i32) {} + | ^^^^^^^^^^ ------- ------- ------- +help: did you mean + | +LL | three_same(1, {i32}, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:23:3 + | +LL | three_same( 1, 1 ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:4:4 + | +LL | fn three_same(_a: i32, _b: i32, _c: i32) {} + | ^^^^^^^^^^ ------- ------- ------- +help: provide the argument + | +LL | three_same(1, 1, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:26:3 + | +LL | three_diff( 1.0, "" ); + | ^^^^^^^^^^^^^^^^^^^^^---^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:5:4 + | +LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: provide the argument + | +LL | three_diff({i32}, 1.0, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:27:3 + | +LL | three_diff( 1, "" ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--^^^ + | | + | an argument of type f32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:5:4 + | +LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: provide the argument + | +LL | three_diff(1, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:28:3 + | +LL | three_diff( 1, 1.0 ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ an argument of type &str is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:5:4 + | +LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: provide the argument + | +LL | three_diff(1, 1.0, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:29:3 + | +LL | three_diff( "" ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--^^^ + | | | + | | an argument of type i32 is missing + | an argument of type f32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:5:4 + | +LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_diff({i32}, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:30:3 + | +LL | three_diff( 1.0 ); + | ^^^^^^^^^^^^^^^^^^^^^---^^^^^^^^^^^ + | | | + | | an argument of type i32 is missing + | an argument of type &str is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:5:4 + | +LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_diff({i32}, 1.0, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:31:3 + | +LL | three_diff( 1 ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type f32 is missing + | an argument of type &str is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:5:4 + | +LL | fn three_diff(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_diff(1, {f32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:34:3 + | +LL | four_repeated( ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | an argument of type f32 is missing + | an argument of type f32 is missing + | an argument of type &str is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:6:4 + | +LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} + | ^^^^^^^^^^^^^ ------- ------- ------- -------- +help: did you mean + | +LL | four_repeated({i32}, {f32}, {f32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:35:3 + | +LL | four_repeated( 1, "" ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--^^^^ + | | | + | | an argument of type f32 is missing + | an argument of type f32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:6:4 + | +LL | fn four_repeated(_a: i32, _b: f32, _c: f32, _d: &str) {} + | ^^^^^^^^^^^^^ ------- ------- ------- -------- +help: did you mean + | +LL | four_repeated(1, {f32}, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:38:3 + | +LL | complex( ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | | + | an argument of type i32 is missing + | an argument of type f32 is missing + | an argument of type i32 is missing + | an argument of type f32 is missing + | an argument of type &str is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:7:4 + | +LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} + | ^^^^^^^ ------- ------- ------- ------- -------- +help: did you mean + | +LL | complex({i32}, {f32}, {i32}, {f32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/missing_arguments.rs:39:3 + | +LL | complex( 1, "" ); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--^^^^ + | | | + | | an argument of type f32 is missing + | an argument of type i32 is missing + | an argument of type f32 is missing + | +note: function defined here + --> $DIR/missing_arguments.rs:7:4 + | +LL | fn complex(_a: i32, _b: f32, _c: i32, _d: f32, _e: &str) {} + | ^^^^^^^ ------- ------- ------- ------- -------- +help: did you mean + | +LL | complex(1, {f32}, {i32}, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 19 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/mixed_cases.rs b/src/test/ui/argument-suggestions/mixed_cases.rs new file mode 100644 index 0000000000000..45d96bac53cb8 --- /dev/null +++ b/src/test/ui/argument-suggestions/mixed_cases.rs @@ -0,0 +1,24 @@ +// Cases where multiple argument suggestions are mixed + +struct X {} + +fn two_args(_a: i32, _b: f32) {} +fn three_args(_a: i32, _b: f32, _c: &str) {} + +fn main() { + // Extra + Invalid + two_args(1, "", X {}); //~ ERROR arguments to this function are incorrect + three_args(1, "", X {}, ""); //~ ERROR arguments to this function are incorrect + + // Missing and Invalid + three_args(1, X {}); //~ ERROR arguments to this function are incorrect + + // Missing and Extra + three_args(1, "", X {}); //~ ERROR arguments to this function are incorrect + + // Swapped and Invalid + three_args("", X {}, 1); //~ ERROR arguments to this function are incorrect + + // Swapped and missing + three_args("", 1); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/mixed_cases.stderr b/src/test/ui/argument-suggestions/mixed_cases.stderr new file mode 100644 index 0000000000000..f592ea5e804f9 --- /dev/null +++ b/src/test/ui/argument-suggestions/mixed_cases.stderr @@ -0,0 +1,120 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/mixed_cases.rs:10:3 + | +LL | two_args(1, "", X {}); + | ^^^^^^^^^-^^^^^^^^^^^ + | | + | expected `f32`, found `i32` + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/mixed_cases.rs:5:4 + | +LL | fn two_args(_a: i32, _b: f32) {} + | ^^^^^^^^ ------- ------- +help: did you mean + | +LL | two_args(1, {f32}); + | ^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/mixed_cases.rs:11:3 + | +LL | three_args(1, "", X {}, ""); + | ^^^^^^^^^^^-^^--^^^^^^^^^^^ + | | | + | | an argument of type f32 is missing + | | argument of type f32 unexpected + | argument of type i32 unexpected + | +note: function defined here + --> $DIR/mixed_cases.rs:6:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_args(1, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/mixed_cases.rs:14:3 + | +LL | three_args(1, X {}); + | ^^^^^^^^^^^-^^^^^^^ + | | | + | | expected `f32`, found `i32` + | an argument of type &str is missing + | +note: function defined here + --> $DIR/mixed_cases.rs:6:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_args(1, {f32}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/mixed_cases.rs:17:3 + | +LL | three_args(1, "", X {}); + | ^^^^^^^^^^^^^^--^^^^^^^ + | | + | an argument of type f32 is missing + | argument of type f32 unexpected + | +note: function defined here + --> $DIR/mixed_cases.rs:6:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_args(1, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/mixed_cases.rs:20:3 + | +LL | three_args("", X {}, 1); + | ^^^^^^^^^^^--^^^^^^^^-^ + | | | + | | expected `&str`,found `{integer}` + | expected `i32`,found `&'static str` + | expected `f32`, found `&'static str` + | +note: function defined here + --> $DIR/mixed_cases.rs:6:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_args(1, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/mixed_cases.rs:23:3 + | +LL | three_args("", 1); + | ^^^^^^^^^^^--^^-^ + | | | + | | an argument of type f32 is missing + | | expected `&str`,found `{integer}` + | expected `i32`,found `&'static str` + | +note: function defined here + --> $DIR/mixed_cases.rs:6:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: did you mean + | +LL | three_args(1, {f32}, ""); + | ^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/permuted_arguments.rs b/src/test/ui/argument-suggestions/permuted_arguments.rs new file mode 100644 index 0000000000000..f512fde651cd9 --- /dev/null +++ b/src/test/ui/argument-suggestions/permuted_arguments.rs @@ -0,0 +1,13 @@ +// More complicated permutations +struct X {} +struct Y {} + +fn three_args(_a: i32, _b: f32, _c: &str) {} +fn many_args(_a: i32, _b: f32, _c: &str, _d: X, _e: Y) {} + +fn main() { + // b, c, a + three_args(1.0, "", 1); //~ ERROR arguments to this function are incorrect + // d, e, b, a, c + many_args(X {}, Y {}, 1, 1.0, ""); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/permuted_arguments.stderr b/src/test/ui/argument-suggestions/permuted_arguments.stderr new file mode 100644 index 0000000000000..241489f56a55e --- /dev/null +++ b/src/test/ui/argument-suggestions/permuted_arguments.stderr @@ -0,0 +1,45 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/permuted_arguments.rs:10:3 + | +LL | three_args(1.0, "", 1); + | ^^^^^^^^^^^---^^--^^-^ + | | | | + | | | expected `&str`,found `{integer}` + | | expected `f32`,found `&'static str` + | expected `i32`,found `{float}` + | +note: function defined here + --> $DIR/permuted_arguments.rs:5:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: reorder these arguments + | +LL | three_args(1, 1.0, ""); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/permuted_arguments.rs:12:3 + | +LL | many_args(X {}, Y {}, 1, 1.0, ""); + | ^^^^^^^^^^----^^----^^-^^---^^--^ + | | | | | | + | | | | | expected `Y`,found `&'static str` + | | | | expected `X`,found `{float}` + | | | expected `&str`,found `{integer}` + | | expected `f32`,found `Y` + | expected `i32`,found `X` + | +note: function defined here + --> $DIR/permuted_arguments.rs:6:4 + | +LL | fn many_args(_a: i32, _b: f32, _c: &str, _d: X, _e: Y) {} + | ^^^^^^^^^ ------- ------- -------- ----- ----- +help: reorder these arguments + | +LL | many_args(1, 1.0, "", X {}, Y {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 2 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/argument-suggestions/swapped_arguments.rs b/src/test/ui/argument-suggestions/swapped_arguments.rs new file mode 100644 index 0000000000000..a21de610c6a13 --- /dev/null +++ b/src/test/ui/argument-suggestions/swapped_arguments.rs @@ -0,0 +1,14 @@ +struct X {} + +fn two_args(_a: i32, _b: f32) {} +fn three_args(_a: i32, _b: f32, _c: &str) {} +fn four_args(_a: i32, _b: f32, _c: &str, _d: X) {} + +fn main() { + two_args(1.0, 1); //~ ERROR arguments to this function are incorrect + three_args(1.0, 1, ""); //~ ERROR arguments to this function are incorrect + three_args( 1, "", 1.0); //~ ERROR arguments to this function are incorrect + three_args( "", 1.0, 1); //~ ERROR arguments to this function are incorrect + + four_args(1.0, 1, X {}, ""); //~ ERROR arguments to this function are incorrect +} diff --git a/src/test/ui/argument-suggestions/swapped_arguments.stderr b/src/test/ui/argument-suggestions/swapped_arguments.stderr new file mode 100644 index 0000000000000..7f318ae2c9d37 --- /dev/null +++ b/src/test/ui/argument-suggestions/swapped_arguments.stderr @@ -0,0 +1,100 @@ +error[E0308]: arguments to this function are incorrect + --> $DIR/swapped_arguments.rs:8:3 + | +LL | two_args(1.0, 1); + | ^^^^^^^^^---^^-^ + | | | + | | expected `f32`,found `{integer}` + | expected `i32`,found `{float}` + | +note: function defined here + --> $DIR/swapped_arguments.rs:3:4 + | +LL | fn two_args(_a: i32, _b: f32) {} + | ^^^^^^^^ ------- ------- +help: swap these arguments + | +LL | two_args(1, 1.0); + | ^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/swapped_arguments.rs:9:3 + | +LL | three_args(1.0, 1, ""); + | ^^^^^^^^^^^---^^^^-^^^^^^ + | | | + | | expected `f32`,found `{integer}` + | expected `i32`,found `{float}` + | +note: function defined here + --> $DIR/swapped_arguments.rs:4:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: swap these arguments + | +LL | three_args(1, 1.0, ""); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/swapped_arguments.rs:10:3 + | +LL | three_args( 1, "", 1.0); + | ^^^^^^^^^^^^^^^^^--^^---^ + | | | + | | expected `&str`,found `{float}` + | expected `f32`,found `&'static str` + | +note: function defined here + --> $DIR/swapped_arguments.rs:4:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: swap these arguments + | +LL | three_args(1, 1.0, ""); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/swapped_arguments.rs:11:3 + | +LL | three_args( "", 1.0, 1); + | ^^^^^^^^^^^^--^^^^^^^^^-^ + | | | + | | expected `&str`,found `{integer}` + | expected `i32`,found `&'static str` + | +note: function defined here + --> $DIR/swapped_arguments.rs:4:4 + | +LL | fn three_args(_a: i32, _b: f32, _c: &str) {} + | ^^^^^^^^^^ ------- ------- -------- +help: swap these arguments + | +LL | three_args(1, 1.0, ""); + | ^^^^^^^^^^^^^^^^^^^^^^ + +error[E0308]: arguments to this function are incorrect + --> $DIR/swapped_arguments.rs:13:3 + | +LL | four_args(1.0, 1, X {}, ""); + | ^^^^^^^^^^---^^-^^----^^--^ + | | | | | + | | | | expected `X`,found `&'static str` + | | | expected `&str`,found `X` + | | expected `f32`,found `{integer}` + | expected `i32`,found `{float}` + | +note: function defined here + --> $DIR/swapped_arguments.rs:5:4 + | +LL | fn four_args(_a: i32, _b: f32, _c: &str, _d: X) {} + | ^^^^^^^^^ ------- ------- -------- ----- +help: did you mean + | +LL | four_args(1, 1.0, "", X {}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 5 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/associated-types/associated-type-projection-from-supertrait.rs b/src/test/ui/associated-types/associated-type-projection-from-supertrait.rs index 7e05bcd309a4f..f807427bb09cf 100644 --- a/src/test/ui/associated-types/associated-type-projection-from-supertrait.rs +++ b/src/test/ui/associated-types/associated-type-projection-from-supertrait.rs @@ -24,13 +24,13 @@ impl Car for ModelU { } fn dent(c: C, color: C::Color) { c.chip_paint(color) } fn a() { dent(ModelT, Black); } -fn b() { dent(ModelT, Blue); } //~ ERROR mismatched types -fn c() { dent(ModelU, Black); } //~ ERROR mismatched types +fn b() { dent(ModelT, Blue); } //~ ERROR arguments to this function are incorrect +fn c() { dent(ModelU, Black); } //~ ERROR arguments to this function are incorrect fn d() { dent(ModelU, Blue); } fn e() { ModelT.chip_paint(Black); } -fn f() { ModelT.chip_paint(Blue); } //~ ERROR mismatched types -fn g() { ModelU.chip_paint(Black); } //~ ERROR mismatched types +fn f() { ModelT.chip_paint(Blue); } //~ ERROR arguments to this function are incorrect +fn g() { ModelU.chip_paint(Black); } //~ ERROR arguments to this function are incorrect fn h() { ModelU.chip_paint(Blue); } pub fn main() { } diff --git a/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr index 07f207627f4df..9b4bfe00f8bd5 100644 --- a/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr +++ b/src/test/ui/associated-types/associated-type-projection-from-supertrait.stderr @@ -1,26 +1,70 @@ -error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:27:23 +error[E0308]: arguments to this function are incorrect + --> $DIR/associated-type-projection-from-supertrait.rs:27:10 | LL | fn b() { dent(ModelT, Blue); } - | ^^^^ expected struct `Black`, found struct `Blue` + | ^^^^^------^^^^^^^ + | | + | expected `_`, found `ModelT` + | +note: function defined here + --> $DIR/associated-type-projection-from-supertrait.rs:25:4 + | +LL | fn dent(c: C, color: C::Color) { c.chip_paint(color) } + | ^^^^ ---- --------------- +help: provide an argument of the correct type + | +LL | fn b() { dent(ModelT, {Black}); } + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:28:23 +error[E0308]: arguments to this function are incorrect + --> $DIR/associated-type-projection-from-supertrait.rs:28:10 | LL | fn c() { dent(ModelU, Black); } - | ^^^^^ expected struct `Blue`, found struct `Black` + | ^^^^^------^^^^^^^^ + | | + | expected `_`, found `ModelU` + | +note: function defined here + --> $DIR/associated-type-projection-from-supertrait.rs:25:4 + | +LL | fn dent(c: C, color: C::Color) { c.chip_paint(color) } + | ^^^^ ---- --------------- +help: provide an argument of the correct type + | +LL | fn c() { dent(ModelU, {Blue}); } + | ^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:32:28 +error[E0308]: arguments to this function are incorrect + --> $DIR/associated-type-projection-from-supertrait.rs:32:17 | LL | fn f() { ModelT.chip_paint(Blue); } - | ^^^^ expected struct `Black`, found struct `Blue` + | ^^^^^^^^^^ ---- expected `Black`, found `Blue` + | +note: associated function defined here + --> $DIR/associated-type-projection-from-supertrait.rs:12:8 + | +LL | fn chip_paint(&self, c: Self::Color) { } + | ^^^^^^^^^^ ----- -------------- +help: provide an argument of the correct type + | +LL | fn f() { ModelT.chip_paint({Black})(Blue); } + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/associated-type-projection-from-supertrait.rs:33:28 +error[E0308]: arguments to this function are incorrect + --> $DIR/associated-type-projection-from-supertrait.rs:33:17 | LL | fn g() { ModelU.chip_paint(Black); } - | ^^^^^ expected struct `Blue`, found struct `Black` + | ^^^^^^^^^^ ----- expected `Blue`, found `Black` + | +note: associated function defined here + --> $DIR/associated-type-projection-from-supertrait.rs:12:8 + | +LL | fn chip_paint(&self, c: Self::Color) { } + | ^^^^^^^^^^ ----- -------------- +help: provide an argument of the correct type + | +LL | fn g() { ModelU.chip_paint({Blue})(Black); } + | ^^^^^^^^^^^^^^^^^^ error: aborting due to 4 previous errors diff --git a/src/test/ui/associated-types/associated-types-path-2.rs b/src/test/ui/associated-types/associated-types-path-2.rs index c993e1d27202d..4d943389f4d97 100644 --- a/src/test/ui/associated-types/associated-types-path-2.rs +++ b/src/test/ui/associated-types/associated-types-path-2.rs @@ -17,7 +17,7 @@ pub fn f2(a: T) -> T::A { pub fn f1_int_int() { f1(2i32, 4i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u32`, found `i32` } diff --git a/src/test/ui/associated-types/associated-types-path-2.stderr b/src/test/ui/associated-types/associated-types-path-2.stderr index 0881258aca1ac..3eddc5078c59b 100644 --- a/src/test/ui/associated-types/associated-types-path-2.stderr +++ b/src/test/ui/associated-types/associated-types-path-2.stderr @@ -1,13 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/associated-types-path-2.rs:19:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/associated-types-path-2.rs:19:5 | LL | f1(2i32, 4i32); - | ^^^^ expected `u32`, found `i32` + | ^^^----^^^^^^^ + | | + | expected `_`, found `i32` + | +note: function defined here + --> $DIR/associated-types-path-2.rs:13:8 | -help: change the type of the numeric literal from `i32` to `u32` +LL | pub fn f1(a: T, x: T::A) {} + | ^^ ---- ------- +help: provide an argument of the correct type | -LL | f1(2i32, 4u32); - | ^^^^ +LL | f1(2i32, {u32}); + | ^^^^^^^^^^^^^^^ error[E0277]: the trait bound `u32: Foo` is not satisfied --> $DIR/associated-types-path-2.rs:29:5 diff --git a/src/test/ui/async-await/dont-suggest-missing-await.rs b/src/test/ui/async-await/dont-suggest-missing-await.rs index a8e5b38ec1dd8..c7d70c4bcf63b 100644 --- a/src/test/ui/async-await/dont-suggest-missing-await.rs +++ b/src/test/ui/async-await/dont-suggest-missing-await.rs @@ -12,7 +12,7 @@ async fn dont_suggest_await_in_closure() { || { let x = make_u32(); take_u32(x) - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] }; } diff --git a/src/test/ui/async-await/dont-suggest-missing-await.stderr b/src/test/ui/async-await/dont-suggest-missing-await.stderr index 14e72c2b1e7e2..275d96cd0e992 100644 --- a/src/test/ui/async-await/dont-suggest-missing-await.stderr +++ b/src/test/ui/async-await/dont-suggest-missing-await.stderr @@ -1,18 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/dont-suggest-missing-await.rs:14:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/dont-suggest-missing-await.rs:14:9 | -LL | async fn make_u32() -> u32 { - | --- the `Output` of this `async fn`'s found opaque type -... LL | take_u32(x) - | ^ expected `u32`, found opaque type + | ^^^^^^^^^-^ + | | + | expected `u32`, found `impl Future` | - = note: expected type `u32` - found opaque type `impl Future` -help: consider `await`ing on the `Future` +note: function defined here + --> $DIR/dont-suggest-missing-await.rs:5:4 + | +LL | fn take_u32(x: u32) {} + | ^^^^^^^^ ------ +help: provide an argument of the correct type + | +LL | take_u32({u32}) | -LL | take_u32(x.await) - | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/async-await/suggest-missing-await-closure.fixed b/src/test/ui/async-await/suggest-missing-await-closure.fixed index febcd02184261..27e09082641f6 100644 --- a/src/test/ui/async-await/suggest-missing-await-closure.fixed +++ b/src/test/ui/async-await/suggest-missing-await-closure.fixed @@ -13,8 +13,8 @@ async fn make_u32() -> u32 { async fn suggest_await_in_async_closure() { async || { let x = make_u32(); - take_u32(x.await) - //~^ ERROR mismatched types [E0308] + take_u32({u32}) + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider `await`ing on the `Future` //~| SUGGESTION .await }; diff --git a/src/test/ui/async-await/suggest-missing-await-closure.rs b/src/test/ui/async-await/suggest-missing-await-closure.rs index faabf6ee3f16f..1d44d51c52690 100644 --- a/src/test/ui/async-await/suggest-missing-await-closure.rs +++ b/src/test/ui/async-await/suggest-missing-await-closure.rs @@ -14,7 +14,7 @@ async fn suggest_await_in_async_closure() { async || { let x = make_u32(); take_u32(x) - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider `await`ing on the `Future` //~| SUGGESTION .await }; diff --git a/src/test/ui/async-await/suggest-missing-await-closure.stderr b/src/test/ui/async-await/suggest-missing-await-closure.stderr index 2151057aa7fc0..62e2b4e186b5a 100644 --- a/src/test/ui/async-await/suggest-missing-await-closure.stderr +++ b/src/test/ui/async-await/suggest-missing-await-closure.stderr @@ -1,18 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/suggest-missing-await-closure.rs:16:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/suggest-missing-await-closure.rs:16:9 | -LL | async fn make_u32() -> u32 { - | --- the `Output` of this `async fn`'s found opaque type -... LL | take_u32(x) - | ^ expected `u32`, found opaque type + | ^^^^^^^^^-^ + | | + | expected `u32`, found `impl Future` | - = note: expected type `u32` - found opaque type `impl Future` -help: consider `await`ing on the `Future` +note: function defined here + --> $DIR/suggest-missing-await-closure.rs:6:4 + | +LL | fn take_u32(_x: u32) {} + | ^^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | take_u32({u32}) | -LL | take_u32(x.await) - | ^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/async-await/suggest-missing-await.rs b/src/test/ui/async-await/suggest-missing-await.rs index d629054911dac..eba53562fe3be 100644 --- a/src/test/ui/async-await/suggest-missing-await.rs +++ b/src/test/ui/async-await/suggest-missing-await.rs @@ -10,7 +10,7 @@ async fn make_u32() -> u32 { async fn suggest_await_in_async_fn() { let x = make_u32(); take_u32(x) - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider `await`ing on the `Future` //~| SUGGESTION .await } @@ -20,7 +20,7 @@ async fn dummy() {} #[allow(unused)] async fn suggest_await_in_async_fn_return() { dummy() - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP try adding a semicolon //~| HELP consider `await`ing on the `Future` //~| SUGGESTION .await diff --git a/src/test/ui/async-await/suggest-missing-await.stderr b/src/test/ui/async-await/suggest-missing-await.stderr index 46615dae7e2ba..691aa2f2cbae8 100644 --- a/src/test/ui/async-await/suggest-missing-await.stderr +++ b/src/test/ui/async-await/suggest-missing-await.stderr @@ -1,18 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/suggest-missing-await.rs:12:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/suggest-missing-await.rs:12:5 | -LL | async fn make_u32() -> u32 { - | --- the `Output` of this `async fn`'s found opaque type -... LL | take_u32(x) - | ^ expected `u32`, found opaque type + | ^^^^^^^^^-^ + | | + | expected `u32`, found `impl Future` | - = note: expected type `u32` - found opaque type `impl Future` -help: consider `await`ing on the `Future` +note: function defined here + --> $DIR/suggest-missing-await.rs:3:4 + | +LL | fn take_u32(_x: u32) {} + | ^^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | take_u32({u32}) | -LL | take_u32(x.await) - | ^^^^^^ error[E0308]: mismatched types --> $DIR/suggest-missing-await.rs:22:5 diff --git a/src/test/ui/c-variadic/variadic-ffi-1.rs b/src/test/ui/c-variadic/variadic-ffi-1.rs index a7824d919674d..1f69521a9764b 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.rs +++ b/src/test/ui/c-variadic/variadic-ffi-1.rs @@ -17,8 +17,10 @@ fn main() { foo(); //~ ERROR this function takes at least 2 arguments but 0 arguments were supplied foo(1); //~ ERROR this function takes at least 2 arguments but 1 argument was supplied - let x: unsafe extern "C" fn(f: isize, x: u8) = foo; //~ ERROR mismatched types - let y: extern "C" fn(f: isize, x: u8, ...) = bar; //~ ERROR mismatched types + let x: unsafe extern "C" fn(f: isize, x: u8) = foo; + //~^ ERROR arguments to this function are incorrect + let y: extern "C" fn(f: isize, x: u8, ...) = bar; + //~^ ERROR arguments to this function are incorrect foo(1, 2, 3f32); //~ ERROR can't pass foo(1, 2, true); //~ ERROR can't pass diff --git a/src/test/ui/c-variadic/variadic-ffi-1.stderr b/src/test/ui/c-variadic/variadic-ffi-1.stderr index 6f2a6c359b537..ec8e53f97349a 100644 --- a/src/test/ui/c-variadic/variadic-ffi-1.stderr +++ b/src/test/ui/c-variadic/variadic-ffi-1.stderr @@ -4,33 +4,40 @@ error[E0045]: C-variadic function must have C or cdecl calling convention LL | fn printf(_: *const u8, ...); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ C-variadics require C or cdecl calling convention -error[E0060]: this function takes at least 2 arguments but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/variadic-ffi-1.rs:17:9 | LL | foo(); - | ^^^-- supplied 0 arguments + | ^^^^^ | | - | expected at least 2 arguments + | an argument of type isize is missing + | an argument of type u8 is missing | note: function defined here --> $DIR/variadic-ffi-1.rs:10:8 | LL | fn foo(f: isize, x: u8, ...); | ^^^ +help: did you mean + | +LL | foo({isize}, {u8}); + | ^^^^^^^^^^^^^^^^^^ -error[E0060]: this function takes at least 2 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/variadic-ffi-1.rs:18:9 | LL | foo(1); - | ^^^ - supplied 1 argument - | | - | expected at least 2 arguments + | ^^^^^^ an argument of type u8 is missing | note: function defined here --> $DIR/variadic-ffi-1.rs:10:8 | LL | fn foo(f: isize, x: u8, ...); | ^^^ +help: provide the argument + | +LL | foo(1, {u8}); + | ^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/variadic-ffi-1.rs:20:56 @@ -44,7 +51,7 @@ LL | let x: unsafe extern "C" fn(f: isize, x: u8) = foo; found fn item `unsafe extern "C" fn(_, _, ...) {foo}` error[E0308]: mismatched types - --> $DIR/variadic-ffi-1.rs:21:54 + --> $DIR/variadic-ffi-1.rs:22:54 | LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; | ----------------------------------- ^^^ expected variadic fn, found non-variadic function @@ -55,42 +62,42 @@ LL | let y: extern "C" fn(f: isize, x: u8, ...) = bar; found fn item `extern "C" fn(_, _) {bar}` error[E0617]: can't pass `f32` to variadic function - --> $DIR/variadic-ffi-1.rs:23:19 + --> $DIR/variadic-ffi-1.rs:25:19 | LL | foo(1, 2, 3f32); | ^^^^ help: cast the value to `c_double`: `3f32 as c_double` error[E0617]: can't pass `bool` to variadic function - --> $DIR/variadic-ffi-1.rs:24:19 + --> $DIR/variadic-ffi-1.rs:26:19 | LL | foo(1, 2, true); | ^^^^ help: cast the value to `c_int`: `true as c_int` error[E0617]: can't pass `i8` to variadic function - --> $DIR/variadic-ffi-1.rs:25:19 + --> $DIR/variadic-ffi-1.rs:27:19 | LL | foo(1, 2, 1i8); | ^^^ help: cast the value to `c_int`: `1i8 as c_int` error[E0617]: can't pass `u8` to variadic function - --> $DIR/variadic-ffi-1.rs:26:19 + --> $DIR/variadic-ffi-1.rs:28:19 | LL | foo(1, 2, 1u8); | ^^^ help: cast the value to `c_uint`: `1u8 as c_uint` error[E0617]: can't pass `i16` to variadic function - --> $DIR/variadic-ffi-1.rs:27:19 + --> $DIR/variadic-ffi-1.rs:29:19 | LL | foo(1, 2, 1i16); | ^^^^ help: cast the value to `c_int`: `1i16 as c_int` error[E0617]: can't pass `u16` to variadic function - --> $DIR/variadic-ffi-1.rs:28:19 + --> $DIR/variadic-ffi-1.rs:30:19 | LL | foo(1, 2, 1u16); | ^^^^ help: cast the value to `c_uint`: `1u16 as c_uint` error: aborting due to 11 previous errors -Some errors have detailed explanations: E0045, E0060, E0308, E0617. +Some errors have detailed explanations: E0045, E0308, E0617. For more information about an error, try `rustc --explain E0045`. diff --git a/src/test/ui/closures/closure-reform-bad.rs b/src/test/ui/closures/closure-reform-bad.rs index 0ba48ab518442..62103c50be330 100644 --- a/src/test/ui/closures/closure-reform-bad.rs +++ b/src/test/ui/closures/closure-reform-bad.rs @@ -8,5 +8,5 @@ fn call_bare(f: fn(&str)) { fn main() { let string = "world!"; let f = |s: &str| println!("{}{}", s, string); - call_bare(f) //~ ERROR mismatched types + call_bare(f) //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/closures/closure-reform-bad.stderr b/src/test/ui/closures/closure-reform-bad.stderr index 77c8c7ab7948d..7382343f5d956 100644 --- a/src/test/ui/closures/closure-reform-bad.stderr +++ b/src/test/ui/closures/closure-reform-bad.stderr @@ -1,13 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/closure-reform-bad.rs:11:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/closure-reform-bad.rs:11:5 | -LL | let f = |s: &str| println!("{}{}", s, string); - | ------------------------------------- the found closure LL | call_bare(f) - | ^ expected fn pointer, found closure + | ^^^^^^^^^^-^ + | | + | expected `for<'r> fn(&'r str)`, found `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50]` | - = note: expected fn pointer `for<'r> fn(&'r str)` - found closure `[closure@$DIR/closure-reform-bad.rs:10:13: 10:50]` +note: function defined here + --> $DIR/closure-reform-bad.rs:4:4 + | +LL | fn call_bare(f: fn(&str)) { + | ^^^^^^^^^ ----------- +help: provide an argument of the correct type + | +LL | call_bare({for<'r> fn(&'r str)}) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs index c139e823c2aef..6d2262d123925 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.rs @@ -6,24 +6,36 @@ use std::fmt::Debug; pub fn main() { - let _ = box { [1, 2, 3] }: Box<[i32]>; //~ ERROR mismatched types - let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; //~ ERROR mismatched types + let _ = box { [1, 2, 3] }: Box<[i32]>; + //~^ ERROR mismatched types + let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; + //~^ ERROR mismatched types let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; //~^ ERROR mismatched types - let _ = box { |x| (x as u8) }: Box _>; //~ ERROR mismatched types - let _ = box if true { false } else { true }: Box; //~ ERROR mismatched types - let _ = box match true { true => 'a', false => 'b' }: Box; //~ ERROR mismatched types + let _ = box { |x| (x as u8) }: Box _>; + //~^ ERROR mismatched types + let _ = box if true { false } else { true }: Box; + //~^ ERROR mismatched types + let _ = box match true { true => 'a', false => 'b' }: Box; + //~^ ERROR mismatched types - let _ = &{ [1, 2, 3] }: &[i32]; //~ ERROR mismatched types - let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; //~ ERROR mismatched types + let _ = &{ [1, 2, 3] }: &[i32]; + //~^ ERROR mismatched types + let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; + //~^ ERROR mismatched types let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; //~^ ERROR mismatched types - let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; //~ ERROR mismatched types - let _ = &if true { false } else { true }: &dyn Debug; //~ ERROR mismatched types - let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; //~ ERROR mismatched types + let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; + //~^ ERROR mismatched types + let _ = &if true { false } else { true }: &dyn Debug; + //~^ ERROR mismatched types + let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; + //~^ ERROR mismatched types - let _ = Box::new([1, 2, 3]): Box<[i32]>; //~ ERROR mismatched types - let _ = Box::new(|x| (x as u8)): Box _>; //~ ERROR mismatched types + let _ = Box::new([1, 2, 3]): Box<[i32]>; + //~^ ERROR mismatched types + let _ = Box::new(|x| (x as u8)): Box _>; + //~^ ERROR mismatched types let _ = vec![ Box::new(|x| (x as u8)), diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index f0109f22a2bc1..d441fbf5c8b74 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -8,7 +8,7 @@ LL | let _ = box { [1, 2, 3] }: Box<[i32]>; found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:10:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:11:13 | LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` @@ -17,7 +17,7 @@ LL | let _ = box if true { [1, 2, 3] } else { [1, 3, 4] }: Box<[i32]>; found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:11:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` @@ -26,16 +26,16 @@ LL | let _ = box match true { true => [1, 2, 3], false => [1, 3, 4] }: Box<[ found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | LL | let _ = box { |x| (x as u8) }: Box _>; | ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure | = note: expected struct `Box u8>` - found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>` + found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:15:19: 15:32]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:17:13 | LL | let _ = box if true { false } else { true }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` @@ -44,7 +44,7 @@ LL | let _ = box if true { false } else { true }: Box; found struct `Box` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:19:13 | LL | let _ = box match true { true => 'a', false => 'b' }: Box; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` @@ -53,7 +53,7 @@ LL | let _ = box match true { true => 'a', false => 'b' }: Box; found struct `Box` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:17:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | LL | let _ = &{ [1, 2, 3] }: &[i32]; | ^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` @@ -62,7 +62,7 @@ LL | let _ = &{ [1, 2, 3] }: &[i32]; found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:18:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:24:13 | LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` @@ -71,7 +71,7 @@ LL | let _ = &if true { [1, 2, 3] } else { [1, 3, 4] }: &[i32]; found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:19:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` @@ -80,16 +80,16 @@ LL | let _ = &match true { true => [1, 2, 3], false => [1, 3, 4] }: &[i32]; found reference `&[i32; 3]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:28:13 | LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; | ^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure | = note: expected reference `&dyn Fn(i32) -> u8` - found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]` + found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:28:16: 28:29]` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:30:13 | LL | let _ = &if true { false } else { true }: &dyn Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `bool` @@ -98,7 +98,7 @@ LL | let _ = &if true { false } else { true }: &dyn Debug; found reference `&bool` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:32:13 | LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Debug`, found `char` @@ -107,7 +107,7 @@ LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; found reference `&char` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:25:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:35:13 | LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; | ^^^^^^^^^^^^^^^^^^^ expected slice `[i32]`, found array `[i32; 3]` @@ -116,13 +116,13 @@ LL | let _ = Box::new([1, 2, 3]): Box<[i32]>; found struct `Box<[i32; 3]>` error[E0308]: mismatched types - --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 + --> $DIR/coerce-expect-unsized-ascribed.rs:37:13 | LL | let _ = Box::new(|x| (x as u8)): Box _>; | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn Fn`, found closure | = note: expected struct `Box u8>` - found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>` + found struct `Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:37:22: 37:35]>` error: aborting due to 14 previous errors diff --git a/src/test/ui/coercion/coerce-mut.rs b/src/test/ui/coercion/coerce-mut.rs index 43f0b55856d3c..ee3756533c6e4 100644 --- a/src/test/ui/coercion/coerce-mut.rs +++ b/src/test/ui/coercion/coerce-mut.rs @@ -3,7 +3,7 @@ fn f(x: &mut i32) {} fn main() { let x = 0; f(&x); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected mutable reference `&mut i32` //~| found reference `&{integer}` //~| types differ in mutability diff --git a/src/test/ui/coercion/coerce-mut.stderr b/src/test/ui/coercion/coerce-mut.stderr index 2601ca5e91e5b..774db4e557108 100644 --- a/src/test/ui/coercion/coerce-mut.stderr +++ b/src/test/ui/coercion/coerce-mut.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/coerce-mut.rs:5:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-mut.rs:5:5 | LL | f(&x); - | ^^ types differ in mutability + | ^^--^ + | | + | expected `&mut i32`, found `&{integer}` | - = note: expected mutable reference `&mut i32` - found reference `&{integer}` +note: function defined here + --> $DIR/coerce-mut.rs:1:4 + | +LL | fn f(x: &mut i32) {} + | ^ ----------- +help: provide an argument of the correct type + | +LL | f({&mut i32}); + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs index 48be2d3146b81..92b951b329f77 100644 --- a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs +++ b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.rs @@ -2,5 +2,5 @@ fn test(_a: T, _b: T) {} fn main() { test(&mut 7, &7); - //~^ mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr index 59b0ec496f16f..6814ba0cdfe87 100644 --- a/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr +++ b/src/test/ui/coercion/coerce-reborrow-multi-arg-fail.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/coerce-reborrow-multi-arg-fail.rs:4:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-reborrow-multi-arg-fail.rs:4:5 | LL | test(&mut 7, &7); - | ^^ types differ in mutability + | ^^^^^------^^^^^ + | | + | expected `_`, found `&mut {integer}` | - = note: expected mutable reference `&mut {integer}` - found reference `&{integer}` +note: function defined here + --> $DIR/coerce-reborrow-multi-arg-fail.rs:1:4 + | +LL | fn test(_a: T, _b: T) {} + | ^^^^ ----- ----- +help: provide an argument of the correct type + | +LL | test(&mut 7, {&mut {integer}}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/coercion/coerce-to-bang.rs b/src/test/ui/coercion/coerce-to-bang.rs index 1e06934d09f9e..fac2bc8fe278d 100644 --- a/src/test/ui/coercion/coerce-to-bang.rs +++ b/src/test/ui/coercion/coerce-to-bang.rs @@ -4,7 +4,7 @@ fn foo(x: usize, y: !, z: usize) { } fn call_foo_a() { foo(return, 22, 44); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } fn call_foo_b() { @@ -15,7 +15,7 @@ fn call_foo_b() { fn call_foo_c() { // This test fails because the divergence happens **after** the // coercion to `!`: - foo(22, 44, return); //~ ERROR mismatched types + foo(22, 44, return); //~ ERROR arguments to this function are incorrect } fn call_foo_d() { @@ -24,7 +24,7 @@ fn call_foo_d() { let b = 22; let c = 44; foo(a, b, c); // ... and hence a reference to `a` is expected to diverge. - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } fn call_foo_e() { @@ -33,7 +33,7 @@ fn call_foo_e() { let a = return; let b = 22; let c = 44; - foo(a, b, c); //~ ERROR mismatched types + foo(a, b, c); //~ ERROR arguments to this function are incorrect } fn call_foo_f() { @@ -42,28 +42,29 @@ fn call_foo_f() { let a: usize = return; let b = 22; let c = 44; - foo(a, b, c); //~ ERROR mismatched types + foo(a, b, c); //~ ERROR arguments to this function are incorrect } fn array_a() { // Return is coerced to `!` just fine, but `22` cannot be. - let x: [!; 2] = [return, 22]; //~ ERROR mismatched types + let x: [!; 2] = [return, 22]; //~ ERROR arguments to this function are incorrect } fn array_b() { // Error: divergence has not yet occurred. - let x: [!; 2] = [22, return]; //~ ERROR mismatched types + let x: [!; 2] = [22, return]; //~ ERROR arguments to this function are incorrect } fn tuple_a() { // No divergence at all. - let x: (usize, !, usize) = (22, 44, 66); //~ ERROR mismatched types + let x: (usize, !, usize) = (22, 44, 66); + //~^ ERROR arguments to this function are incorrect } fn tuple_b() { // Divergence happens before coercion: OK let x: (usize, !, usize) = (return, 44, 66); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } fn tuple_c() { @@ -73,7 +74,8 @@ fn tuple_c() { fn tuple_d() { // Error: divergence happens too late - let x: (usize, !, usize) = (22, 44, return); //~ ERROR mismatched types + let x: (usize, !, usize) = (22, 44, return); + //~^ ERROR arguments to this function are incorrect } fn main() { } diff --git a/src/test/ui/coercion/coerce-to-bang.stderr b/src/test/ui/coercion/coerce-to-bang.stderr index 390aa7c692d18..0f1a491503526 100644 --- a/src/test/ui/coercion/coerce-to-bang.stderr +++ b/src/test/ui/coercion/coerce-to-bang.stderr @@ -1,47 +1,92 @@ -error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:6:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-to-bang.rs:6:5 | LL | foo(return, 22, 44); - | ^^ expected `!`, found integer + | ^^^^------^^^^^^^^^ + | | + | expected `!`, found `!` | - = note: expected type `!` - found type `{integer}` +note: function defined here + --> $DIR/coerce-to-bang.rs:3:4 + | +LL | fn foo(x: usize, y: !, z: usize) { } + | ^^^ -------- ---- -------- +help: provide an argument of the correct type + | +LL | foo(return, {!}, 44); + | ^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:18:13 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-to-bang.rs:18:5 | LL | foo(22, 44, return); - | ^^ expected `!`, found integer + | ^^^^--^^^^^^^^^^^^^ + | | + | expected `!`, found `usize` | - = note: expected type `!` - found type `{integer}` +note: function defined here + --> $DIR/coerce-to-bang.rs:3:4 + | +LL | fn foo(x: usize, y: !, z: usize) { } + | ^^^ -------- ---- -------- +help: provide an argument of the correct type + | +LL | foo(22, {!}, return); + | ^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:26:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-to-bang.rs:26:5 | LL | foo(a, b, c); // ... and hence a reference to `a` is expected to diverge. - | ^ expected `!`, found integer + | ^^^^-^^^^^^^ + | | + | expected `!`, found `!` | - = note: expected type `!` - found type `{integer}` +note: function defined here + --> $DIR/coerce-to-bang.rs:3:4 + | +LL | fn foo(x: usize, y: !, z: usize) { } + | ^^^ -------- ---- -------- +help: provide an argument of the correct type + | +LL | foo(a, {!}, c); // ... and hence a reference to `a` is expected to diverge. + | ^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:36:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-to-bang.rs:36:5 | LL | foo(a, b, c); - | ^ expected `!`, found integer + | ^^^^-^^^^^^^ + | | + | expected `!`, found `_` | - = note: expected type `!` - found type `{integer}` +note: function defined here + --> $DIR/coerce-to-bang.rs:3:4 + | +LL | fn foo(x: usize, y: !, z: usize) { } + | ^^^ -------- ---- -------- +help: provide an argument of the correct type + | +LL | foo(a, {!}, c); + | ^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:45:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-to-bang.rs:45:5 | LL | foo(a, b, c); - | ^ expected `!`, found integer + | ^^^^-^^^^^^^ + | | + | expected `!`, found `usize` | - = note: expected type `!` - found type `{integer}` +note: function defined here + --> $DIR/coerce-to-bang.rs:3:4 + | +LL | fn foo(x: usize, y: !, z: usize) { } + | ^^^ -------- ---- -------- +help: provide an argument of the correct type + | +LL | foo(a, {!}, c); + | ^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/coerce-to-bang.rs:50:21 @@ -73,7 +118,7 @@ LL | let x: (usize, !, usize) = (22, 44, 66); found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:65:41 + --> $DIR/coerce-to-bang.rs:66:41 | LL | let x: (usize, !, usize) = (return, 44, 66); | ^^ expected `!`, found integer @@ -82,7 +127,7 @@ LL | let x: (usize, !, usize) = (return, 44, 66); found type `{integer}` error[E0308]: mismatched types - --> $DIR/coerce-to-bang.rs:76:37 + --> $DIR/coerce-to-bang.rs:77:37 | LL | let x: (usize, !, usize) = (22, 44, return); | ^^ expected `!`, found integer diff --git a/src/test/ui/const-generics/const-argument-cross-crate-mismatch.full.stderr b/src/test/ui/const-generics/const-argument-cross-crate-mismatch.full.stderr index a35c3abc113b9..e9854f0b9b53b 100644 --- a/src/test/ui/const-generics/const-argument-cross-crate-mismatch.full.stderr +++ b/src/test/ui/const-generics/const-argument-cross-crate-mismatch.full.stderr @@ -1,14 +1,28 @@ -error[E0308]: mismatched types - --> $DIR/const-argument-cross-crate-mismatch.rs:7:67 +error[E0308]: arguments to this function are incorrect + --> $DIR/const-argument-cross-crate-mismatch.rs:7:41 | LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); - | ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements + | ^^^^^^^^^^^^^^^^^^^^^^^^^^----------^ + | | + | expected `[u8; 3]`, found `[u8; 2]` + | +help: provide an argument of the correct type + | +LL | let _ = const_generic_lib::function(({[u8; 3]})); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/const-argument-cross-crate-mismatch.rs:9:65 +error[E0308]: arguments to this function are incorrect + --> $DIR/const-argument-cross-crate-mismatch.rs:9:39 | LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); - | ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements + | ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ + | | + | expected `[u8; 2]`, found `[u8; 3]` + | +help: provide an argument of the correct type + | +LL | let _: const_generic_lib::Alias = ({[u8; 2]}); + | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-argument-cross-crate-mismatch.min.stderr b/src/test/ui/const-generics/const-argument-cross-crate-mismatch.min.stderr index a35c3abc113b9..e9854f0b9b53b 100644 --- a/src/test/ui/const-generics/const-argument-cross-crate-mismatch.min.stderr +++ b/src/test/ui/const-generics/const-argument-cross-crate-mismatch.min.stderr @@ -1,14 +1,28 @@ -error[E0308]: mismatched types - --> $DIR/const-argument-cross-crate-mismatch.rs:7:67 +error[E0308]: arguments to this function are incorrect + --> $DIR/const-argument-cross-crate-mismatch.rs:7:41 | LL | let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); - | ^^^^^^^^^^ expected an array with a fixed size of 3 elements, found one with 2 elements + | ^^^^^^^^^^^^^^^^^^^^^^^^^^----------^ + | | + | expected `[u8; 3]`, found `[u8; 2]` + | +help: provide an argument of the correct type + | +LL | let _ = const_generic_lib::function(({[u8; 3]})); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/const-argument-cross-crate-mismatch.rs:9:65 +error[E0308]: arguments to this function are incorrect + --> $DIR/const-argument-cross-crate-mismatch.rs:9:39 | LL | let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); - | ^^^^^^^^^^^^^^^ expected an array with a fixed size of 2 elements, found one with 3 elements + | ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ + | | + | expected `[u8; 2]`, found `[u8; 3]` + | +help: provide an argument of the correct type + | +LL | let _: const_generic_lib::Alias = ({[u8; 2]}); + | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/const-generics/const-argument-cross-crate-mismatch.rs b/src/test/ui/const-generics/const-argument-cross-crate-mismatch.rs index 9ae2ae50ba0ab..f4fc6430b50bc 100644 --- a/src/test/ui/const-generics/const-argument-cross-crate-mismatch.rs +++ b/src/test/ui/const-generics/const-argument-cross-crate-mismatch.rs @@ -5,7 +5,7 @@ extern crate const_generic_lib; fn main() { let _ = const_generic_lib::function(const_generic_lib::Struct([0u8, 1u8])); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect let _: const_generic_lib::Alias = const_generic_lib::Struct([0u8, 1u8, 2u8]); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/const-generics/issues/issue-62504.min.stderr b/src/test/ui/const-generics/issues/issue-62504.min.stderr index 5d45e302888d4..5bb24aa203dd0 100644 --- a/src/test/ui/const-generics/issues/issue-62504.min.stderr +++ b/src/test/ui/const-generics/issues/issue-62504.min.stderr @@ -1,12 +1,3 @@ -error[E0308]: mismatched types - --> $DIR/issue-62504.rs:18:21 - | -LL | ArrayHolder([0; Self::SIZE]) - | ^^^^^^^^^^^^^^^ expected `X`, found `Self::SIZE` - | - = note: expected array `[u32; X]` - found array `[u32; _]` - error: constant expression depends on a generic parameter --> $DIR/issue-62504.rs:18:25 | @@ -15,6 +6,24 @@ LL | ArrayHolder([0; Self::SIZE]) | = note: this may fail depending on what value the parameter takes +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-62504.rs:18:9 + | +LL | ArrayHolder([0; Self::SIZE]) + | ^^^^^^^^^^^^---------------^ + | | + | expected `[u32; X]`, found `[u32; _]` + | +note: tuple struct defined here + --> $DIR/issue-62504.rs:14:1 + | +LL | struct ArrayHolder([u32; X]); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | struct ArrayHolder([u32; X]);({[u32; X]}) + | + error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/const-generics/issues/issue-62504.rs b/src/test/ui/const-generics/issues/issue-62504.rs index 0b95754cab45d..5de4fa2f97eb6 100644 --- a/src/test/ui/const-generics/issues/issue-62504.rs +++ b/src/test/ui/const-generics/issues/issue-62504.rs @@ -17,7 +17,7 @@ impl ArrayHolder { pub const fn new() -> Self { ArrayHolder([0; Self::SIZE]) //~^ ERROR constant expression depends on a generic parameter - //[min]~| ERROR mismatched types + //[min]~| ERROR arguments to this function are incorrect } } diff --git a/src/test/ui/conversion-methods.rs b/src/test/ui/conversion-methods.rs index 46c2e511f3381..68c0b0d09c36d 100644 --- a/src/test/ui/conversion-methods.rs +++ b/src/test/ui/conversion-methods.rs @@ -2,12 +2,14 @@ use std::path::{Path, PathBuf}; fn main() { - let _tis_an_instants_play: String = "'Tis a fond Ambush—"; //~ ERROR mismatched types + let _tis_an_instants_play: String = "'Tis a fond Ambush—"; + //~^ ERROR mismatched types let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); //~^ ERROR mismatched types let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here //~^ ERROR mismatched types - let _prove_piercing_earnest: Vec = &[1, 2, 3]; //~ ERROR mismatched types + let _prove_piercing_earnest: Vec = &[1, 2, 3]; + //~^ ERROR mismatched types } diff --git a/src/test/ui/conversion-methods.stderr b/src/test/ui/conversion-methods.stderr index 4f47e1fd0ffe0..96ec85fe8f722 100644 --- a/src/test/ui/conversion-methods.stderr +++ b/src/test/ui/conversion-methods.stderr @@ -9,7 +9,7 @@ LL | let _tis_an_instants_play: String = "'Tis a fond Ambush—"; | expected due to this error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:6:40 + --> $DIR/conversion-methods.rs:7:40 | LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); | ------- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -19,7 +19,7 @@ LL | let _just_to_make_bliss: PathBuf = Path::new("/ern/her/own/surprise"); | expected due to this error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:9:40 + --> $DIR/conversion-methods.rs:10:40 | LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we suggest .to_string() here | ------ ^ @@ -29,7 +29,7 @@ LL | let _but_should_the_play: String = 2; // Perhaps surprisingly, we sugge | expected due to this error[E0308]: mismatched types - --> $DIR/conversion-methods.rs:12:47 + --> $DIR/conversion-methods.rs:13:47 | LL | let _prove_piercing_earnest: Vec = &[1, 2, 3]; | ---------- ^^^^^^^^^^ diff --git a/src/test/ui/deref-suggestion.rs b/src/test/ui/deref-suggestion.rs index 580410aecf4f8..eb5f453634069 100644 --- a/src/test/ui/deref-suggestion.rs +++ b/src/test/ui/deref-suggestion.rs @@ -1,18 +1,18 @@ macro_rules! borrow { - ($x:expr) => { &$x } //~ ERROR mismatched types + ($x:expr) => { &$x } //~ ERROR arguments to this function are incorrect } fn foo(_: String) {} fn foo2(s: &String) { foo(s); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } fn foo3(_: u32) {} fn foo4(u: &u32) { foo3(u); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } struct S<'a> { @@ -28,13 +28,13 @@ fn main() { let r_s = &s; foo2(r_s); foo(&"aaa".to_owned()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo(&mut "aaa".to_owned()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo3(borrow!(0)); foo4(&0); assert_eq!(3i32, &3i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect let u = 3; let s = S { u }; //~^ ERROR mismatched types diff --git a/src/test/ui/deref-suggestion.stderr b/src/test/ui/deref-suggestion.stderr index f59f05db9c047..03cbfeea65de8 100644 --- a/src/test/ui/deref-suggestion.stderr +++ b/src/test/ui/deref-suggestion.stderr @@ -1,49 +1,93 @@ -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:8:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/deref-suggestion.rs:8:5 | LL | foo(s); - | ^ + | ^^^^-^ | | - | expected struct `String`, found `&String` - | help: try using a conversion method: `s.to_string()` + | expected `String`, found `&String` + | +note: function defined here + --> $DIR/deref-suggestion.rs:5:4 + | +LL | fn foo(_: String) {} + | ^^^ --------- +help: provide an argument of the correct type + | +LL | foo({String}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:14:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/deref-suggestion.rs:14:5 | LL | foo3(u); - | ^ + | ^^^^^-^ | | | expected `u32`, found `&u32` - | help: consider dereferencing the borrow: `*u` + | +note: function defined here + --> $DIR/deref-suggestion.rs:12:4 + | +LL | fn foo3(_: u32) {} + | ^^^^ ------ +help: provide an argument of the correct type + | +LL | foo3({u32}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:30:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/deref-suggestion.rs:30:5 | LL | foo(&"aaa".to_owned()); - | ^^^^^^^^^^^^^^^^^ + | ^^^^-----------------^ | | - | expected struct `String`, found `&String` - | help: consider removing the borrow: `"aaa".to_owned()` + | expected `String`, found `&String` + | +note: function defined here + --> $DIR/deref-suggestion.rs:5:4 + | +LL | fn foo(_: String) {} + | ^^^ --------- +help: provide an argument of the correct type + | +LL | foo({String}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:32:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/deref-suggestion.rs:32:5 | LL | foo(&mut "aaa".to_owned()); - | ^^^^^^^^^^^^^^^^^^^^^ + | ^^^^---------------------^ | | - | expected struct `String`, found `&mut String` - | help: consider removing the borrow: `"aaa".to_owned()` + | expected `String`, found `&mut String` + | +note: function defined here + --> $DIR/deref-suggestion.rs:5:4 + | +LL | fn foo(_: String) {} + | ^^^ --------- +help: provide an argument of the correct type + | +LL | foo({String}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/deref-suggestion.rs:2:20 +error[E0308]: arguments to this function are incorrect + --> $DIR/deref-suggestion.rs:34:5 | LL | ($x:expr) => { &$x } - | ^^^ expected `u32`, found `&{integer}` + | --- expected `u32`, found `&{integer}` ... LL | foo3(borrow!(0)); - | ---------- in this macro invocation + | ^^^^^^^^^^^^^^^^ | - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +note: function defined here + --> $DIR/deref-suggestion.rs:12:4 + | +LL | fn foo3(_: u32) {} + | ^^^^ ------ +help: provide an argument of the correct type + | +LL | foo3({u32}); + | ^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/deref-suggestion.rs:36:5 diff --git a/src/test/ui/did_you_mean/issue-42764.stderr b/src/test/ui/did_you_mean/issue-42764.stderr index 16b80a6f41236..b1701797dd9dc 100644 --- a/src/test/ui/did_you_mean/issue-42764.stderr +++ b/src/test/ui/did_you_mean/issue-42764.stderr @@ -1,17 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-42764.rs:11:43 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-42764.rs:11:5 | LL | this_function_expects_a_double_option(n); - | ^ expected enum `DoubleOption`, found `usize` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `DoubleOption<_>`, found `usize` + | +note: function defined here + --> $DIR/issue-42764.rs:7:4 | - = note: expected enum `DoubleOption<_>` - found type `usize` -help: try using a variant of the expected enum +LL | fn this_function_expects_a_double_option(d: DoubleOption) {} + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ------------------ +help: provide an argument of the correct type | -LL | this_function_expects_a_double_option(DoubleOption::FirstSome(n)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ -LL | this_function_expects_a_double_option(DoubleOption::AlternativeSome(n)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | this_function_expects_a_double_option({DoubleOption<_>}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-42764.rs:27:33 diff --git a/src/test/ui/disambiguate-identical-names.rs b/src/test/ui/disambiguate-identical-names.rs index 708d2cd76a1d9..eb0567032b5d3 100644 --- a/src/test/ui/disambiguate-identical-names.rs +++ b/src/test/ui/disambiguate-identical-names.rs @@ -11,5 +11,5 @@ fn main() { v.insert(3u8, 1u8); test(&v); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/disambiguate-identical-names.stderr b/src/test/ui/disambiguate-identical-names.stderr index 0c6bd9379f753..3355c7abb8962 100644 --- a/src/test/ui/disambiguate-identical-names.stderr +++ b/src/test/ui/disambiguate-identical-names.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/disambiguate-identical-names.rs:13:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/disambiguate-identical-names.rs:13:5 | LL | test(&v); - | ^^ expected struct `std::vec::Vec`, found struct `HashMap` + | ^^^^^--^ + | | + | expected `&std::vec::Vec>`, found `&HashMap` | - = note: expected reference `&std::vec::Vec>` - found reference `&HashMap` +note: function defined here + --> $DIR/disambiguate-identical-names.rs:6:4 + | +LL | fn test(_v: &Vec>) { + | ^^^^ ------------------ +help: provide an argument of the correct type + | +LL | test({&std::vec::Vec>}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/error-codes/E0057.stderr b/src/test/ui/error-codes/E0057.stderr index 31579e2828964..da379790557c4 100644 --- a/src/test/ui/error-codes/E0057.stderr +++ b/src/test/ui/error-codes/E0057.stderr @@ -1,19 +1,27 @@ -error[E0057]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0057.rs:3:13 | LL | let a = f(); - | ^-- supplied 0 arguments - | | - | expected 1 argument + | ^^^ an argument of type _ is missing + | +help: provide the argument + | +LL | let a = ({_}); + | ^^^^^ -error[E0057]: this function takes 1 argument but 2 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); - | ^ - - supplied 2 arguments - | | - | expected 1 argument + | ^^-^^^^ + | | + | argument of type {integer} unexpected + | +help: remove the extra argument + | +LL | let c = (2); + | ^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0057`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/error-codes/E0060.stderr b/src/test/ui/error-codes/E0060.stderr index c80014d14763b..745f31611b162 100644 --- a/src/test/ui/error-codes/E0060.stderr +++ b/src/test/ui/error-codes/E0060.stderr @@ -1,17 +1,19 @@ -error[E0060]: this function takes at least 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0060.rs:6:14 | LL | unsafe { printf(); } - | ^^^^^^-- supplied 0 arguments - | | - | expected at least 1 argument + | ^^^^^^^^ an argument of type *const u8 is missing | note: function defined here --> $DIR/E0060.rs:2:8 | LL | fn printf(_: *const u8, ...) -> u32; | ^^^^^^ +help: provide the argument + | +LL | unsafe { printf({*const u8}); } + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0060`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/error-codes/E0061.stderr b/src/test/ui/error-codes/E0061.stderr index 98488a2d298b9..ea93562b8cc9c 100644 --- a/src/test/ui/error-codes/E0061.stderr +++ b/src/test/ui/error-codes/E0061.stderr @@ -1,31 +1,35 @@ -error[E0061]: this function takes 2 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0061.rs:6:5 | LL | f(0); - | ^ - supplied 1 argument - | | - | expected 2 arguments + | ^^^^ an argument of type &str is missing | note: function defined here --> $DIR/E0061.rs:1:4 | LL | fn f(a: u16, b: &str) {} | ^ ------ ------- +help: provide the argument + | +LL | f(0, {&str}); + | ^^^^^^^^^^^^ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0061.rs:10:5 | LL | f2(); - | ^^-- supplied 0 arguments - | | - | expected 1 argument + | ^^^^ an argument of type u16 is missing | note: function defined here --> $DIR/E0061.rs:3:4 | LL | fn f2(a: u16) {} | ^^ ------ +help: provide the argument + | +LL | f2({u16}); + | ^^^^^^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/estr-subtyping.rs b/src/test/ui/estr-subtyping.rs index 9c5825fff8552..f28fd1db68c06 100644 --- a/src/test/ui/estr-subtyping.rs +++ b/src/test/ui/estr-subtyping.rs @@ -7,7 +7,7 @@ fn has_uniq(x: String) { } fn has_slice(x: &str) { - wants_uniq(x); //~ ERROR mismatched types + wants_uniq(x); //~ ERROR arguments to this function are incorrect wants_slice(x); } diff --git a/src/test/ui/estr-subtyping.stderr b/src/test/ui/estr-subtyping.stderr index 268ec63a80dc6..a424615b45779 100644 --- a/src/test/ui/estr-subtyping.stderr +++ b/src/test/ui/estr-subtyping.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/estr-subtyping.rs:10:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/estr-subtyping.rs:10:4 | LL | wants_uniq(x); - | ^ + | ^^^^^^^^^^^-^ | | - | expected struct `String`, found `&str` - | help: try using a conversion method: `x.to_string()` + | expected `String`, found `&str` + | +note: function defined here + --> $DIR/estr-subtyping.rs:1:4 + | +LL | fn wants_uniq(x: String) { } + | ^^^^^^^^^^ --------- +help: provide an argument of the correct type + | +LL | wants_uniq({String}); + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/fmt/ifmt-bad-arg.stderr b/src/test/ui/fmt/ifmt-bad-arg.stderr index 0ff478826f728..c4c792f9114bc 100644 --- a/src/test/ui/fmt/ifmt-bad-arg.stderr +++ b/src/test/ui/fmt/ifmt-bad-arg.stderr @@ -302,25 +302,33 @@ LL | println!("{:.*}"); = note: positional arguments are zero-based = note: for information about formatting flags, visit https://doc.rust-lang.org/std/fmt/index.html -error[E0308]: mismatched types - --> $DIR/ifmt-bad-arg.rs:78:32 +error[E0308]: arguments to this function are incorrect + --> $DIR/ifmt-bad-arg.rs:78:5 | LL | println!("{} {:.*} {}", 1, 3.2, 4); - | ^^^ expected `usize`, found floating-point number + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^^^^ + | | + | expected `&usize`, found `&{float}` | - = note: expected reference `&usize` - found reference `&{float}` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: provide an argument of the correct type + | +LL | $crate::io::_print(({&usize})); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/ifmt-bad-arg.rs:81:35 +error[E0308]: arguments to this function are incorrect + --> $DIR/ifmt-bad-arg.rs:81:5 | LL | println!("{} {:07$.*} {}", 1, 3.2, 4); - | ^^^ expected `usize`, found floating-point number + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---^^^^^ + | | + | expected `&usize`, found `&{float}` | - = note: expected reference `&usize` - found reference `&{float}` = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: provide an argument of the correct type + | +LL | $crate::io::_print(({&usize})); + | ^^^^^^^^^^ error: aborting due to 36 previous errors diff --git a/src/test/ui/generator/type-mismatch-signature-deduction.rs b/src/test/ui/generator/type-mismatch-signature-deduction.rs index 7774ff48f56b7..d77d951a0c53f 100644 --- a/src/test/ui/generator/type-mismatch-signature-deduction.rs +++ b/src/test/ui/generator/type-mismatch-signature-deduction.rs @@ -10,7 +10,7 @@ fn foo() -> impl Generator { //~ ERROR type mismatch yield (); - 5 //~ ERROR mismatched types [E0308] + 5 //~ ERROR arguments to this function are incorrect [E0308] } } diff --git a/src/test/ui/generic-associated-types/missing-bounds.fixed b/src/test/ui/generic-associated-types/missing-bounds.fixed index 54478d1628245..0e8f2ed6649b2 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.fixed +++ b/src/test/ui/generic-associated-types/missing-bounds.fixed @@ -4,21 +4,21 @@ use std::ops::Add; struct A(B); -impl Add for A where B: Add + Add { +impl Add for A where B: Add { type Output = Self; fn add(self, rhs: Self) -> Self { - A(self.0 + rhs.0) //~ ERROR mismatched types + struct A(B);({B}) //~ ERROR arguments to this function are incorrect } } struct C(B); -impl> Add for C { +impl Add for C { type Output = Self; fn add(self, rhs: Self) -> Self { - Self(self.0 + rhs.0) //~ ERROR mismatched types + struct C(B);({B}) //~ ERROR arguments to this function are incorrect } } diff --git a/src/test/ui/generic-associated-types/missing-bounds.rs b/src/test/ui/generic-associated-types/missing-bounds.rs index 962d2db9476bd..96fd6ba1d2d5d 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.rs +++ b/src/test/ui/generic-associated-types/missing-bounds.rs @@ -8,7 +8,7 @@ impl Add for A where B: Add { type Output = Self; fn add(self, rhs: Self) -> Self { - A(self.0 + rhs.0) //~ ERROR mismatched types + A(self.0 + rhs.0) //~ ERROR arguments to this function are incorrect } } @@ -18,7 +18,7 @@ impl Add for C { type Output = Self; fn add(self, rhs: Self) -> Self { - Self(self.0 + rhs.0) //~ ERROR mismatched types + Self(self.0 + rhs.0) //~ ERROR arguments to this function are incorrect } } diff --git a/src/test/ui/generic-associated-types/missing-bounds.stderr b/src/test/ui/generic-associated-types/missing-bounds.stderr index 4d4f7e55873b9..e5a3bbad47f91 100644 --- a/src/test/ui/generic-associated-types/missing-bounds.stderr +++ b/src/test/ui/generic-associated-types/missing-bounds.stderr @@ -1,34 +1,38 @@ -error[E0308]: mismatched types - --> $DIR/missing-bounds.rs:11:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/missing-bounds.rs:11:9 | -LL | impl Add for A where B: Add { - | - this type parameter -... LL | A(self.0 + rhs.0) - | ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type + | ^^--------------^ + | | + | expected `B`, found `>::Output` | - = note: expected type parameter `B` - found associated type `::Output` -help: consider further restricting this bound +note: tuple struct defined here + --> $DIR/missing-bounds.rs:5:1 | -LL | impl Add for A where B: Add + Add { - | ^^^^^^^^^^^^^^^^^ +LL | struct A(B); + | ^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | struct A(B);({B}) + | ^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/missing-bounds.rs:21:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/missing-bounds.rs:21:9 | -LL | impl Add for C { - | - this type parameter -... LL | Self(self.0 + rhs.0) - | ^^^^^^^^^^^^^^ expected type parameter `B`, found associated type + | ^^^^^--------------^ + | | + | expected `B`, found `>::Output` + | +note: tuple struct defined here + --> $DIR/missing-bounds.rs:15:1 | - = note: expected type parameter `B` - found associated type `::Output` -help: consider further restricting this bound +LL | struct C(B); + | ^^^^^^^^^^^^^^^ +help: provide an argument of the correct type | -LL | impl> Add for C { - | ^^^^^^^^^^^^^^^^^ +LL | struct C(B);({B}) + | ^^^^^^^^^^^^^^^^^^^^ error[E0369]: cannot add `B` to `B` --> $DIR/missing-bounds.rs:31:21 diff --git a/src/test/ui/hrtb/issue-58451.rs b/src/test/ui/hrtb/issue-58451.rs index f36d549e476b8..74ef71ed71e9c 100644 --- a/src/test/ui/hrtb/issue-58451.rs +++ b/src/test/ui/hrtb/issue-58451.rs @@ -9,5 +9,5 @@ where {} fn main() { - f(&[f()]); //~ ERROR this function takes 1 argument + f(&[f()]); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/hrtb/issue-58451.stderr b/src/test/ui/hrtb/issue-58451.stderr index 2cc1c7a2e7269..9e34c6cab76a0 100644 --- a/src/test/ui/hrtb/issue-58451.stderr +++ b/src/test/ui/hrtb/issue-58451.stderr @@ -1,17 +1,19 @@ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/issue-58451.rs:12:9 | LL | f(&[f()]); - | ^-- supplied 0 arguments - | | - | expected 1 argument + | ^^^ an argument of type _ is missing | note: function defined here --> $DIR/issue-58451.rs:5:4 | LL | fn f(i: I) | ^ ---- +help: provide the argument + | +LL | f(&[f({_})]); + | ^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/include-macros/mismatched-types.rs b/src/test/ui/include-macros/mismatched-types.rs index 83fa378a3ae05..b363661ebd0f9 100644 --- a/src/test/ui/include-macros/mismatched-types.rs +++ b/src/test/ui/include-macros/mismatched-types.rs @@ -1,4 +1,6 @@ fn main() { - let b: &[u8] = include_str!("file.txt"); //~ ERROR mismatched types - let s: &str = include_bytes!("file.txt"); //~ ERROR mismatched types + let b: &[u8] = include_str!("file.txt"); + //~^ ERROR mismatched types + let s: &str = include_bytes!("file.txt"); + //~^ ERROR mismatched types } diff --git a/src/test/ui/include-macros/mismatched-types.stderr b/src/test/ui/include-macros/mismatched-types.stderr index d035df8e5d83a..bfe3dbc4f1a88 100644 --- a/src/test/ui/include-macros/mismatched-types.stderr +++ b/src/test/ui/include-macros/mismatched-types.stderr @@ -11,7 +11,7 @@ LL | let b: &[u8] = include_str!("file.txt"); = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) error[E0308]: mismatched types - --> $DIR/mismatched-types.rs:3:19 + --> $DIR/mismatched-types.rs:4:19 | LL | let s: &str = include_bytes!("file.txt"); | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `str`, found array `[u8; 0]` diff --git a/src/test/ui/indexing-requires-a-uint.rs b/src/test/ui/indexing-requires-a-uint.rs index dbe9b44a13890..01832c8595d1d 100644 --- a/src/test/ui/indexing-requires-a-uint.rs +++ b/src/test/ui/indexing-requires-a-uint.rs @@ -10,5 +10,5 @@ fn main() { let i = 0; // i is an IntVar [0][i]; // i should be locked to usize bar::(i); // i should not be re-coerced back to an isize - //~^ ERROR: mismatched types + //~^ ERROR: arguments to this function are incorrect } diff --git a/src/test/ui/indexing-requires-a-uint.stderr b/src/test/ui/indexing-requires-a-uint.stderr index 3152dec30a0e6..62aba9b280271 100644 --- a/src/test/ui/indexing-requires-a-uint.stderr +++ b/src/test/ui/indexing-requires-a-uint.stderr @@ -7,16 +7,23 @@ LL | [0][0u8]; = help: the trait `SliceIndex<[{integer}]>` is not implemented for `u8` = note: required because of the requirements on the impl of `Index` for `[{integer}]` -error[E0308]: mismatched types - --> $DIR/indexing-requires-a-uint.rs:12:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/indexing-requires-a-uint.rs:12:5 | LL | bar::(i); // i should not be re-coerced back to an isize - | ^ expected `isize`, found `usize` + | ^^^^^^^^^^^^^-^ + | | + | expected `isize`, found `{integer}` | -help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/indexing-requires-a-uint.rs:5:8 | -LL | bar::(i.try_into().unwrap()); // i should not be re-coerced back to an isize - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn bar(_: T) {} + | ^^^ ---- +help: provide an argument of the correct type + | +LL | bar({isize}); // i should not be re-coerced back to an isize + | ^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/integer-literal-suffix-inference.rs b/src/test/ui/integer-literal-suffix-inference.rs index c320f2bb7b446..32b6ae8c9fabe 100644 --- a/src/test/ui/integer-literal-suffix-inference.rs +++ b/src/test/ui/integer-literal-suffix-inference.rs @@ -36,185 +36,185 @@ fn main() { id_i8(a8); // ok id_i8(a16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `i16` id_i8(a32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `i32` id_i8(a64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `i64` id_i8(asize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `isize` id_i16(a8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `i8` id_i16(a16); // ok id_i16(a32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `i32` id_i16(a64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `i64` id_i16(asize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `isize` id_i32(a8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `i8` id_i32(a16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `i16` id_i32(a32); // ok id_i32(a64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `i64` id_i32(asize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `isize` id_i64(a8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `i8` id_i64(a16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `i16` id_i64(a32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `i32` id_i64(a64); // ok id_i64(asize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `isize` id_isize(a8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `isize`, found `i8` id_isize(a16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `isize`, found `i16` id_isize(a32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `isize`, found `i32` id_isize(a64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `isize`, found `i64` id_isize(asize); //ok id_i8(c8); // ok id_i8(c16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `i16` id_i8(c32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `i32` id_i8(c64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i8`, found `i64` id_i16(c8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `i8` id_i16(c16); // ok id_i16(c32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `i32` id_i16(c64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `i64` id_i32(c8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `i8` id_i32(c16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `i16` id_i32(c32); // ok id_i32(c64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i32`, found `i64` id_i64(a8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `i8` id_i64(a16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `i16` id_i64(a32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i64`, found `i32` id_i64(a64); // ok id_u8(b8); // ok id_u8(b16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u8`, found `u16` id_u8(b32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u8`, found `u32` id_u8(b64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u8`, found `u64` id_u8(bsize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u8`, found `usize` id_u16(b8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `u8` id_u16(b16); // ok id_u16(b32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `u32` id_u16(b64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `u64` id_u16(bsize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `usize` id_u32(b8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u32`, found `u8` id_u32(b16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u32`, found `u16` id_u32(b32); // ok id_u32(b64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u32`, found `u64` id_u32(bsize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u32`, found `usize` id_u64(b8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u64`, found `u8` id_u64(b16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u64`, found `u16` id_u64(b32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u64`, found `u32` id_u64(b64); // ok id_u64(bsize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u64`, found `usize` id_usize(b8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `usize`, found `u8` id_usize(b16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `usize`, found `u16` id_usize(b32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `usize`, found `u32` id_usize(b64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `usize`, found `u64` id_usize(bsize); //ok } diff --git a/src/test/ui/integer-literal-suffix-inference.stderr b/src/test/ui/integer-literal-suffix-inference.stderr index bfb47515823a3..81ed01893f417 100644 --- a/src/test/ui/integer-literal-suffix-inference.stderr +++ b/src/test/ui/integer-literal-suffix-inference.stderr @@ -1,530 +1,938 @@ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:38:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:38:5 | LL | id_i8(a16); - | ^^^ expected `i8`, found `i16` + | ^^^^^^---^ + | | + | expected `i8`, found `i16` | -help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -LL | id_i8(a16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type + | +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:41:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:41:5 | LL | id_i8(a32); - | ^^^ expected `i8`, found `i32` + | ^^^^^^---^ + | | + | expected `i8`, found `i32` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type | -LL | id_i8(a32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:44:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:44:5 | LL | id_i8(a64); - | ^^^ expected `i8`, found `i64` + | ^^^^^^---^ + | | + | expected `i8`, found `i64` | -help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -LL | id_i8(a64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type + | +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:47:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:47:5 | LL | id_i8(asize); - | ^^^^^ expected `i8`, found `isize` + | ^^^^^^-----^ + | | + | expected `i8`, found `isize` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type | -LL | id_i8(asize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:51:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:51:5 | LL | id_i16(a8); - | ^^ + | ^^^^^^^--^ | | | expected `i16`, found `i8` - | help: you can convert an `i8` to an `i16`: `a8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 + | +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:55:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:55:5 | LL | id_i16(a32); - | ^^^ expected `i16`, found `i32` + | ^^^^^^^---^ + | | + | expected `i16`, found `i32` | -help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 | -LL | id_i16(a32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:58:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:58:5 | LL | id_i16(a64); - | ^^^ expected `i16`, found `i64` + | ^^^^^^^---^ + | | + | expected `i16`, found `i64` | -help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 | -LL | id_i16(a64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:61:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:61:5 | LL | id_i16(asize); - | ^^^^^ expected `i16`, found `isize` + | ^^^^^^^-----^ + | | + | expected `i16`, found `isize` | -help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 | -LL | id_i16(asize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:65:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:65:5 | LL | id_i32(a8); - | ^^ + | ^^^^^^^--^ | | | expected `i32`, found `i8` - | help: you can convert an `i8` to an `i32`: `a8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 + | +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:68:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:68:5 | LL | id_i32(a16); - | ^^^ + | ^^^^^^^---^ | | | expected `i32`, found `i16` - | help: you can convert an `i16` to an `i32`: `a16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 + | +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:72:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:72:5 | LL | id_i32(a64); - | ^^^ expected `i32`, found `i64` + | ^^^^^^^---^ + | | + | expected `i32`, found `i64` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 | -help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_i32(a64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:75:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:75:5 | LL | id_i32(asize); - | ^^^^^ expected `i32`, found `isize` + | ^^^^^^^-----^ + | | + | expected `i32`, found `isize` | -help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 | -LL | id_i32(asize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:79:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:79:5 | LL | id_i64(a8); - | ^^ + | ^^^^^^^--^ | | | expected `i64`, found `i8` - | help: you can convert an `i8` to an `i64`: `a8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 + | +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:82:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:82:5 | LL | id_i64(a16); - | ^^^ + | ^^^^^^^---^ | | | expected `i64`, found `i16` - | help: you can convert an `i16` to an `i64`: `a16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 + | +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:85:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:85:5 | LL | id_i64(a32); - | ^^^ + | ^^^^^^^---^ | | | expected `i64`, found `i32` - | help: you can convert an `i32` to an `i64`: `a32.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 + | +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:89:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:89:5 | LL | id_i64(asize); - | ^^^^^ expected `i64`, found `isize` + | ^^^^^^^-----^ + | | + | expected `i64`, found `isize` | -help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 | -LL | id_i64(asize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:93:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:93:5 | LL | id_isize(a8); - | ^^ + | ^^^^^^^^^--^ | | | expected `isize`, found `i8` - | help: you can convert an `i8` to an `isize`: `a8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:19:8 + | +LL | fn id_isize(n: isize) -> isize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type + | +LL | id_isize({isize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:96:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:96:5 | LL | id_isize(a16); - | ^^^ + | ^^^^^^^^^---^ | | | expected `isize`, found `i16` - | help: you can convert an `i16` to an `isize`: `a16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:19:8 + | +LL | fn id_isize(n: isize) -> isize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type + | +LL | id_isize({isize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:99:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:99:5 | LL | id_isize(a32); - | ^^^ expected `isize`, found `i32` + | ^^^^^^^^^---^ + | | + | expected `isize`, found `i32` | -help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:19:8 | -LL | id_isize(a32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_isize(n: isize) -> isize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type + | +LL | id_isize({isize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:102:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:102:5 | LL | id_isize(a64); - | ^^^ expected `isize`, found `i64` + | ^^^^^^^^^---^ + | | + | expected `isize`, found `i64` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:19:8 | -help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit +LL | fn id_isize(n: isize) -> isize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type | -LL | id_isize(a64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_isize({isize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:108:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:108:5 | LL | id_i8(c16); - | ^^^ expected `i8`, found `i16` + | ^^^^^^---^ + | | + | expected `i8`, found `i16` | -help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -LL | id_i8(c16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type + | +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:111:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:111:5 | LL | id_i8(c32); - | ^^^ expected `i8`, found `i32` + | ^^^^^^---^ + | | + | expected `i8`, found `i32` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type | -LL | id_i8(c32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:114:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:114:5 | LL | id_i8(c64); - | ^^^ expected `i8`, found `i64` + | ^^^^^^---^ + | | + | expected `i8`, found `i64` | -help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:15:8 | -LL | id_i8(c64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i8(n: i8) -> i8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type + | +LL | id_i8({i8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:118:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:118:5 | LL | id_i16(c8); - | ^^ + | ^^^^^^^--^ | | | expected `i16`, found `i8` - | help: you can convert an `i8` to an `i16`: `c8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 + | +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:122:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:122:5 | LL | id_i16(c32); - | ^^^ expected `i16`, found `i32` + | ^^^^^^^---^ + | | + | expected `i16`, found `i32` | -help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 | -LL | id_i16(c32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:125:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:125:5 | LL | id_i16(c64); - | ^^^ expected `i16`, found `i64` + | ^^^^^^^---^ + | | + | expected `i16`, found `i64` | -help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:16:8 | -LL | id_i16(c64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_i16(n: i16) -> i16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i16({i16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:129:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:129:5 | LL | id_i32(c8); - | ^^ + | ^^^^^^^--^ | | | expected `i32`, found `i8` - | help: you can convert an `i8` to an `i32`: `c8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 + | +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:132:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:132:5 | LL | id_i32(c16); - | ^^^ + | ^^^^^^^---^ | | | expected `i32`, found `i16` - | help: you can convert an `i16` to an `i32`: `c16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 + | +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:136:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:136:5 | LL | id_i32(c64); - | ^^^ expected `i32`, found `i64` + | ^^^^^^^---^ + | | + | expected `i32`, found `i64` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:17:8 | -help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit +LL | fn id_i32(n: i32) -> i32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_i32(c64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_i32({i32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:140:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:140:5 | LL | id_i64(a8); - | ^^ + | ^^^^^^^--^ | | | expected `i64`, found `i8` - | help: you can convert an `i8` to an `i64`: `a8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 + | +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:143:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:143:5 | LL | id_i64(a16); - | ^^^ + | ^^^^^^^---^ | | | expected `i64`, found `i16` - | help: you can convert an `i16` to an `i64`: `a16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 + | +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:146:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:146:5 | LL | id_i64(a32); - | ^^^ + | ^^^^^^^---^ | | | expected `i64`, found `i32` - | help: you can convert an `i32` to an `i64`: `a32.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:18:8 + | +LL | fn id_i64(n: i64) -> i64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_i64({i64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:152:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:152:5 | LL | id_u8(b16); - | ^^^ expected `u8`, found `u16` + | ^^^^^^---^ + | | + | expected `u8`, found `u16` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:27:8 | -help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit +LL | fn id_u8(n: u8) -> u8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type | -LL | id_u8(b16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u8({u8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:155:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:155:5 | LL | id_u8(b32); - | ^^^ expected `u8`, found `u32` + | ^^^^^^---^ + | | + | expected `u8`, found `u32` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:27:8 | -help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit +LL | fn id_u8(n: u8) -> u8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type | -LL | id_u8(b32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u8({u8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:158:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:158:5 | LL | id_u8(b64); - | ^^^ expected `u8`, found `u64` + | ^^^^^^---^ + | | + | expected `u8`, found `u64` | -help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:27:8 | -LL | id_u8(b64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_u8(n: u8) -> u8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type + | +LL | id_u8({u8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:161:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:161:5 | LL | id_u8(bsize); - | ^^^^^ expected `u8`, found `usize` + | ^^^^^^-----^ + | | + | expected `u8`, found `usize` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:27:8 | -help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit +LL | fn id_u8(n: u8) -> u8 { n } + | ^^^^^ ----- +help: provide an argument of the correct type | -LL | id_u8(bsize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u8({u8}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:165:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:165:5 | LL | id_u16(b8); - | ^^ + | ^^^^^^^--^ | | | expected `u16`, found `u8` - | help: you can convert a `u8` to a `u16`: `b8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:28:8 + | +LL | fn id_u16(n: u16) -> u16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u16({u16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:169:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:169:5 | LL | id_u16(b32); - | ^^^ expected `u16`, found `u32` + | ^^^^^^^---^ + | | + | expected `u16`, found `u32` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:28:8 | -help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit +LL | fn id_u16(n: u16) -> u16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_u16(b32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u16({u16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:172:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:172:5 | LL | id_u16(b64); - | ^^^ expected `u16`, found `u64` + | ^^^^^^^---^ + | | + | expected `u16`, found `u64` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:28:8 | -help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit +LL | fn id_u16(n: u16) -> u16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_u16(b64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u16({u16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:175:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:175:5 | LL | id_u16(bsize); - | ^^^^^ expected `u16`, found `usize` + | ^^^^^^^-----^ + | | + | expected `u16`, found `usize` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:28:8 | -help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit +LL | fn id_u16(n: u16) -> u16 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_u16(bsize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u16({u16}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:179:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:179:5 | LL | id_u32(b8); - | ^^ + | ^^^^^^^--^ | | | expected `u32`, found `u8` - | help: you can convert a `u8` to a `u32`: `b8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:29:8 + | +LL | fn id_u32(n: u32) -> u32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u32({u32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:182:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:182:5 | LL | id_u32(b16); - | ^^^ + | ^^^^^^^---^ | | | expected `u32`, found `u16` - | help: you can convert a `u16` to a `u32`: `b16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:29:8 + | +LL | fn id_u32(n: u32) -> u32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u32({u32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:186:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:186:5 | LL | id_u32(b64); - | ^^^ expected `u32`, found `u64` + | ^^^^^^^---^ + | | + | expected `u32`, found `u64` | -help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:29:8 | -LL | id_u32(b64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_u32(n: u32) -> u32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u32({u32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:189:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:189:5 | LL | id_u32(bsize); - | ^^^^^ expected `u32`, found `usize` + | ^^^^^^^-----^ + | | + | expected `u32`, found `usize` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:29:8 | -help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit +LL | fn id_u32(n: u32) -> u32 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_u32(bsize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u32({u32}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:193:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:193:5 | LL | id_u64(b8); - | ^^ + | ^^^^^^^--^ | | | expected `u64`, found `u8` - | help: you can convert a `u8` to a `u64`: `b8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:30:8 + | +LL | fn id_u64(n: u64) -> u64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u64({u64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:196:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:196:5 | LL | id_u64(b16); - | ^^^ + | ^^^^^^^---^ | | | expected `u64`, found `u16` - | help: you can convert a `u16` to a `u64`: `b16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:30:8 + | +LL | fn id_u64(n: u64) -> u64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u64({u64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:199:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:199:5 | LL | id_u64(b32); - | ^^^ + | ^^^^^^^---^ | | | expected `u64`, found `u32` - | help: you can convert a `u32` to a `u64`: `b32.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:30:8 + | +LL | fn id_u64(n: u64) -> u64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type + | +LL | id_u64({u64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:203:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:203:5 | LL | id_u64(bsize); - | ^^^^^ expected `u64`, found `usize` + | ^^^^^^^-----^ + | | + | expected `u64`, found `usize` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:30:8 | -help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit +LL | fn id_u64(n: u64) -> u64 { n } + | ^^^^^^ ------ +help: provide an argument of the correct type | -LL | id_u64(bsize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_u64({u64}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:207:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:207:5 | LL | id_usize(b8); - | ^^ + | ^^^^^^^^^--^ | | | expected `usize`, found `u8` - | help: you can convert a `u8` to a `usize`: `b8.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:31:8 + | +LL | fn id_usize(n: usize) -> usize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type + | +LL | id_usize({usize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:210:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:210:5 | LL | id_usize(b16); - | ^^^ + | ^^^^^^^^^---^ | | | expected `usize`, found `u16` - | help: you can convert a `u16` to a `usize`: `b16.into()` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:31:8 + | +LL | fn id_usize(n: usize) -> usize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type + | +LL | id_usize({usize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:213:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:213:5 | LL | id_usize(b32); - | ^^^ expected `usize`, found `u32` + | ^^^^^^^^^---^ + | | + | expected `usize`, found `u32` | -help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:31:8 | -LL | id_usize(b32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn id_usize(n: usize) -> usize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type + | +LL | id_usize({usize}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/integer-literal-suffix-inference.rs:216:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/integer-literal-suffix-inference.rs:216:5 | LL | id_usize(b64); - | ^^^ expected `usize`, found `u64` + | ^^^^^^^^^---^ + | | + | expected `usize`, found `u64` + | +note: function defined here + --> $DIR/integer-literal-suffix-inference.rs:31:8 | -help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit +LL | fn id_usize(n: usize) -> usize { n } + | ^^^^^^^^ -------- +help: provide an argument of the correct type | -LL | id_usize(b64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^ +LL | id_usize({usize}); + | ^^^^^^^^^^^^^^^^^ error: aborting due to 52 previous errors diff --git a/src/test/ui/issues/issue-10764.rs b/src/test/ui/issues/issue-10764.rs index 8fa3607815ad5..9c3e2da2725fb 100644 --- a/src/test/ui/issues/issue-10764.rs +++ b/src/test/ui/issues/issue-10764.rs @@ -2,4 +2,4 @@ fn f(_: extern "Rust" fn()) {} extern fn bar() {} fn main() { f(bar) } -//~^ ERROR mismatched types +//~^ ERROR arguments to this function are incorrect diff --git a/src/test/ui/issues/issue-10764.stderr b/src/test/ui/issues/issue-10764.stderr index b0bafc9942ee9..1a22b5834c48d 100644 --- a/src/test/ui/issues/issue-10764.stderr +++ b/src/test/ui/issues/issue-10764.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-10764.rs:4:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-10764.rs:4:13 | LL | fn main() { f(bar) } - | ^^^ expected "Rust" fn, found "C" fn + | ^^---^ + | | + | expected `fn()`, found `extern "C" fn() {bar}` | - = note: expected fn pointer `fn()` - found fn item `extern "C" fn() {bar}` +note: function defined here + --> $DIR/issue-10764.rs:1:4 + | +LL | fn f(_: extern "Rust" fn()) {} + | ^ --------------------- +help: provide an argument of the correct type + | +LL | fn main() { f({fn()}) } + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11374.stderr b/src/test/ui/issues/issue-11374.stderr index d6a3e758de84a..e858c38b7bb13 100644 --- a/src/test/ui/issues/issue-11374.stderr +++ b/src/test/ui/issues/issue-11374.stderr @@ -1,14 +1,18 @@ -error[E0308]: mismatched types - --> $DIR/issue-11374.rs:26:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-11374.rs:26:7 | LL | c.read_to(v); - | ^ - | | - | expected `&mut [u8]`, found struct `Vec` - | help: consider mutably borrowing here: `&mut v` + | ^^^^^^^ - expected `&mut [u8]`, found `Vec<_>` | - = note: expected mutable reference `&mut [u8]` - found struct `Vec<_>` +note: associated function defined here + --> $DIR/issue-11374.rs:13:12 + | +LL | pub fn read_to(&mut self, vec: &mut [u8]) { + | ^^^^^^^ --------- -------------- +help: provide an argument of the correct type + | +LL | c.read_to({&mut [u8]})(v); + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-11515.rs b/src/test/ui/issues/issue-11515.rs index a7671b9282a99..803b7a0b42392 100644 --- a/src/test/ui/issues/issue-11515.rs +++ b/src/test/ui/issues/issue-11515.rs @@ -6,5 +6,6 @@ struct Test { fn main() { let closure: Box = Box::new(|| ()); - let test = box Test { func: closure }; //~ ERROR mismatched types + let test = box Test { func: closure }; + //~^ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-12997-2.rs b/src/test/ui/issues/issue-12997-2.rs index 9df965315ab38..2defd4ea57fd1 100644 --- a/src/test/ui/issues/issue-12997-2.rs +++ b/src/test/ui/issues/issue-12997-2.rs @@ -6,4 +6,4 @@ #[bench] fn bar(x: isize) { } -//~^ ERROR mismatched types +//~^ ERROR arguments to this function are incorrect diff --git a/src/test/ui/issues/issue-12997-2.stderr b/src/test/ui/issues/issue-12997-2.stderr index 895b415a7e2e1..838ed76008d84 100644 --- a/src/test/ui/issues/issue-12997-2.stderr +++ b/src/test/ui/issues/issue-12997-2.stderr @@ -1,10 +1,19 @@ -error[E0308]: mismatched types +error[E0308]: arguments to this function are incorrect --> $DIR/issue-12997-2.rs:8:1 | LL | fn bar(x: isize) { } | ^^^^^^^^^^^^^^^^^^^^ expected `isize`, found `&mut Bencher` | +note: function defined here + --> $DIR/issue-12997-2.rs:8:4 + | +LL | fn bar(x: isize) { } + | ^^^ -------- = note: this error originates in an attribute macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: provide an argument of the correct type + | +LL | bar({isize}) + | error: aborting due to previous error diff --git a/src/test/ui/issues/issue-13359.rs b/src/test/ui/issues/issue-13359.rs index 9129790c501e3..213e9e9654951 100644 --- a/src/test/ui/issues/issue-13359.rs +++ b/src/test/ui/issues/issue-13359.rs @@ -4,10 +4,10 @@ fn bar(_s: u32) { } fn main() { foo(1*(1 as isize)); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `i16`, found `isize` bar(1*(1 as usize)); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u32`, found `usize` } diff --git a/src/test/ui/issues/issue-13359.stderr b/src/test/ui/issues/issue-13359.stderr index 115b471e96b46..7556cb58671eb 100644 --- a/src/test/ui/issues/issue-13359.stderr +++ b/src/test/ui/issues/issue-13359.stderr @@ -1,24 +1,38 @@ -error[E0308]: mismatched types - --> $DIR/issue-13359.rs:6:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-13359.rs:6:5 | LL | foo(1*(1 as isize)); - | ^^^^^^^^^^^^^^ expected `i16`, found `isize` + | ^^^^--------------^ + | | + | expected `i16`, found `_` | -help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/issue-13359.rs:1:4 | -LL | foo((1*(1 as isize)).try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_s: i16) { } + | ^^^ ------- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-13359.rs:10:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-13359.rs:10:5 | LL | bar(1*(1 as usize)); - | ^^^^^^^^^^^^^^ expected `u32`, found `usize` + | ^^^^--------------^ + | | + | expected `u32`, found `_` + | +note: function defined here + --> $DIR/issue-13359.rs:3:4 | -help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit +LL | fn bar(_s: u32) { } + | ^^^ ------- +help: provide an argument of the correct type | -LL | bar((1*(1 as usize)).try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | bar({u32}); + | ^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-13853.rs b/src/test/ui/issues/issue-13853.rs index ac9886d2e7249..383186b554a25 100644 --- a/src/test/ui/issues/issue-13853.rs +++ b/src/test/ui/issues/issue-13853.rs @@ -34,5 +34,5 @@ pub fn main() { graph.push(Stuff); - iterate(graph); //~ ERROR mismatched types + iterate(graph); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/issues/issue-13853.stderr b/src/test/ui/issues/issue-13853.stderr index 527e0225eb976..f428d33b538eb 100644 --- a/src/test/ui/issues/issue-13853.stderr +++ b/src/test/ui/issues/issue-13853.stderr @@ -16,17 +16,23 @@ error[E0599]: no method named `iter` found for reference `&G` in the current sco LL | for node in graph.iter() { | ^^^^ method not found in `&G` -error[E0308]: mismatched types - --> $DIR/issue-13853.rs:37:13 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-13853.rs:37:5 | LL | iterate(graph); - | ^^^^^ + | ^^^^^^^^-----^ | | - | expected reference, found struct `Vec` - | help: consider borrowing here: `&graph` + | expected `&_`, found `Vec` + | +note: function defined here + --> $DIR/issue-13853.rs:26:4 + | +LL | fn iterate>(graph: &G) { + | ^^^^^^^ --------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `Vec` +LL | iterate({&_}); + | ^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/issues/issue-1448-2.rs b/src/test/ui/issues/issue-1448-2.rs index 829e81b9c24b5..4fafb85dc57b4 100644 --- a/src/test/ui/issues/issue-1448-2.rs +++ b/src/test/ui/issues/issue-1448-2.rs @@ -3,5 +3,5 @@ fn foo(a: u32) -> u32 { a } fn main() { - println!("{}", foo(10i32)); //~ ERROR mismatched types + println!("{}", foo(10i32)); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/issues/issue-1448-2.stderr b/src/test/ui/issues/issue-1448-2.stderr index 9cf2f09e17747..baeb84533f237 100644 --- a/src/test/ui/issues/issue-1448-2.stderr +++ b/src/test/ui/issues/issue-1448-2.stderr @@ -1,13 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-1448-2.rs:6:24 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-1448-2.rs:6:20 | LL | println!("{}", foo(10i32)); - | ^^^^^ expected `u32`, found `i32` + | ^^^^-----^ + | | + | expected `u32`, found `i32` | -help: change the type of the numeric literal from `i32` to `u32` +note: function defined here + --> $DIR/issue-1448-2.rs:3:4 | -LL | println!("{}", foo(10u32)); - | ^^^^^ +LL | fn foo(a: u32) -> u32 { a } + | ^^^ ------ +help: provide an argument of the correct type + | +LL | println!("{}", foo({u32})); + | ^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-15783.rs b/src/test/ui/issues/issue-15783.rs index 0b1f4545e8804..bb0c2d5793613 100644 --- a/src/test/ui/issues/issue-15783.rs +++ b/src/test/ui/issues/issue-15783.rs @@ -6,7 +6,7 @@ fn main() { let name = "Foo"; let x = Some(&[name]); let msg = foo(x); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected enum `Option<&[&str]>` //~| found enum `Option<&[&str; 1]>` //~| expected slice `[&str]`, found array `[&str; 1]` diff --git a/src/test/ui/issues/issue-15783.stderr b/src/test/ui/issues/issue-15783.stderr index 0b09751676e9c..a683b891cddb5 100644 --- a/src/test/ui/issues/issue-15783.stderr +++ b/src/test/ui/issues/issue-15783.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-15783.rs:8:19 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-15783.rs:8:15 | LL | let msg = foo(x); - | ^ expected slice `[&str]`, found array `[&str; 1]` + | ^^^^-^ + | | + | expected `Option<&[&str]>`, found `Option<&[&str; 1]>` | - = note: expected enum `Option<&[&str]>` - found enum `Option<&[&str; 1]>` +note: function defined here + --> $DIR/issue-15783.rs:1:8 + | +LL | pub fn foo(params: Option<&[&str]>) -> usize { + | ^^^ ----------------------- +help: provide an argument of the correct type + | +LL | let msg = foo({Option<&[&str]>}); + | ^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-16939.rs b/src/test/ui/issues/issue-16939.rs index ad7248343918d..e10eb048e4b55 100644 --- a/src/test/ui/issues/issue-16939.rs +++ b/src/test/ui/issues/issue-16939.rs @@ -2,7 +2,7 @@ // wrong arity. fn _foo (f: F) { - |t| f(t); //~ ERROR E0057 + |t| f(t); //~ ERROR arguments to this function are incorrect } fn main() {} diff --git a/src/test/ui/issues/issue-16939.stderr b/src/test/ui/issues/issue-16939.stderr index 103f56fa04dd3..ffac0e1c97d52 100644 --- a/src/test/ui/issues/issue-16939.stderr +++ b/src/test/ui/issues/issue-16939.stderr @@ -1,11 +1,16 @@ -error[E0057]: this function takes 0 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/issue-16939.rs:5:9 | LL | |t| f(t); - | ^ - supplied 1 argument - | | - | expected 0 arguments + | ^^-^ + | | + | argument unexpected + | +help: remove the extra argument + | +LL | |t| (); + | ^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0057`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-17033.rs b/src/test/ui/issues/issue-17033.rs index 72a8cd9823a4b..f135819838f01 100644 --- a/src/test/ui/issues/issue-17033.rs +++ b/src/test/ui/issues/issue-17033.rs @@ -1,5 +1,5 @@ fn f<'r>(p: &'r mut fn(p: &mut ())) { - (*p)(()) //~ ERROR mismatched types + (*p)(()) //~ ERROR arguments to this function are incorrect //~| expected `&mut ()`, found `()` } diff --git a/src/test/ui/issues/issue-17033.stderr b/src/test/ui/issues/issue-17033.stderr index 518fc30142c94..7a22dedbda750 100644 --- a/src/test/ui/issues/issue-17033.stderr +++ b/src/test/ui/issues/issue-17033.stderr @@ -1,11 +1,15 @@ -error[E0308]: mismatched types - --> $DIR/issue-17033.rs:2:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-17033.rs:2:5 | LL | (*p)(()) - | ^^ + | ^^^^^--^ | | | expected `&mut ()`, found `()` - | help: consider mutably borrowing here: `&mut ()` + | +help: provide an argument of the correct type + | +LL | ({&mut ()}) + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-18819.rs b/src/test/ui/issues/issue-18819.rs index e634c55f824fd..979038fb7b44e 100644 --- a/src/test/ui/issues/issue-18819.rs +++ b/src/test/ui/issues/issue-18819.rs @@ -14,5 +14,5 @@ fn print_x(_: &dyn Foo, extra: &str) { fn main() { print_x(X); - //~^ ERROR E0061 + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/issues/issue-18819.stderr b/src/test/ui/issues/issue-18819.stderr index b10d26abe3485..00b8667f46c0d 100644 --- a/src/test/ui/issues/issue-18819.stderr +++ b/src/test/ui/issues/issue-18819.stderr @@ -1,17 +1,22 @@ -error[E0061]: this function takes 2 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/issue-18819.rs:16:5 | LL | print_x(X); - | ^^^^^^^ - supplied 1 argument - | | - | expected 2 arguments + | ^^^^^^^^-^ + | | | + | | expected `&dyn Foo`, found `X` + | an argument of type &str is missing | note: function defined here --> $DIR/issue-18819.rs:11:4 | LL | fn print_x(_: &dyn Foo, extra: &str) { | ^^^^^^^ ---------------------- ----------- +help: did you mean + | +LL | print_x({&dyn Foo}, {&str}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-24819.rs b/src/test/ui/issues/issue-24819.rs index 59c3f2cd114de..dbe05b88f182a 100644 --- a/src/test/ui/issues/issue-24819.rs +++ b/src/test/ui/issues/issue-24819.rs @@ -3,7 +3,7 @@ use std::collections::HashSet; fn main() { let mut v = Vec::new(); foo(&mut v); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected struct `HashSet`, found struct `Vec` } diff --git a/src/test/ui/issues/issue-24819.stderr b/src/test/ui/issues/issue-24819.stderr index 2f931e59d5942..2a2ed40f199bd 100644 --- a/src/test/ui/issues/issue-24819.stderr +++ b/src/test/ui/issues/issue-24819.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-24819.rs:5:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-24819.rs:5:5 | LL | foo(&mut v); - | ^^^^^^ expected struct `HashSet`, found struct `Vec` + | ^^^^------^ + | | + | expected `&mut HashSet`, found `&mut Vec<_>` | - = note: expected mutable reference `&mut HashSet` - found mutable reference `&mut Vec<_>` +note: function defined here + --> $DIR/issue-24819.rs:10:4 + | +LL | fn foo(h: &mut HashSet) { + | ^^^ -------------------- +help: provide an argument of the correct type + | +LL | foo({&mut HashSet}); + | ^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-25439.stderr b/src/test/ui/issues/issue-25439.stderr index 325c28c15e272..4a4a8e8fc4da0 100644 --- a/src/test/ui/issues/issue-25439.stderr +++ b/src/test/ui/issues/issue-25439.stderr @@ -1,14 +1,21 @@ -error[E0644]: closure/generator type that references itself - --> $DIR/issue-25439.rs:8:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-25439.rs:8:5 | LL | fix(|_, x| x); - | ^^^^^^^^ cyclic type of infinite size + | ^^^^--------^ + | | + | expected `_` | - = note: closures cannot capture themselves or take themselves as argument; - this error may be the result of a recent compiler bug-fix, - see issue #46062 - for more information +note: function defined here + --> $DIR/issue-25439.rs:3:4 + | +LL | fn fix(f: F) -> i32 where F: Fn(Helper, i32) -> i32 { + | ^^^ ---- +help: provide an argument of the correct type + | +LL | fix({_}); + | ^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0644`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-26094.rs b/src/test/ui/issues/issue-26094.rs index 78fb0491d82dd..292851316935d 100644 --- a/src/test/ui/issues/issue-26094.rs +++ b/src/test/ui/issues/issue-26094.rs @@ -8,6 +8,6 @@ fn some_function() {} //~ NOTE defined here fn main() { some_macro!(some_function); - //~^ ERROR this function takes 0 arguments but 1 argument was supplied - //~| NOTE expected 0 arguments + //~^ ERROR arguments to this function are incorrect + //~| NOTE argument unexpected } diff --git a/src/test/ui/issues/issue-26094.stderr b/src/test/ui/issues/issue-26094.stderr index a6f1ac9286cda..32ab0fb06a8f6 100644 --- a/src/test/ui/issues/issue-26094.stderr +++ b/src/test/ui/issues/issue-26094.stderr @@ -1,18 +1,25 @@ -error[E0061]: this function takes 0 arguments but 1 argument was supplied - --> $DIR/issue-26094.rs:10:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-26094.rs:3:9 | LL | $other(None) - | ---- supplied 1 argument + | ^^^^^^^----^ + | | + | argument unexpected ... LL | some_macro!(some_function); - | ^^^^^^^^^^^^^ expected 0 arguments + | --------------------------- in this macro invocation | note: function defined here --> $DIR/issue-26094.rs:7:4 | LL | fn some_function() {} | ^^^^^^^^^^^^^ + = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: remove the extra argument + | +LL | some_function() + | ^^^^^^^^^^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-29084.rs b/src/test/ui/issues/issue-29084.rs index d16252686698d..0c16e0f971f00 100644 --- a/src/test/ui/issues/issue-29084.rs +++ b/src/test/ui/issues/issue-29084.rs @@ -2,7 +2,7 @@ macro_rules! foo { ($d:expr) => {{ fn bar(d: u8) { } bar(&mut $d); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u8`, found `&mut u8` }} } diff --git a/src/test/ui/issues/issue-29084.stderr b/src/test/ui/issues/issue-29084.stderr index bc22e9371395f..7eced45b00bc7 100644 --- a/src/test/ui/issues/issue-29084.stderr +++ b/src/test/ui/issues/issue-29084.stderr @@ -1,13 +1,27 @@ -error[E0308]: mismatched types - --> $DIR/issue-29084.rs:4:13 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-29084.rs:4:9 | LL | bar(&mut $d); - | ^^^^^^^ expected `u8`, found `&mut u8` + | ^^^^-------^ + | | + | expected `u8`, found `&mut u8` ... LL | foo!(0u8); | ---------- in this macro invocation | +note: function defined here + --> $DIR/issue-29084.rs:3:12 + | +LL | fn bar(d: u8) { } + | ^^^ ----- +... +LL | foo!(0u8); + | ---------- in this macro invocation = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: provide an argument of the correct type + | +LL | bar({u8}); + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-3044.rs b/src/test/ui/issues/issue-3044.rs index 81d76a90eb0ac..d67ffc27c24b3 100644 --- a/src/test/ui/issues/issue-3044.rs +++ b/src/test/ui/issues/issue-3044.rs @@ -2,5 +2,6 @@ fn main() { let needlesArr: Vec = vec!['a', 'f']; needlesArr.iter().fold(|x, y| { }); - //~^^ ERROR this function takes 2 arguments but 1 argument was supplied + //~^^ ERROR mismatched types + //~| ERROR arguments to this function are incorrect } diff --git a/src/test/ui/issues/issue-3044.stderr b/src/test/ui/issues/issue-3044.stderr index d2c010659edd0..a5456f4db9311 100644 --- a/src/test/ui/issues/issue-3044.stderr +++ b/src/test/ui/issues/issue-3044.stderr @@ -1,13 +1,26 @@ -error[E0061]: this function takes 2 arguments but 1 argument was supplied - --> $DIR/issue-3044.rs:3:23 +error[E0308]: mismatched types + --> $DIR/issue-3044.rs:3:35 | LL | needlesArr.iter().fold(|x, y| { - | _______________________^^^^_- - | | | - | | expected 2 arguments + | ___________________________________^ LL | | }); - | |_____- supplied 1 argument + | |_____^ expected closure, found `()` + | + = note: expected closure `[closure@$DIR/issue-3044.rs:3:28: 4:6]` + found unit type `()` + +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-3044.rs:3:23 + | +LL | needlesArr.iter().fold(|x, y| { + | ^^^^ an argument of type _ is missing + | +help: provide the argument + | +LL | needlesArr.iter().(|x, y| { +LL | }, {_})(|x, y| { + | -error: aborting due to previous error +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-43420-no-over-suggest.rs b/src/test/ui/issues/issue-43420-no-over-suggest.rs index 4365bff5af566..36715d3b218b1 100644 --- a/src/test/ui/issues/issue-43420-no-over-suggest.rs +++ b/src/test/ui/issues/issue-43420-no-over-suggest.rs @@ -5,5 +5,5 @@ fn foo(b: &[u16]) {} fn main() { let a: Vec = Vec::new(); - foo(&a); //~ ERROR mismatched types + foo(&a); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/issues/issue-43420-no-over-suggest.stderr b/src/test/ui/issues/issue-43420-no-over-suggest.stderr index 77d52f6ecab11..018d597babf46 100644 --- a/src/test/ui/issues/issue-43420-no-over-suggest.stderr +++ b/src/test/ui/issues/issue-43420-no-over-suggest.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-43420-no-over-suggest.rs:8:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-43420-no-over-suggest.rs:8:5 | LL | foo(&a); - | ^^ expected slice `[u16]`, found struct `Vec` + | ^^^^--^ + | | + | expected `&[u16]`, found `&Vec` | - = note: expected reference `&[u16]` - found reference `&Vec` +note: function defined here + --> $DIR/issue-43420-no-over-suggest.rs:4:4 + | +LL | fn foo(b: &[u16]) {} + | ^^^ --------- +help: provide an argument of the correct type + | +LL | foo({&[u16]}); + | ^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-44023.rs b/src/test/ui/issues/issue-44023.rs index 4c38ddfcdf189..8cf791d367372 100644 --- a/src/test/ui/issues/issue-44023.rs +++ b/src/test/ui/issues/issue-44023.rs @@ -2,5 +2,6 @@ pub fn main () {} -fn საჭმელად_გემრიელი_სადილი ( ) -> isize { //~ ERROR mismatched types +fn საჭმელად_გემრიელი_სადილი ( ) -> isize { + //~^ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-4517.rs b/src/test/ui/issues/issue-4517.rs index caf85d44aac5c..d0d3b14555cc7 100644 --- a/src/test/ui/issues/issue-4517.rs +++ b/src/test/ui/issues/issue-4517.rs @@ -3,6 +3,6 @@ fn bar(int_param: usize) {} fn main() { let foo: [u8; 4] = [1; 4]; bar(foo); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `usize`, found array `[u8; 4]` } diff --git a/src/test/ui/issues/issue-4517.stderr b/src/test/ui/issues/issue-4517.stderr index 1ae97b69c6cac..6853b3f65f991 100644 --- a/src/test/ui/issues/issue-4517.stderr +++ b/src/test/ui/issues/issue-4517.stderr @@ -1,8 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-4517.rs:5:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-4517.rs:5:5 | LL | bar(foo); - | ^^^ expected `usize`, found array `[u8; 4]` + | ^^^^---^ + | | + | expected `usize`, found `[u8; 4]` + | +note: function defined here + --> $DIR/issue-4517.rs:1:4 + | +LL | fn bar(int_param: usize) {} + | ^^^ ---------------- +help: provide an argument of the correct type + | +LL | bar({usize}); + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46112.rs b/src/test/ui/issues/issue-46112.rs index 0cdd2c27ff73e..9c3e5e3cc1e41 100644 --- a/src/test/ui/issues/issue-46112.rs +++ b/src/test/ui/issues/issue-46112.rs @@ -7,4 +7,4 @@ extern crate xcrate_issue_46112_rexport_core; fn test(r: Result, &'static str>) { } fn main() { test(Ok(())); } -//~^ mismatched types +//~^ arguments to this function are incorrect diff --git a/src/test/ui/issues/issue-46112.stderr b/src/test/ui/issues/issue-46112.stderr index ec05fbe580ede..af74de58595d4 100644 --- a/src/test/ui/issues/issue-46112.stderr +++ b/src/test/ui/issues/issue-46112.stderr @@ -1,14 +1,15 @@ -error[E0308]: mismatched types - --> $DIR/issue-46112.rs:9:21 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-46112.rs:9:18 | LL | fn main() { test(Ok(())); } - | ^^ + | ^^^--^ | | - | expected enum `Option`, found `()` - | help: try using a variant of the expected enum: `Some(())` + | expected `Option<()>`, found `()` | - = note: expected enum `Option<()>` - found unit type `()` +help: provide an argument of the correct type + | +LL | fn main() { test(({Option<()>})); } + | ^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed index 8668d8acd5b30..79dc5dfdbf556 100644 --- a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed +++ b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.fixed @@ -9,8 +9,8 @@ fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { fn main() { let behold: isize = 2; let with_tears: usize = 3; - light_flows_our_war_of_mocking_words(&(behold as usize)); - //~^ ERROR mismatched types [E0308] - light_flows_our_war_of_mocking_words(&(with_tears + 4)); - //~^ ERROR mismatched types [E0308] + light_flows_our_war_of_mocking_words({&usize}); + //~^ ERROR arguments to this function are incorrect [E0308] + light_flows_our_war_of_mocking_words({&usize}); + //~^ ERROR arguments to this function are incorrect [E0308] } diff --git a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs index c8494612ca340..f714aa36cf8a9 100644 --- a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs +++ b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.rs @@ -10,7 +10,7 @@ fn main() { let behold: isize = 2; let with_tears: usize = 3; light_flows_our_war_of_mocking_words(behold as usize); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] light_flows_our_war_of_mocking_words(with_tears + 4); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] } diff --git a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr index 2d666e2b66c25..6e2439602c43e 100644 --- a/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr +++ b/src/test/ui/issues/issue-46756-consider-borrowing-cast-or-binexpr.stderr @@ -1,20 +1,38 @@ -error[E0308]: mismatched types - --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:12:42 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:12:5 | LL | light_flows_our_war_of_mocking_words(behold as usize); - | ^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------^ | | | expected `&usize`, found `usize` - | help: consider borrowing here: `&(behold as usize)` + | +note: function defined here + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:5:4 + | +LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- +help: provide an argument of the correct type + | +LL | light_flows_our_war_of_mocking_words({&usize}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:14:42 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:14:5 | LL | light_flows_our_war_of_mocking_words(with_tears + 4); - | ^^^^^^^^^^^^^^ + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^--------------^ | | - | expected `&usize`, found `usize` - | help: consider borrowing here: `&(with_tears + 4)` + | expected `&usize`, found `_` + | +note: function defined here + --> $DIR/issue-46756-consider-borrowing-cast-or-binexpr.rs:5:4 + | +LL | fn light_flows_our_war_of_mocking_words(and_yet: &usize) -> usize { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ --------------- +help: provide an argument of the correct type + | +LL | light_flows_our_war_of_mocking_words({&usize}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/issues/issue-48364.rs b/src/test/ui/issues/issue-48364.rs index 14ee75e7c9cb6..6c6a6ca4bba01 100644 --- a/src/test/ui/issues/issue-48364.rs +++ b/src/test/ui/issues/issue-48364.rs @@ -1,6 +1,6 @@ fn foo() -> bool { b"".starts_with(stringify!(foo)) - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } fn main() {} diff --git a/src/test/ui/issues/issue-48364.stderr b/src/test/ui/issues/issue-48364.stderr index 5ccede308a1c1..347c0aa8913e3 100644 --- a/src/test/ui/issues/issue-48364.stderr +++ b/src/test/ui/issues/issue-48364.stderr @@ -1,12 +1,13 @@ -error[E0308]: mismatched types - --> $DIR/issue-48364.rs:2:21 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-48364.rs:2:9 | LL | b"".starts_with(stringify!(foo)) - | ^^^^^^^^^^^^^^^ expected slice `[u8]`, found `str` + | ^^^^^^^^^^^ --------------- expected `&[u8]`, found `&'static str` | - = note: expected reference `&[u8]` - found reference `&'static str` - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) +help: provide an argument of the correct type + | +LL | b"".({&[u8]})(stringify!(foo)) + | ^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-4935.rs b/src/test/ui/issues/issue-4935.rs index b342bbb1b8eab..27cfa7a728129 100644 --- a/src/test/ui/issues/issue-4935.rs +++ b/src/test/ui/issues/issue-4935.rs @@ -3,4 +3,4 @@ fn foo(a: usize) {} //~^ defined here fn main() { foo(5, 6) } -//~^ ERROR this function takes 1 argument but 2 arguments were supplied +//~^ ERROR arguments to this function are incorrect diff --git a/src/test/ui/issues/issue-4935.stderr b/src/test/ui/issues/issue-4935.stderr index 03b9b91edefb2..4de960e65a1da 100644 --- a/src/test/ui/issues/issue-4935.stderr +++ b/src/test/ui/issues/issue-4935.stderr @@ -1,17 +1,21 @@ -error[E0061]: this function takes 1 argument but 2 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/issue-4935.rs:5:13 | LL | fn main() { foo(5, 6) } - | ^^^ - - supplied 2 arguments - | | - | expected 1 argument + | ^^^^-^^^^ + | | + | argument of type usize unexpected | note: function defined here --> $DIR/issue-4935.rs:3:4 | LL | fn foo(a: usize) {} | ^^^ -------- +help: remove the extra argument + | +LL | fn main() { foo(5) } + | ^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/issues/issue-51154.rs b/src/test/ui/issues/issue-51154.rs index 12903f79010cb..ac5bd8aeea1b7 100644 --- a/src/test/ui/issues/issue-51154.rs +++ b/src/test/ui/issues/issue-51154.rs @@ -1,6 +1,6 @@ fn foo() { let _: Box = Box::new(|| ()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } fn main() {} diff --git a/src/test/ui/issues/issue-51154.stderr b/src/test/ui/issues/issue-51154.stderr index 3c3428f3096a8..aa4c89bb35c52 100644 --- a/src/test/ui/issues/issue-51154.stderr +++ b/src/test/ui/issues/issue-51154.stderr @@ -1,14 +1,15 @@ -error[E0308]: mismatched types - --> $DIR/issue-51154.rs:2:30 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-51154.rs:2:21 | -LL | fn foo() { - | - this type parameter LL | let _: Box = Box::new(|| ()); - | ^^^^^ expected type parameter `F`, found closure + | ^^^^^^^^^-----^ + | | + | expected `F` | - = note: expected type parameter `F` - found closure `[closure@$DIR/issue-51154.rs:2:30: 2:35]` - = help: every closure has a distinct type and so could not always match the caller-chosen type of parameter `F` +help: provide an argument of the correct type + | +LL | let _: Box = ({F}); + | ^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-5216.rs b/src/test/ui/issues/issue-5216.rs index 35b343edfbdbe..1194832fdc710 100644 --- a/src/test/ui/issues/issue-5216.rs +++ b/src/test/ui/issues/issue-5216.rs @@ -1,6 +1,6 @@ fn f() { } struct S(Box); -pub static C: S = S(f); //~ ERROR mismatched types +pub static C: S = S(f); //~ ERROR arguments to this function are incorrect fn g() { } diff --git a/src/test/ui/issues/issue-5216.stderr b/src/test/ui/issues/issue-5216.stderr index 7a1f42adf65d4..095041566916d 100644 --- a/src/test/ui/issues/issue-5216.stderr +++ b/src/test/ui/issues/issue-5216.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-5216.rs:3:21 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-5216.rs:3:19 | LL | pub static C: S = S(f); - | ^ expected struct `Box`, found fn item + | ^^-^ + | | + | expected `Box<(dyn FnMut() + 'static)>`, found `fn() {f}` | - = note: expected struct `Box<(dyn FnMut() + 'static)>` - found fn item `fn() {f}` +note: tuple struct defined here + --> $DIR/issue-5216.rs:2:1 + | +LL | struct S(Box); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | pub static C: S = struct S(Box);({Box<(dyn FnMut() + 'static)>}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-5216.rs:8:19 diff --git a/src/test/ui/issues/issue-52533-1.rs b/src/test/ui/issues/issue-52533-1.rs index c80f43237fc76..3279977d83253 100644 --- a/src/test/ui/issues/issue-52533-1.rs +++ b/src/test/ui/issues/issue-52533-1.rs @@ -7,5 +7,5 @@ fn gimme(_: impl for<'a, 'b, 'c> FnOnce(&'a Foo<'a, 'b, u32>, fn main() { gimme(|x, y| y) - //~^ ERROR mismatched types [E0308] + //~^ ERROR mismatched types } diff --git a/src/test/ui/issues/issue-61106.rs b/src/test/ui/issues/issue-61106.rs index 308ef1de3ccc3..bcfa5489f5194 100644 --- a/src/test/ui/issues/issue-61106.rs +++ b/src/test/ui/issues/issue-61106.rs @@ -1,6 +1,6 @@ fn main() { let x = String::new(); - foo(x.clone()); //~ ERROR mismatched types + foo(x.clone()); //~ ERROR arguments to this function are incorrect } fn foo(_: &str) {} diff --git a/src/test/ui/issues/issue-61106.stderr b/src/test/ui/issues/issue-61106.stderr index 2d841d28ee26d..9730a5eb39d86 100644 --- a/src/test/ui/issues/issue-61106.stderr +++ b/src/test/ui/issues/issue-61106.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-61106.rs:3:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-61106.rs:3:5 | LL | foo(x.clone()); - | ^^^^^^^^^ + | ^^^^---------^ | | - | expected `&str`, found struct `String` - | help: consider borrowing here: `&x` + | expected `&str`, found `String` + | +note: function defined here + --> $DIR/issue-61106.rs:6:4 + | +LL | fn foo(_: &str) {} + | ^^^ ------- +help: provide an argument of the correct type + | +LL | foo({&str}); + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/issues/issue-61882.rs b/src/test/ui/issues/issue-61882.rs index 013398b4598a8..8ed4847da66a3 100644 --- a/src/test/ui/issues/issue-61882.rs +++ b/src/test/ui/issues/issue-61882.rs @@ -2,7 +2,7 @@ struct A(T); impl A { const B: A = Self(0); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| ERROR mismatched types } diff --git a/src/test/ui/issues/issue-61882.stderr b/src/test/ui/issues/issue-61882.stderr index 09ffe8e64b1b1..cf10532d68114 100644 --- a/src/test/ui/issues/issue-61882.stderr +++ b/src/test/ui/issues/issue-61882.stderr @@ -1,8 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-61882.rs:4:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-61882.rs:4:22 | LL | const B: A = Self(0); - | ^ expected `bool`, found integer + | ^^^^^-^ + | | + | expected `bool`, found `{integer}` + | +note: tuple struct defined here + --> $DIR/issue-61882.rs:1:1 + | +LL | struct A(T); + | ^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | const B: A = struct A(T);({bool}); + | ^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-61882.rs:4:22 diff --git a/src/test/ui/issues/issue-69306.rs b/src/test/ui/issues/issue-69306.rs index 85d60952ac823..da4f3162fc218 100644 --- a/src/test/ui/issues/issue-69306.rs +++ b/src/test/ui/issues/issue-69306.rs @@ -3,12 +3,12 @@ fn main() {} struct S0(T); impl S0 { const C: S0 = Self(0); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| ERROR mismatched types fn foo() { Self(0); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } } @@ -24,14 +24,14 @@ trait Foo { } impl Foo for as Fun>::Out { fn foo() { - Self(0); //~ ERROR mismatched types + Self(0); //~ ERROR arguments to this function are incorrect } } struct S1(T, U); impl S1 { const C: S1 = Self(0, 1); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| ERROR mismatched types } @@ -39,7 +39,7 @@ struct S2(T); impl S2 { fn map(x: U) -> S2 { Self(x) - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| ERROR mismatched types } } diff --git a/src/test/ui/issues/issue-69306.stderr b/src/test/ui/issues/issue-69306.stderr index 58e85ec700d2d..5b84ff59283db 100644 --- a/src/test/ui/issues/issue-69306.stderr +++ b/src/test/ui/issues/issue-69306.stderr @@ -1,13 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/issue-69306.rs:5:28 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-69306.rs:5:23 | -LL | impl S0 { - | - this type parameter LL | const C: S0 = Self(0); - | ^ expected type parameter `T`, found integer + | ^^^^^-^ + | | + | expected `T`, found `{integer}` | - = note: expected type parameter `T` - found type `{integer}` +note: tuple struct defined here + --> $DIR/issue-69306.rs:3:1 + | +LL | struct S0(T); + | ^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | const C: S0 = struct S0(T);({T}); + | ^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-69306.rs:5:23 @@ -20,40 +27,59 @@ LL | const C: S0 = Self(0); = note: expected struct `S0` found struct `S0` -error[E0308]: mismatched types - --> $DIR/issue-69306.rs:10:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-69306.rs:10:9 | -LL | impl S0 { - | - this type parameter -... LL | Self(0); - | ^ expected type parameter `T`, found integer + | ^^^^^-^ + | | + | expected `T`, found `{integer}` + | +note: tuple struct defined here + --> $DIR/issue-69306.rs:3:1 | - = note: expected type parameter `T` - found type `{integer}` +LL | struct S0(T); + | ^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | struct S0(T);({T}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-69306.rs:27:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-69306.rs:27:9 | -LL | impl Foo for as Fun>::Out { - | - this type parameter -LL | fn foo() { LL | Self(0); - | ^ expected type parameter `T`, found integer + | ^^^^^-^ + | | + | expected `T`, found `{integer}` + | +note: tuple struct defined here + --> $DIR/issue-69306.rs:3:1 + | +LL | struct S0(T); + | ^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type | - = note: expected type parameter `T` - found type `{integer}` +LL | struct S0(T);({T}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-69306.rs:33:32 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-69306.rs:33:27 | -LL | impl S1 { - | - this type parameter LL | const C: S1 = Self(0, 1); - | ^ expected type parameter `T`, found integer + | ^^^^^-^^^^ + | | + | expected `T`, found `{integer}` | - = note: expected type parameter `T` - found type `{integer}` +note: tuple struct defined here + --> $DIR/issue-69306.rs:31:1 + | +LL | struct S1(T, U); + | ^^^^^^^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | const C: S1 = struct S1(T, U);({T}, 1); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/issue-69306.rs:33:27 @@ -66,20 +92,23 @@ LL | const C: S1 = Self(0, 1); = note: expected struct `S1` found struct `S1` -error[E0308]: mismatched types - --> $DIR/issue-69306.rs:41:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-69306.rs:41:9 | -LL | impl S2 { - | - expected type parameter -LL | fn map(x: U) -> S2 { - | - found type parameter LL | Self(x) - | ^ expected type parameter `T`, found type parameter `U` + | ^^^^^-^ + | | + | expected `T`, found `U` + | +note: tuple struct defined here + --> $DIR/issue-69306.rs:38:1 + | +LL | struct S2(T); + | ^^^^^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | struct S2(T);({T}) | - = note: expected type parameter `T` - found type parameter `U` - = note: a type parameter was expected, but a different one was found; you might be missing a type parameter or trait bound - = note: for more information, visit https://doc.rust-lang.org/book/ch10-02-traits.html#traits-as-parameters error[E0308]: mismatched types --> $DIR/issue-69306.rs:41:9 diff --git a/src/test/ui/liveness/liveness-closure-require-ret.rs b/src/test/ui/liveness/liveness-closure-require-ret.rs index b86d1fe4a660c..1ccc64d2c283c 100644 --- a/src/test/ui/liveness/liveness-closure-require-ret.rs +++ b/src/test/ui/liveness/liveness-closure-require-ret.rs @@ -1,2 +1,3 @@ fn force(f: F) -> isize where F: FnOnce() -> isize { f() } -fn main() { println!("{}", force(|| {})); } //~ ERROR mismatched types +fn main() { println!("{}", force(|| {})); } +//~^ ERROR mismatched types diff --git a/src/test/ui/liveness/liveness-return-last-stmt-semi.rs b/src/test/ui/liveness/liveness-return-last-stmt-semi.rs index e8909c4a5ae9b..ad53644aed20d 100644 --- a/src/test/ui/liveness/liveness-return-last-stmt-semi.rs +++ b/src/test/ui/liveness/liveness-return-last-stmt-semi.rs @@ -2,7 +2,7 @@ // regression test for #8005 macro_rules! test { () => { fn foo() -> i32 { 1; } } } - //~^ ERROR mismatched types +//~^ ERROR mismatched types fn no_return() -> i32 {} //~ ERROR mismatched types diff --git a/src/test/ui/loops/loop-labeled-break-value.rs b/src/test/ui/loops/loop-labeled-break-value.rs index 3488b057bc5d2..92c07f56cebe3 100644 --- a/src/test/ui/loops/loop-labeled-break-value.rs +++ b/src/test/ui/loops/loop-labeled-break-value.rs @@ -3,9 +3,11 @@ fn main() { let _: i32 = loop { break }; //~ ERROR mismatched types } loop { - let _: i32 = 'inner: loop { break 'inner }; //~ ERROR mismatched types + let _: i32 = 'inner: loop { break 'inner }; + //~^ ERROR mismatched types } loop { - let _: i32 = 'inner2: loop { loop { break 'inner2 } }; //~ ERROR mismatched types + let _: i32 = 'inner2: loop { loop { break 'inner2 } }; + //~^ ERROR mismatched types } } diff --git a/src/test/ui/loops/loop-labeled-break-value.stderr b/src/test/ui/loops/loop-labeled-break-value.stderr index aa04d330f25d7..1b42fa8a74ba9 100644 --- a/src/test/ui/loops/loop-labeled-break-value.stderr +++ b/src/test/ui/loops/loop-labeled-break-value.stderr @@ -17,7 +17,7 @@ LL | let _: i32 = 'inner: loop { break 'inner }; | help: give it a value of the expected type: `break 'inner 42` error[E0308]: mismatched types - --> $DIR/loop-labeled-break-value.rs:9:45 + --> $DIR/loop-labeled-break-value.rs:10:45 | LL | let _: i32 = 'inner2: loop { loop { break 'inner2 } }; | ^^^^^^^^^^^^^ diff --git a/src/test/ui/match/match-tag-nullary.rs b/src/test/ui/match/match-tag-nullary.rs index bb2f599694499..d65f1bfd53887 100644 --- a/src/test/ui/match/match-tag-nullary.rs +++ b/src/test/ui/match/match-tag-nullary.rs @@ -1,4 +1,5 @@ enum A { A } enum B { B } -fn main() { let x: A = A::A; match x { B::B => { } } } //~ ERROR mismatched types +fn main() { let x: A = A::A; match x { B::B => { } } } +//~^ ERROR mismatched types diff --git a/src/test/ui/match/match-tag-unary.rs b/src/test/ui/match/match-tag-unary.rs index aedceafb4398e..487521bc4eb36 100644 --- a/src/test/ui/match/match-tag-unary.rs +++ b/src/test/ui/match/match-tag-unary.rs @@ -1,4 +1,5 @@ enum A { A(isize) } enum B { B(isize) } -fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } //~ ERROR mismatched types +fn main() { let x: A = A::A(0); match x { B::B(y) => { } } } +//~^ ERROR mismatched types diff --git a/src/test/ui/methods/method-call-err-msg.rs b/src/test/ui/methods/method-call-err-msg.rs index 9bfacc7babf2e..ec6624f06ba49 100644 --- a/src/test/ui/methods/method-call-err-msg.rs +++ b/src/test/ui/methods/method-call-err-msg.rs @@ -10,13 +10,13 @@ impl Foo { fn main() { let x = Foo; - x.zero(0) //~ ERROR this function takes 0 arguments but 1 argument was supplied - .one() //~ ERROR this function takes 1 argument but 0 arguments were supplied - .two(0); //~ ERROR this function takes 2 arguments but 1 argument was supplied + x.zero(0) //~ ERROR arguments to this function are incorrect + .one() //~ ERROR arguments to this function are incorrect + .two(0); //~ ERROR arguments to this function are incorrect let y = Foo; y.zero() .take() //~ ERROR no method named `take` found .one(0); - y.three::(); //~ ERROR this function takes 3 arguments but 0 arguments were supplied + y.three::(); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/methods/method-call-err-msg.stderr b/src/test/ui/methods/method-call-err-msg.stderr index 60f9eeeca27fe..b636c3d3fe939 100644 --- a/src/test/ui/methods/method-call-err-msg.stderr +++ b/src/test/ui/methods/method-call-err-msg.stderr @@ -1,44 +1,50 @@ -error[E0061]: this function takes 0 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/method-call-err-msg.rs:13:7 | LL | x.zero(0) - | ^^^^ - supplied 1 argument - | | - | expected 0 arguments + | ^^^^ - argument unexpected | note: associated function defined here --> $DIR/method-call-err-msg.rs:5:8 | LL | fn zero(self) -> Foo { self } | ^^^^ ---- +help: remove the extra argument + | +LL | x.zero()(0) + | ^^^^^^ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/method-call-err-msg.rs:14:7 | LL | .one() - | ^^^- supplied 0 arguments - | | - | expected 1 argument + | ^^^ an argument of type isize is missing | note: associated function defined here --> $DIR/method-call-err-msg.rs:6:8 | LL | fn one(self, _: isize) -> Foo { self } | ^^^ ---- -------- +help: provide the argument + | +LL | .one({isize})() + | ^^^^^^^^^^^^ -error[E0061]: this function takes 2 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/method-call-err-msg.rs:15:7 | LL | .two(0); - | ^^^ - supplied 1 argument - | | - | expected 2 arguments + | ^^^ an argument of type isize is missing | note: associated function defined here --> $DIR/method-call-err-msg.rs:7:8 | LL | fn two(self, _: isize, _: isize) -> Foo { self } | ^^^ ---- -------- -------- +help: provide the argument + | +LL | .two(0, {isize})(0); + | ^^^^^^^^^^^^^^^ error[E0599]: no method named `take` found for struct `Foo` in the current scope --> $DIR/method-call-err-msg.rs:19:7 @@ -59,21 +65,27 @@ LL | .take() = note: the following trait defines an item `take`, perhaps you need to implement it: candidate #1: `Iterator` -error[E0061]: this function takes 3 arguments but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/method-call-err-msg.rs:21:7 | LL | y.three::(); - | ^^^^^--------- supplied 0 arguments + | ^^^^^ | | - | expected 3 arguments + | an argument of type usize is missing + | an argument of type usize is missing + | an argument of type usize is missing | note: associated function defined here --> $DIR/method-call-err-msg.rs:8:8 | LL | fn three(self, _: T, _: T, _: T) -> Foo { self } | ^^^^^ ---- ---- ---- ---- +help: did you mean + | +LL | y.three({usize}, {usize}, {usize})::(); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 5 previous errors -Some errors have detailed explanations: E0061, E0599. -For more information about an error, try `rustc --explain E0061`. +Some errors have detailed explanations: E0308, E0599. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/methods/method-self-arg-1.rs b/src/test/ui/methods/method-self-arg-1.rs index f589f20d81ddf..0b43d530eb042 100644 --- a/src/test/ui/methods/method-self-arg-1.rs +++ b/src/test/ui/methods/method-self-arg-1.rs @@ -8,9 +8,9 @@ impl Foo { fn main() { let x = Foo; - Foo::bar(x); //~ ERROR mismatched types + Foo::bar(x); //~ ERROR arguments to this function are incorrect //~| expected `&Foo`, found struct `Foo` - Foo::bar(&42); //~ ERROR mismatched types + Foo::bar(&42); //~ ERROR arguments to this function are incorrect //~| expected struct `Foo`, found integer //~| expected reference `&Foo` //~| found reference `&{integer}` diff --git a/src/test/ui/methods/method-self-arg-1.stderr b/src/test/ui/methods/method-self-arg-1.stderr index 17ea61fc4bddb..3023cda9a0cd6 100644 --- a/src/test/ui/methods/method-self-arg-1.stderr +++ b/src/test/ui/methods/method-self-arg-1.stderr @@ -1,20 +1,38 @@ -error[E0308]: mismatched types - --> $DIR/method-self-arg-1.rs:11:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/method-self-arg-1.rs:11:5 | LL | Foo::bar(x); - | ^ + | ^^^^^^^^^-^ | | - | expected `&Foo`, found struct `Foo` - | help: consider borrowing here: `&x` + | expected `&Foo`, found `Foo` + | +note: associated function defined here + --> $DIR/method-self-arg-1.rs:6:8 + | +LL | fn bar(&self) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | bar({&Foo}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/method-self-arg-1.rs:13:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/method-self-arg-1.rs:13:5 | LL | Foo::bar(&42); - | ^^^ expected struct `Foo`, found integer + | ^^^^^^^^^---^ + | | + | expected `&Foo`, found `&{integer}` + | +note: associated function defined here + --> $DIR/method-self-arg-1.rs:6:8 + | +LL | fn bar(&self) {} + | ^^^ ----- +help: provide an argument of the correct type | - = note: expected reference `&Foo` - found reference `&{integer}` +LL | bar({&Foo}); + | ^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/mismatched_types/issue-26480.rs b/src/test/ui/mismatched_types/issue-26480.rs index d140e12b04d38..2b1584d3aa3ee 100644 --- a/src/test/ui/mismatched_types/issue-26480.rs +++ b/src/test/ui/mismatched_types/issue-26480.rs @@ -13,7 +13,8 @@ macro_rules! write { const stdout: i32 = 1; unsafe { write(stdout, $arr.as_ptr() as *const i8, - $arr.len() * size_of($arr[0])); //~ ERROR mismatched types + $arr.len() * size_of($arr[0])); + //~^ ERROR mismatched types } }} } diff --git a/src/test/ui/mismatched_types/issue-35030.rs b/src/test/ui/mismatched_types/issue-35030.rs index 91ea7ea80c3d7..45bc2205433ea 100644 --- a/src/test/ui/mismatched_types/issue-35030.rs +++ b/src/test/ui/mismatched_types/issue-35030.rs @@ -6,7 +6,7 @@ trait Parser { impl Parser for bool { fn parse(text: &str) -> Option { - Some(true) //~ ERROR mismatched types + Some(true) //~ ERROR arguments to this function are incorrect } } diff --git a/src/test/ui/mismatched_types/issue-35030.stderr b/src/test/ui/mismatched_types/issue-35030.stderr index 9f4e4398984ae..bbc66ef64b5b3 100644 --- a/src/test/ui/mismatched_types/issue-35030.stderr +++ b/src/test/ui/mismatched_types/issue-35030.stderr @@ -1,14 +1,15 @@ -error[E0308]: mismatched types - --> $DIR/issue-35030.rs:9:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-35030.rs:9:9 | -LL | impl Parser for bool { - | ---- this type parameter -LL | fn parse(text: &str) -> Option { LL | Some(true) - | ^^^^ expected type parameter `bool`, found `bool` + | ^^^^^----^ + | | + | expected `bool`, found `bool` | - = note: expected type parameter `bool` (type parameter `bool`) - found type `bool` (`bool`) +help: provide an argument of the correct type + | +LL | ({bool}) + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.rs b/src/test/ui/mismatched_types/numeric-literal-cast.rs index 69cfe262fdf42..1f1caaaf7fa75 100644 --- a/src/test/ui/mismatched_types/numeric-literal-cast.rs +++ b/src/test/ui/mismatched_types/numeric-literal-cast.rs @@ -4,9 +4,9 @@ fn foo2(_: i32) {} fn main() { foo(1u8); -//~^ ERROR mismatched types +//~^ ERROR arguments to this function are incorrect foo1(2f32); -//~^ ERROR mismatched types +//~^ ERROR arguments to this function are incorrect foo2(3i16); -//~^ ERROR mismatched types +//~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/mismatched_types/numeric-literal-cast.stderr b/src/test/ui/mismatched_types/numeric-literal-cast.stderr index 22a6df8902596..23a1cd8dc7d9a 100644 --- a/src/test/ui/mismatched_types/numeric-literal-cast.stderr +++ b/src/test/ui/mismatched_types/numeric-literal-cast.stderr @@ -1,35 +1,56 @@ -error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:6:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-literal-cast.rs:6:5 | LL | foo(1u8); - | ^^^ expected `u16`, found `u8` + | ^^^^---^ + | | + | expected `u16`, found `u8` | -help: change the type of the numeric literal from `u8` to `u16` +note: function defined here + --> $DIR/numeric-literal-cast.rs:1:4 | -LL | foo(1u16); - | ^^^^ +LL | fn foo(_: u16) {} + | ^^^ ------ +help: provide an argument of the correct type + | +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:8:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-literal-cast.rs:8:5 | LL | foo1(2f32); - | ^^^^ expected `f64`, found `f32` + | ^^^^^----^ + | | + | expected `f64`, found `f32` + | +note: function defined here + --> $DIR/numeric-literal-cast.rs:2:4 | -help: change the type of the numeric literal from `f32` to `f64` +LL | fn foo1(_: f64) {} + | ^^^^ ------ +help: provide an argument of the correct type | -LL | foo1(2f64); - | ^^^^ +LL | foo1({f64}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-literal-cast.rs:10:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-literal-cast.rs:10:5 | LL | foo2(3i16); - | ^^^^ expected `i32`, found `i16` + | ^^^^^----^ + | | + | expected `i32`, found `i16` + | +note: function defined here + --> $DIR/numeric-literal-cast.rs:3:4 | -help: change the type of the numeric literal from `i16` to `i32` +LL | fn foo2(_: i32) {} + | ^^^^ ------ +help: provide an argument of the correct type | -LL | foo2(3i32); - | ^^^^ +LL | foo2({i32}); + | ^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.rs b/src/test/ui/mismatched_types/overloaded-calls-bad.rs index 902a6ec81d60b..21300467d5e6e 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.rs +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.rs @@ -25,9 +25,9 @@ fn main() { x: 3, y: 3, }; - let ans = s("what"); //~ ERROR mismatched types + let ans = s("what"); //~ ERROR arguments to this function are incorrect let ans = s(); - //~^ ERROR this function takes 1 argument but 0 arguments were supplied + //~^ ERROR arguments to this function are incorrect let ans = s("burma", "shave"); - //~^ ERROR this function takes 1 argument but 2 arguments were supplied + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr index 706e25529bfaf..ae20d7a36b074 100644 --- a/src/test/ui/mismatched_types/overloaded-calls-bad.stderr +++ b/src/test/ui/mismatched_types/overloaded-calls-bad.stderr @@ -1,26 +1,41 @@ -error[E0308]: mismatched types - --> $DIR/overloaded-calls-bad.rs:28:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/overloaded-calls-bad.rs:28:15 | LL | let ans = s("what"); - | ^^^^^^ expected `isize`, found `&str` + | ^^------^ + | | + | expected `isize`, found `&'static str` + | +help: provide an argument of the correct type + | +LL | let ans = ({isize}); + | ^^^^^^^^^ -error[E0057]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/overloaded-calls-bad.rs:29:15 | LL | let ans = s(); - | ^-- supplied 0 arguments - | | - | expected 1 argument + | ^^^ an argument of type isize is missing + | +help: provide the argument + | +LL | let ans = ({isize}); + | ^^^^^^^^^ -error[E0057]: this function takes 1 argument but 2 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/overloaded-calls-bad.rs:31:15 | LL | let ans = s("burma", "shave"); - | ^ ------- ------- supplied 2 arguments - | | - | expected 1 argument + | ^^-------^^^^^^^^^^ + | | + | expected `isize`, found `&'static str` + | argument of type isize unexpected + | +help: did you mean + | +LL | let ans = ({isize}); + | ^^^^^^^^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0057, E0308. -For more information about an error, try `rustc --explain E0057`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs index 882533992bd3c..b7ff461549b34 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.rs @@ -10,7 +10,7 @@ fn c(x: Box) { } fn d(x: Box) { - a(x); //~ ERROR mismatched types [E0308] + a(x); //~ ERROR arguments to this function are incorrect [E0308] } fn main() { } diff --git a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr index 485fae6d4d9ff..41960825e7852 100644 --- a/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr +++ b/src/test/ui/mismatched_types/trait-bounds-cant-coerce.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/trait-bounds-cant-coerce.rs:13:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-bounds-cant-coerce.rs:13:5 | LL | a(x); - | ^ expected trait `Foo + Send`, found trait `Foo` + | ^^-^ + | | + | expected `Box<(dyn Foo + Send + 'static)>`, found `Box<(dyn Foo + 'static)>` | - = note: expected struct `Box<(dyn Foo + Send + 'static)>` - found struct `Box<(dyn Foo + 'static)>` +note: function defined here + --> $DIR/trait-bounds-cant-coerce.rs:5:4 + | +LL | fn a(_x: Box) { + | ^ ----------------------- +help: provide an argument of the correct type + | +LL | a({Box<(dyn Foo + Send + 'static)>}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/mut/mut-cross-borrowing.rs b/src/test/ui/mut/mut-cross-borrowing.rs index 63e49c292eac7..7f7e6d7e0d422 100644 --- a/src/test/ui/mut/mut-cross-borrowing.rs +++ b/src/test/ui/mut/mut-cross-borrowing.rs @@ -4,5 +4,5 @@ fn f(_: &mut isize) {} fn main() { let mut x: Box<_> = box 3; - f(x) //~ ERROR mismatched types + f(x) //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/mut/mut-cross-borrowing.stderr b/src/test/ui/mut/mut-cross-borrowing.stderr index b77813f8af0b4..3d2fa1abfe54d 100644 --- a/src/test/ui/mut/mut-cross-borrowing.stderr +++ b/src/test/ui/mut/mut-cross-borrowing.stderr @@ -1,14 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/mut-cross-borrowing.rs:7:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/mut-cross-borrowing.rs:7:5 | LL | f(x) - | ^ + | ^^-^ | | - | expected `&mut isize`, found struct `Box` - | help: consider mutably borrowing here: `&mut x` + | expected `&mut isize`, found `Box<{integer}>` | - = note: expected mutable reference `&mut isize` - found struct `Box<{integer}>` +note: function defined here + --> $DIR/mut-cross-borrowing.rs:3:4 + | +LL | fn f(_: &mut isize) {} + | ^ ------------- +help: provide an argument of the correct type + | +LL | f({&mut isize}) + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/never_type/call-fn-never-arg-wrong-type.rs b/src/test/ui/never_type/call-fn-never-arg-wrong-type.rs index d06637e74a2f2..3c5125bb6053a 100644 --- a/src/test/ui/never_type/call-fn-never-arg-wrong-type.rs +++ b/src/test/ui/never_type/call-fn-never-arg-wrong-type.rs @@ -7,5 +7,5 @@ fn foo(x: !) -> ! { } fn main() { - foo("wow"); //~ ERROR mismatched types + foo("wow"); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/never_type/call-fn-never-arg-wrong-type.stderr b/src/test/ui/never_type/call-fn-never-arg-wrong-type.stderr index eacef1dc3302d..de8b6e7115edb 100644 --- a/src/test/ui/never_type/call-fn-never-arg-wrong-type.stderr +++ b/src/test/ui/never_type/call-fn-never-arg-wrong-type.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/call-fn-never-arg-wrong-type.rs:10:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/call-fn-never-arg-wrong-type.rs:10:5 | LL | foo("wow"); - | ^^^^^ expected `!`, found `&str` + | ^^^^-----^ + | | + | expected `!`, found `&'static str` | - = note: expected type `!` - found reference `&'static str` +note: function defined here + --> $DIR/call-fn-never-arg-wrong-type.rs:5:4 + | +LL | fn foo(x: !) -> ! { + | ^^^ ---- +help: provide an argument of the correct type + | +LL | foo({!}); + | ^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/not-enough-arguments.rs b/src/test/ui/not-enough-arguments.rs index 4247625518871..3bcdbbd4ac811 100644 --- a/src/test/ui/not-enough-arguments.rs +++ b/src/test/ui/not-enough-arguments.rs @@ -25,7 +25,7 @@ fn bar( fn main() { foo(1, 2, 3); - //~^ ERROR this function takes 4 arguments but 3 + //~^ ERROR arguments to this function are incorrect bar(1, 2, 3); - //~^ ERROR this function takes 6 arguments but 3 + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/not-enough-arguments.stderr b/src/test/ui/not-enough-arguments.stderr index df95783724148..0e56123e91151 100644 --- a/src/test/ui/not-enough-arguments.stderr +++ b/src/test/ui/not-enough-arguments.stderr @@ -1,24 +1,28 @@ -error[E0061]: this function takes 4 arguments but 3 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/not-enough-arguments.rs:27:3 | LL | foo(1, 2, 3); - | ^^^ - - - supplied 3 arguments - | | - | expected 4 arguments + | ^^^^^^^^^^^^ an argument of type isize is missing | note: function defined here --> $DIR/not-enough-arguments.rs:5:4 | LL | fn foo(a: isize, b: isize, c: isize, d:isize) { | ^^^ -------- -------- -------- ------- +help: provide the argument + | +LL | foo(1, 2, 3, {isize}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0061]: this function takes 6 arguments but 3 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/not-enough-arguments.rs:29:3 | LL | bar(1, 2, 3); - | ^^^ - - - supplied 3 arguments + | ^^^^^^^^^^^^ | | - | expected 6 arguments + | an argument of type i32 is missing + | an argument of type i32 is missing + | an argument of type i32 is missing | note: function defined here --> $DIR/not-enough-arguments.rs:10:4 @@ -37,7 +41,11 @@ LL | e: i32, | ------ LL | f: i32, | ------ +help: did you mean + | +LL | bar(1, 2, 3, {i32}, {i32}, {i32}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/numeric/len.rs b/src/test/ui/numeric/len.rs index a725409882059..1f61d299cfbf9 100644 --- a/src/test/ui/numeric/len.rs +++ b/src/test/ui/numeric/len.rs @@ -1,6 +1,6 @@ fn main() { let array = [1, 2, 3]; - test(array.len()); //~ ERROR mismatched types + test(array.len()); //~ ERROR arguments to this function are incorrect } fn test(length: u32) { diff --git a/src/test/ui/numeric/len.stderr b/src/test/ui/numeric/len.stderr index 79b38b0698631..da8b252f2d21e 100644 --- a/src/test/ui/numeric/len.stderr +++ b/src/test/ui/numeric/len.stderr @@ -1,13 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/len.rs:3:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/len.rs:3:5 | LL | test(array.len()); - | ^^^^^^^^^^^ expected `u32`, found `usize` + | ^^^^^-----------^ + | | + | expected `u32`, found `usize` | -help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/len.rs:6:4 | -LL | test(array.len().try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn test(length: u32) { + | ^^^^ ----------- +help: provide an argument of the correct type + | +LL | test({u32}); + | ^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/numeric/numeric-cast-without-suggestion.rs b/src/test/ui/numeric/numeric-cast-without-suggestion.rs index faf24a8c18efd..4d678e2474482 100644 --- a/src/test/ui/numeric/numeric-cast-without-suggestion.rs +++ b/src/test/ui/numeric/numeric-cast-without-suggestion.rs @@ -14,25 +14,25 @@ fn main() { let x_f64: f64 = 11.0; let x_f32: f32 = 12.0; - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types - foo::(x_f32); //~ ERROR mismatched types - foo::(x_f64); //~ ERROR mismatched types + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect + foo::(x_f32); //~ ERROR arguments to this function are incorrect + foo::(x_f64); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/numeric/numeric-cast-without-suggestion.stderr b/src/test/ui/numeric/numeric-cast-without-suggestion.stderr index a96518a34342d..85c7bdddee804 100644 --- a/src/test/ui/numeric/numeric-cast-without-suggestion.stderr +++ b/src/test/ui/numeric/numeric-cast-without-suggestion.stderr @@ -1,128 +1,380 @@ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:17:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:17:5 | LL | foo::(x_f64); - | ^^^^^ expected `usize`, found `f64` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:18:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:18:5 | LL | foo::(x_f32); - | ^^^^^ expected `usize`, found `f32` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:19:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:19:5 | LL | foo::(x_f64); - | ^^^^^ expected `isize`, found `f64` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:20:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:20:5 | LL | foo::(x_f32); - | ^^^^^ expected `isize`, found `f32` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:21:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:21:5 | LL | foo::(x_f64); - | ^^^^^ expected `u64`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `u64`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:22:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:22:5 | LL | foo::(x_f32); - | ^^^^^ expected `u64`, found `f32` + | ^^^^^^^^^^^-----^ + | | + | expected `u64`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:23:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:23:5 | LL | foo::(x_f64); - | ^^^^^ expected `i64`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `i64`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:24:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:24:5 | LL | foo::(x_f32); - | ^^^^^ expected `i64`, found `f32` + | ^^^^^^^^^^^-----^ + | | + | expected `i64`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:25:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:25:5 | LL | foo::(x_f64); - | ^^^^^ expected `u32`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `u32`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:26:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:26:5 | LL | foo::(x_f32); - | ^^^^^ expected `u32`, found `f32` + | ^^^^^^^^^^^-----^ + | | + | expected `u32`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:27:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:27:5 | LL | foo::(x_f64); - | ^^^^^ expected `i32`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `i32`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:28:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:28:5 | LL | foo::(x_f32); - | ^^^^^ expected `i32`, found `f32` + | ^^^^^^^^^^^-----^ + | | + | expected `i32`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:29:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:29:5 | LL | foo::(x_f64); - | ^^^^^ expected `u16`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:30:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:30:5 | LL | foo::(x_f32); - | ^^^^^ expected `u16`, found `f32` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:31:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:31:5 | LL | foo::(x_f64); - | ^^^^^ expected `i16`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:32:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:32:5 | LL | foo::(x_f32); - | ^^^^^ expected `i16`, found `f32` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:33:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:33:5 | LL | foo::(x_f64); - | ^^^^^ expected `u8`, found `f64` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:34:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:34:5 | LL | foo::(x_f32); - | ^^^^^ expected `u8`, found `f32` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:35:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:35:5 | LL | foo::(x_f64); - | ^^^^^ expected `i8`, found `f64` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:36:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:36:5 | LL | foo::(x_f32); - | ^^^^^ expected `i8`, found `f32` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `f32` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast-without-suggestion.rs:37:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast-without-suggestion.rs:37:5 | LL | foo::(x_f64); - | ^^^^^ expected `f32`, found `f64` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `f64` + | +note: function defined here + --> $DIR/numeric-cast-without-suggestion.rs:1:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ error: aborting due to 21 previous errors diff --git a/src/test/ui/numeric/numeric-cast.fixed b/src/test/ui/numeric/numeric-cast.fixed index cf0560a107772..591e8095b7a3f 100644 --- a/src/test/ui/numeric/numeric-cast.fixed +++ b/src/test/ui/numeric/numeric-cast.fixed @@ -20,274 +20,274 @@ fn main() { let x_f32: f32 = 12.0; foo::(x_usize); - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i8.try_into().unwrap()); - //~^ ERROR mismatched types + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect + foo({usize}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.into()); - //~^ ERROR mismatched types - foo::(x_i8.into()); - //~^ ERROR mismatched types + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect + foo({isize}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u64}); + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - foo::(x_u32.into()); - //~^ ERROR mismatched types - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i8.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect + foo({u64}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.into()); - //~^ ERROR mismatched types - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - foo::(x_i32.into()); - //~^ ERROR mismatched types - foo::(x_i16.into()); - //~^ ERROR mismatched types - foo::(x_i8.into()); - //~^ ERROR mismatched types + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect + foo({i64}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i8.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({u32}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - foo::(x_i16.into()); - //~^ ERROR mismatched types - foo::(x_i8.into()); - //~^ ERROR mismatched types + foo({i32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i8.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect + foo({u16}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect + foo({i16}); + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - foo::(x_i8.into()); - //~^ ERROR mismatched types + foo({i16}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u16.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i8.try_into().unwrap()); - //~^ ERROR mismatched types + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect + foo({u8}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); - foo::(x_usize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u16.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_u8.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_isize.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i64.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i32.try_into().unwrap()); - //~^ ERROR mismatched types - foo::(x_i16.try_into().unwrap()); - //~^ ERROR mismatched types + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect + foo({i8}); + //~^ ERROR arguments to this function are incorrect foo::(x_i8); // foo::(x_f64); // foo::(x_f32); - foo::(x_usize as f64); - //~^ ERROR mismatched types - foo::(x_u64 as f64); - //~^ ERROR mismatched types - foo::(x_u32.into()); - //~^ ERROR mismatched types - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize as f64); - //~^ ERROR mismatched types - foo::(x_i64 as f64); - //~^ ERROR mismatched types - foo::(x_i32.into()); - //~^ ERROR mismatched types - foo::(x_i16.into()); - //~^ ERROR mismatched types - foo::(x_i8.into()); - //~^ ERROR mismatched types + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect + foo({f64}); + //~^ ERROR arguments to this function are incorrect foo::(x_f64); - foo::(x_f32.into()); - //~^ ERROR mismatched types + foo({f64}); + //~^ ERROR arguments to this function are incorrect - foo::(x_usize as f32); - //~^ ERROR mismatched types - foo::(x_u64 as f32); - //~^ ERROR mismatched types - foo::(x_u32 as f32); - //~^ ERROR mismatched types - foo::(x_u16.into()); - //~^ ERROR mismatched types - foo::(x_u8.into()); - //~^ ERROR mismatched types - foo::(x_isize as f32); - //~^ ERROR mismatched types - foo::(x_i64 as f32); - //~^ ERROR mismatched types - foo::(x_i32 as f32); - //~^ ERROR mismatched types - foo::(x_i16.into()); - //~^ ERROR mismatched types - foo::(x_i8.into()); - //~^ ERROR mismatched types + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect + foo({f32}); + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); foo::(x_f32); - foo::((x_u8 as u16).into()); - //~^ ERROR mismatched types - foo::((-x_i8).into()); - //~^ ERROR mismatched types + foo({u32}); + //~^ ERROR arguments to this function are incorrect + foo({i32}); + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/numeric/numeric-cast.rs b/src/test/ui/numeric/numeric-cast.rs index 7bddfc5090535..0306ed22c7e1b 100644 --- a/src/test/ui/numeric/numeric-cast.rs +++ b/src/test/ui/numeric/numeric-cast.rs @@ -21,273 +21,273 @@ fn main() { foo::(x_usize); foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); // foo::(x_f64); // foo::(x_f32); foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_f64); foo::(x_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect // foo::(x_f64); foo::(x_f32); foo::(x_u8 as u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(-x_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/numeric/numeric-cast.stderr b/src/test/ui/numeric/numeric-cast.stderr index ffd6368bac15f..a8873efb2540f 100644 --- a/src/test/ui/numeric/numeric-cast.stderr +++ b/src/test/ui/numeric/numeric-cast.stderr @@ -1,1193 +1,2036 @@ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:23:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:23:5 | LL | foo::(x_u64); - | ^^^^^ expected `usize`, found `u64` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `u64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u64` to a `usize` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:25:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:25:5 | LL | foo::(x_u32); - | ^^^^^ expected `usize`, found `u32` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `u32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u32` to a `usize` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:27:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:27:5 | LL | foo::(x_u16); - | ^^^^^ + | ^^^^^^^^^^^^^-----^ | | | expected `usize`, found `u16` - | help: you can convert a `u16` to a `usize`: `x_u16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:29:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:29:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^^^----^ | | | expected `usize`, found `u8` - | help: you can convert a `u8` to a `usize`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:31:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:31:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `usize`, found `isize` + | ^^^^^^^^^^^^^-------^ + | | + | expected `usize`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to a `usize` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:33:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:33:5 | LL | foo::(x_i64); - | ^^^^^ expected `usize`, found `i64` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to a `usize` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:35:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:35:5 | LL | foo::(x_i32); - | ^^^^^ expected `usize`, found `i32` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `i32` | -help: you can convert an `i32` to a `usize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:37:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:37:5 | LL | foo::(x_i16); - | ^^^^^ expected `usize`, found `i16` + | ^^^^^^^^^^^^^-----^ + | | + | expected `usize`, found `i16` | -help: you can convert an `i16` to a `usize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:39:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:39:5 | LL | foo::(x_i8); - | ^^^^ expected `usize`, found `i8` + | ^^^^^^^^^^^^^----^ + | | + | expected `usize`, found `i8` | -help: you can convert an `i8` to a `usize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i8.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:44:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:44:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `isize`, found `usize` + | ^^^^^^^^^^^^^-------^ + | | + | expected `isize`, found `usize` | -help: you can convert a `usize` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:46:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:46:5 | LL | foo::(x_u64); - | ^^^^^ expected `isize`, found `u64` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `u64` | -help: you can convert a `u64` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:48:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:48:5 | LL | foo::(x_u32); - | ^^^^^ expected `isize`, found `u32` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `u32` | -help: you can convert a `u32` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:50:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:50:5 | LL | foo::(x_u16); - | ^^^^^ expected `isize`, found `u16` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `u16` | -help: you can convert a `u16` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:52:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:52:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^^^----^ | | | expected `isize`, found `u8` - | help: you can convert a `u8` to an `isize`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:55:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:55:5 | LL | foo::(x_i64); - | ^^^^^ expected `isize`, found `i64` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `i64` | -help: you can convert an `i64` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:57:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:57:5 | LL | foo::(x_i32); - | ^^^^^ expected `isize`, found `i32` + | ^^^^^^^^^^^^^-----^ + | | + | expected `isize`, found `i32` | -help: you can convert an `i32` to an `isize` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:59:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:59:5 | LL | foo::(x_i16); - | ^^^^^ + | ^^^^^^^^^^^^^-----^ | | | expected `isize`, found `i16` - | help: you can convert an `i16` to an `isize`: `x_i16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:61:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:61:5 | LL | foo::(x_i8); - | ^^^^ + | ^^^^^^^^^^^^^----^ | | | expected `isize`, found `i8` - | help: you can convert an `i8` to an `isize`: `x_i8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({isize}); + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:66:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:66:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `u64`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `u64`, found `usize` | -help: you can convert a `usize` to a `u64` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:69:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:69:5 | LL | foo::(x_u32); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `u64`, found `u32` - | help: you can convert a `u32` to a `u64`: `x_u32.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:71:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:71:5 | LL | foo::(x_u16); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `u64`, found `u16` - | help: you can convert a `u16` to a `u64`: `x_u16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:73:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:73:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `u64`, found `u8` - | help: you can convert a `u8` to a `u64`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:75:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:75:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `u64`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `u64`, found `isize` | -help: you can convert an `isize` to a `u64` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:77:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:77:5 | LL | foo::(x_i64); - | ^^^^^ expected `u64`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `u64`, found `i64` | -help: you can convert an `i64` to a `u64` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:79:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:79:5 | LL | foo::(x_i32); - | ^^^^^ expected `u64`, found `i32` + | ^^^^^^^^^^^-----^ + | | + | expected `u64`, found `i32` | -help: you can convert an `i32` to a `u64` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:81:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:81:5 | LL | foo::(x_i16); - | ^^^^^ expected `u64`, found `i16` + | ^^^^^^^^^^^-----^ + | | + | expected `u64`, found `i16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i16` to a `u64` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:83:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:83:5 | LL | foo::(x_i8); - | ^^^^ expected `u64`, found `i8` + | ^^^^^^^^^^^----^ + | | + | expected `u64`, found `i8` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i8` to a `u64` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i8.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:88:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:88:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `i64`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `i64`, found `usize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `usize` to an `i64` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:90:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:90:5 | LL | foo::(x_u64); - | ^^^^^ expected `i64`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `i64`, found `u64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u64` to an `i64` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:92:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:92:5 | LL | foo::(x_u32); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i64`, found `u32` - | help: you can convert a `u32` to an `i64`: `x_u32.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:94:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:94:5 | LL | foo::(x_u16); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i64`, found `u16` - | help: you can convert a `u16` to an `i64`: `x_u16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:96:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:96:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `i64`, found `u8` - | help: you can convert a `u8` to an `i64`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:98:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:98:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `i64`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `i64`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to an `i64` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:101:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:101:5 | LL | foo::(x_i32); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i64`, found `i32` - | help: you can convert an `i32` to an `i64`: `x_i32.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:103:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:103:5 | LL | foo::(x_i16); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i64`, found `i16` - | help: you can convert an `i16` to an `i64`: `x_i16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:105:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:105:5 | LL | foo::(x_i8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `i64`, found `i8` - | help: you can convert an `i8` to an `i64`: `x_i8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:110:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:110:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `u32`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `u32`, found `usize` | -help: you can convert a `usize` to a `u32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:112:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:112:5 | LL | foo::(x_u64); - | ^^^^^ expected `u32`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `u32`, found `u64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u64` to a `u32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:115:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:115:5 | LL | foo::(x_u16); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `u32`, found `u16` - | help: you can convert a `u16` to a `u32`: `x_u16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:117:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:117:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `u32`, found `u8` - | help: you can convert a `u8` to a `u32`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:119:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:119:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `u32`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `u32`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to a `u32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:121:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:121:5 | LL | foo::(x_i64); - | ^^^^^ expected `u32`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `u32`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to a `u32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:123:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:123:5 | LL | foo::(x_i32); - | ^^^^^ expected `u32`, found `i32` + | ^^^^^^^^^^^-----^ + | | + | expected `u32`, found `i32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i32` to a `u32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:125:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:125:5 | LL | foo::(x_i16); - | ^^^^^ expected `u32`, found `i16` + | ^^^^^^^^^^^-----^ + | | + | expected `u32`, found `i16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i16` to a `u32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:127:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:127:5 | LL | foo::(x_i8); - | ^^^^ expected `u32`, found `i8` + | ^^^^^^^^^^^----^ + | | + | expected `u32`, found `i8` | -help: you can convert an `i8` to a `u32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i8.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:132:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:132:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `i32`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `i32`, found `usize` | -help: you can convert a `usize` to an `i32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:134:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:134:5 | LL | foo::(x_u64); - | ^^^^^ expected `i32`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `i32`, found `u64` | -help: you can convert a `u64` to an `i32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:136:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:136:5 | LL | foo::(x_u32); - | ^^^^^ expected `i32`, found `u32` + | ^^^^^^^^^^^-----^ + | | + | expected `i32`, found `u32` | -help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:138:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:138:5 | LL | foo::(x_u16); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i32`, found `u16` - | help: you can convert a `u16` to an `i32`: `x_u16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:140:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:140:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `i32`, found `u8` - | help: you can convert a `u8` to an `i32`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:142:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:142:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `i32`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `i32`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to an `i32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:144:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:144:5 | LL | foo::(x_i64); - | ^^^^^ expected `i32`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `i32`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to an `i32` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:147:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:147:5 | LL | foo::(x_i16); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i32`, found `i16` - | help: you can convert an `i16` to an `i32`: `x_i16.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:149:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:149:5 | LL | foo::(x_i8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `i32`, found `i8` - | help: you can convert an `i8` to an `i32`: `x_i8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:154:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:154:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `u16`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `u16`, found `usize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `usize` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:156:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:156:5 | LL | foo::(x_u64); - | ^^^^^ expected `u16`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `u64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u64` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:158:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:158:5 | LL | foo::(x_u32); - | ^^^^^ expected `u16`, found `u32` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `u32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u32` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:161:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:161:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `u16`, found `u8` - | help: you can convert a `u8` to a `u16`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:163:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:163:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `u16`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `u16`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:165:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:165:5 | LL | foo::(x_i64); - | ^^^^^ expected `u16`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:167:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:167:5 | LL | foo::(x_i32); - | ^^^^^ expected `u16`, found `i32` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `i32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:169:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:169:5 | LL | foo::(x_i16); - | ^^^^^ expected `u16`, found `i16` + | ^^^^^^^^^^^-----^ + | | + | expected `u16`, found `i16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i16` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:171:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:171:5 | LL | foo::(x_i8); - | ^^^^ expected `u16`, found `i8` + | ^^^^^^^^^^^----^ + | | + | expected `u16`, found `i8` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i8` to a `u16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i8.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:176:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:176:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `i16`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `i16`, found `usize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `usize` to an `i16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:178:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:178:5 | LL | foo::(x_u64); - | ^^^^^ expected `i16`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `u64` | -help: you can convert a `u64` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:180:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:180:5 | LL | foo::(x_u32); - | ^^^^^ expected `i16`, found `u32` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `u32` | -help: you can convert a `u32` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:182:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:182:5 | LL | foo::(x_u16); - | ^^^^^ expected `i16`, found `u16` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `u16` | -help: you can convert a `u16` to an `i16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:184:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:184:5 | LL | foo::(x_u8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `i16`, found `u8` - | help: you can convert a `u8` to an `i16`: `x_u8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:186:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:186:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `i16`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `i16`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to an `i16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:188:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:188:5 | LL | foo::(x_i64); - | ^^^^^ expected `i16`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to an `i16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:190:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:190:5 | LL | foo::(x_i32); - | ^^^^^ expected `i16`, found `i32` + | ^^^^^^^^^^^-----^ + | | + | expected `i16`, found `i32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i32` to an `i16` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:193:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:193:5 | LL | foo::(x_i8); - | ^^^^ + | ^^^^^^^^^^^----^ | | | expected `i16`, found `i8` - | help: you can convert an `i8` to an `i16`: `x_i8.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i16}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:198:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:198:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `u8`, found `usize` + | ^^^^^^^^^^-------^ + | | + | expected `u8`, found `usize` | -help: you can convert a `usize` to a `u8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:200:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:200:5 | LL | foo::(x_u64); - | ^^^^^ expected `u8`, found `u64` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `u64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u64` to a `u8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:202:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:202:5 | LL | foo::(x_u32); - | ^^^^^ expected `u8`, found `u32` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `u32` | -help: you can convert a `u32` to a `u8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:204:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:204:5 | LL | foo::(x_u16); - | ^^^^^ expected `u8`, found `u16` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `u16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u16` to a `u8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:207:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:207:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `u8`, found `isize` + | ^^^^^^^^^^-------^ + | | + | expected `u8`, found `isize` | -help: you can convert an `isize` to a `u8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:209:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:209:5 | LL | foo::(x_i64); - | ^^^^^ expected `u8`, found `i64` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to a `u8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:211:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:211:5 | LL | foo::(x_i32); - | ^^^^^ expected `u8`, found `i32` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `i32` | -help: you can convert an `i32` to a `u8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:213:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:213:5 | LL | foo::(x_i16); - | ^^^^^ expected `u8`, found `i16` + | ^^^^^^^^^^-----^ + | | + | expected `u8`, found `i16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i16` to a `u8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:215:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:215:5 | LL | foo::(x_i8); - | ^^^^ expected `u8`, found `i8` + | ^^^^^^^^^^----^ + | | + | expected `u8`, found `i8` | -help: you can convert an `i8` to a `u8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i8.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:220:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:220:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `i8`, found `usize` + | ^^^^^^^^^^-------^ + | | + | expected `i8`, found `usize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `usize` to an `i8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_usize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:222:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:222:5 | LL | foo::(x_u64); - | ^^^^^ expected `i8`, found `u64` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `u64` | -help: you can convert a `u64` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:224:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:224:5 | LL | foo::(x_u32); - | ^^^^^ expected `i8`, found `u32` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `u32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u32` to an `i8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:226:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:226:5 | LL | foo::(x_u16); - | ^^^^^ expected `i8`, found `u16` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `u16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u16` to an `i8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:228:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:228:5 | LL | foo::(x_u8); - | ^^^^ expected `i8`, found `u8` + | ^^^^^^^^^^----^ + | | + | expected `i8`, found `u8` | -help: you can convert a `u8` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u8.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:230:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:230:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `i8`, found `isize` + | ^^^^^^^^^^-------^ + | | + | expected `i8`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to an `i8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:232:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:232:5 | LL | foo::(x_i64); - | ^^^^^ expected `i8`, found `i64` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `i64` | -help: you can convert an `i64` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i64.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:234:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:234:5 | LL | foo::(x_i32); - | ^^^^^ expected `i8`, found `i32` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `i32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i32` to an `i8` and panic if the converted value doesn't fit +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i32.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:236:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:236:5 | LL | foo::(x_i16); - | ^^^^^ expected `i8`, found `i16` + | ^^^^^^^^^^-----^ + | | + | expected `i8`, found `i16` | -help: you can convert an `i16` to an `i8` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i16.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i8}); + | ^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:242:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:242:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `f64`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `f64`, found `usize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -help: you can cast a `usize` to an `f64`, producing the floating point representation of the integer, - | rounded if necessary -LL | foo::(x_usize as f64); - | ^^^^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:244:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:244:5 | LL | foo::(x_u64); - | ^^^^^ expected `f64`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `f64`, found `u64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can cast a `u64` to an `f64`, producing the floating point representation of the integer, - | rounded if necessary -LL | foo::(x_u64 as f64); - | ^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:246:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:246:5 | LL | foo::(x_u32); - | ^^^^^ expected `f64`, found `u32` + | ^^^^^^^^^^^-----^ + | | + | expected `f64`, found `u32` | -help: you can convert a `u32` to an `f64`, producing the floating point representation of the integer +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u32.into()); - | ^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:248:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:248:5 | LL | foo::(x_u16); - | ^^^^^ expected `f64`, found `u16` + | ^^^^^^^^^^^-----^ + | | + | expected `f64`, found `u16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u16` to an `f64`, producing the floating point representation of the integer +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u16.into()); - | ^^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:250:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:250:5 | LL | foo::(x_u8); - | ^^^^ expected `f64`, found `u8` + | ^^^^^^^^^^^----^ + | | + | expected `f64`, found `u8` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert a `u8` to an `f64`, producing the floating point representation of the integer +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_u8.into()); - | ^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:252:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:252:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `f64`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `f64`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to an `f64`, producing the floating point representation of the integer, rounded if necessary +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize as f64); - | ^^^^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:254:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:254:5 | LL | foo::(x_i64); - | ^^^^^ expected `f64`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `f64`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to an `f64`, producing the floating point representation of the integer, rounded if necessary +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64 as f64); - | ^^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:256:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:256:5 | LL | foo::(x_i32); - | ^^^^^ expected `f64`, found `i32` + | ^^^^^^^^^^^-----^ + | | + | expected `f64`, found `i32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i32` to an `f64`, producing the floating point representation of the integer +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i32.into()); - | ^^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:258:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:258:5 | LL | foo::(x_i16); - | ^^^^^ expected `f64`, found `i16` + | ^^^^^^^^^^^-----^ + | | + | expected `f64`, found `i16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i16` to an `f64`, producing the floating point representation of the integer +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i16.into()); - | ^^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:260:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:260:5 | LL | foo::(x_i8); - | ^^^^ expected `f64`, found `i8` + | ^^^^^^^^^^^----^ + | | + | expected `f64`, found `i8` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i8` to an `f64`, producing the floating point representation of the integer +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i8.into()); - | ^^^^^^^^^^^ +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:263:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:263:5 | LL | foo::(x_f32); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `f64`, found `f32` - | help: you can convert an `f32` to an `f64`: `x_f32.into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f64}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:266:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:266:5 | LL | foo::(x_usize); - | ^^^^^^^ expected `f32`, found `usize` + | ^^^^^^^^^^^-------^ + | | + | expected `f32`, found `usize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can cast a `usize` to an `f32`, producing the floating point representation of the integer, - | rounded if necessary -LL | foo::(x_usize as f32); - | ^^^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:268:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:268:5 | LL | foo::(x_u64); - | ^^^^^ expected `f32`, found `u64` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `u64` | -help: you can cast a `u64` to an `f32`, producing the floating point representation of the integer, - | rounded if necessary -LL | foo::(x_u64 as f32); - | ^^^^^^^^^^^^ +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:270:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:270:5 | LL | foo::(x_u32); - | ^^^^^ expected `f32`, found `u32` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `u32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can cast a `u32` to an `f32`, producing the floating point representation of the integer, - | rounded if necessary -LL | foo::(x_u32 as f32); - | ^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:272:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:272:5 | LL | foo::(x_u16); - | ^^^^^ expected `f32`, found `u16` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `u16` | -help: you can convert a `u16` to an `f32`, producing the floating point representation of the integer +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u16.into()); - | ^^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:274:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:274:5 | LL | foo::(x_u8); - | ^^^^ expected `f32`, found `u8` + | ^^^^^^^^^^^----^ + | | + | expected `f32`, found `u8` | -help: you can convert a `u8` to an `f32`, producing the floating point representation of the integer +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_u8.into()); - | ^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:276:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:276:5 | LL | foo::(x_isize); - | ^^^^^^^ expected `f32`, found `isize` + | ^^^^^^^^^^^-------^ + | | + | expected `f32`, found `isize` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `isize` to an `f32`, producing the floating point representation of the integer, rounded if necessary +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_isize as f32); - | ^^^^^^^^^^^^^^ +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:278:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:278:5 | LL | foo::(x_i64); - | ^^^^^ expected `f32`, found `i64` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `i64` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i64` to an `f32`, producing the floating point representation of the integer, rounded if necessary +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i64 as f32); - | ^^^^^^^^^^^^ +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:280:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:280:5 | LL | foo::(x_i32); - | ^^^^^ expected `f32`, found `i32` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `i32` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i32` to an `f32`, producing the floating point representation of the integer, rounded if necessary +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i32 as f32); - | ^^^^^^^^^^^^ +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:282:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:282:5 | LL | foo::(x_i16); - | ^^^^^ expected `f32`, found `i16` + | ^^^^^^^^^^^-----^ + | | + | expected `f32`, found `i16` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -help: you can convert an `i16` to an `f32`, producing the floating point representation of the integer +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type | -LL | foo::(x_i16.into()); - | ^^^^^^^^^^^^ +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:284:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:284:5 | LL | foo::(x_i8); - | ^^^^ expected `f32`, found `i8` + | ^^^^^^^^^^^----^ + | | + | expected `f32`, found `i8` | -help: you can convert an `i8` to an `f32`, producing the floating point representation of the integer +note: function defined here + --> $DIR/numeric-cast.rs:6:4 | -LL | foo::(x_i8.into()); - | ^^^^^^^^^^^ +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({f32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:289:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:289:5 | LL | foo::(x_u8 as u16); - | ^^^^^^^^^^^ + | ^^^^^^^^^^^-----------^ | | | expected `u32`, found `u16` - | help: you can convert a `u16` to a `u32`: `(x_u8 as u16).into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({u32}); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/numeric-cast.rs:291:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/numeric-cast.rs:291:5 | LL | foo::(-x_i8); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | | expected `i32`, found `i8` - | help: you can convert an `i8` to an `i32`: `(-x_i8).into()` + | +note: function defined here + --> $DIR/numeric-cast.rs:6:4 + | +LL | fn foo(_x: N) {} + | ^^^ ----- +help: provide an argument of the correct type + | +LL | foo({i32}); + | ^^^^^^^^^^ error: aborting due to 113 previous errors diff --git a/src/test/ui/numeric/numeric-suffix.fixed b/src/test/ui/numeric/numeric-suffix.fixed index 53c5fe0f435f9..24f0745b2b5f5 100644 --- a/src/test/ui/numeric/numeric-suffix.fixed +++ b/src/test/ui/numeric/numeric-suffix.fixed @@ -5,294 +5,294 @@ fn foo(_x: N) {} fn main() { foo::(42_usize); foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); foo::(42i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8.into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); foo::((42_u8 as u16).into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::((-42_i8).into()); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/numeric/numeric-suffix.rs b/src/test/ui/numeric/numeric-suffix.rs index ca38ed82220b2..cfccf308b42c4 100644 --- a/src/test/ui/numeric/numeric-suffix.rs +++ b/src/test/ui/numeric/numeric-suffix.rs @@ -5,294 +5,294 @@ fn foo(_x: N) {} fn main() { foo::(42_usize); foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); foo::(42.0_f32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_usize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_u8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_isize); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f64); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(42.0_f32); foo::(42_u8 as u16); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect foo::(-42_i8); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/or-patterns/issue-64879-trailing-before-guard.rs b/src/test/ui/or-patterns/issue-64879-trailing-before-guard.rs index 181c770096a5f..d68ad9545768d 100644 --- a/src/test/ui/or-patterns/issue-64879-trailing-before-guard.rs +++ b/src/test/ui/or-patterns/issue-64879-trailing-before-guard.rs @@ -9,7 +9,8 @@ fn main() { E::A | E::B | //~ ERROR a trailing `|` is not allowed in an or-pattern if true => { - let recovery_witness: bool = 0; //~ ERROR mismatched types + let recovery_witness: bool = 0; + //~^ ERROR mismatched types } } } diff --git a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs index 5ec7dc6962c18..53e6e01cb4162 100644 --- a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs +++ b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.rs @@ -10,11 +10,13 @@ fn main() { } match Blah::A(1, 1, 2) { - Blah::A(_, x, y) | Blah::B(x, y) => {} //~ ERROR mismatched types + Blah::A(_, x, y) | Blah::B(x, y) => {} + //~^ ERROR mismatched types } match Some(Blah::A(1, 1, 2)) { - Some(Blah::A(_, x, y) | Blah::B(x, y)) => {} //~ ERROR mismatched types + Some(Blah::A(_, x, y) | Blah::B(x, y)) => {} + //~^ ERROR mismatched types } match (0u8, 1u16) { diff --git a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr index 00dba053a59d3..3f19cfd2164e0 100644 --- a/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr +++ b/src/test/ui/or-patterns/or-patterns-binding-type-mismatch.stderr @@ -11,7 +11,7 @@ LL | Blah::A(_, x, y) | Blah::B(x, y) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:17:44 + --> $DIR/or-patterns-binding-type-mismatch.rs:18:44 | LL | match Some(Blah::A(1, 1, 2)) { | ---------------------- this expression has type `Option` @@ -23,7 +23,7 @@ LL | Some(Blah::A(_, x, y) | Blah::B(x, y)) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:21:19 + --> $DIR/or-patterns-binding-type-mismatch.rs:23:19 | LL | match (0u8, 1u16) { | ----------- this expression has type `(u8, u16)` @@ -35,7 +35,7 @@ LL | (x, y) | (y, x) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:21:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:23:22 | LL | match (0u8, 1u16) { | ----------- this expression has type `(u8, u16)` @@ -47,7 +47,7 @@ LL | (x, y) | (y, x) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:41 + --> $DIR/or-patterns-binding-type-mismatch.rs:28:41 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -59,7 +59,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:50 + --> $DIR/or-patterns-binding-type-mismatch.rs:28:50 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -71,7 +71,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:59 + --> $DIR/or-patterns-binding-type-mismatch.rs:28:59 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -83,7 +83,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:26:62 + --> $DIR/or-patterns-binding-type-mismatch.rs:28:62 | LL | match Some((0u8, Some((1u16, 2u32)))) { | ------------------------------- this expression has type `Option<(u8, Option<(u16, u32)>)>` @@ -93,7 +93,7 @@ LL | Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) => {} = note: in the same arm, a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:34:42 + --> $DIR/or-patterns-binding-type-mismatch.rs:36:42 | LL | if let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2) { | - ^ ---------------- this expression has type `Blah` @@ -104,7 +104,7 @@ LL | if let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2) { = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:38:47 + --> $DIR/or-patterns-binding-type-mismatch.rs:40:47 | LL | if let Some(Blah::A(_, x, y) | Blah::B(x, y)) = Some(Blah::A(1, 1, 2)) { | - ^ ---------------------- this expression has type `Option` @@ -115,7 +115,7 @@ LL | if let Some(Blah::A(_, x, y) | Blah::B(x, y)) = Some(Blah::A(1, 1, 2)) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:42:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:44:22 | LL | if let (x, y) | (y, x) = (0u8, 1u16) { | - ^ ----------- this expression has type `(u8, u16)` @@ -126,7 +126,7 @@ LL | if let (x, y) | (y, x) = (0u8, 1u16) { = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:42:25 + --> $DIR/or-patterns-binding-type-mismatch.rs:44:25 | LL | if let (x, y) | (y, x) = (0u8, 1u16) { | - ^ ----------- this expression has type `(u8, u16)` @@ -137,7 +137,7 @@ LL | if let (x, y) | (y, x) = (0u8, 1u16) { = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:44 + --> $DIR/or-patterns-binding-type-mismatch.rs:49:44 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - ^ expected `u16`, found `u8` @@ -150,7 +150,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:53 + --> $DIR/or-patterns-binding-type-mismatch.rs:49:53 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - ^ expected `u8`, found `u16` @@ -163,7 +163,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:62 + --> $DIR/or-patterns-binding-type-mismatch.rs:49:62 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - ^ expected `u32`, found `u16` @@ -176,7 +176,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:47:65 + --> $DIR/or-patterns-binding-type-mismatch.rs:49:65 | LL | if let Some((x, Some((y, z)))) | Some((y, Some((x, z) | (z, x)))) | - first introduced with type `u8` here ^ expected `u8`, found `u32` @@ -187,7 +187,7 @@ LL | = Some((0u8, Some((1u16, 2u32)))) = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:55:39 + --> $DIR/or-patterns-binding-type-mismatch.rs:57:39 | LL | let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2); | - ^ ---------------- this expression has type `Blah` @@ -198,7 +198,7 @@ LL | let Blah::A(_, x, y) | Blah::B(x, y) = Blah::A(1, 1, 2); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:58:19 + --> $DIR/or-patterns-binding-type-mismatch.rs:60:19 | LL | let (x, y) | (y, x) = (0u8, 1u16); | - ^ ----------- this expression has type `(u8, u16)` @@ -209,7 +209,7 @@ LL | let (x, y) | (y, x) = (0u8, 1u16); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:58:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:60:22 | LL | let (x, y) | (y, x) = (0u8, 1u16); | - ^ ----------- this expression has type `(u8, u16)` @@ -220,7 +220,7 @@ LL | let (x, y) | (y, x) = (0u8, 1u16); = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:62:42 + --> $DIR/or-patterns-binding-type-mismatch.rs:64:42 | LL | fn f1((Blah::A(_, x, y) | Blah::B(x, y)): Blah) {} | - ^ ---- expected due to this @@ -231,7 +231,7 @@ LL | fn f1((Blah::A(_, x, y) | Blah::B(x, y)): Blah) {} = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:65:22 + --> $DIR/or-patterns-binding-type-mismatch.rs:67:22 | LL | fn f2(((x, y) | (y, x)): (u8, u16)) {} | - ^ --------- expected due to this @@ -242,7 +242,7 @@ LL | fn f2(((x, y) | (y, x)): (u8, u16)) {} = note: a binding must have the same type in all alternatives error[E0308]: mismatched types - --> $DIR/or-patterns-binding-type-mismatch.rs:65:25 + --> $DIR/or-patterns-binding-type-mismatch.rs:67:25 | LL | fn f2(((x, y) | (y, x)): (u8, u16)) {} | - ^ --------- expected due to this diff --git a/src/test/ui/overloaded-calls-nontuple.stderr b/src/test/ui/overloaded-calls-nontuple.stderr index bdadb95db2947..808f934d7e8ea 100644 --- a/src/test/ui/overloaded-calls-nontuple.stderr +++ b/src/test/ui/overloaded-calls-nontuple.stderr @@ -10,12 +10,5 @@ error: A function with the "rust-call" ABI must take a single non-self argument LL | extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0059]: cannot use call notation; the first type parameter for the function trait is neither a tuple nor unit - --> $DIR/overloaded-calls-nontuple.rs:28:10 - | -LL | drop(s(3)) - | ^^^^ - -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0059`. diff --git a/src/test/ui/parser/fn-arg-doc-comment.rs b/src/test/ui/parser/fn-arg-doc-comment.rs index 2d1554183cccc..9249318609a44 100644 --- a/src/test/ui/parser/fn-arg-doc-comment.rs +++ b/src/test/ui/parser/fn-arg-doc-comment.rs @@ -16,11 +16,11 @@ fn bar(id: #[allow(dead_code)] i32) {} fn main() { // verify that the parser recovered and properly typechecked the args f("", ""); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| NOTE expected `u8`, found `&str` //~| ERROR mismatched types //~| NOTE expected `u8`, found `&str` bar(""); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| NOTE expected `i32`, found `&str` } diff --git a/src/test/ui/parser/fn-arg-doc-comment.stderr b/src/test/ui/parser/fn-arg-doc-comment.stderr index 41f2c080b9465..0653e7d162436 100644 --- a/src/test/ui/parser/fn-arg-doc-comment.stderr +++ b/src/test/ui/parser/fn-arg-doc-comment.stderr @@ -16,24 +16,53 @@ error: documentation comments cannot be applied to function parameters LL | /// Other | ^^^^^^^^^ doc comments are not allowed here -error[E0308]: mismatched types - --> $DIR/fn-arg-doc-comment.rs:18:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/fn-arg-doc-comment.rs:18:5 | LL | f("", ""); - | ^^ expected `u8`, found `&str` - -error[E0308]: mismatched types - --> $DIR/fn-arg-doc-comment.rs:18:11 + | ^^--^^^^^ + | | + | expected `u8`, found `&'static str` + | expected `u8`, found `&'static str` | -LL | f("", ""); - | ^^ expected `u8`, found `&str` +note: function defined here + --> $DIR/fn-arg-doc-comment.rs:1:8 + | +LL | pub fn f( + | ^ +LL | / /// Comment +LL | | +LL | | +LL | | id: u8, + | |__________- +LL | / /// Other +LL | | +LL | | +LL | | a: u8, + | |_________- +help: did you mean + | +LL | f({u8}, {u8}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/fn-arg-doc-comment.rs:23:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/fn-arg-doc-comment.rs:23:5 | LL | bar(""); - | ^^ expected `i32`, found `&str` + | ^^^^--^ + | | + | expected `i32`, found `&'static str` + | +note: function defined here + --> $DIR/fn-arg-doc-comment.rs:12:4 + | +LL | fn bar(id: #[allow(dead_code)] i32) {} + | ^^^ --------------------------- +help: provide an argument of the correct type + | +LL | bar({i32}); + | ^^^^^^^^^^ -error: aborting due to 6 previous errors +error: aborting due to 5 previous errors For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/pattern/pattern-error-continue.rs b/src/test/ui/pattern/pattern-error-continue.rs index 0702a9986fc1c..3a2c0d5cc08d7 100644 --- a/src/test/ui/pattern/pattern-error-continue.rs +++ b/src/test/ui/pattern/pattern-error-continue.rs @@ -26,7 +26,7 @@ fn main() { _ => () } f(true); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `char`, found `bool` match () { diff --git a/src/test/ui/pattern/pattern-error-continue.stderr b/src/test/ui/pattern/pattern-error-continue.stderr index 497c93b29497c..d2fce1bceae17 100644 --- a/src/test/ui/pattern/pattern-error-continue.stderr +++ b/src/test/ui/pattern/pattern-error-continue.stderr @@ -32,11 +32,23 @@ LL | match 'c' { LL | S { .. } => (), | ^^^^^^^^ expected `char`, found struct `S` -error[E0308]: mismatched types - --> $DIR/pattern-error-continue.rs:28:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/pattern-error-continue.rs:28:5 | LL | f(true); - | ^^^^ expected `char`, found `bool` + | ^^----^ + | | + | expected `char`, found `bool` + | +note: function defined here + --> $DIR/pattern-error-continue.rs:13:4 + | +LL | fn f(_c: char) {} + | ^ -------- +help: provide an argument of the correct type + | +LL | f({char}); + | ^^^^^^^^^ error: aborting due to 5 previous errors diff --git a/src/test/ui/proc-macro/signature.rs b/src/test/ui/proc-macro/signature.rs index dbc1577172f03..36eab0c70c101 100644 --- a/src/test/ui/proc-macro/signature.rs +++ b/src/test/ui/proc-macro/signature.rs @@ -8,6 +8,6 @@ extern crate proc_macro; #[proc_macro_derive(A)] pub unsafe extern fn foo(a: i32, b: u32) -> u32 { - //~^ ERROR: mismatched types + //~^ ERROR: arguments to this function are incorrect loop {} } diff --git a/src/test/ui/proc-macro/signature.stderr b/src/test/ui/proc-macro/signature.stderr index 6ebc99601c41f..9816eb52d663f 100644 --- a/src/test/ui/proc-macro/signature.stderr +++ b/src/test/ui/proc-macro/signature.stderr @@ -1,14 +1,12 @@ -error[E0308]: mismatched types - --> $DIR/signature.rs:10:1 +error[E0308]: arguments to this function are incorrect | -LL | / pub unsafe extern fn foo(a: i32, b: u32) -> u32 { -LL | | -LL | | loop {} -LL | | } - | |_^ expected normal fn, found unsafe fn +help: provide an argument of the correct type + | +LL | (pub unsafe extern fn foo(a: i32, b: u32) -> u32 { +LL | +LL | loop {} +LL | }, , {fn(proc_macro::TokenStream) -> proc_macro::TokenStream})// force-host | - = note: expected fn pointer `fn(proc_macro::TokenStream) -> proc_macro::TokenStream` - found fn item `unsafe extern "C" fn(i32, u32) -> u32 {foo}` error: aborting due to previous error diff --git a/src/test/ui/range/issue-54505-no-literals.fixed b/src/test/ui/range/issue-54505-no-literals.fixed index 4d8f67182b9ac..061a4c2a60043 100644 --- a/src/test/ui/range/issue-54505-no-literals.fixed +++ b/src/test/ui/range/issue-54505-no-literals.fixed @@ -13,63 +13,63 @@ fn take_range(_r: &impl RangeBounds) {} fn main() { - take_range(&std::ops::Range { start: 0, end: 1 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::Range { start: 0, end: 1 } - take_range(&::std::ops::Range { start: 0, end: 1 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::Range { start: 0, end: 1 } - take_range(&std::ops::RangeFrom { start: 1 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeFrom { start: 1 } - take_range(&::std::ops::RangeFrom { start: 1 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeFrom { start: 1 } - take_range(&std::ops::RangeFull {}); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeFull {} - take_range(&::std::ops::RangeFull {}); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeFull {} - take_range(&std::ops::RangeInclusive::new(0, 1)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeInclusive::new(0, 1) - take_range(&::std::ops::RangeInclusive::new(0, 1)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeInclusive::new(0, 1) - take_range(&std::ops::RangeTo { end: 5 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeTo { end: 5 } - take_range(&::std::ops::RangeTo { end: 5 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeTo { end: 5 } - take_range(&std::ops::RangeToInclusive { end: 5 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeToInclusive { end: 5 } - take_range(&::std::ops::RangeToInclusive { end: 5 }); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeToInclusive { end: 5 } } diff --git a/src/test/ui/range/issue-54505-no-literals.rs b/src/test/ui/range/issue-54505-no-literals.rs index dc21dcbc2db41..b7c154dc201a8 100644 --- a/src/test/ui/range/issue-54505-no-literals.rs +++ b/src/test/ui/range/issue-54505-no-literals.rs @@ -14,62 +14,62 @@ fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(std::ops::Range { start: 0, end: 1 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::Range { start: 0, end: 1 } take_range(::std::ops::Range { start: 0, end: 1 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::Range { start: 0, end: 1 } take_range(std::ops::RangeFrom { start: 1 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeFrom { start: 1 } take_range(::std::ops::RangeFrom { start: 1 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeFrom { start: 1 } take_range(std::ops::RangeFull {}); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeFull {} take_range(::std::ops::RangeFull {}); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeFull {} take_range(std::ops::RangeInclusive::new(0, 1)); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeInclusive::new(0, 1) take_range(::std::ops::RangeInclusive::new(0, 1)); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeInclusive::new(0, 1) take_range(std::ops::RangeTo { end: 5 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeTo { end: 5 } take_range(::std::ops::RangeTo { end: 5 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeTo { end: 5 } take_range(std::ops::RangeToInclusive { end: 5 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &std::ops::RangeToInclusive { end: 5 } take_range(::std::ops::RangeToInclusive { end: 5 }); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &::std::ops::RangeToInclusive { end: 5 } } diff --git a/src/test/ui/range/issue-54505-no-literals.stderr b/src/test/ui/range/issue-54505-no-literals.stderr index 065e16a8227ca..a5e7380c3b7ea 100644 --- a/src/test/ui/range/issue-54505-no-literals.stderr +++ b/src/test/ui/range/issue-54505-no-literals.stderr @@ -1,146 +1,218 @@ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:16:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:16:5 | LL | take_range(std::ops::Range { start: 0, end: 1 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^------------------------------------^ | | - | expected reference, found struct `std::ops::Range` - | help: consider borrowing here: `&std::ops::Range { start: 0, end: 1 }` + | expected `&_`, found `std::ops::Range<_>` | - = note: expected reference `&_` - found struct `std::ops::Range<{integer}>` +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:21:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:21:5 | LL | take_range(::std::ops::Range { start: 0, end: 1 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^--------------------------------------^ | | - | expected reference, found struct `std::ops::Range` - | help: consider borrowing here: `&::std::ops::Range { start: 0, end: 1 }` + | expected `&_`, found `std::ops::Range<_>` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 | - = note: expected reference `&_` - found struct `std::ops::Range<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:26:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:26:5 | LL | take_range(std::ops::RangeFrom { start: 1 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^--------------------------------^ | | - | expected reference, found struct `RangeFrom` - | help: consider borrowing here: `&std::ops::RangeFrom { start: 1 }` + | expected `&_`, found `RangeFrom<_>` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeFrom<{integer}>` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:31:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:31:5 | LL | take_range(::std::ops::RangeFrom { start: 1 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^----------------------------------^ | | - | expected reference, found struct `RangeFrom` - | help: consider borrowing here: `&::std::ops::RangeFrom { start: 1 }` + | expected `&_`, found `RangeFrom<_>` | - = note: expected reference `&_` - found struct `RangeFrom<{integer}>` +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:36:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:36:5 | LL | take_range(std::ops::RangeFull {}); - | ^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^----------------------^ | | - | expected reference, found struct `RangeFull` - | help: consider borrowing here: `&std::ops::RangeFull {}` + | expected `&_`, found `RangeFull` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 | - = note: expected reference `&_` - found struct `RangeFull` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:41:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:41:5 | LL | take_range(::std::ops::RangeFull {}); - | ^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^------------------------^ | | - | expected reference, found struct `RangeFull` - | help: consider borrowing here: `&::std::ops::RangeFull {}` + | expected `&_`, found `RangeFull` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeFull` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:46:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:46:5 | LL | take_range(std::ops::RangeInclusive::new(0, 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^-----------------------------------^ | | - | expected reference, found struct `RangeInclusive` - | help: consider borrowing here: `&std::ops::RangeInclusive::new(0, 1)` + | expected `&_`, found `RangeInclusive<_>` | - = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:51:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:51:5 | LL | take_range(::std::ops::RangeInclusive::new(0, 1)); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^-------------------------------------^ | | - | expected reference, found struct `RangeInclusive` - | help: consider borrowing here: `&::std::ops::RangeInclusive::new(0, 1)` + | expected `&_`, found `RangeInclusive<_>` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 | - = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:56:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:56:5 | LL | take_range(std::ops::RangeTo { end: 5 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^----------------------------^ | | - | expected reference, found struct `RangeTo` - | help: consider borrowing here: `&std::ops::RangeTo { end: 5 }` + | expected `&_`, found `RangeTo<_>` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeTo<{integer}>` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:61:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:61:5 | LL | take_range(::std::ops::RangeTo { end: 5 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^------------------------------^ | | - | expected reference, found struct `RangeTo` - | help: consider borrowing here: `&::std::ops::RangeTo { end: 5 }` + | expected `&_`, found `RangeTo<_>` | - = note: expected reference `&_` - found struct `RangeTo<{integer}>` +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:66:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:66:5 | LL | take_range(std::ops::RangeToInclusive { end: 5 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^-------------------------------------^ | | - | expected reference, found struct `RangeToInclusive` - | help: consider borrowing here: `&std::ops::RangeToInclusive { end: 5 }` + | expected `&_`, found `RangeToInclusive<_>` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 | - = note: expected reference `&_` - found struct `RangeToInclusive<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-literals.rs:71:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-literals.rs:71:5 | LL | take_range(::std::ops::RangeToInclusive { end: 5 }); - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^^^^^^^^^---------------------------------------^ | | - | expected reference, found struct `RangeToInclusive` - | help: consider borrowing here: `&::std::ops::RangeToInclusive { end: 5 }` + | expected `&_`, found `RangeToInclusive<_>` + | +note: function defined here + --> $DIR/issue-54505-no-literals.rs:12:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeToInclusive<{integer}>` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ error: aborting due to 12 previous errors diff --git a/src/test/ui/range/issue-54505-no-std.rs b/src/test/ui/range/issue-54505-no-std.rs index f5d5823e468b0..4f6d69252232f 100644 --- a/src/test/ui/range/issue-54505-no-std.rs +++ b/src/test/ui/range/issue-54505-no-std.rs @@ -25,32 +25,32 @@ fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(0..1); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(1..); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(..); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(0..=1); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(..5); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(..=42); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } diff --git a/src/test/ui/range/issue-54505-no-std.stderr b/src/test/ui/range/issue-54505-no-std.stderr index 73507f4836b23..a64cccd179b0f 100644 --- a/src/test/ui/range/issue-54505-no-std.stderr +++ b/src/test/ui/range/issue-54505-no-std.stderr @@ -1,76 +1,112 @@ error: `#[panic_handler]` function required, but not found -error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:27:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-std.rs:27:5 | LL | take_range(0..1); - | ^^^^ + | ^^^^^^^^^^^----^ | | - | expected reference, found struct `Range` - | help: consider borrowing here: `&(0..1)` + | expected `&_`, found `Range<_>` | - = note: expected reference `&_` - found struct `Range<{integer}>` +note: function defined here + --> $DIR/issue-54505-no-std.rs:23:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:32:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-std.rs:32:5 | LL | take_range(1..); - | ^^^ + | ^^^^^^^^^^^---^ | | - | expected reference, found struct `RangeFrom` - | help: consider borrowing here: `&(1..)` + | expected `&_`, found `RangeFrom<_>` + | +note: function defined here + --> $DIR/issue-54505-no-std.rs:23:4 | - = note: expected reference `&_` - found struct `RangeFrom<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:37:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-std.rs:37:5 | LL | take_range(..); - | ^^ + | ^^^^^^^^^^^--^ | | - | expected reference, found struct `RangeFull` - | help: consider borrowing here: `&(..)` + | expected `&_`, found `RangeFull` + | +note: function defined here + --> $DIR/issue-54505-no-std.rs:23:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeFull` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:42:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-std.rs:42:5 | LL | take_range(0..=1); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | - | expected reference, found struct `RangeInclusive` - | help: consider borrowing here: `&(0..=1)` + | expected `&_`, found `RangeInclusive<_>` | - = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` +note: function defined here + --> $DIR/issue-54505-no-std.rs:23:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:47:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-std.rs:47:5 | LL | take_range(..5); - | ^^^ + | ^^^^^^^^^^^---^ | | - | expected reference, found struct `RangeTo` - | help: consider borrowing here: `&(..5)` + | expected `&_`, found `RangeTo<_>` + | +note: function defined here + --> $DIR/issue-54505-no-std.rs:23:4 | - = note: expected reference `&_` - found struct `RangeTo<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505-no-std.rs:52:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505-no-std.rs:52:5 | LL | take_range(..=42); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | - | expected reference, found struct `RangeToInclusive` - | help: consider borrowing here: `&(..=42)` + | expected `&_`, found `RangeToInclusive<_>` + | +note: function defined here + --> $DIR/issue-54505-no-std.rs:23:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeToInclusive<{integer}>` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/range/issue-54505.fixed b/src/test/ui/range/issue-54505.fixed index f8298c0b5ceff..d1d55e77bab7f 100644 --- a/src/test/ui/range/issue-54505.fixed +++ b/src/test/ui/range/issue-54505.fixed @@ -11,33 +11,33 @@ fn take_range(_r: &impl RangeBounds) {} fn main() { - take_range(&(0..1)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) - take_range(&(1..)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) - take_range(&(..)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) - take_range(&(0..=1)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) - take_range(&(..5)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) - take_range(&(..=42)); - //~^ ERROR mismatched types [E0308] + take_range({&_}); + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } diff --git a/src/test/ui/range/issue-54505.rs b/src/test/ui/range/issue-54505.rs index 03673252dd3ba..6790b4cb9c1ec 100644 --- a/src/test/ui/range/issue-54505.rs +++ b/src/test/ui/range/issue-54505.rs @@ -12,32 +12,32 @@ fn take_range(_r: &impl RangeBounds) {} fn main() { take_range(0..1); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..1) take_range(1..); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(1..) take_range(..); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..) take_range(0..=1); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(0..=1) take_range(..5); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..5) take_range(..=42); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] //~| HELP consider borrowing here //~| SUGGESTION &(..=42) } diff --git a/src/test/ui/range/issue-54505.stderr b/src/test/ui/range/issue-54505.stderr index 121af29834d87..636ac22311e6d 100644 --- a/src/test/ui/range/issue-54505.stderr +++ b/src/test/ui/range/issue-54505.stderr @@ -1,74 +1,110 @@ -error[E0308]: mismatched types - --> $DIR/issue-54505.rs:14:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505.rs:14:5 | LL | take_range(0..1); - | ^^^^ + | ^^^^^^^^^^^----^ | | - | expected reference, found struct `std::ops::Range` - | help: consider borrowing here: `&(0..1)` + | expected `&_`, found `std::ops::Range<_>` | - = note: expected reference `&_` - found struct `std::ops::Range<{integer}>` +note: function defined here + --> $DIR/issue-54505.rs:10:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505.rs:19:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505.rs:19:5 | LL | take_range(1..); - | ^^^ + | ^^^^^^^^^^^---^ | | - | expected reference, found struct `RangeFrom` - | help: consider borrowing here: `&(1..)` + | expected `&_`, found `RangeFrom<_>` + | +note: function defined here + --> $DIR/issue-54505.rs:10:4 | - = note: expected reference `&_` - found struct `RangeFrom<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505.rs:24:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505.rs:24:5 | LL | take_range(..); - | ^^ + | ^^^^^^^^^^^--^ | | - | expected reference, found struct `RangeFull` - | help: consider borrowing here: `&(..)` + | expected `&_`, found `RangeFull` + | +note: function defined here + --> $DIR/issue-54505.rs:10:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeFull` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505.rs:29:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505.rs:29:5 | LL | take_range(0..=1); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | - | expected reference, found struct `RangeInclusive` - | help: consider borrowing here: `&(0..=1)` + | expected `&_`, found `RangeInclusive<_>` | - = note: expected reference `&_` - found struct `RangeInclusive<{integer}>` +note: function defined here + --> $DIR/issue-54505.rs:10:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505.rs:34:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505.rs:34:5 | LL | take_range(..5); - | ^^^ + | ^^^^^^^^^^^---^ | | - | expected reference, found struct `RangeTo` - | help: consider borrowing here: `&(..5)` + | expected `&_`, found `RangeTo<_>` + | +note: function defined here + --> $DIR/issue-54505.rs:10:4 | - = note: expected reference `&_` - found struct `RangeTo<{integer}>` +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type + | +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-54505.rs:39:16 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-54505.rs:39:5 | LL | take_range(..=42); - | ^^^^^ + | ^^^^^^^^^^^-----^ | | - | expected reference, found struct `RangeToInclusive` - | help: consider borrowing here: `&(..=42)` + | expected `&_`, found `RangeToInclusive<_>` + | +note: function defined here + --> $DIR/issue-54505.rs:10:4 + | +LL | fn take_range(_r: &impl RangeBounds) {} + | ^^^^^^^^^^ ------------------------- +help: provide an argument of the correct type | - = note: expected reference `&_` - found struct `RangeToInclusive<{integer}>` +LL | take_range({&_}); + | ^^^^^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/range/issue-73553-misinterp-range-literal.rs b/src/test/ui/range/issue-73553-misinterp-range-literal.rs index e65dba0a03821..5db5ff4d59626 100644 --- a/src/test/ui/range/issue-73553-misinterp-range-literal.rs +++ b/src/test/ui/range/issue-73553-misinterp-range-literal.rs @@ -10,7 +10,7 @@ fn tell(x: usize) -> usize { fn main() { demo(tell(1)..tell(10)); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect demo(1..10); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/range/issue-73553-misinterp-range-literal.stderr b/src/test/ui/range/issue-73553-misinterp-range-literal.stderr index 5167b87fd27b8..ca8ed5470d799 100644 --- a/src/test/ui/range/issue-73553-misinterp-range-literal.stderr +++ b/src/test/ui/range/issue-73553-misinterp-range-literal.stderr @@ -1,26 +1,38 @@ -error[E0308]: mismatched types - --> $DIR/issue-73553-misinterp-range-literal.rs:12:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-73553-misinterp-range-literal.rs:12:5 | LL | demo(tell(1)..tell(10)); - | ^^^^^^^^^^^^^^^^^ + | ^^^^^-----------------^ | | - | expected reference, found struct `std::ops::Range` - | help: consider borrowing here: `&(tell(1)..tell(10))` + | expected `&std::ops::Range`, found `std::ops::Range<_>` | - = note: expected reference `&std::ops::Range` - found struct `std::ops::Range` +note: function defined here + --> $DIR/issue-73553-misinterp-range-literal.rs:3:4 + | +LL | fn demo(r: &Range) { + | ^^^^ --------- +help: provide an argument of the correct type + | +LL | demo({&std::ops::Range}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-73553-misinterp-range-literal.rs:14:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-73553-misinterp-range-literal.rs:14:5 | LL | demo(1..10); - | ^^^^^ + | ^^^^^-----^ | | - | expected reference, found struct `std::ops::Range` - | help: consider borrowing here: `&(1..10)` + | expected `&std::ops::Range`, found `std::ops::Range<_>` + | +note: function defined here + --> $DIR/issue-73553-misinterp-range-literal.rs:3:4 + | +LL | fn demo(r: &Range) { + | ^^^^ --------- +help: provide an argument of the correct type | - = note: expected reference `&std::ops::Range` - found struct `std::ops::Range<{integer}>` +LL | demo({&std::ops::Range}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs index ab4c6d9cf9198..71faf818cfbd8 100644 --- a/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs +++ b/src/test/ui/regions/region-lifetime-bounds-on-fns-where-clause.rs @@ -17,7 +17,8 @@ fn c<'a,'b>(x: &mut &'a isize, y: &mut &'b isize) { fn d() { // 'a and 'b are early bound in the function `a` because they appear // inconstraints: - let _: fn(&mut &isize, &mut &isize) = a; //~ ERROR mismatched types + let _: fn(&mut &isize, &mut &isize) = a; + //~^ ERROR mismatched types } fn e() { diff --git a/src/test/ui/regions/regions-infer-not-param.rs b/src/test/ui/regions/regions-infer-not-param.rs index 7643be64d5b23..ce3c7edc4fbf9 100644 --- a/src/test/ui/regions/regions-infer-not-param.rs +++ b/src/test/ui/regions/regions-infer-not-param.rs @@ -12,11 +12,13 @@ struct Indirect2<'a> { g: Box) + 'static> } -fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } //~ ERROR mismatched types +fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } +//~^ ERROR mismatched types fn take_indirect1(p: Indirect1) -> Indirect1 { p } -fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } //~ ERROR mismatched types +fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } +//~^ ERROR mismatched types //~| expected struct `Indirect2<'b>` //~| found struct `Indirect2<'a>` //~| ERROR mismatched types diff --git a/src/test/ui/regions/regions-infer-not-param.stderr b/src/test/ui/regions/regions-infer-not-param.stderr index a6e2047559cce..2440bf34e21f5 100644 --- a/src/test/ui/regions/regions-infer-not-param.stderr +++ b/src/test/ui/regions/regions-infer-not-param.stderr @@ -18,39 +18,39 @@ LL | fn take_direct<'a,'b>(p: Direct<'a>) -> Direct<'b> { p } | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:20:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch | = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` -note: the lifetime `'a` as defined on the function body at 19:19... - --> $DIR/regions-infer-not-param.rs:19:19 +note: the lifetime `'a` as defined on the function body at 20:19... + --> $DIR/regions-infer-not-param.rs:20:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ -note: ...does not necessarily outlive the lifetime `'b` as defined on the function body at 19:22 - --> $DIR/regions-infer-not-param.rs:19:22 +note: ...does not necessarily outlive the lifetime `'b` as defined on the function body at 20:22 + --> $DIR/regions-infer-not-param.rs:20:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ error[E0308]: mismatched types - --> $DIR/regions-infer-not-param.rs:19:63 + --> $DIR/regions-infer-not-param.rs:20:63 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^ lifetime mismatch | = note: expected struct `Indirect2<'b>` found struct `Indirect2<'a>` -note: the lifetime `'b` as defined on the function body at 19:22... - --> $DIR/regions-infer-not-param.rs:19:22 +note: the lifetime `'b` as defined on the function body at 20:22... + --> $DIR/regions-infer-not-param.rs:20:22 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ -note: ...does not necessarily outlive the lifetime `'a` as defined on the function body at 19:19 - --> $DIR/regions-infer-not-param.rs:19:19 +note: ...does not necessarily outlive the lifetime `'a` as defined on the function body at 20:19 + --> $DIR/regions-infer-not-param.rs:20:19 | LL | fn take_indirect2<'a,'b>(p: Indirect2<'a>) -> Indirect2<'b> { p } | ^^ diff --git a/src/test/ui/resolve/resolve-primitive-fallback.rs b/src/test/ui/resolve/resolve-primitive-fallback.rs index 992bcd7977fcf..dee0f4782766b 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.rs +++ b/src/test/ui/resolve/resolve-primitive-fallback.rs @@ -2,7 +2,7 @@ fn main() { // Make sure primitive type fallback doesn't work in value namespace std::mem::size_of(u16); //~^ ERROR expected value, found builtin type `u16` - //~| ERROR this function takes 0 arguments but 1 argument was supplied + //~| ERROR arguments to this function are incorrect // Make sure primitive type fallback doesn't work with global paths let _: ::u8; diff --git a/src/test/ui/resolve/resolve-primitive-fallback.stderr b/src/test/ui/resolve/resolve-primitive-fallback.stderr index 8611306e82d03..1a7552a976f9d 100644 --- a/src/test/ui/resolve/resolve-primitive-fallback.stderr +++ b/src/test/ui/resolve/resolve-primitive-fallback.stderr @@ -15,15 +15,20 @@ help: consider importing this builtin type LL | use std::primitive::u8; | -error[E0061]: this function takes 0 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/resolve-primitive-fallback.rs:3:5 | LL | std::mem::size_of(u16); - | ^^^^^^^^^^^^^^^^^ --- supplied 1 argument - | | - | expected 0 arguments + | ^^^^^^^^^^^^^^^^^^---^ + | | + | argument unexpected + | +help: remove the extra argument + | +LL | (); + | ^^ error: aborting due to 3 previous errors -Some errors have detailed explanations: E0061, E0412, E0423. -For more information about an error, try `rustc --explain E0061`. +Some errors have detailed explanations: E0308, E0412, E0423. +For more information about an error, try `rustc --explain E0308`. diff --git a/src/test/ui/short-error-format.stderr b/src/test/ui/short-error-format.stderr index 8a22d673b9821..29619f7ca6391 100644 --- a/src/test/ui/short-error-format.stderr +++ b/src/test/ui/short-error-format.stderr @@ -1,3 +1,3 @@ -$DIR/short-error-format.rs:6:9: error[E0308]: mismatched types +$DIR/short-error-format.rs:6:5: error[E0308]: arguments to this function are incorrect $DIR/short-error-format.rs:8:7: error[E0599]: no method named `salut` found for type `u32` in the current scope error: aborting due to 2 previous errors diff --git a/src/test/ui/span/E0057.stderr b/src/test/ui/span/E0057.stderr index 31579e2828964..da379790557c4 100644 --- a/src/test/ui/span/E0057.stderr +++ b/src/test/ui/span/E0057.stderr @@ -1,19 +1,27 @@ -error[E0057]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0057.rs:3:13 | LL | let a = f(); - | ^-- supplied 0 arguments - | | - | expected 1 argument + | ^^^ an argument of type _ is missing + | +help: provide the argument + | +LL | let a = ({_}); + | ^^^^^ -error[E0057]: this function takes 1 argument but 2 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/E0057.rs:5:13 | LL | let c = f(2, 3); - | ^ - - supplied 2 arguments - | | - | expected 1 argument + | ^^-^^^^ + | | + | argument of type {integer} unexpected + | +help: remove the extra argument + | +LL | let c = (2); + | ^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0057`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/span/coerce-suggestions.stderr b/src/test/ui/span/coerce-suggestions.stderr index 857c3081c62ef..8da1522d25386 100644 --- a/src/test/ui/span/coerce-suggestions.stderr +++ b/src/test/ui/span/coerce-suggestions.stderr @@ -16,23 +16,41 @@ LL | let x: &str = String::new(); | | help: consider borrowing here: `&String::new()` | expected due to this -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:12:10 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-suggestions.rs:12:5 | LL | test(&y); - | ^^ types differ in mutability + | ^^^^^--^ + | | + | expected `&mut String`, found `&String` + | +note: function defined here + --> $DIR/coerce-suggestions.rs:3:4 + | +LL | fn test(_x: &mut String) {} + | ^^^^ --------------- +help: provide an argument of the correct type | - = note: expected mutable reference `&mut String` - found reference `&String` +LL | test({&mut String}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/coerce-suggestions.rs:14:11 +error[E0308]: arguments to this function are incorrect + --> $DIR/coerce-suggestions.rs:14:5 | LL | test2(&y); - | ^^ types differ in mutability + | ^^^^^^--^ + | | + | expected `&mut i32`, found `&String` + | +note: function defined here + --> $DIR/coerce-suggestions.rs:4:4 + | +LL | fn test2(_x: &mut i32) {} + | ^^^^^ ------------ +help: provide an argument of the correct type | - = note: expected mutable reference `&mut i32` - found reference `&String` +LL | test2({&mut i32}); + | ^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/coerce-suggestions.rs:17:9 diff --git a/src/test/ui/span/issue-34264.rs b/src/test/ui/span/issue-34264.rs index 5b8fc71384efe..9506ae69cf4cc 100644 --- a/src/test/ui/span/issue-34264.rs +++ b/src/test/ui/span/issue-34264.rs @@ -4,8 +4,8 @@ fn bar(x, y: usize) {} //~ ERROR expected one of fn main() { foo(Some(42), 2); - foo(Some(42), 2, ""); //~ ERROR this function takes - bar("", ""); //~ ERROR mismatched types + foo(Some(42), 2, ""); //~ ERROR arguments to this function are incorrect + bar("", ""); //~ ERROR arguments to this function are incorrect bar(1, 2); - bar(1, 2, 3); //~ ERROR this function takes + bar(1, 2, 3); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/span/issue-34264.stderr b/src/test/ui/span/issue-34264.stderr index 5cda17fd6a1fc..78e60885b345a 100644 --- a/src/test/ui/span/issue-34264.stderr +++ b/src/test/ui/span/issue-34264.stderr @@ -50,41 +50,60 @@ 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 +error[E0308]: arguments to this function are incorrect --> $DIR/issue-34264.rs:7:5 | LL | foo(Some(42), 2, ""); - | ^^^ -------- - -- supplied 3 arguments - | | - | expected 2 arguments + | ^^^^--------^^^^^^^^ + | | + | argument of type [type error] unexpected | note: function defined here --> $DIR/issue-34264.rs:1:4 | LL | fn foo(Option, String) {} | ^^^ ----------- ------ +help: remove the extra argument + | +LL | foo(Some(42), 2); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/issue-34264.rs:8:13 +error[E0308]: arguments to this function are incorrect + --> $DIR/issue-34264.rs:8:5 | LL | bar("", ""); - | ^^ expected `usize`, found `&str` + | ^^^^--^^^^^ + | | + | expected `usize`, found `&'static str` + | +note: function defined here + --> $DIR/issue-34264.rs:3:4 + | +LL | fn bar(x, y: usize) {} + | ^^^ - -------- +help: provide an argument of the correct type + | +LL | bar("", {usize}); + | ^^^^^^^^^^^^^^^^ -error[E0061]: this function takes 2 arguments but 3 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/issue-34264.rs:10:5 | LL | bar(1, 2, 3); - | ^^^ - - - supplied 3 arguments - | | - | expected 2 arguments + | ^^^^-^^^^^^^ + | | + | argument of type [type error] unexpected | note: function defined here --> $DIR/issue-34264.rs:3:4 | LL | fn bar(x, y: usize) {} | ^^^ - -------- +help: remove the extra argument + | +LL | bar(1, 2); + | ^^^^^^^^^ error: aborting due to 6 previous errors -Some errors have detailed explanations: E0061, E0308. -For more information about an error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/span/missing-unit-argument.rs b/src/test/ui/span/missing-unit-argument.rs index b8fb332120a4e..52967d0f2a9fc 100644 --- a/src/test/ui/span/missing-unit-argument.rs +++ b/src/test/ui/span/missing-unit-argument.rs @@ -8,10 +8,10 @@ impl S { } fn main() { - let _: Result<(), String> = Ok(); //~ ERROR this function takes - foo(); //~ ERROR this function takes - foo(()); //~ ERROR this function takes - bar(); //~ ERROR this function takes - S.baz(); //~ ERROR this function takes - S.generic::<()>(); //~ ERROR this function takes + let _: Result<(), String> = Ok(); //~ ERROR arguments to this function are incorrect + foo(); //~ ERROR arguments to this function are incorrect + foo(()); //~ ERROR arguments to this function are incorrect + bar(); //~ ERROR arguments to this function are incorrect + S.baz(); //~ ERROR arguments to this function are incorrect + S.generic::<()>(); //~ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/span/missing-unit-argument.stderr b/src/test/ui/span/missing-unit-argument.stderr index b15da2cb47955..70505261b3a53 100644 --- a/src/test/ui/span/missing-unit-argument.stderr +++ b/src/test/ui/span/missing-unit-argument.stderr @@ -1,90 +1,97 @@ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/missing-unit-argument.rs:11:33 | LL | let _: Result<(), String> = Ok(); - | ^^-- supplied 0 arguments + | ^^^^ an argument of type () is missing | -help: expected the unit value `()`; create it with empty parentheses +help: provide the argument | -LL | let _: Result<(), String> = Ok(()); - | ^^ +LL | let _: Result<(), String> = (()); + | ^^^^ -error[E0061]: this function takes 2 arguments but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/missing-unit-argument.rs:12:5 | LL | foo(); - | ^^^-- supplied 0 arguments + | ^^^^^ | | - | expected 2 arguments + | an argument of type () is missing + | an argument of type () is missing | note: function defined here --> $DIR/missing-unit-argument.rs:1:4 | LL | fn foo(():(), ():()) {} | ^^^ ----- ----- +help: did you mean + | +LL | foo((), ()); + | ^^^^^^^^^^^ -error[E0061]: this function takes 2 arguments but 1 argument was supplied +error[E0308]: arguments to this function are incorrect --> $DIR/missing-unit-argument.rs:13:5 | LL | foo(()); - | ^^^ -- supplied 1 argument - | | - | expected 2 arguments + | ^^^^^^^ an argument of type () is missing | note: function defined here --> $DIR/missing-unit-argument.rs:1:4 | LL | fn foo(():(), ():()) {} | ^^^ ----- ----- +help: provide the argument + | +LL | foo((), ()); + | ^^^^^^^^^^^ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/missing-unit-argument.rs:14:5 | LL | bar(); - | ^^^-- supplied 0 arguments + | ^^^^^ an argument of type () is missing | note: function defined here --> $DIR/missing-unit-argument.rs:2:4 | LL | fn bar(():()) {} | ^^^ ----- -help: expected the unit value `()`; create it with empty parentheses +help: provide the argument | LL | bar(()); - | ^^ + | ^^^^^^^ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/missing-unit-argument.rs:15:7 | LL | S.baz(); - | ^^^- supplied 0 arguments + | ^^^ an argument of type () is missing | note: associated function defined here --> $DIR/missing-unit-argument.rs:6:8 | LL | fn baz(self, (): ()) { } | ^^^ ---- ------ -help: expected the unit value `()`; create it with empty parentheses +help: provide the argument | -LL | S.baz(()); - | ^^ +LL | S.baz(())(); + | ^^^^^^^ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/missing-unit-argument.rs:16:7 | LL | S.generic::<()>(); - | ^^^^^^^------ supplied 0 arguments + | ^^^^^^^ an argument of type () is missing | note: associated function defined here --> $DIR/missing-unit-argument.rs:7:8 | LL | fn generic(self, _: T) { } | ^^^^^^^ ---- ---- -help: expected the unit value `()`; create it with empty parentheses +help: provide the argument | -LL | S.generic::<()>(()); - | ^^ +LL | S.generic(())::<()>(); + | ^^^^^^^^^^^ error: aborting due to 6 previous errors -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/suggestions/as-ref.rs b/src/test/ui/suggestions/as-ref.rs index 03f04c389f1f3..d5471b3c5c2fb 100644 --- a/src/test/ui/suggestions/as-ref.rs +++ b/src/test/ui/suggestions/as-ref.rs @@ -4,14 +4,14 @@ fn takes_ref(_: &Foo) {} fn main() { let ref opt = Some(Foo); opt.map(|arg| takes_ref(arg)); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] opt.and_then(|arg| Some(takes_ref(arg))); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] let ref opt: Result<_, ()> = Ok(Foo); opt.map(|arg| takes_ref(arg)); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] opt.and_then(|arg| Ok(takes_ref(arg))); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] let x: &Option = &Some(3); let y: Option<&usize> = x; //~^ ERROR mismatched types [E0308] diff --git a/src/test/ui/suggestions/as-ref.stderr b/src/test/ui/suggestions/as-ref.stderr index 4b5a9be7e5b4d..4d832d5ea0876 100644 --- a/src/test/ui/suggestions/as-ref.stderr +++ b/src/test/ui/suggestions/as-ref.stderr @@ -1,34 +1,74 @@ -error[E0308]: mismatched types - --> $DIR/as-ref.rs:6:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/as-ref.rs:6:17 | LL | opt.map(|arg| takes_ref(arg)); - | --- ^^^ expected `&Foo`, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().map` + | ^^^^^^^^^^---^ + | | + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/as-ref.rs:2:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | opt.map(|arg| takes_ref({&Foo})); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/as-ref.rs:8:37 +error[E0308]: arguments to this function are incorrect + --> $DIR/as-ref.rs:8:27 | LL | opt.and_then(|arg| Some(takes_ref(arg))); - | -------- ^^^ expected `&Foo`, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().and_then` + | ^^^^^^^^^^---^ + | | + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/as-ref.rs:2:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | opt.and_then(|arg| Some(takes_ref({&Foo}))); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/as-ref.rs:11:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/as-ref.rs:11:17 | LL | opt.map(|arg| takes_ref(arg)); - | --- ^^^ expected `&Foo`, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().map` + | ^^^^^^^^^^---^ + | | + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/as-ref.rs:2:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | opt.map(|arg| takes_ref({&Foo})); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/as-ref.rs:13:35 +error[E0308]: arguments to this function are incorrect + --> $DIR/as-ref.rs:13:25 | LL | opt.and_then(|arg| Ok(takes_ref(arg))); - | -------- ^^^ expected `&Foo`, found struct `Foo` - | | - | help: consider using `as_ref` instead: `as_ref().and_then` + | ^^^^^^^^^^---^ + | | + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/as-ref.rs:2:4 + | +LL | fn takes_ref(_: &Foo) {} + | ^^^^^^^^^ ------- +help: provide an argument of the correct type + | +LL | opt.and_then(|arg| Ok(takes_ref({&Foo}))); + | ^^^^^^^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/as-ref.rs:16:27 diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.rs b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.rs index 5dee0f5dae0b0..2658e9a1f0dd3 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.rs +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.rs @@ -19,7 +19,7 @@ fn bar + Send + 'static>(x: F) -> BoxFuture<'static, i32> } fn baz + Send + 'static>(x: F) -> BoxFuture<'static, i32> { - Pin::new(x) //~ ERROR mismatched types + Pin::new(x) //~ ERROR arguments to this function are incorrect //~^ ERROR E0277 } diff --git a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr index 32961b7f87be0..a04db1c69e64f 100644 --- a/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr +++ b/src/test/ui/suggestions/expected-boxed-future-isnt-pinned.stderr @@ -25,28 +25,26 @@ LL | Box::new(x) found struct `Box` = help: use `Box::pin` -error[E0308]: mismatched types - --> $DIR/expected-boxed-future-isnt-pinned.rs:22:14 +error[E0277]: `dyn Future + Send` cannot be unpinned + --> $DIR/expected-boxed-future-isnt-pinned.rs:22:5 | -LL | fn baz + Send + 'static>(x: F) -> BoxFuture<'static, i32> { - | - this type parameter LL | Pin::new(x) - | ^ - | | - | expected struct `Box`, found type parameter `F` - | help: store this in the heap by calling `Box::new`: `Box::new(x)` + | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` | - = note: expected struct `Box + Send>` - found type parameter `F` - = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html + = note: required by `Pin::

::new` -error[E0277]: `dyn Future + Send` cannot be unpinned +error[E0308]: arguments to this function are incorrect --> $DIR/expected-boxed-future-isnt-pinned.rs:22:5 | LL | Pin::new(x) - | ^^^^^^^^ the trait `Unpin` is not implemented for `dyn Future + Send` + | ^^^^^^^^^-^ + | | + | expected `Box + Send>`, found `F` | - = note: required by `Pin::

::new` +help: provide an argument of the correct type + | +LL | ({Box + Send>}) + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error[E0277]: `dyn Future + Send` cannot be unpinned --> $DIR/expected-boxed-future-isnt-pinned.rs:27:5 diff --git a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs index 82935af0a81d2..189de8a2c14c7 100644 --- a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs +++ b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.rs @@ -12,5 +12,5 @@ fn main() { let _: usize = X {}; //~^ ERROR mismatched types foo(""); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr index aa621111c00c5..f276af53af39d 100644 --- a/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr +++ b/src/test/ui/suggestions/recover-from-semicolon-trailing-item.stderr @@ -34,11 +34,23 @@ LL | let _: usize = X {}; | | | expected due to this -error[E0308]: mismatched types - --> $DIR/recover-from-semicolon-trailing-item.rs:14:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/recover-from-semicolon-trailing-item.rs:14:5 | LL | foo(""); - | ^^ expected `usize`, found `&str` + | ^^^^--^ + | | + | expected `usize`, found `&'static str` + | +note: function defined here + --> $DIR/recover-from-semicolon-trailing-item.rs:6:4 + | +LL | fn foo(a: usize) {}; + | ^^^ -------- +help: provide an argument of the correct type + | +LL | foo({usize}); + | ^^^^^^^^^^^^ error: aborting due to 6 previous errors diff --git a/src/test/ui/suggestions/suggest-box.fixed b/src/test/ui/suggestions/suggest-box.fixed index 3de02cd0bd481..001505f335721 100644 --- a/src/test/ui/suggestions/suggest-box.fixed +++ b/src/test/ui/suggestions/suggest-box.fixed @@ -1,7 +1,8 @@ // run-rustfix fn main() { - let _x: Box Result<(), ()>> = Box::new(|| { //~ ERROR mismatched types + let _x: Box Result<(), ()>> = Box::new(|| { + //~^ ERROR mismatched types Err(())?; Ok(()) }); diff --git a/src/test/ui/suggestions/suggest-box.rs b/src/test/ui/suggestions/suggest-box.rs index e680a61db3b17..60d9350dc0024 100644 --- a/src/test/ui/suggestions/suggest-box.rs +++ b/src/test/ui/suggestions/suggest-box.rs @@ -1,7 +1,8 @@ // run-rustfix fn main() { - let _x: Box Result<(), ()>> = || { //~ ERROR mismatched types + let _x: Box Result<(), ()>> = || { + //~^ ERROR mismatched types Err(())?; Ok(()) }; diff --git a/src/test/ui/suggestions/suggest-box.stderr b/src/test/ui/suggestions/suggest-box.stderr index 57c83baf4f831..0e831d65447bf 100644 --- a/src/test/ui/suggestions/suggest-box.stderr +++ b/src/test/ui/suggestions/suggest-box.stderr @@ -5,17 +5,19 @@ LL | let _x: Box Result<(), ()>> = || { | _____________-------------------------------___^ | | | | | expected due to this +LL | | LL | | Err(())?; LL | | Ok(()) LL | | }; | |_____^ expected struct `Box`, found closure | = note: expected struct `Box std::result::Result<(), ()>>` - found closure `[closure@$DIR/suggest-box.rs:4:47: 7:6]` + found closure `[closure@$DIR/suggest-box.rs:4:47: 8:6]` = note: for more on the distinction between the stack and the heap, read https://doc.rust-lang.org/book/ch15-01-box.html, https://doc.rust-lang.org/rust-by-example/std/box.html, and https://doc.rust-lang.org/std/boxed/index.html help: store this in the heap by calling `Box::new` | LL | let _x: Box Result<(), ()>> = Box::new(|| { +LL | LL | Err(())?; LL | Ok(()) LL | }); diff --git a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.fixed b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.fixed index 8ef7e34ab3050..2afd28f7431e6 100644 --- a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.fixed +++ b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.fixed @@ -9,33 +9,33 @@ trait Trait { struct S(T); impl S { - fn foo<'a, T: Trait + 'a>(&self, _: impl Trait, x: impl Trait, _: T) { - qux(x.func()) //~ ERROR mismatched types + fn foo<'a, T: Trait + 'a>(&self, _: impl Trait, x: impl Trait, _: T) { + qux({usize}) //~ ERROR arguments to this function are incorrect } - fn ban(x: T) where T: Trait { - qux(x.func()) //~ ERROR mismatched types + fn ban(x: T) where T: Trait { + qux({usize}) //~ ERROR arguments to this function are incorrect } } -fn foo<'a, T: Trait + 'a>(_: impl Trait, x: impl Trait, _: T) { - qux(x.func()) //~ ERROR mismatched types +fn foo<'a, T: Trait + 'a>(_: impl Trait, x: impl Trait, _: T) { + qux({usize}) //~ ERROR arguments to this function are incorrect } -fn bar>(x: T) { - qux(x.func()) //~ ERROR mismatched types +fn bar(x: T) { + qux({usize}) //~ ERROR arguments to this function are incorrect } -fn foo2(x: impl Trait) { - qux(x.func()) //~ ERROR mismatched types +fn foo2(x: impl Trait) { + qux({usize}) //~ ERROR arguments to this function are incorrect } -fn bar2>(x: T) { - qux(x.func()) //~ ERROR mismatched types +fn bar2>(x: T) { + qux({usize}) //~ ERROR arguments to this function are incorrect } -fn ban(x: T) where T: Trait { - qux(x.func()) //~ ERROR mismatched types +fn ban(x: T) where T: Trait { + qux({usize}) //~ ERROR arguments to this function are incorrect } fn qux(_: usize) {} diff --git a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.rs b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.rs index 7bd38d0d45d90..8560feaec85ed 100644 --- a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.rs +++ b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.rs @@ -10,32 +10,32 @@ trait Trait { struct S(T); impl S { fn foo<'a, T: Trait + 'a>(&self, _: impl Trait, x: impl Trait, _: T) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn ban(x: T) where T: Trait { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } } fn foo<'a, T: Trait + 'a>(_: impl Trait, x: impl Trait, _: T) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn bar(x: T) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn foo2(x: impl Trait) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn bar2>(x: T) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn ban(x: T) where T: Trait { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn qux(_: usize) {} diff --git a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.stderr b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.stderr index f785f7b84a76f..bb98e280b1035 100644 --- a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.stderr +++ b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction-fixable.stderr @@ -1,93 +1,128 @@ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:13:13 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:13:9 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | -LL | fn foo<'a, T: Trait + 'a>(&self, _: impl Trait, x: impl Trait, _: T) { - | ^^^^^^^^^^^ +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type + | +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:17:13 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:17:9 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn ban(x: T) where T: Trait { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:22:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:22:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | -LL | fn foo<'a, T: Trait + 'a>(_: impl Trait, x: impl Trait, _: T) { - | ^^^^^^^^^^^ +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type + | +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:26:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:26:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn bar>(x: T) { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:30:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:30:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found ` as Trait>::A` | - = note: expected type `usize` - found associated type ` as Trait>::A` -help: consider constraining the associated type ` as Trait>::A` to `usize` +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | -LL | fn foo2(x: impl Trait) { - | ^^^^^^^^^^^ +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type + | +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:34:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:34:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `>::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | - = note: expected type `usize` - found associated type `>::A` -help: consider constraining the associated type `>::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn bar2>(x: T) { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:38:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:38:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction-fixable.rs:41:4 | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn ban(x: T) where T: Trait { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ error: aborting due to 7 previous errors diff --git a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.rs b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.rs index 0d90e449523a3..9f2e4ece80b3d 100644 --- a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.rs +++ b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.rs @@ -11,32 +11,32 @@ trait Trait { } fn foo(_: impl Trait, x: impl Trait) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn bar(x: T) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn foo2(x: impl Trait) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn bar2>(x: T) { - x.funk(3); //~ ERROR mismatched types - qux(x.func()) //~ ERROR mismatched types + x.funk(3); //~ ERROR arguments to this function are incorrect + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn baz>(x: T) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn bat(x: &mut dyn Trait<(), A = ()>) { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn ban(x: T) where T: Trait { - qux(x.func()) //~ ERROR mismatched types + qux(x.func()) //~ ERROR arguments to this function are incorrect } fn qux(_: usize) {} diff --git a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.stderr b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.stderr index e629f8f970d32..3588322d6142d 100644 --- a/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.stderr +++ b/src/test/ui/suggestions/trait-with-missing-associated-type-restriction.stderr @@ -12,108 +12,147 @@ help: a method is available that returns `>::A` LL | fn func(&self) -> Self::A; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::func` -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:14:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:14:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn foo(_: impl Trait, x: impl Trait) { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:18:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:18:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 | -LL | fn bar>(x: T) { - | ^^^^^^^^^^^ +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type + | +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:22:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:22:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found ` as Trait>::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 | - = note: expected type `usize` - found associated type ` as Trait>::A` -help: consider constraining the associated type ` as Trait>::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn foo2(x: impl Trait) { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:26:12 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:26:7 | LL | x.funk(3); - | ^ expected associated type, found integer + | ^^^^ - expected `>::A`, found `{integer}` | - = note: expected associated type `>::A` - found type `{integer}` -help: some methods are available that return `>::A` - --> $DIR/trait-with-missing-associated-type-restriction.rs:8:5 +note: associated function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:9:8 | -LL | fn func(&self) -> Self::A; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::func` LL | fn funk(&self, _: Self::A); -LL | fn funq(&self) -> Self::A {} - | ^^^^^^^^^^^^^^^^^^^^^^^^^ consider calling `Trait::funq` -help: consider constraining the associated type `>::A` to `{integer}` + | ^^^^ +help: provide an argument of the correct type | -LL | fn bar2>(x: T) { - | ^^^^^^^^^^^^^^^ +LL | x.funk({>::A})(3); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:27:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:27:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `>::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 | - = note: expected type `usize` - found associated type `>::A` -help: consider constraining the associated type `>::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn bar2>(x: T) { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:31:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:31:5 | -LL | fn baz>(x: T) { - | - this type parameter LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found type parameter `D` + | ^^^^--------^ + | | + | expected `usize`, found `D` | - = note: expected type `usize` - found type parameter `D` +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 + | +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type + | +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:35:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:35:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found `()` + | ^^^^--------^ + | | + | expected `usize`, found `()` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 + | +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type + | +LL | qux({usize}) + | ^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/trait-with-missing-associated-type-restriction.rs:39:9 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-with-missing-associated-type-restriction.rs:39:5 | LL | qux(x.func()) - | ^^^^^^^^ expected `usize`, found associated type + | ^^^^--------^ + | | + | expected `usize`, found `::A` + | +note: function defined here + --> $DIR/trait-with-missing-associated-type-restriction.rs:42:4 | - = note: expected type `usize` - found associated type `::A` -help: consider constraining the associated type `::A` to `usize` +LL | fn qux(_: usize) {} + | ^^^ -------- +help: provide an argument of the correct type | -LL | fn ban(x: T) where T: Trait { - | ^^^^^^^^^^^ +LL | qux({usize}) + | ^^^^^^^^^^^^ error: aborting due to 9 previous errors diff --git a/src/test/ui/switched-expectations.rs b/src/test/ui/switched-expectations.rs index c5bc84de54c48..792cc53d3a2ed 100644 --- a/src/test/ui/switched-expectations.rs +++ b/src/test/ui/switched-expectations.rs @@ -1,4 +1,5 @@ fn main() { let var = 10i32; - let ref string: String = var; //~ ERROR mismatched types [E0308] + let ref string: String = var; + //~^ ERROR mismatched types [E0308] } diff --git a/src/test/ui/terminal-width/flag-json.rs b/src/test/ui/terminal-width/flag-json.rs index eabdc59ddedd5..3d2530e204b33 100644 --- a/src/test/ui/terminal-width/flag-json.rs +++ b/src/test/ui/terminal-width/flag-json.rs @@ -5,5 +5,5 @@ fn main() { let _: () = 42; - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/terr-in-field.rs b/src/test/ui/terr-in-field.rs index aa801fd0a6c64..908d1bcdbd617 100644 --- a/src/test/ui/terr-in-field.rs +++ b/src/test/ui/terr-in-field.rs @@ -10,7 +10,7 @@ struct Bar { fn want_foo(f: Foo) {} fn have_bar(b: Bar) { - want_foo(b); //~ ERROR mismatched types + want_foo(b); //~ ERROR arguments to this function are incorrect //~| expected struct `Foo`, found struct `Bar` } diff --git a/src/test/ui/terr-in-field.stderr b/src/test/ui/terr-in-field.stderr index 5c6859a0efe98..4c2020e15ecbc 100644 --- a/src/test/ui/terr-in-field.stderr +++ b/src/test/ui/terr-in-field.stderr @@ -1,8 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/terr-in-field.rs:13:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/terr-in-field.rs:13:5 | LL | want_foo(b); - | ^ expected struct `Foo`, found struct `Bar` + | ^^^^^^^^^-^ + | | + | expected `Foo`, found `Bar` + | +note: function defined here + --> $DIR/terr-in-field.rs:11:4 + | +LL | fn want_foo(f: Foo) {} + | ^^^^^^^^ ------ +help: provide an argument of the correct type + | +LL | want_foo({Foo}); + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/terr-sorts.rs b/src/test/ui/terr-sorts.rs index c1e2f7daee5ec..5734d6817bfd4 100644 --- a/src/test/ui/terr-sorts.rs +++ b/src/test/ui/terr-sorts.rs @@ -7,7 +7,7 @@ type Bar = Box; fn want_foo(f: Foo) {} fn have_bar(b: Bar) { - want_foo(b); //~ ERROR mismatched types + want_foo(b); //~ ERROR arguments to this function are incorrect //~| expected struct `Foo` //~| found struct `Box` } diff --git a/src/test/ui/terr-sorts.stderr b/src/test/ui/terr-sorts.stderr index 869b372965966..97557f80b7985 100644 --- a/src/test/ui/terr-sorts.stderr +++ b/src/test/ui/terr-sorts.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/terr-sorts.rs:10:14 +error[E0308]: arguments to this function are incorrect + --> $DIR/terr-sorts.rs:10:5 | LL | want_foo(b); - | ^ expected struct `Foo`, found struct `Box` + | ^^^^^^^^^-^ + | | + | expected `Foo`, found `Box` | - = note: expected struct `Foo` - found struct `Box` +note: function defined here + --> $DIR/terr-sorts.rs:8:4 + | +LL | fn want_foo(f: Foo) {} + | ^^^^^^^^ ------ +help: provide an argument of the correct type + | +LL | want_foo({Foo}); + | ^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/trait-bounds-sugar.rs b/src/test/ui/traits/trait-bounds-sugar.rs index 65b6f6faa4250..eaf2adfeb157d 100644 --- a/src/test/ui/traits/trait-bounds-sugar.rs +++ b/src/test/ui/traits/trait-bounds-sugar.rs @@ -9,7 +9,7 @@ fn b(_x: &'static (dyn Foo + 'static)) { } fn c(x: Box) { - a(x); //~ ERROR mismatched types + a(x); //~ ERROR arguments to this function are incorrect } fn d(x: &'static (dyn Foo + Sync)) { diff --git a/src/test/ui/traits/trait-bounds-sugar.stderr b/src/test/ui/traits/trait-bounds-sugar.stderr index 6bd335fe4739a..aab1290d1613b 100644 --- a/src/test/ui/traits/trait-bounds-sugar.stderr +++ b/src/test/ui/traits/trait-bounds-sugar.stderr @@ -1,11 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/trait-bounds-sugar.rs:12:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/trait-bounds-sugar.rs:12:5 | LL | a(x); - | ^ expected trait `Foo + Send`, found trait `Foo + Sync` + | ^^-^ + | | + | expected `Box<(dyn Foo + Send + 'static)>`, found `Box<(dyn Foo + Sync + 'static)>` | - = note: expected struct `Box<(dyn Foo + Send + 'static)>` - found struct `Box<(dyn Foo + Sync + 'static)>` +note: function defined here + --> $DIR/trait-bounds-sugar.rs:5:4 + | +LL | fn a(_x: Box) { + | ^ ----------------------- +help: provide an argument of the correct type + | +LL | a({Box<(dyn Foo + Send + 'static)>}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/traits/traits-multidispatch-bad.rs b/src/test/ui/traits/traits-multidispatch-bad.rs index b625b96159025..86fc2cbdd041e 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.rs +++ b/src/test/ui/traits/traits-multidispatch-bad.rs @@ -16,7 +16,7 @@ where T : Convert } fn a() { - test(22i32, 44i32); //~ ERROR mismatched types + test(22i32, 44i32); //~ ERROR arguments to this function are incorrect } fn main() {} diff --git a/src/test/ui/traits/traits-multidispatch-bad.stderr b/src/test/ui/traits/traits-multidispatch-bad.stderr index 671faf45178f9..902d8967f49e9 100644 --- a/src/test/ui/traits/traits-multidispatch-bad.stderr +++ b/src/test/ui/traits/traits-multidispatch-bad.stderr @@ -1,13 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/traits-multidispatch-bad.rs:19:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/traits-multidispatch-bad.rs:19:5 | LL | test(22i32, 44i32); - | ^^^^^ expected `u32`, found `i32` + | ^^^^^-----^^^^^^^^ + | | + | expected `_`, found `i32` | -help: change the type of the numeric literal from `i32` to `u32` +note: function defined here + --> $DIR/traits-multidispatch-bad.rs:13:4 | -LL | test(22i32, 44u32); - | ^^^^^ +LL | fn test(_: T, _: U) + | ^^^^ ---- ---- +help: provide an argument of the correct type + | +LL | test(22i32, {u32}); + | ^^^^^^^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/tuple/tuple-arity-mismatch.rs b/src/test/ui/tuple/tuple-arity-mismatch.rs index f1e525c93e17f..97cdbb3c9b819 100644 --- a/src/test/ui/tuple/tuple-arity-mismatch.rs +++ b/src/test/ui/tuple/tuple-arity-mismatch.rs @@ -4,13 +4,13 @@ fn first((value, _): (isize, f64)) -> isize { value } fn main() { let y = first ((1,2.0,3)); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected tuple `(isize, f64)` //~| found tuple `(isize, f64, {integer})` //~| expected a tuple with 2 elements, found one with 3 elements let y = first ((1,)); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected tuple `(isize, f64)` //~| found tuple `(isize,)` //~| expected a tuple with 2 elements, found one with 1 element diff --git a/src/test/ui/tuple/tuple-arity-mismatch.stderr b/src/test/ui/tuple/tuple-arity-mismatch.stderr index 10bcedaf4aa9a..c943070773b81 100644 --- a/src/test/ui/tuple/tuple-arity-mismatch.stderr +++ b/src/test/ui/tuple/tuple-arity-mismatch.stderr @@ -1,20 +1,38 @@ -error[E0308]: mismatched types - --> $DIR/tuple-arity-mismatch.rs:6:20 +error[E0308]: arguments to this function are incorrect + --> $DIR/tuple-arity-mismatch.rs:6:13 | LL | let y = first ((1,2.0,3)); - | ^^^^^^^^^ expected a tuple with 2 elements, found one with 3 elements + | ^^^^^^^---------^ + | | + | expected `(isize, f64)`, found `(isize, f64, {integer})` | - = note: expected tuple `(isize, f64)` - found tuple `(isize, f64, {integer})` +note: function defined here + --> $DIR/tuple-arity-mismatch.rs:3:4 + | +LL | fn first((value, _): (isize, f64)) -> isize { value } + | ^^^^^ ------------------------ +help: provide an argument of the correct type + | +LL | let y = first({(isize, f64)}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/tuple-arity-mismatch.rs:12:20 +error[E0308]: arguments to this function are incorrect + --> $DIR/tuple-arity-mismatch.rs:12:13 | LL | let y = first ((1,)); - | ^^^^ expected a tuple with 2 elements, found one with 1 element + | ^^^^^^^----^ + | | + | expected `(isize, f64)`, found `(isize,)` + | +note: function defined here + --> $DIR/tuple-arity-mismatch.rs:3:4 + | +LL | fn first((value, _): (isize, f64)) -> isize { value } + | ^^^^^ ------------------------ +help: provide an argument of the correct type | - = note: expected tuple `(isize, f64)` - found tuple `(isize,)` +LL | let y = first({(isize, f64)}); + | ^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/tutorial-suffix-inference-test.rs b/src/test/ui/tutorial-suffix-inference-test.rs index 849adfd53686b..3ab4e9dd5f096 100644 --- a/src/test/ui/tutorial-suffix-inference-test.rs +++ b/src/test/ui/tutorial-suffix-inference-test.rs @@ -7,10 +7,10 @@ fn main() { identity_u8(x); // after this, `x` is assumed to have type `u8` identity_u16(x); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `u8` identity_u16(y); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `i32` let a = 3; @@ -19,6 +19,6 @@ fn main() { identity_i(a); // ok identity_u16(a); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| expected `u16`, found `isize` } diff --git a/src/test/ui/tutorial-suffix-inference-test.stderr b/src/test/ui/tutorial-suffix-inference-test.stderr index f9974acfb7071..0c752d5e8848b 100644 --- a/src/test/ui/tutorial-suffix-inference-test.stderr +++ b/src/test/ui/tutorial-suffix-inference-test.stderr @@ -1,33 +1,56 @@ -error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:9:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/tutorial-suffix-inference-test.rs:9:5 | LL | identity_u16(x); - | ^ + | ^^^^^^^^^^^^^-^ | | | expected `u16`, found `u8` - | help: you can convert a `u8` to a `u16`: `x.into()` + | +note: function defined here + --> $DIR/tutorial-suffix-inference-test.rs:6:8 + | +LL | fn identity_u16(n: u16) -> u16 { n } + | ^^^^^^^^^^^^ ------ +help: provide an argument of the correct type + | +LL | identity_u16({u16}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:12:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/tutorial-suffix-inference-test.rs:12:5 | LL | identity_u16(y); - | ^ expected `u16`, found `i32` + | ^^^^^^^^^^^^^-^ + | | + | expected `u16`, found `i32` | -help: you can convert an `i32` to a `u16` and panic if the converted value doesn't fit +note: function defined here + --> $DIR/tutorial-suffix-inference-test.rs:6:8 | -LL | identity_u16(y.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | fn identity_u16(n: u16) -> u16 { n } + | ^^^^^^^^^^^^ ------ +help: provide an argument of the correct type + | +LL | identity_u16({u16}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/tutorial-suffix-inference-test.rs:21:18 +error[E0308]: arguments to this function are incorrect + --> $DIR/tutorial-suffix-inference-test.rs:21:5 | LL | identity_u16(a); - | ^ expected `u16`, found `isize` + | ^^^^^^^^^^^^^-^ + | | + | expected `u16`, found `isize` + | +note: function defined here + --> $DIR/tutorial-suffix-inference-test.rs:6:8 | -help: you can convert an `isize` to a `u16` and panic if the converted value doesn't fit +LL | fn identity_u16(n: u16) -> u16 { n } + | ^^^^^^^^^^^^ ------ +help: provide an argument of the correct type | -LL | identity_u16(a.try_into().unwrap()); - | ^^^^^^^^^^^^^^^^^^^^^ +LL | identity_u16({u16}); + | ^^^^^^^^^^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs index f182c3ba8c798..1ec98a398ee20 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.rs @@ -11,12 +11,12 @@ type AliasFixed = Enum<()>; impl Enum { fn ts_variant() { Self::TSVariant(()); - //~^ ERROR mismatched types [E0308] + //~^ ERROR arguments to this function are incorrect [E0308] Self::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed for this type [E0109] Self::<()>::TSVariant(()); //~^ ERROR type arguments are not allowed for this type [E0109] - //~^^ ERROR mismatched types [E0308] + //~^^ ERROR arguments to this function are incorrect [E0308] Self::<()>::TSVariant::<()>(()); //~^ ERROR type arguments are not allowed for this type [E0109] //~^^ ERROR type arguments are not allowed for this type [E0109] diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr index caea791e6536b..094ab75d379fb 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-generic-args.stderr @@ -1,14 +1,20 @@ -error[E0308]: mismatched types - --> $DIR/enum-variant-generic-args.rs:13:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/enum-variant-generic-args.rs:13:9 | -LL | impl Enum { - | - this type parameter -LL | fn ts_variant() { LL | Self::TSVariant(()); - | ^^ expected type parameter `T`, found `()` + | ^^^^^^^^^^^^^^^^--^ + | | + | expected `T`, found `()` | - = note: expected type parameter `T` - found unit type `()` +note: tuple variant defined here + --> $DIR/enum-variant-generic-args.rs:7:16 + | +LL | enum Enum { TSVariant(T), SVariant { v: T }, UVariant } + | ^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | TSVariant(T)({T}); + | ^^^^^^^^^^^^^^^^^ error[E0109]: type arguments are not allowed for this type --> $DIR/enum-variant-generic-args.rs:15:27 @@ -22,17 +28,23 @@ error[E0109]: type arguments are not allowed for this type LL | Self::<()>::TSVariant(()); | ^^ type argument not allowed -error[E0308]: mismatched types - --> $DIR/enum-variant-generic-args.rs:17:31 +error[E0308]: arguments to this function are incorrect + --> $DIR/enum-variant-generic-args.rs:17:9 | -LL | impl Enum { - | - this type parameter -... LL | Self::<()>::TSVariant(()); - | ^^ expected type parameter `T`, found `()` + | ^^^^^^^^^^^^^^^^^^^^^^--^ + | | + | expected `T`, found `()` | - = note: expected type parameter `T` - found unit type `()` +note: tuple variant defined here + --> $DIR/enum-variant-generic-args.rs:7:16 + | +LL | enum Enum { TSVariant(T), SVariant { v: T }, UVariant } + | ^^^^^^^^^^^^ +help: provide an argument of the correct type + | +LL | TSVariant(T)({T}); + | ^^^^^^^^^^^^^^^^^ error[E0109]: type arguments are not allowed for this type --> $DIR/enum-variant-generic-args.rs:20:16 diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.rs b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.rs index d012687533bbe..8d5c0b23f0f41 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.rs +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.rs @@ -18,6 +18,6 @@ impl E2 { } fn main() { - ::V(); //~ ERROR this function takes 1 argument but 0 arguments were supplied + ::V(); //~ ERROR arguments to this function are incorrect let _: u8 = ::V; //~ ERROR mismatched types } diff --git a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr index 20e260584513a..e162993f68f9f 100644 --- a/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr +++ b/src/test/ui/type-alias-enum-variants/enum-variant-priority-higher-than-other-inherent.stderr @@ -1,16 +1,18 @@ -error[E0061]: this function takes 1 argument but 0 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:21:5 | LL | ::V(); - | ^^^^^^-- supplied 0 arguments - | | - | expected 1 argument + | ^^^^^^^^ an argument of type u8 is missing | note: tuple variant defined here --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:5:5 | LL | V(u8) | ^^^^^ +help: provide the argument + | +LL | V(u8)({u8}); + | ^^^^^^^^^^^ error[E0308]: mismatched types --> $DIR/enum-variant-priority-higher-than-other-inherent.rs:22:17 @@ -22,5 +24,4 @@ LL | let _: u8 = ::V; error: aborting due to 2 previous errors -Some errors have detailed explanations: E0061, E0308. -For more information about an error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.rs b/src/test/ui/type/type-ascription-instead-of-initializer.rs index 9f9b6f06bbc24..6e510e357984d 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.rs +++ b/src/test/ui/type/type-ascription-instead-of-initializer.rs @@ -1,4 +1,4 @@ fn main() { let x: Vec::with_capacity(10, 20); //~ ERROR expected type, found `10` - //~^ ERROR this function takes 1 argument + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/type/type-ascription-instead-of-initializer.stderr b/src/test/ui/type/type-ascription-instead-of-initializer.stderr index 530f77e5ae9b9..e7b453027b244 100644 --- a/src/test/ui/type/type-ascription-instead-of-initializer.stderr +++ b/src/test/ui/type/type-ascription-instead-of-initializer.stderr @@ -7,14 +7,19 @@ LL | let x: Vec::with_capacity(10, 20); | |help: use `=` if you meant to assign | while parsing the type for `x` -error[E0061]: this function takes 1 argument but 2 arguments were supplied +error[E0308]: arguments to this function are incorrect --> $DIR/type-ascription-instead-of-initializer.rs:2:12 | LL | let x: Vec::with_capacity(10, 20); - | ^^^^^^^^^^^^^^^^^^ -- -- supplied 2 arguments - | | - | expected 1 argument + | ^^^^^^^^^^^^^^^^^^^--^^^^^ + | | + | argument of type usize unexpected + | +help: remove the extra argument + | +LL | let x: (10); + | ^^^^ error: aborting due to 2 previous errors -For more information about this error, try `rustc --explain E0061`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/type/type-mismatch-same-crate-name.rs b/src/test/ui/type/type-mismatch-same-crate-name.rs index c9cdc874c02ea..cf05b188900b7 100644 --- a/src/test/ui/type/type-mismatch-same-crate-name.rs +++ b/src/test/ui/type/type-mismatch-same-crate-name.rs @@ -14,11 +14,11 @@ fn main() { { extern crate crate_a1 as a; a::try_foo(foo2); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| perhaps two different versions of crate `crate_a1` //~| expected struct `main::a::Foo` a::try_bar(bar2); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect //~| perhaps two different versions of crate `crate_a1` //~| expected trait `main::a::Bar` //~| expected struct `Box<(dyn main::a::Bar + 'static)>` diff --git a/src/test/ui/type/type-mismatch-same-crate-name.stderr b/src/test/ui/type/type-mismatch-same-crate-name.stderr index 49d40ebed130c..93f1b6c6d581e 100644 --- a/src/test/ui/type/type-mismatch-same-crate-name.stderr +++ b/src/test/ui/type/type-mismatch-same-crate-name.stderr @@ -1,20 +1,28 @@ -error[E0308]: mismatched types - --> $DIR/type-mismatch-same-crate-name.rs:16:20 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch-same-crate-name.rs:16:9 | LL | a::try_foo(foo2); - | ^^^^ expected struct `main::a::Foo`, found a different struct `main::a::Foo` + | ^^^^^^^^^^^----^ + | | + | expected `main::a::Foo`, found `main::a::Foo` | - = note: perhaps two different versions of crate `crate_a1` are being used? +help: provide an argument of the correct type + | +LL | ({main::a::Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch-same-crate-name.rs:20:20 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch-same-crate-name.rs:20:9 | LL | a::try_bar(bar2); - | ^^^^ expected trait `main::a::Bar`, found a different trait `main::a::Bar` + | ^^^^^^^^^^^----^ + | | + | expected `Box<(dyn main::a::Bar + 'static)>`, found `Box` + | +help: provide an argument of the correct type | - = note: expected struct `Box<(dyn main::a::Bar + 'static)>` - found struct `Box` - = note: perhaps two different versions of crate `crate_a1` are being used? +LL | ({Box<(dyn main::a::Bar + 'static)>}); + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to 2 previous errors diff --git a/src/test/ui/type/type-mismatch.rs b/src/test/ui/type/type-mismatch.rs index 11bfa3a72d98b..87950c275e344 100644 --- a/src/test/ui/type/type-mismatch.rs +++ b/src/test/ui/type/type-mismatch.rs @@ -14,65 +14,65 @@ struct bar; fn want(t: T) {} fn have_usize(f: usize) { - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect } fn have_foo(f: foo) { - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect } fn have_foo_foo(f: Foo) { - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::<&Foo>(f); //~ ERROR mismatched types - want::<&Foo>(f); //~ ERROR mismatched types + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::<&Foo>(f); //~ ERROR arguments to this function are incorrect + want::<&Foo>(f); //~ ERROR arguments to this function are incorrect } fn have_foo_foo_b(f: Foo) { - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::<&Foo>(f); //~ ERROR mismatched types - want::<&Foo>(f); //~ ERROR mismatched types + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::<&Foo>(f); //~ ERROR arguments to this function are incorrect + want::<&Foo>(f); //~ ERROR arguments to this function are incorrect } fn have_foo_foo_b_a(f: Foo) { - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::>(f); //~ ERROR mismatched types - want::<&Foo>(f); //~ ERROR mismatched types - want::<&Foo>(f); //~ ERROR mismatched types + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::>(f); //~ ERROR arguments to this function are incorrect + want::<&Foo>(f); //~ ERROR arguments to this function are incorrect + want::<&Foo>(f); //~ ERROR arguments to this function are incorrect } fn main() {} diff --git a/src/test/ui/type/type-mismatch.stderr b/src/test/ui/type/type-mismatch.stderr index 24c71c63103d3..972eba85d3c73 100644 --- a/src/test/ui/type/type-mismatch.stderr +++ b/src/test/ui/type/type-mismatch.stderr @@ -1,419 +1,848 @@ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:17:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:17:5 | LL | want::(f); - | ^ expected struct `foo`, found `usize` + | ^^^^^^^^^^^^-^ + | | + | expected `foo`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({foo}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:18:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:18:5 | LL | want::(f); - | ^ expected struct `bar`, found `usize` + | ^^^^^^^^^^^^-^ + | | + | expected `bar`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({bar}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:19:24 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:19:5 | LL | want::>(f); - | ^ expected struct `Foo`, found `usize` + | ^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found type `usize` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:20:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:20:5 | LL | want::>(f); - | ^ expected struct `Foo`, found `usize` + | ^^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo` - found type `usize` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:21:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:21:5 | LL | want::>(f); - | ^ expected struct `Foo`, found `usize` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `usize` | - = note: expected struct `Foo` - found type `usize` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:22:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:22:5 | LL | want::>(f); - | ^ expected struct `Foo`, found `usize` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found type `usize` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:23:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:23:5 | LL | want::>(f); - | ^ expected struct `Foo`, found `usize` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found type `usize` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:24:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:24:5 | LL | want::>(f); - | ^ expected struct `Foo`, found `usize` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `usize` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found type `usize` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:28:19 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:28:5 | LL | want::(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^-^ + | | + | expected `usize`, found `foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({usize}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:29:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:29:5 | LL | want::(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^-^ + | | + | expected `bar`, found `foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({bar}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:30:24 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:30:5 | LL | want::>(f); - | ^ expected struct `Foo`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo` - found struct `foo` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:31:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:31:5 | LL | want::>(f); - | ^ expected struct `Foo`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `foo` | - = note: expected struct `Foo` - found struct `foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:32:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:32:5 | LL | want::>(f); - | ^ expected struct `Foo`, found struct `foo` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo` - found struct `foo` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:33:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:33:5 | LL | want::>(f); - | ^ expected struct `Foo`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `foo` | - = note: expected struct `Foo` - found struct `foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:34:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:34:5 | LL | want::>(f); - | ^ expected struct `Foo`, found struct `foo` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:35:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:35:5 | LL | want::>(f); - | ^ expected struct `Foo`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo` - found struct `foo` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:39:19 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:39:5 | LL | want::(f); - | ^ expected `usize`, found struct `Foo` + | ^^^^^^^^^^^^^^-^ + | | + | expected `usize`, found `Foo` | - = note: expected type `usize` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({usize}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:40:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:40:5 | LL | want::(f); - | ^ expected struct `foo`, found struct `Foo` + | ^^^^^^^^^^^^-^ + | | + | expected `foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({foo}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:41:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:41:5 | LL | want::(f); - | ^ expected struct `bar`, found struct `Foo` + | ^^^^^^^^^^^^-^ + | | + | expected `bar`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `bar` - found struct `Foo` +LL | want({bar}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:42:24 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:42:5 | LL | want::>(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` | - = note: expected struct `Foo` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:43:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:43:5 | LL | want::>(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:44:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:44:5 | LL | want::>(f); - | ^ expected struct `B`, found struct `A` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo<_, B>` - found struct `Foo<_, A>` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:45:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:45:5 | LL | want::>(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` | - = note: expected struct `Foo` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:46:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:46:5 | LL | want::>(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:47:23 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:47:5 | LL | want::<&Foo>(f); - | ^ + | ^^^^^^^^^^^^^^^^^^-^ | | - | expected `&Foo`, found struct `Foo` - | help: consider borrowing here: `&f` + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected reference `&Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({&Foo}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:48:26 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:48:5 | LL | want::<&Foo>(f); - | ^ expected `&Foo`, found struct `Foo` + | ^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `&Foo`, found `Foo` | - = note: expected reference `&Foo` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({&Foo}); + | ^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:52:19 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:52:5 | LL | want::(f); - | ^ expected `usize`, found struct `Foo` + | ^^^^^^^^^^^^^^-^ + | | + | expected `usize`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected type `usize` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({usize}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:53:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:53:5 | LL | want::(f); - | ^ expected struct `foo`, found struct `Foo` + | ^^^^^^^^^^^^-^ + | | + | expected `foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `foo` - found struct `Foo` +LL | want({foo}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:54:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:54:5 | LL | want::(f); - | ^ expected struct `bar`, found struct `Foo` + | ^^^^^^^^^^^^-^ + | | + | expected `bar`, found `Foo` | - = note: expected struct `bar` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({bar}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:55:24 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:55:5 | LL | want::>(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:56:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:56:5 | LL | want::>(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:57:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:57:5 | LL | want::>(f); - | ^ expected struct `A`, found struct `B` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo<_, A>` - found struct `Foo<_, B>` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:58:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:58:5 | LL | want::>(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo` - found struct `Foo` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:59:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:59:5 | LL | want::>(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` | - = note: expected struct `Foo` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:60:23 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:60:5 | LL | want::<&Foo>(f); - | ^ expected `&Foo`, found struct `Foo` + | ^^^^^^^^^^^^^^^^^^-^ + | | + | expected `&Foo`, found `Foo` | - = note: expected reference `&Foo` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({&Foo}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:61:26 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:61:5 | LL | want::<&Foo>(f); - | ^ + | ^^^^^^^^^^^^^^^^^^^^^-^ | | - | expected `&Foo`, found struct `Foo` - | help: consider borrowing here: `&f` + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected reference `&Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({&Foo}); + | ^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:65:19 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:65:5 | LL | want::(f); - | ^ expected `usize`, found struct `Foo` + | ^^^^^^^^^^^^^^-^ + | | + | expected `usize`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected type `usize` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({usize}); + | ^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:66:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:66:5 | LL | want::(f); - | ^ expected struct `foo`, found struct `Foo` + | ^^^^^^^^^^^^-^ + | | + | expected `foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({foo}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:67:17 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:67:5 | LL | want::(f); - | ^ expected struct `bar`, found struct `Foo` + | ^^^^^^^^^^^^-^ + | | + | expected `bar`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `bar` - found struct `Foo` +LL | want({bar}); + | ^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:68:24 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:68:5 | LL | want::>(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` | - = note: expected struct `Foo` - found struct `Foo` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:69:27 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:69:5 | LL | want::>(f); - | ^ expected `usize`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:70:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:70:5 | LL | want::>(f); - | ^ expected struct `A`, found struct `B` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo<_, A, B>` - found struct `Foo<_, B, A>` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:71:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:71:5 | LL | want::>(f); - | ^ expected struct `B`, found struct `A` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` | - = note: expected struct `Foo<_, _, B>` - found struct `Foo<_, _, A>` +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:72:22 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:72:5 | LL | want::>(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 | - = note: expected struct `Foo` - found struct `Foo` +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type + | +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:73:25 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:73:5 | LL | want::>(f); - | ^ expected struct `bar`, found struct `foo` + | ^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected struct `Foo` - found struct `Foo` +LL | want({Foo}); + | ^^^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:74:23 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:74:5 | LL | want::<&Foo>(f); - | ^ expected `&Foo`, found struct `Foo` + | ^^^^^^^^^^^^^^^^^^-^ + | | + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected reference `&Foo` - found struct `Foo` +LL | want({&Foo}); + | ^^^^^^^^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/type-mismatch.rs:75:26 +error[E0308]: arguments to this function are incorrect + --> $DIR/type-mismatch.rs:75:5 | LL | want::<&Foo>(f); - | ^ expected `&Foo`, found struct `Foo` + | ^^^^^^^^^^^^^^^^^^^^^-^ + | | + | expected `&Foo`, found `Foo` + | +note: function defined here + --> $DIR/type-mismatch.rs:14:4 + | +LL | fn want(t: T) {} + | ^^^^ ---- +help: provide an argument of the correct type | - = note: expected reference `&Foo` - found struct `Foo` +LL | want({&Foo}); + | ^^^^^^^^^^^^^^^^^^^^ error: aborting due to 47 previous errors diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs index 939b3c5223c48..3ac7ee9e25fc8 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.rs @@ -4,7 +4,7 @@ fn main() { >::add(1, 2); //~^ ERROR cannot add `u32` to `i32` >::add(1u32, 2); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect >::add(1, 2u32); - //~^ ERROR mismatched types + //~^ ERROR arguments to this function are incorrect } diff --git a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr index a2bf963044582..f9d479836ea1b 100644 --- a/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr +++ b/src/test/ui/ufcs/ufcs-qpath-self-mismatch.stderr @@ -7,27 +7,31 @@ LL | >::add(1, 2); = help: the trait `Add` is not implemented for `i32` = note: required by `add` -error[E0308]: mismatched types - --> $DIR/ufcs-qpath-self-mismatch.rs:6:28 +error[E0308]: arguments to this function are incorrect + --> $DIR/ufcs-qpath-self-mismatch.rs:6:5 | LL | >::add(1u32, 2); - | ^^^^ expected `i32`, found `u32` + | ^^^^^^^^^^^^^^^^^^^^^^^----^^^^ + | | + | expected `i32`, found `u32` | -help: change the type of the numeric literal from `u32` to `i32` +help: provide an argument of the correct type | -LL | >::add(1i32, 2); - | ^^^^ +LL | ({i32}, 2); + | ^^^^^^^^^^ -error[E0308]: mismatched types - --> $DIR/ufcs-qpath-self-mismatch.rs:8:31 +error[E0308]: arguments to this function are incorrect + --> $DIR/ufcs-qpath-self-mismatch.rs:8:5 | LL | >::add(1, 2u32); - | ^^^^ expected `i32`, found `u32` + | ^^^^^^^^^^^^^^^^^^^^^^^-^^^^^^^ + | | + | expected `i32`, found `i32` | -help: change the type of the numeric literal from `u32` to `i32` +help: provide an argument of the correct type | -LL | >::add(1, 2i32); - | ^^^^ +LL | (1, {i32}); + | ^^^^^^^^^^ error: aborting due to 3 previous errors diff --git a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr index 167479270b546..b12b7759ec498 100644 --- a/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closure-no-cyclic-sig.stderr @@ -1,14 +1,21 @@ -error[E0644]: closure/generator type that references itself - --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:7 +error[E0308]: arguments to this function are incorrect + --> $DIR/unboxed-closure-no-cyclic-sig.rs:8:5 | LL | g(|_| { }); - | ^^^^^^^^ cyclic type of infinite size + | ^^--------^ + | | + | expected `_` | - = note: closures cannot capture themselves or take themselves as argument; - this error may be the result of a recent compiler bug-fix, - see issue #46062 - for more information +note: function defined here + --> $DIR/unboxed-closure-no-cyclic-sig.rs:5:4 + | +LL | fn g(_: F) where F: FnOnce(Option) {} + | ^ ---- +help: provide an argument of the correct type + | +LL | g({_}); + | ^^^^^^ error: aborting due to previous error -For more information about this error, try `rustc --explain E0644`. +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs index 9f76849e5fbff..bf5d77dcc1576 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.rs @@ -2,6 +2,6 @@ use std::ops::FnMut; pub fn main() { let mut f = |x: isize, y: isize| -> isize { x + y }; - let z = f(1_usize, 2); //~ ERROR mismatched types + let z = f(1_usize, 2); //~ ERROR arguments to this function are incorrect println!("{}", z); } diff --git a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr index 482b3ace65b4a..1298684566a86 100644 --- a/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr +++ b/src/test/ui/unboxed-closures/unboxed-closures-type-mismatch.stderr @@ -1,13 +1,15 @@ -error[E0308]: mismatched types - --> $DIR/unboxed-closures-type-mismatch.rs:5:15 +error[E0308]: arguments to this function are incorrect + --> $DIR/unboxed-closures-type-mismatch.rs:5:13 | LL | let z = f(1_usize, 2); - | ^^^^^^^ expected `isize`, found `usize` + | ^^-------^^^^ + | | + | expected `isize`, found `usize` | -help: change the type of the numeric literal from `usize` to `isize` +help: provide an argument of the correct type | -LL | let z = f(1_isize, 2); - | ^^^^^^^ +LL | let z = ({isize}, 2); + | ^^^^^^^^^^^^ error: aborting due to previous error diff --git a/src/test/ui/variance/variance-associated-types2.rs b/src/test/ui/variance/variance-associated-types2.rs index 6a095fce7abfa..3feb110ad679e 100644 --- a/src/test/ui/variance/variance-associated-types2.rs +++ b/src/test/ui/variance/variance-associated-types2.rs @@ -11,7 +11,7 @@ fn make() -> Box> { fn take<'a>(_: &'a u32) { let _: Box> = make(); - //~^ ERROR mismatched types [E0308] + //~^ ERROR mismatched types } fn main() {}