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

Commit aa3b5c5

Browse files
committedAug 20, 2018
Fix diagnostic regression
1 parent ae81fc6 commit aa3b5c5

22 files changed

+129
-133
lines changed
 

‎src/librustc_passes/ast_validation.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,9 @@ impl<'a> Visitor<'a> for NestedImplTraitVisitor<'a> {
539539
fn visit_generic_args(&mut self, _: Span, generic_args: &'a GenericArgs) {
540540
match *generic_args {
541541
GenericArgs::AngleBracketed(ref data) => {
542-
data.args.iter().for_each(|arg| self.visit_generic_arg(arg));
542+
for arg in &data.args {
543+
self.visit_generic_arg(arg)
544+
}
543545
for type_binding in &data.bindings {
544546
// Type bindings such as `Item=impl Debug` in `Iterator<Item=Debug>`
545547
// are allowed to contain nested `impl Trait`.

‎src/librustc_typeck/astconv.rs

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,12 @@ struct ConvertedBinding<'tcx> {
9494

9595
#[derive(PartialEq)]
9696
enum GenericArgPosition {
97-
Datatype,
98-
Function,
99-
Method,
97+
Type,
98+
Value, // e.g. functions
99+
MethodCall,
100100
}
101101

102+
// FIXME(#53525): these error codes should all be unified.
102103
struct GenericArgMismatchErrorCode {
103104
lifetimes: (&'static str, &'static str),
104105
types: (&'static str, &'static str),
@@ -255,9 +256,9 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
255256
&empty_args
256257
},
257258
if is_method_call {
258-
GenericArgPosition::Method
259+
GenericArgPosition::MethodCall
259260
} else {
260-
GenericArgPosition::Function
261+
GenericArgPosition::Value
261262
},
262263
def.parent.is_none() && def.has_self, // `has_self`
263264
seg.infer_types || suppress_mismatch, // `infer_types`
@@ -285,7 +286,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
285286
// arguments in order to validate them with respect to the generic parameters.
286287
let param_counts = def.own_counts();
287288
let arg_counts = args.own_counts();
288-
let infer_lifetimes = position != GenericArgPosition::Datatype && arg_counts.lifetimes == 0;
289+
let infer_lifetimes = position != GenericArgPosition::Type && arg_counts.lifetimes == 0;
289290

290291
let mut defaults: ty::GenericParamCount = Default::default();
291292
for param in &def.params {
@@ -297,7 +298,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
297298
};
298299
}
299300

300-
if position != GenericArgPosition::Datatype && !args.bindings.is_empty() {
301+
if position != GenericArgPosition::Type && !args.bindings.is_empty() {
301302
AstConv::prohibit_assoc_ty_binding(tcx, args.bindings[0].span);
302303
}
303304

@@ -308,7 +309,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
308309
if late bound lifetime parameters are present";
309310
let note = "the late bound lifetime parameter is introduced here";
310311
let span = args.args[0].span();
311-
if position == GenericArgPosition::Function
312+
if position == GenericArgPosition::Value
312313
&& arg_counts.lifetimes != param_counts.lifetimes {
313314
let mut err = tcx.sess.struct_span_err(span, msg);
314315
err.span_note(span_late, note);
@@ -328,7 +329,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
328329
kind,
329330
required,
330331
permitted,
331-
provided| {
332+
provided,
333+
offset| {
332334
// We enforce the following: `required` <= `provided` <= `permitted`.
333335
// For kinds without defaults (i.e. lifetimes), `required == permitted`.
334336
// 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 {
348350
(required, "")
349351
};
350352

353+
let mut span = span;
351354
let label = if required == permitted && provided > permitted {
352355
let diff = provided - permitted;
356+
if diff == 1 {
357+
// In the case when the user has provided too many arguments,
358+
// we want to point to the first unexpected argument.
359+
let first_superfluous_arg: &GenericArg = &args.args[offset + permitted];
360+
span = first_superfluous_arg.span();
361+
}
353362
format!(
354363
"{}unexpected {} argument{}",
355364
if diff != 1 { format!("{} ", diff) } else { String::new() },
@@ -394,6 +403,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
394403
param_counts.lifetimes,
395404
param_counts.lifetimes,
396405
arg_counts.lifetimes,
406+
0,
397407
);
398408
}
399409
if !infer_types
@@ -404,6 +414,7 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
404414
param_counts.types - defaults.types - has_self as usize,
405415
param_counts.types - has_self as usize,
406416
arg_counts.types,
417+
arg_counts.lifetimes,
407418
)
408419
} else {
409420
false
@@ -491,59 +502,50 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
491502
// provided, matching them with the generic parameters we expect.
492503
// Mismatches can occur as a result of elided lifetimes, or for malformed
493504
// input. We try to handle both sensibly.
494-
let mut progress_arg = true;
495505
match (args.peek(), params.peek()) {
496506
(Some(&arg), Some(&param)) => {
497507
match (arg, &param.kind) {
498-
(GenericArg::Lifetime(_), GenericParamDefKind::Lifetime) => {
508+
(GenericArg::Lifetime(_), GenericParamDefKind::Lifetime)
509+
| (GenericArg::Type(_), GenericParamDefKind::Type { .. }) => {
499510
push_kind(&mut substs, provided_kind(param, arg));
511+
args.next();
500512
params.next();
501513
}
502514
(GenericArg::Lifetime(_), GenericParamDefKind::Type { .. }) => {
503515
// We expected a type argument, but got a lifetime
504516
// argument. This is an error, but we need to handle it
505517
// gracefully so we can report sensible errors. In this
506-
// case, we're simply going to infer the remaining
507-
// arguments.
508-
args.by_ref().for_each(drop); // Exhaust the iterator.
509-
}
510-
(GenericArg::Type(_), GenericParamDefKind::Type { .. }) => {
511-
push_kind(&mut substs, provided_kind(param, arg));
512-
params.next();
518+
// case, we're simply going to infer this argument.
519+
args.next();
513520
}
514521
(GenericArg::Type(_), GenericParamDefKind::Lifetime) => {
515522
// We expected a lifetime argument, but got a type
516523
// argument. That means we're inferring the lifetimes.
517524
push_kind(&mut substs, inferred_kind(None, param, infer_types));
518525
params.next();
519-
progress_arg = false;
520526
}
521527
}
522528
}
523529
(Some(_), None) => {
524530
// We should never be able to reach this point with well-formed input.
525531
// Getting to this point means the user supplied more arguments than
526532
// there are parameters.
533+
args.next();
527534
}
528535
(None, Some(&param)) => {
529536
// If there are fewer arguments than parameters, it means
530537
// we're inferring the remaining arguments.
531538
match param.kind {
532-
GenericParamDefKind::Lifetime => {
533-
push_kind(&mut substs, inferred_kind(None, param, infer_types));
534-
}
535-
GenericParamDefKind::Type { .. } => {
539+
GenericParamDefKind::Lifetime | GenericParamDefKind::Type { .. } => {
536540
let kind = inferred_kind(Some(&substs), param, infer_types);
537541
push_kind(&mut substs, kind);
538542
}
539543
}
544+
args.next();
540545
params.next();
541546
}
542547
(None, None) => break,
543548
}
544-
if progress_arg {
545-
args.next();
546-
}
547549
}
548550
}
549551

@@ -582,12 +584,12 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
582584
span,
583585
&generic_params,
584586
&generic_args,
585-
GenericArgPosition::Datatype,
587+
GenericArgPosition::Type,
586588
has_self,
587589
infer_types,
588590
GenericArgMismatchErrorCode {
589591
lifetimes: ("E0107", "E0107"),
590-
types: ("E0243", "E0244"), // FIXME: E0243 and E0244 should be unified.
592+
types: ("E0243", "E0244"),
591593
},
592594
);
593595

@@ -616,17 +618,14 @@ impl<'o, 'gcx: 'tcx, 'tcx> dyn AstConv<'gcx, 'tcx>+'o {
616618
|_| (Some(generic_args), infer_types),
617619
// Provide substitutions for parameters for which (valid) arguments have been provided.
618620
|param, arg| {
619-
match param.kind {
620-
GenericParamDefKind::Lifetime => match arg {
621-
GenericArg::Lifetime(lt) => {
622-
self.ast_region_to_region(&lt, Some(param)).into()
623-
}
624-
_ => unreachable!(),
621+
match (&param.kind, arg) {
622+
(GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
623+
self.ast_region_to_region(&lt, Some(param)).into()
625624
}
626-
GenericParamDefKind::Type { .. } => match arg {
627-
GenericArg::Type(ty) => self.ast_ty_to_ty(&ty).into(),
628-
_ => unreachable!(),
625+
(GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
626+
self.ast_ty_to_ty(&ty).into()
629627
}
628+
_ => unreachable!(),
630629
}
631630
},
632631
// Provide substitutions for parameters for which arguments are inferred.

‎src/librustc_typeck/check/method/confirm.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -344,17 +344,14 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> {
344344
},
345345
// Provide substitutions for parameters for which (valid) arguments have been provided.
346346
|param, arg| {
347-
match param.kind {
348-
GenericParamDefKind::Lifetime => match arg {
349-
GenericArg::Lifetime(lt) => {
350-
AstConv::ast_region_to_region(self.fcx, lt, Some(param)).into()
351-
}
352-
_ => unreachable!(),
347+
match (&param.kind, arg) {
348+
(GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
349+
AstConv::ast_region_to_region(self.fcx, lt, Some(param)).into()
353350
}
354-
GenericParamDefKind::Type { .. } => match arg {
355-
GenericArg::Type(ty) => self.to_ty(ty).into(),
356-
_ => unreachable!(),
351+
(GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
352+
self.to_ty(ty).into()
357353
}
354+
_ => unreachable!(),
358355
}
359356
},
360357
// Provide substitutions for parameters for which arguments are inferred.

‎src/librustc_typeck/check/mod.rs

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,11 @@ use session::{CompileIncomplete, config, Session};
109109
use TypeAndSubsts;
110110
use lint;
111111
use util::common::{ErrorReported, indenter};
112-
use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, NodeMap};
112+
use util::nodemap::{DefIdMap, DefIdSet, FxHashMap, FxHashSet, NodeMap};
113113

114114
use std::cell::{Cell, RefCell, Ref, RefMut};
115115
use rustc_data_structures::sync::Lrc;
116-
use std::collections::{hash_map::Entry, HashSet};
116+
use std::collections::hash_map::Entry;
117117
use std::cmp;
118118
use std::fmt::Display;
119119
use std::iter;
@@ -4908,7 +4908,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49084908
// provided (if any) into their appropriate spaces. We'll also report
49094909
// errors if type parameters are provided in an inappropriate place.
49104910

4911-
let mut generic_segs = HashSet::new();
4911+
let mut generic_segs = FxHashSet::default();
49124912
for PathSeg(_, index) in &path_segs {
49134913
generic_segs.insert(index);
49144914
}
@@ -4937,24 +4937,25 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49374937
// to add defaults. If the user provided *too many* types, that's
49384938
// a problem.
49394939

4940-
let mut suppress_errors = FxHashMap();
4940+
let mut infer_args_for_err = FxHashSet::default();
49414941
for &PathSeg(def_id, index) in &path_segs {
49424942
let seg = &segments[index];
49434943
let generics = self.tcx.generics_of(def_id);
4944-
// `impl Trait` is treated as a normal generic parameter internally,
4945-
// but we don't allow users to specify the parameter's value
4946-
// explicitly, so we have to do some error-checking here.
4947-
let suppress = AstConv::check_generic_arg_count_for_call(
4944+
// Argument-position `impl Trait` is treated as a normal generic
4945+
// parameter internally, but we don't allow users to specify the
4946+
// parameter's value explicitly, so we have to do some error-
4947+
// checking here.
4948+
let suppress_errors = AstConv::check_generic_arg_count_for_call(
49484949
self.tcx,
49494950
span,
49504951
&generics,
49514952
&seg,
49524953
false, // `is_method_call`
49534954
);
4954-
if suppress {
4955+
if suppress_errors {
4956+
infer_args_for_err.insert(index);
49554957
self.set_tainted_by_errors(); // See issue #53251.
49564958
}
4957-
suppress_errors.insert(index, suppress);
49584959
}
49594960

49604961
let has_self = path_segs.last().map(|PathSeg(def_id, _)| {
@@ -4976,7 +4977,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49764977
}) {
49774978
// If we've encountered an `impl Trait`-related error, we're just
49784979
// going to infer the arguments for better error messages.
4979-
if !suppress_errors[&index] {
4980+
if !infer_args_for_err.contains(&index) {
49804981
// Check whether the user has provided generic arguments.
49814982
if let Some(ref data) = segments[index].args {
49824983
return (Some(data), segments[index].infer_types);
@@ -4989,17 +4990,14 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> {
49894990
},
49904991
// Provide substitutions for parameters for which (valid) arguments have been provided.
49914992
|param, arg| {
4992-
match param.kind {
4993-
GenericParamDefKind::Lifetime => match arg {
4994-
GenericArg::Lifetime(lt) => {
4995-
AstConv::ast_region_to_region(self, lt, Some(param)).into()
4996-
}
4997-
_ => unreachable!(),
4993+
match (&param.kind, arg) {
4994+
(GenericParamDefKind::Lifetime, GenericArg::Lifetime(lt)) => {
4995+
AstConv::ast_region_to_region(self, lt, Some(param)).into()
49984996
}
4999-
GenericParamDefKind::Type { .. } => match arg {
5000-
GenericArg::Type(ty) => self.to_ty(ty).into(),
5001-
_ => unreachable!(),
4997+
(GenericParamDefKind::Type { .. }, GenericArg::Type(ty)) => {
4998+
self.to_ty(ty).into()
50024999
}
5000+
_ => unreachable!(),
50035001
}
50045002
},
50055003
// Provide substitutions for parameters for which arguments are inferred.

‎src/test/ui/bad/bad-mid-path-type-params.stderr

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
error[E0087]: wrong number of type arguments: expected 1, found 2
2-
--> $DIR/bad-mid-path-type-params.rs:40:13
2+
--> $DIR/bad-mid-path-type-params.rs:40:28
33
|
44
LL | let _ = S::new::<isize,f64>(1, 1.0);
5-
| ^^^^^^^^^^^^^^^^^^^ unexpected type argument
5+
| ^^^ unexpected type argument
66

77
error[E0107]: wrong number of lifetime arguments: expected 0, found 1
8-
--> $DIR/bad-mid-path-type-params.rs:43:13
8+
--> $DIR/bad-mid-path-type-params.rs:43:17
99
|
1010
LL | let _ = S::<'a,isize>::new::<f64>(1, 1.0);
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
11+
| ^^ unexpected lifetime argument
1212

1313
error[E0087]: wrong number of type arguments: expected 1, found 2
14-
--> $DIR/bad-mid-path-type-params.rs:46:17
14+
--> $DIR/bad-mid-path-type-params.rs:46:36
1515
|
1616
LL | let _: S2 = Trait::new::<isize,f64>(1, 1.0);
17-
| ^^^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
17+
| ^^^ unexpected type argument
1818

1919
error[E0088]: wrong number of lifetime arguments: expected 0, found 1
20-
--> $DIR/bad-mid-path-type-params.rs:49:17
20+
--> $DIR/bad-mid-path-type-params.rs:49:25
2121
|
2222
LL | let _: S2 = Trait::<'a,isize>::new::<f64>(1, 1.0);
23-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
23+
| ^^ unexpected lifetime argument
2424

2525
error: aborting due to 4 previous errors
2626

‎src/test/ui/constructor-lifetime-args.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | S::<'static>(&0, &0);
55
| ^^^^^^^^^^^^ expected 2 lifetime arguments
66

77
error[E0088]: wrong number of lifetime arguments: expected 2, found 3
8-
--> $DIR/constructor-lifetime-args.rs:29:5
8+
--> $DIR/constructor-lifetime-args.rs:29:27
99
|
1010
LL | S::<'static, 'static, 'static>(&0, &0);
11-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
11+
| ^^^^^^^ unexpected lifetime argument
1212

1313
error[E0090]: wrong number of lifetime arguments: expected 2, found 1
1414
--> $DIR/constructor-lifetime-args.rs:32:5
@@ -17,10 +17,10 @@ LL | E::V::<'static>(&0);
1717
| ^^^^^^^^^^^^^^^ expected 2 lifetime arguments
1818

1919
error[E0088]: wrong number of lifetime arguments: expected 2, found 3
20-
--> $DIR/constructor-lifetime-args.rs:34:5
20+
--> $DIR/constructor-lifetime-args.rs:34:30
2121
|
2222
LL | E::V::<'static, 'static, 'static>(&0);
23-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
23+
| ^^^^^^^ unexpected lifetime argument
2424

2525
error: aborting due to 4 previous errors
2626

‎src/test/ui/error-codes/E0087.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0087]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/E0087.rs:15:5
2+
--> $DIR/E0087.rs:15:11
33
|
44
LL | foo::<f64>(); //~ ERROR wrong number of type arguments: expected 0, found 1 [E0087]
5-
| ^^^^^^^^^^ unexpected type argument
5+
| ^^^ unexpected type argument
66

77
error[E0087]: wrong number of type arguments: expected 1, found 2
8-
--> $DIR/E0087.rs:17:5
8+
--> $DIR/E0087.rs:17:16
99
|
1010
LL | bar::<f64, u64>(); //~ ERROR wrong number of type arguments: expected 1, found 2 [E0087]
11-
| ^^^^^^^^^^^^^^^ unexpected type argument
11+
| ^^^ unexpected type argument
1212

1313
error: aborting due to 2 previous errors
1414

‎src/test/ui/error-codes/E0088.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0088]: wrong number of lifetime arguments: expected 0, found 1
2-
--> $DIR/E0088.rs:15:5
2+
--> $DIR/E0088.rs:15:9
33
|
44
LL | f::<'static>(); //~ ERROR E0088
5-
| ^^^^^^^^^^^^ unexpected lifetime argument
5+
| ^^^^^^^ unexpected lifetime argument
66

77
error[E0088]: wrong number of lifetime arguments: expected 1, found 2
8-
--> $DIR/E0088.rs:16:5
8+
--> $DIR/E0088.rs:16:18
99
|
1010
LL | g::<'static, 'static>(); //~ ERROR E0088
11-
| ^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
11+
| ^^^^^^^ unexpected lifetime argument
1212

1313
error: aborting due to 2 previous errors
1414

‎src/test/ui/error-codes/E0107.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | buzz: Buzz<'a>,
55
| ^^^^^^^^ expected 2 lifetime arguments
66

77
error[E0107]: wrong number of lifetime arguments: expected 0, found 1
8-
--> $DIR/E0107.rs:24:10
8+
--> $DIR/E0107.rs:24:14
99
|
1010
LL | bar: Bar<'a>,
11-
| ^^^^^^^ unexpected lifetime argument
11+
| ^^ unexpected lifetime argument
1212

1313
error[E0107]: wrong number of lifetime arguments: expected 1, found 3
1414
--> $DIR/E0107.rs:27:11

‎src/test/ui/issue-53251.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0087]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/issue-53251.rs:21:17
2+
--> $DIR/issue-53251.rs:21:24
33
|
44
LL | S::f::<i64>();
5-
| ^^^^^^^^^^^ unexpected type argument
5+
| ^^^ unexpected type argument
66
...
77
LL | impl_add!(a b);
88
| --------------- in this macro invocation

‎src/test/ui/issues/issue-18423.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0107]: wrong number of lifetime arguments: expected 0, found 1
2-
--> $DIR/issue-18423.rs:14:8
2+
--> $DIR/issue-18423.rs:14:12
33
|
44
LL | x: Box<'a, isize> //~ ERROR wrong number of lifetime arguments
5-
| ^^^^^^^^^^^^^^ unexpected lifetime argument
5+
| ^^ unexpected lifetime argument
66

77
error: aborting due to previous error
88

‎src/test/ui/issues/issue-3214.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ LL | x: T, //~ ERROR can't use type parameters from outer function
1010
| ^ use of type variable from outer function
1111

1212
error[E0244]: wrong number of type arguments: expected 0, found 1
13-
--> $DIR/issue-3214.rs:16:22
13+
--> $DIR/issue-3214.rs:16:26
1414
|
1515
LL | impl<T> Drop for foo<T> {
16-
| ^^^^^^ unexpected type argument
16+
| ^ unexpected type argument
1717

1818
error: aborting due to 2 previous errors
1919

‎src/test/ui/methods/method-call-lifetime-args-fail.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ LL | S.early::<'static>();
55
| ^^^^^ expected 2 lifetime arguments
66

77
error[E0088]: wrong number of lifetime arguments: expected 2, found 3
8-
--> $DIR/method-call-lifetime-args-fail.rs:28:7
8+
--> $DIR/method-call-lifetime-args-fail.rs:28:33
99
|
1010
LL | S.early::<'static, 'static, 'static>();
11-
| ^^^^^ unexpected lifetime argument
11+
| ^^^^^^^ unexpected lifetime argument
1212

1313
error: cannot specify lifetime arguments explicitly if late bound lifetime parameters are present
1414
--> $DIR/method-call-lifetime-args-fail.rs:37:15
@@ -185,10 +185,10 @@ LL | S::early::<'static>(S);
185185
| ^^^^^^^^^^^^^^^^^^^ expected 2 lifetime arguments
186186

187187
error[E0088]: wrong number of lifetime arguments: expected 2, found 3
188-
--> $DIR/method-call-lifetime-args-fail.rs:75:5
188+
--> $DIR/method-call-lifetime-args-fail.rs:75:34
189189
|
190190
LL | S::early::<'static, 'static, 'static>(S);
191-
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
191+
| ^^^^^^^ unexpected lifetime argument
192192

193193
error: aborting due to 18 previous errors
194194

‎src/test/ui/seq-args.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0244]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/seq-args.rs:14:9
2+
--> $DIR/seq-args.rs:14:13
33
|
44
LL | impl<T> seq<T> for Vec<T> { //~ ERROR wrong number of type arguments
5-
| ^^^^^^ unexpected type argument
5+
| ^ unexpected type argument
66

77
error[E0244]: wrong number of type arguments: expected 0, found 1
8-
--> $DIR/seq-args.rs:17:6
8+
--> $DIR/seq-args.rs:17:10
99
|
1010
LL | impl seq<bool> for u32 { //~ ERROR wrong number of type arguments
11-
| ^^^^^^^^^ unexpected type argument
11+
| ^^^^ unexpected type argument
1212

1313
error: aborting due to 2 previous errors
1414

‎src/test/ui/structs/structure-constructor-type-mismatch.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ LL | x: 7,
7171
found type `{integer}`
7272

7373
error[E0244]: wrong number of type arguments: expected 0, found 1
74-
--> $DIR/structure-constructor-type-mismatch.rs:58:15
74+
--> $DIR/structure-constructor-type-mismatch.rs:58:24
7575
|
7676
LL | let pt3 = PointF::<i32> { //~ ERROR wrong number of type arguments
77-
| ^^^^^^^^^^^^^ unexpected type argument
77+
| ^^^ unexpected type argument
7878

7979
error[E0308]: mismatched types
8080
--> $DIR/structure-constructor-type-mismatch.rs:59:12
@@ -101,10 +101,10 @@ LL | y: 10, //~ ERROR mismatched types
101101
found type `{integer}`
102102

103103
error[E0244]: wrong number of type arguments: expected 0, found 1
104-
--> $DIR/structure-constructor-type-mismatch.rs:64:9
104+
--> $DIR/structure-constructor-type-mismatch.rs:64:18
105105
|
106106
LL | PointF::<u32> { .. } => {} //~ ERROR wrong number of type arguments
107-
| ^^^^^^^^^^^^^ unexpected type argument
107+
| ^^^ unexpected type argument
108108

109109
error[E0308]: mismatched types
110110
--> $DIR/structure-constructor-type-mismatch.rs:64:9

‎src/test/ui/traits/trait-object-vs-lifetime.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ LL | let _: S<'static, 'static +>;
1111
| ^^^^^^^^^
1212

1313
error[E0107]: wrong number of lifetime arguments: expected 1, found 2
14-
--> $DIR/trait-object-vs-lifetime.rs:23:12
14+
--> $DIR/trait-object-vs-lifetime.rs:23:23
1515
|
1616
LL | let _: S<'static, 'static>;
17-
| ^^^^^^^^^^^^^^^^^^^ unexpected lifetime argument
17+
| ^^^^^^^ unexpected lifetime argument
1818

1919
error[E0243]: wrong number of type arguments: expected 1, found 0
2020
--> $DIR/trait-object-vs-lifetime.rs:23:12

‎src/test/ui/traits/trait-test-2.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
error[E0087]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/trait-test-2.rs:18:8
2+
--> $DIR/trait-test-2.rs:18:14
33
|
44
LL | 10.dup::<i32>(); //~ ERROR wrong number of type arguments: expected 0, found 1
5-
| ^^^ unexpected type argument
5+
| ^^^ unexpected type argument
66

77
error[E0087]: wrong number of type arguments: expected 1, found 2
8-
--> $DIR/trait-test-2.rs:19:8
8+
--> $DIR/trait-test-2.rs:19:20
99
|
1010
LL | 10.blah::<i32, i32>(); //~ ERROR wrong number of type arguments: expected 1, found 2
11-
| ^^^^ unexpected type argument
11+
| ^^^ unexpected type argument
1212

1313
error[E0277]: the trait bound `dyn bar: bar` is not satisfied
1414
--> $DIR/trait-test-2.rs:20:26

‎src/test/ui/typeck/typeck-builtin-bound-type-parameters.stderr

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
error[E0244]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/typeck-builtin-bound-type-parameters.rs:11:11
2+
--> $DIR/typeck-builtin-bound-type-parameters.rs:11:16
33
|
44
LL | fn foo1<T:Copy<U>, U>(x: T) {}
5-
| ^^^^^^^ unexpected type argument
5+
| ^ unexpected type argument
66

77
error[E0244]: wrong number of type arguments: expected 0, found 1
8-
--> $DIR/typeck-builtin-bound-type-parameters.rs:14:14
8+
--> $DIR/typeck-builtin-bound-type-parameters.rs:14:19
99
|
1010
LL | trait Trait: Copy<Send> {}
11-
| ^^^^^^^^^^ unexpected type argument
11+
| ^^^^ unexpected type argument
1212

1313
error[E0244]: wrong number of type arguments: expected 0, found 1
14-
--> $DIR/typeck-builtin-bound-type-parameters.rs:17:21
14+
--> $DIR/typeck-builtin-bound-type-parameters.rs:17:26
1515
|
1616
LL | struct MyStruct1<T: Copy<T>>;
17-
| ^^^^^^^ unexpected type argument
17+
| ^ unexpected type argument
1818

1919
error[E0107]: wrong number of lifetime arguments: expected 0, found 1
20-
--> $DIR/typeck-builtin-bound-type-parameters.rs:20:25
20+
--> $DIR/typeck-builtin-bound-type-parameters.rs:20:30
2121
|
2222
LL | struct MyStruct2<'a, T: Copy<'a>>;
23-
| ^^^^^^^^ unexpected lifetime argument
23+
| ^^ unexpected lifetime argument
2424

2525
error[E0107]: wrong number of lifetime arguments: expected 0, found 1
26-
--> $DIR/typeck-builtin-bound-type-parameters.rs:24:15
26+
--> $DIR/typeck-builtin-bound-type-parameters.rs:24:20
2727
|
2828
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
29-
| ^^^^^^^^^^^ unexpected lifetime argument
29+
| ^^ unexpected lifetime argument
3030

3131
error[E0244]: wrong number of type arguments: expected 0, found 1
32-
--> $DIR/typeck-builtin-bound-type-parameters.rs:24:15
32+
--> $DIR/typeck-builtin-bound-type-parameters.rs:24:24
3333
|
3434
LL | fn foo2<'a, T:Copy<'a, U>, U>(x: T) {}
35-
| ^^^^^^^^^^^ unexpected type argument
35+
| ^ unexpected type argument
3636

3737
error: aborting due to 6 previous errors
3838

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0244]: wrong number of type arguments: expected 1, found 2
2-
--> $DIR/typeck_type_placeholder_lifetime_1.rs:19:12
2+
--> $DIR/typeck_type_placeholder_lifetime_1.rs:19:19
33
|
44
LL | let c: Foo<_, _> = Foo { r: &5 };
5-
| ^^^^^^^^^ unexpected type argument
5+
| ^ unexpected type argument
66

77
error: aborting due to previous error
88

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0244]: wrong number of type arguments: expected 1, found 2
2-
--> $DIR/typeck_type_placeholder_lifetime_2.rs:19:12
2+
--> $DIR/typeck_type_placeholder_lifetime_2.rs:19:19
33
|
44
LL | let c: Foo<_, usize> = Foo { r: &5 };
5-
| ^^^^^^^^^^^^^ unexpected type argument
5+
| ^^^^^ unexpected type argument
66

77
error: aborting due to previous error
88

‎src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-number-number-type-parameters.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0244]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:11
2+
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15
33
|
44
LL | fn foo(_: Zero())
5-
| ^^^^^^ unexpected type argument
5+
| ^^ unexpected type argument
66

77
error[E0220]: associated type `Output` not found for `Zero`
88
--> $DIR/unboxed-closure-sugar-wrong-number-number-type-parameters.rs:15:15

‎src/test/ui/unboxed-closures/unboxed-closure-sugar-wrong-trait.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
error[E0244]: wrong number of type arguments: expected 0, found 1
2-
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:8
2+
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:13
33
|
44
LL | fn f<F:Trait(isize) -> isize>(x: F) {}
5-
| ^^^^^^^^^^^^^^^^^^^^^ unexpected type argument
5+
| ^^^^^^^^^^^^^^^^ unexpected type argument
66

77
error[E0220]: associated type `Output` not found for `Trait`
88
--> $DIR/unboxed-closure-sugar-wrong-trait.rs:15:24

0 commit comments

Comments
 (0)
Please sign in to comment.