1
Fork 0

Fix diagnostic regression

This commit is contained in:
varkor 2018-08-20 12:52:56 +01:00
parent ae81fc61d0
commit aa3b5c58e4
22 changed files with 129 additions and 133 deletions

View file

@ -539,7 +539,9 @@ impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> {
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) { fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
match *generic_args { match *generic_args {
GenericArgs::AngleBracketed(ref data) => { GenericArgs::AngleBracketed(ref data) => {
data.args.iter().for_each(|arg| self.visit_generic_arg(arg)); for arg in &data.args {
self.visit_generic_arg(arg)
}
for type_binding in &data.bindings { for type_binding in &data.bindings {
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>` // Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
// are allowed to contain nested `impl Trait`. // are allowed to contain nested `impl Trait`.

View file

@ -94,11 +94,12 @@ struct ConvertedBinding<'tcx> {
#[derive(PartialEq)] #[derive(PartialEq)]
enum GenericArgPosition { enum GenericArgPosition {
Datatype, Type,
Function, Value, // e.g. functions
Method, MethodCall,
} }
// FIXME(#53525): these error codes should all be unified.
struct GenericArgMismatchErrorCode { struct GenericArgMismatchErrorCode {
lifetimes: (&'static str, &'static str), lifetimes: (&'static str, &'static str),
types: (&'static str, &'static str), types: (&'static str, &'static str),
@ -255,9 +256,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
&empty_args &empty_args
}, },
if is_method_call { if is_method_call {
GenericArgPosition::Method GenericArgPosition::MethodCall
} else { } else {
GenericArgPosition::Function GenericArgPosition::Value
}, },
def.parent.is_none() && def.has_self, // `has_self` def.parent.is_none() && def.has_self, // `has_self`
seg.infer_types || suppress_mismatch, // `infer_types` seg.infer_types || suppress_mismatch, // `infer_types`
@ -285,7 +286,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
// arguments in order to validate them with respect to the generic parameters. // arguments in order to validate them with respect to the generic parameters.
let param_counts = def.own_counts(); let param_counts = def.own_counts();
let arg_counts = args.own_counts(); let arg_counts = args.own_counts();
let infer_lifetimes = position != GenericArgPosition::Datatype && arg_counts.lifetimes == 0; let infer_lifetimes = position != GenericArgPosition::Type && arg_counts.lifetimes == 0;
let mut defaults: ty::GenericParamCount = Default::default(); let mut defaults: ty::GenericParamCount = Default::default();
for param in &def.params { for param in &def.params {
@ -297,7 +298,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
}; };
} }
if position != GenericArgPosition::Datatype && !args.bindings.is_empty() { if position != GenericArgPosition::Type && !args.bindings.is_empty() {
AstConv::prohibit_assoc_ty_binding(tcx, args.bindings[0].span); AstConv::prohibit_assoc_ty_binding(tcx, args.bindings[0].span);
} }
@ -308,7 +309,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
if late bound lifetime parameters are present"; if late bound lifetime parameters are present";
let note = "the late bound lifetime parameter is introduced here"; let note = "the late bound lifetime parameter is introduced here";
let span = args.args[0].span(); let span = args.args[0].span();
if position == GenericArgPosition::Function if position == GenericArgPosition::Value
&& arg_counts.lifetimes != param_counts.lifetimes { && arg_counts.lifetimes != param_counts.lifetimes {
let mut err = tcx.sess.struct_span_err(span, msg); let mut err = tcx.sess.struct_span_err(span, msg);
err.span_note(span_late, note); err.span_note(span_late, note);
@ -328,7 +329,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
kind, kind,
required, required,
permitted, permitted,
provided| { provided,
offset| {
// We enforce the following: `required` <= `provided` <= `permitted`. // We enforce the following: `required` <= `provided` <= `permitted`.
// For kinds without defaults (i.e. lifetimes), `required == permitted`. // For kinds without defaults (i.e. lifetimes), `required == permitted`.
// For other kinds (i.e. types), `permitted` may be greater than `required`. // For other kinds (i.e. types), `permitted` may be greater than `required`.
@ -348,8 +350,15 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
(required, "") (required, "")
}; };
let mut span = span;
let label = if required == permitted && provided > permitted { let label = if required == permitted && provided > permitted {
let diff = provided - permitted; let diff = provided - permitted;
if diff == 1 {
// In the case when the user has provided too many arguments,
// we want to point to the first unexpected argument.
let first_superfluous_arg: &GenericArg = &args.args[offset + permitted];
span = first_superfluous_arg.span();
}
format!( format!(
"{}unexpected {} argument{}", "{}unexpected {} argument{}",
if diff != 1 { format!("{} ", diff) } else { String::new() }, if diff != 1 { format!("{} ", diff) } else { String::new() },
@ -394,6 +403,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
param_counts.lifetimes, param_counts.lifetimes,
param_counts.lifetimes, param_counts.lifetimes,
arg_counts.lifetimes, arg_counts.lifetimes,
0,
); );
} }
if !infer_types if !infer_types
@ -404,6 +414,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
param_counts.types - defaults.types - has_self as usize, param_counts.types - defaults.types - has_self as usize,
param_counts.types - has_self as usize, param_counts.types - has_self as usize,
arg_counts.types, arg_counts.types,
arg_counts.lifetimes,
) )
} else { } else {
false false
@ -491,32 +502,27 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
// provided, matching them with the generic parameters we expect. // provided, matching them with the generic parameters we expect.
// Mismatches can occur as a result of elided lifetimes, or for malformed // Mismatches can occur as a result of elided lifetimes, or for malformed
// input. We try to handle both sensibly. // input. We try to handle both sensibly.
let mut progress_arg = true;
match (args.peek(), params.peek()) { match (args.peek(), params.peek()) {
(Some(&arg), Some(&param)) => { (Some(&arg), Some(&param)) => {
match (arg, &param.kind) { match (arg, &param.kind) {
(GenericArg::Lifetime(_), GenericParamDefKind::Lifetime) => { (GenericArg::Lifetime(_), GenericParamDefKind::Lifetime)
| (GenericArg::Type(_), GenericParamDefKind::Type { .. }) => {
push_kind(&mut substs, provided_kind(param, arg)); push_kind(&mut substs, provided_kind(param, arg));
args.next();
params.next(); params.next();
} }
(GenericArg::Lifetime(_), GenericParamDefKind::Type { .. }) => { (GenericArg::Lifetime(_), GenericParamDefKind::Type { .. }) => {
// We expected a type argument, but got a lifetime // We expected a type argument, but got a lifetime
// argument. This is an error, but we need to handle it // argument. This is an error, but we need to handle it
// gracefully so we can report sensible errors. In this // gracefully so we can report sensible errors. In this
// case, we're simply going to infer the remaining // case, we're simply going to infer this argument.
// arguments. args.next();
args.by_ref().for_each(drop); // Exhaust the iterator.
}
(GenericArg::Type(_), GenericParamDefKind::Type { .. }) => {
push_kind(&mut substs, provided_kind(param, arg));
params.next();
} }
(GenericArg::Type(_), GenericParamDefKind::Lifetime) => { (GenericArg::Type(_), GenericParamDefKind::Lifetime) => {
// We expected a lifetime argument, but got a type // We expected a lifetime argument, but got a type
// argument. That means we're inferring the lifetimes. // argument. That means we're inferring the lifetimes.
push_kind(&mut substs, inferred_kind(None, param, infer_types)); push_kind(&mut substs, inferred_kind(None, param, infer_types));
params.next(); params.next();
progress_arg = false;
} }
} }
} }
@ -524,26 +530,22 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
// We should never be able to reach this point with well-formed input. // We should never be able to reach this point with well-formed input.
// Getting to this point means the user supplied more arguments than // Getting to this point means the user supplied more arguments than
// there are parameters. // there are parameters.
args.next();
} }
(None, Some(&param)) => { (None, Some(&param)) => {
// If there are fewer arguments than parameters, it means // If there are fewer arguments than parameters, it means
// we're inferring the remaining arguments. // we're inferring the remaining arguments.
match param.kind { match param.kind {
GenericParamDefKind::Lifetime => { GenericParamDefKind::Lifetime | GenericParamDefKind::Type { .. } => {
push_kind(&mut substs, inferred_kind(None, param, infer_types));
}
GenericParamDefKind::Type { .. } => {
let kind = inferred_kind(Some(&substs), param, infer_types); let kind = inferred_kind(Some(&substs), param, infer_types);
push_kind(&mut substs, kind); push_kind(&mut substs, kind);
} }
} }
args.next();
params.next(); params.next();
} }
(None, None) => break, (None, None) => break,
} }
if progress_arg {
args.next();
}
} }
} }
@ -582,12 +584,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
span, span,
&generic_params, &generic_params,
&generic_args, &generic_args,
GenericArgPosition::Datatype, GenericArgPosition::Type,
has_self, has_self,
infer_types, infer_types,
GenericArgMismatchErrorCode { GenericArgMismatchErrorCode {
lifetimes: ("E0107", "E0107"), lifetimes: ("E0107", "E0107"),
types: ("E0243", "E0244"), // FIXME: E0243 and E0244 should be unified. types: ("E0243", "E0244"),
}, },
); );
@ -616,17 +618,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
|_| (Some(generic_args), infer_types), |_| (Some(generic_args), infer_types),
// Provide substitutions for parameters for which (valid) arguments have been provided. // Provide substitutions for parameters for which (valid) arguments have been provided.
|param, arg| { |param, arg| {
match param.kind { match (&param.kind, arg) {
GenericParamDefKind::Lifetime => match arg { (GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
GenericArg::Lifetime(lt) => { self.ast_region_to_region(&lt, Some(param)).into()
self.ast_region_to_region(&lt, Some(param)).into()
}
_ => unreachable!(),
} }
GenericParamDefKind::Type { .. } => match arg { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
GenericArg::Type(ty) => self.ast_ty_to_ty(&ty).into(), self.ast_ty_to_ty(&ty).into()
_ => unreachable!(),
} }
_ => unreachable!(),
} }
}, },
// Provide substitutions for parameters for which arguments are inferred. // Provide substitutions for parameters for which arguments are inferred.

View file

@ -344,17 +344,14 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
}, },
// Provide substitutions for parameters for which (valid) arguments have been provided. // Provide substitutions for parameters for which (valid) arguments have been provided.
|param, arg| { |param, arg| {
match param.kind { match (&param.kind, arg) {
GenericParamDefKind::Lifetime => match arg { (GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
GenericArg::Lifetime(lt) => { AstConv::ast_region_to_region(self.fcx, lt, Some(param)).into()
AstConv::ast_region_to_region(self.fcx, lt, Some(param)).into()
}
_ => unreachable!(),
} }
GenericParamDefKind::Type { .. } => match arg { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
GenericArg::Type(ty) => self.to_ty(ty).into(), self.to_ty(ty).into()
_ => unreachable!(),
} }
_ => unreachable!(),
} }
}, },
// Provide substitutions for parameters for which arguments are inferred. // Provide substitutions for parameters for which arguments are inferred.

View file

@ -109,11 +109,11 @@ use session::{CompileIncomplete, config, Session};
use TypeAndSubsts; use TypeAndSubsts;
use lint; use lint;
use util::common::{ErrorReported, indenter}; use util::common::{ErrorReported, indenter};
use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, NodeMap}; use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap};
use std::cell::{Cell, RefCell, Ref, RefMut}; use std::cell::{Cell, RefCell, Ref, RefMut};
use rustc_data_structures::sync::Lrc; use rustc_data_structures::sync::Lrc;
use std::collections::{hash_map::Entry, HashSet}; use std::collections::hash_map::Entry;
use std::cmp; use std::cmp;
use std::fmt::Display; use std::fmt::Display;
use std::iter; use std::iter;
@ -4908,7 +4908,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// provided (if any) into their appropriate spaces. We'll also report // provided (if any) into their appropriate spaces. We'll also report
// errors if type parameters are provided in an inappropriate place. // errors if type parameters are provided in an inappropriate place.
let mut generic_segs = HashSet::new(); let mut generic_segs = FxHashSet::default();
for PathSeg(_, index) in &path_segs { for PathSeg(_, index) in &path_segs {
generic_segs.insert(index); generic_segs.insert(index);
} }
@ -4937,24 +4937,25 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
// to add defaults. If the user provided *too many* types, that's // to add defaults. If the user provided *too many* types, that's
// a problem. // a problem.
let mut suppress_errors = FxHashMap(); let mut infer_args_for_err = FxHashSet::default();
for &PathSeg(def_id, index) in &path_segs { for &PathSeg(def_id, index) in &path_segs {
let seg = &segments[index]; let seg = &segments[index];
let generics = self.tcx.generics_of(def_id); let generics = self.tcx.generics_of(def_id);
// `impl Trait` is treated as a normal generic parameter internally, // Argument-position `impl Trait` is treated as a normal generic
// but we don't allow users to specify the parameter's value // parameter internally, but we don't allow users to specify the
// explicitly, so we have to do some error-checking here. // parameter's value explicitly, so we have to do some error-
let suppress = AstConv::check_generic_arg_count_for_call( // checking here.
let suppress_errors = AstConv::check_generic_arg_count_for_call(
self.tcx, self.tcx,
span, span,
&generics, &generics,
&seg, &seg,
false, // `is_method_call` false, // `is_method_call`
); );
if suppress { if suppress_errors {
infer_args_for_err.insert(index);
self.set_tainted_by_errors(); // See issue #53251. self.set_tainted_by_errors(); // See issue #53251.
} }
suppress_errors.insert(index, suppress);
} }
let has_self = path_segs.last().map(|PathSeg(def_id, _)| { let has_self = path_segs.last().map(|PathSeg(def_id, _)| {
@ -4976,7 +4977,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}) { }) {
// If we've encountered an `impl Trait`-related error, we're just // If we've encountered an `impl Trait`-related error, we're just
// going to infer the arguments for better error messages. // going to infer the arguments for better error messages.
if !suppress_errors[&index] { if !infer_args_for_err.contains(&index) {
// Check whether the user has provided generic arguments. // Check whether the user has provided generic arguments.
if let Some(ref data) = segments[index].args { if let Some(ref data) = segments[index].args {
return (Some(data), segments[index].infer_types); return (Some(data), segments[index].infer_types);
@ -4989,17 +4990,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
}, },
// Provide substitutions for parameters for which (valid) arguments have been provided. // Provide substitutions for parameters for which (valid) arguments have been provided.
|param, arg| { |param, arg| {
match param.kind { match (&param.kind, arg) {
GenericParamDefKind::Lifetime => match arg { (GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
GenericArg::Lifetime(lt) => { AstConv::ast_region_to_region(self, lt, Some(param)).into()
AstConv::ast_region_to_region(self, lt, Some(param)).into()
}
_ => unreachable!(),
} }
GenericParamDefKind::Type { .. } => match arg { (GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
GenericArg::Type(ty) => self.to_ty(ty).into(), self.to_ty(ty).into()
_ => unreachable!(),
} }
_ => unreachable!(),
} }
}, },
// Provide substitutions for parameters for which arguments are inferred. // Provide substitutions for parameters for which arguments are inferred.

View file

@ -1,26 +1,26 @@
error[E0087]: wrong number of type arguments: expected 1, found 2 error[E0087]: wrong number of type arguments: expected 1, found 2
--> $DIR/bad-mid-path-type-params.rs:40:13 --> $DIR/bad-mid-path-type-params.rs:40:28
| |
LL | let _ = S::new::<isize,f64>(1, 1.0); LL | let _ = S::new::<isize,f64>(1, 1.0);
| ^^^^^^^^^^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
error[E0107]: wrong number of lifetime arguments: expected 0, found 1 error[E0107]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/bad-mid-path-type-params.rs:43:13 --> $DIR/bad-mid-path-type-params.rs:43:17
| |
LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0); LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^ unexpected lifetime argument
error[E0087]: wrong number of type arguments: expected 1, found 2 error[E0087]: wrong number of type arguments: expected 1, found 2
--> $DIR/bad-mid-path-type-params.rs:46:17 --> $DIR/bad-mid-path-type-params.rs:46:36
| |
LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0); LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
| ^^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
error[E0088]: wrong number of lifetime arguments: expected 0, found 1 error[E0088]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/bad-mid-path-type-params.rs:49:17 --> $DIR/bad-mid-path-type-params.rs:49:25
| |
LL | let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0); LL | let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^ unexpected lifetime argument
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -5,10 +5,10 @@ LL | S::<'static>(&0, &0);
| ^^^^^^^^^^^^ expected 2 lifetime arguments | ^^^^^^^^^^^^ expected 2 lifetime arguments
error[E0088]: wrong number of lifetime arguments: expected 2, found 3 error[E0088]: wrong number of lifetime arguments: expected 2, found 3
--> $DIR/constructor-lifetime-args.rs:29:5 --> $DIR/constructor-lifetime-args.rs:29:27
| |
LL | S::<'static, 'static, 'static>(&0, &0); LL | S::<'static, 'static, 'static>(&0, &0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error[E0090]: wrong number of lifetime arguments: expected 2, found 1 error[E0090]: wrong number of lifetime arguments: expected 2, found 1
--> $DIR/constructor-lifetime-args.rs:32:5 --> $DIR/constructor-lifetime-args.rs:32:5
@ -17,10 +17,10 @@ LL | E::V::<'static>(&0);
| ^^^^^^^^^^^^^^^ expected 2 lifetime arguments | ^^^^^^^^^^^^^^^ expected 2 lifetime arguments
error[E0088]: wrong number of lifetime arguments: expected 2, found 3 error[E0088]: wrong number of lifetime arguments: expected 2, found 3
--> $DIR/constructor-lifetime-args.rs:34:5 --> $DIR/constructor-lifetime-args.rs:34:30
| |
LL | E::V::<'static, 'static, 'static>(&0); LL | E::V::<'static, 'static, 'static>(&0);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error: aborting due to 4 previous errors error: aborting due to 4 previous errors

View file

@ -1,14 +1,14 @@
error[E0087]: wrong number of type arguments: expected 0, found 1 error[E0087]: wrong number of type arguments: expected 0, found 1
--> $DIR/E0087.rs:15:5 --> $DIR/E0087.rs:15:11
| |
LL | foo::<f64>(); //~ ERROR wrong number of type arguments: expected 0, found 1 [E0087] LL | foo::<f64>(); //~ ERROR wrong number of type arguments: expected 0, found 1 [E0087]
| ^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
error[E0087]: wrong number of type arguments: expected 1, found 2 error[E0087]: wrong number of type arguments: expected 1, found 2
--> $DIR/E0087.rs:17:5 --> $DIR/E0087.rs:17:16
| |
LL | bar::<f64, u64>(); //~ ERROR wrong number of type arguments: expected 1, found 2 [E0087] LL | bar::<f64, u64>(); //~ ERROR wrong number of type arguments: expected 1, found 2 [E0087]
| ^^^^^^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -1,14 +1,14 @@
error[E0088]: wrong number of lifetime arguments: expected 0, found 1 error[E0088]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/E0088.rs:15:5 --> $DIR/E0088.rs:15:9
| |
LL | f::<'static>(); //~ ERROR E0088 LL | f::<'static>(); //~ ERROR E0088
| ^^^^^^^^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error[E0088]: wrong number of lifetime arguments: expected 1, found 2 error[E0088]: wrong number of lifetime arguments: expected 1, found 2
--> $DIR/E0088.rs:16:5 --> $DIR/E0088.rs:16:18
| |
LL | g::<'static, 'static>(); //~ ERROR E0088 LL | g::<'static, 'static>(); //~ ERROR E0088
| ^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -5,10 +5,10 @@ LL | buzz: Buzz<'a>,
| ^^^^^^^^ expected 2 lifetime arguments | ^^^^^^^^ expected 2 lifetime arguments
error[E0107]: wrong number of lifetime arguments: expected 0, found 1 error[E0107]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/E0107.rs:24:10 --> $DIR/E0107.rs:24:14
| |
LL | bar: Bar<'a>, LL | bar: Bar<'a>,
| ^^^^^^^ unexpected lifetime argument | ^^ unexpected lifetime argument
error[E0107]: wrong number of lifetime arguments: expected 1, found 3 error[E0107]: wrong number of lifetime arguments: expected 1, found 3
--> $DIR/E0107.rs:27:11 --> $DIR/E0107.rs:27:11

View file

@ -1,8 +1,8 @@
error[E0087]: wrong number of type arguments: expected 0, found 1 error[E0087]: wrong number of type arguments: expected 0, found 1
--> $DIR/issue-53251.rs:21:17 --> $DIR/issue-53251.rs:21:24
| |
LL | S::f::<i64>(); LL | S::f::<i64>();
| ^^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
... ...
LL | impl_add!(a b); LL | impl_add!(a b);
| --------------- in this macro invocation | --------------- in this macro invocation

View file

@ -1,8 +1,8 @@
error[E0107]: wrong number of lifetime arguments: expected 0, found 1 error[E0107]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/issue-18423.rs:14:8 --> $DIR/issue-18423.rs:14:12
| |
LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime arguments LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime arguments
| ^^^^^^^^^^^^^^ unexpected lifetime argument | ^^ unexpected lifetime argument
error: aborting due to previous error error: aborting due to previous error

View file

@ -10,10 +10,10 @@ LL | x: T, //~ ERROR can't use type parameters from outer function
| ^ use of type variable from outer function | ^ use of type variable from outer function
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/issue-3214.rs:16:22 --> $DIR/issue-3214.rs:16:26
| |
LL | impl<T> Drop for foo<T> { LL | impl<T> Drop for foo<T> {
| ^^^^^^ unexpected type argument | ^ unexpected type argument
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -5,10 +5,10 @@ LL | S.early::<'static>();
| ^^^^^ expected 2 lifetime arguments | ^^^^^ expected 2 lifetime arguments
error[E0088]: wrong number of lifetime arguments: expected 2, found 3 error[E0088]: wrong number of lifetime arguments: expected 2, found 3
--> $DIR/method-call-lifetime-args-fail.rs:28:7 --> $DIR/method-call-lifetime-args-fail.rs:28:33
| |
LL | S.early::<'static, 'static, 'static>(); LL | S.early::<'static, 'static, 'static>();
| ^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
--> $DIR/method-call-lifetime-args-fail.rs:37:15 --> $DIR/method-call-lifetime-args-fail.rs:37:15
@ -185,10 +185,10 @@ LL | S::early::<'static>(S);
| ^^^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments | ^^^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
error[E0088]: wrong number of lifetime arguments: expected 2, found 3 error[E0088]: wrong number of lifetime arguments: expected 2, found 3
--> $DIR/method-call-lifetime-args-fail.rs:75:5 --> $DIR/method-call-lifetime-args-fail.rs:75:34
| |
LL | S::early::<'static, 'static, 'static>(S); LL | S::early::<'static, 'static, 'static>(S);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error: aborting due to 18 previous errors error: aborting due to 18 previous errors

View file

@ -1,14 +1,14 @@
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/seq-args.rs:14:9 --> $DIR/seq-args.rs:14:13
| |
LL | impl<T> seq<T> for Vec<T> { //~ ERROR wrong number of type arguments LL | impl<T> seq<T> for Vec<T> { //~ ERROR wrong number of type arguments
| ^^^^^^ unexpected type argument | ^ unexpected type argument
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/seq-args.rs:17:6 --> $DIR/seq-args.rs:17:10
| |
LL | impl seq<bool> for u32 { //~ ERROR wrong number of type arguments LL | impl seq<bool> for u32 { //~ ERROR wrong number of type arguments
| ^^^^^^^^^ unexpected type argument | ^^^^ unexpected type argument
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -71,10 +71,10 @@ LL | x: 7,
found type `{integer}` found type `{integer}`
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/structure-constructor-type-mismatch.rs:58:15 --> $DIR/structure-constructor-type-mismatch.rs:58:24
| |
LL | let pt3 = PointF::<i32> { //~ ERROR wrong number of type arguments LL | let pt3 = PointF::<i32> { //~ ERROR wrong number of type arguments
| ^^^^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/structure-constructor-type-mismatch.rs:59:12 --> $DIR/structure-constructor-type-mismatch.rs:59:12
@ -101,10 +101,10 @@ LL | y: 10, //~ ERROR mismatched types
found type `{integer}` found type `{integer}`
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/structure-constructor-type-mismatch.rs:64:9 --> $DIR/structure-constructor-type-mismatch.rs:64:18
| |
LL | PointF::<u32> { .. } => {} //~ ERROR wrong number of type arguments LL | PointF::<u32> { .. } => {} //~ ERROR wrong number of type arguments
| ^^^^^^^^^^^^^ unexpected type argument | ^^^ unexpected type argument
error[E0308]: mismatched types error[E0308]: mismatched types
--> $DIR/structure-constructor-type-mismatch.rs:64:9 --> $DIR/structure-constructor-type-mismatch.rs:64:9

View file

@ -11,10 +11,10 @@ LL | let _: S<'static, 'static +>;
| ^^^^^^^^^ | ^^^^^^^^^
error[E0107]: wrong number of lifetime arguments: expected 1, found 2 error[E0107]: wrong number of lifetime arguments: expected 1, found 2
--> $DIR/trait-object-vs-lifetime.rs:23:12 --> $DIR/trait-object-vs-lifetime.rs:23:23
| |
LL | let _: S<'static, 'static>; LL | let _: S<'static, 'static>;
| ^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument | ^^^^^^^ unexpected lifetime argument
error[E0243]: wrong number of type arguments: expected 1, found 0 error[E0243]: wrong number of type arguments: expected 1, found 0
--> $DIR/trait-object-vs-lifetime.rs:23:12 --> $DIR/trait-object-vs-lifetime.rs:23:12

View file

@ -1,14 +1,14 @@
error[E0087]: wrong number of type arguments: expected 0, found 1 error[E0087]: wrong number of type arguments: expected 0, found 1
--> $DIR/trait-test-2.rs:18:8 --> $DIR/trait-test-2.rs:18:14
| |
LL | 10.dup::<i32>(); //~ ERROR wrong number of type arguments: expected 0, found 1 LL | 10.dup::<i32>(); //~ ERROR wrong number of type arguments: expected 0, found 1
| ^^^ unexpected type argument | ^^^ unexpected type argument
error[E0087]: wrong number of type arguments: expected 1, found 2 error[E0087]: wrong number of type arguments: expected 1, found 2
--> $DIR/trait-test-2.rs:19:8 --> $DIR/trait-test-2.rs:19:20
| |
LL | 10.blah::<i32, i32>(); //~ ERROR wrong number of type arguments: expected 1, found 2 LL | 10.blah::<i32, i32>(); //~ ERROR wrong number of type arguments: expected 1, found 2
| ^^^^ unexpected type argument | ^^^ unexpected type argument
error[E0277]: the trait bound `dyn bar: bar` is not satisfied error[E0277]: the trait bound `dyn bar: bar` is not satisfied
--> $DIR/trait-test-2.rs:20:26 --> $DIR/trait-test-2.rs:20:26

View file

@ -1,38 +1,38 @@
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/typeck-builtin-bound-type-parameters.rs:11:11 --> $DIR/typeck-builtin-bound-type-parameters.rs:11:16
| |
LL | fn foo1<T:Copy<U>, U>(x: T) {} LL | fn foo1<T:Copy<U>, U>(x: T) {}
| ^^^^^^^ unexpected type argument | ^ unexpected type argument
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/typeck-builtin-bound-type-parameters.rs:14:14 --> $DIR/typeck-builtin-bound-type-parameters.rs:14:19
| |
LL | trait Trait: Copy<Send> {} LL | trait Trait: Copy<Send> {}
| ^^^^^^^^^^ unexpected type argument | ^^^^ unexpected type argument
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/typeck-builtin-bound-type-parameters.rs:17:21 --> $DIR/typeck-builtin-bound-type-parameters.rs:17:26
| |
LL | struct MyStruct1<T: Copy<T>>; LL | struct MyStruct1<T: Copy<T>>;
| ^^^^^^^ unexpected type argument | ^ unexpected type argument
error[E0107]: wrong number of lifetime arguments: expected 0, found 1 error[E0107]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/typeck-builtin-bound-type-parameters.rs:20:25 --> $DIR/typeck-builtin-bound-type-parameters.rs:20:30
| |
LL | struct MyStruct2<'a, T: Copy<'a>>; LL | struct MyStruct2<'a, T: Copy<'a>>;
| ^^^^^^^^ unexpected lifetime argument | ^^ unexpected lifetime argument
error[E0107]: wrong number of lifetime arguments: expected 0, found 1 error[E0107]: wrong number of lifetime arguments: expected 0, found 1
--> $DIR/typeck-builtin-bound-type-parameters.rs:24:15 --> $DIR/typeck-builtin-bound-type-parameters.rs:24:20
| |
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| ^^^^^^^^^^^ unexpected lifetime argument | ^^ unexpected lifetime argument
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/typeck-builtin-bound-type-parameters.rs:24:15 --> $DIR/typeck-builtin-bound-type-parameters.rs:24:24
| |
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {} LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
| ^^^^^^^^^^^ unexpected type argument | ^ unexpected type argument
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -1,8 +1,8 @@
error[E0244]: wrong number of type arguments: expected 1, found 2 error[E0244]: wrong number of type arguments: expected 1, found 2
--> $DIR/typeck_type_placeholder_lifetime_1.rs:19:12 --> $DIR/typeck_type_placeholder_lifetime_1.rs:19:19
| |
LL | let c: Foo<_, _> = Foo { r: &5 }; LL | let c: Foo<_, _> = Foo { r: &5 };
| ^^^^^^^^^ unexpected type argument | ^ unexpected type argument
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,8 +1,8 @@
error[E0244]: wrong number of type arguments: expected 1, found 2 error[E0244]: wrong number of type arguments: expected 1, found 2
--> $DIR/typeck_type_placeholder_lifetime_2.rs:19:12 --> $DIR/typeck_type_placeholder_lifetime_2.rs:19:19
| |
LL | let c: Foo<_, usize> = Foo { r: &5 }; LL | let c: Foo<_, usize> = Foo { r: &5 };
| ^^^^^^^^^^^^^ unexpected type argument | ^^^^^ unexpected type argument
error: aborting due to previous error error: aborting due to previous error

View file

@ -1,8 +1,8 @@
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:11 --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15
| |
LL | fn foo(_: Zero()) LL | fn foo(_: Zero())
| ^^^^^^ unexpected type argument | ^^ unexpected type argument
error[E0220]: associated type `Output` not found for `Zero` error[E0220]: associated type `Output` not found for `Zero`
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15 --> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15

View file

@ -1,8 +1,8 @@
error[E0244]: wrong number of type arguments: expected 0, found 1 error[E0244]: wrong number of type arguments: expected 0, found 1
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:8 --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:13
| |
LL | fn f<F:Trait(isize) -> isize>(x: F) {} LL | fn f<F:Trait(isize) -> isize>(x: F) {}
| ^^^^^^^^^^^^^^^^^^^^^ unexpected type argument | ^^^^^^^^^^^^^^^^ unexpected type argument
error[E0220]: associated type `Output` not found for `Trait` error[E0220]: associated type `Output` not found for `Trait`
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24 --> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24