diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2016-10-19 08:00:00 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-10-19 08:00:00 +0300 |
| commit | c38324dee2285348e636de282f3a56ba6931f6d9 (patch) | |
| tree | 690f4b620998d9de80433dc432934481fb4fd728 | |
| parent | fc8f9b950b93dc6a7b9e3945b7b36ded64a64e04 (diff) | |
| parent | ac42f3f2064130fa0c841fdf645616e0fa46734a (diff) | |
| download | rust-c38324dee2285348e636de282f3a56ba6931f6d9.tar.gz rust-c38324dee2285348e636de282f3a56ba6931f6d9.zip | |
Rollup merge of #37193 - zackmdavis:pluralization_of_expected_type_arguments, r=nrc
correct erroneous pluralization of '1 type argument' error messages This is in the matter of #37042.
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 7 | ||||
| -rw-r--r-- | src/test/compile-fail/E0243.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/generic-type-less-params-with-defaults.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/issue-14092.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs | 2 | ||||
| -rw-r--r-- | src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs | 2 |
6 files changed, 10 insertions, 7 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index d58b8f083e2..c9ce320988c 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -2218,10 +2218,12 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize, } else { "expected" }; + let arguments_plural = if required == 1 { "" } else { "s" }; struct_span_err!(tcx.sess, span, E0243, "wrong number of type arguments") .span_label( span, - &format!("{} {} type arguments, found {}", expected, required, supplied) + &format!("{} {} type argument{}, found {}", + expected, required, arguments_plural, supplied) ) .emit(); } else if supplied > accepted { @@ -2232,11 +2234,12 @@ fn check_type_argument_count(tcx: TyCtxt, span: Span, supplied: usize, } else { format!("expected {}", accepted) }; + let arguments_plural = if accepted == 1 { "" } else { "s" }; struct_span_err!(tcx.sess, span, E0244, "wrong number of type arguments") .span_label( span, - &format!("{} type arguments, found {}", expected, supplied) + &format!("{} type argument{}, found {}", expected, arguments_plural, supplied) ) .emit(); } diff --git a/src/test/compile-fail/E0243.rs b/src/test/compile-fail/E0243.rs index 77c9856c261..4434723e12f 100644 --- a/src/test/compile-fail/E0243.rs +++ b/src/test/compile-fail/E0243.rs @@ -11,7 +11,7 @@ struct Foo<T> { x: T } struct Bar { x: Foo } //~^ ERROR E0243 - //~| NOTE expected 1 type arguments, found 0 + //~| NOTE expected 1 type argument, found 0 fn main() { } diff --git a/src/test/compile-fail/generic-type-less-params-with-defaults.rs b/src/test/compile-fail/generic-type-less-params-with-defaults.rs index d9ac715fa95..9b1f3e51647 100644 --- a/src/test/compile-fail/generic-type-less-params-with-defaults.rs +++ b/src/test/compile-fail/generic-type-less-params-with-defaults.rs @@ -18,5 +18,5 @@ struct Vec<T, A = Heap>( fn main() { let _: Vec; //~^ ERROR E0243 - //~| NOTE expected at least 1 type arguments, found 0 + //~| NOTE expected at least 1 type argument, found 0 } diff --git a/src/test/compile-fail/issue-14092.rs b/src/test/compile-fail/issue-14092.rs index dd02fa7ac15..df8707ab823 100644 --- a/src/test/compile-fail/issue-14092.rs +++ b/src/test/compile-fail/issue-14092.rs @@ -10,6 +10,6 @@ fn fn1(0: Box) {} //~^ ERROR E0243 - //~| NOTE expected 1 type arguments, found 0 + //~| NOTE expected 1 type argument, found 0 fn main() {} diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs index f60d925a748..f40445a030e 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs +++ b/src/test/compile-fail/typeck_type_placeholder_lifetime_1.rs @@ -18,5 +18,5 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, _> = Foo { r: &5 }; //~^ ERROR E0244 - //~| NOTE expected 1 type arguments, found 2 + //~| NOTE expected 1 type argument, found 2 } diff --git a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs b/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs index ec2675ece74..47898690fcc 100644 --- a/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs +++ b/src/test/compile-fail/typeck_type_placeholder_lifetime_2.rs @@ -18,5 +18,5 @@ struct Foo<'a, T:'a> { pub fn main() { let c: Foo<_, usize> = Foo { r: &5 }; //~^ ERROR E0244 - //~| NOTE expected 1 type arguments, found 2 + //~| NOTE expected 1 type argument, found 2 } |
