Skip to content

Commit b14eb0c

Browse files
pluralize stuff
1 parent deb1357 commit b14eb0c

25 files changed

+105
-111
lines changed

compiler/rustc_ast_lowering/src/lib.rs

+25-31
Original file line numberDiff line numberDiff line change
@@ -288,31 +288,31 @@ enum ImplTraitPosition {
288288
impl std::fmt::Display for ImplTraitPosition {
289289
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
290290
let name = match self {
291-
ImplTraitPosition::Path => "path",
292-
ImplTraitPosition::Variable => "variable binding",
293-
ImplTraitPosition::Trait => "trait",
294-
ImplTraitPosition::AsyncBlock => "async block",
295-
ImplTraitPosition::Bound => "bound",
296-
ImplTraitPosition::Generic => "generic",
297-
ImplTraitPosition::ExternFnParam => "`extern fn` param",
298-
ImplTraitPosition::ClosureParam => "closure param",
299-
ImplTraitPosition::PointerParam => "`fn` pointer param",
300-
ImplTraitPosition::FnTraitParam => "`Fn` trait param",
301-
ImplTraitPosition::TraitParam => "trait method param",
302-
ImplTraitPosition::ImplParam => "`impl` method param",
303-
ImplTraitPosition::ExternFnReturn => "`extern fn` return",
304-
ImplTraitPosition::ClosureReturn => "closure return",
305-
ImplTraitPosition::PointerReturn => "`fn` pointer return",
306-
ImplTraitPosition::FnTraitReturn => "`Fn` trait return",
307-
ImplTraitPosition::TraitReturn => "trait method return",
308-
ImplTraitPosition::ImplReturn => "`impl` method return",
309-
ImplTraitPosition::GenericDefault => "generic parameter default",
310-
ImplTraitPosition::ConstTy => "const type",
311-
ImplTraitPosition::StaticTy => "static type",
312-
ImplTraitPosition::AssocTy => "associated type",
313-
ImplTraitPosition::FieldTy => "field type",
314-
ImplTraitPosition::Cast => "cast type",
315-
ImplTraitPosition::ImplSelf => "impl header",
291+
ImplTraitPosition::Path => "paths",
292+
ImplTraitPosition::Variable => "variable bindings",
293+
ImplTraitPosition::Trait => "traits",
294+
ImplTraitPosition::AsyncBlock => "async blocks",
295+
ImplTraitPosition::Bound => "bounds",
296+
ImplTraitPosition::Generic => "generics",
297+
ImplTraitPosition::ExternFnParam => "`extern fn` params",
298+
ImplTraitPosition::ClosureParam => "closure params",
299+
ImplTraitPosition::PointerParam => "`fn` pointer params",
300+
ImplTraitPosition::FnTraitParam => "`Fn` trait params",
301+
ImplTraitPosition::TraitParam => "trait method params",
302+
ImplTraitPosition::ImplParam => "`impl` method params",
303+
ImplTraitPosition::ExternFnReturn => "`extern fn` return types",
304+
ImplTraitPosition::ClosureReturn => "closure return types",
305+
ImplTraitPosition::PointerReturn => "`fn` pointer return types",
306+
ImplTraitPosition::FnTraitReturn => "`Fn` trait return types",
307+
ImplTraitPosition::TraitReturn => "trait method return types",
308+
ImplTraitPosition::ImplReturn => "`impl` method return types",
309+
ImplTraitPosition::GenericDefault => "generic parameter defaults",
310+
ImplTraitPosition::ConstTy => "const types",
311+
ImplTraitPosition::StaticTy => "static types",
312+
ImplTraitPosition::AssocTy => "associated types",
313+
ImplTraitPosition::FieldTy => "field types",
314+
ImplTraitPosition::Cast => "cast types",
315+
ImplTraitPosition::ImplSelf => "impl headers",
316316
};
317317

318318
write!(f, "{name}")
@@ -1038,12 +1038,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
10381038
// fn foo(x: dyn Iterator<Item = impl Debug>)
10391039
ImplTraitContext::Universal if self.is_in_dyn_type => DesugarKind::ImplTrait,
10401040

1041-
// In `type Foo = dyn Iterator<Item: Debug>` we desugar to
1042-
// `type Foo = dyn Iterator<Item = impl Debug>` but we have to override the
1043-
// "impl trait context" to permit `impl Debug` in this position (it desugars
1044-
// then to an opaque type).
1045-
//
1046-
// FIXME: this is only needed until `impl Trait` is allowed in type aliases.
10471041
ImplTraitContext::Disallowed(position) if self.is_in_dyn_type => {
10481042
DesugarKind::Error(position)
10491043
}

tests/ui/associated-consts/issue-105330.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ LL | fn main<A: TraitWAssocConst<A=32>>() {
3333
= note: see issue #92827 <https://github.com/rust-lang/rust/issues/92827> for more information
3434
= help: add `#![feature(associated_const_equality)]` to the crate attributes to enable
3535

36-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl header
36+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in impl headers
3737
--> $DIR/issue-105330.rs:6:27
3838
|
3939
LL | impl TraitWAssocConst for impl Demo {

tests/ui/associated-type-bounds/bad-universal-in-dyn-in-where-clause.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: associated type bounds are only allowed in where clauses and function signatures, not in bound
1+
error: associated type bounds are only allowed in where clauses and function signatures, not in bounds
22
--> $DIR/bad-universal-in-dyn-in-where-clause.rs:9:19
33
|
44
LL | dyn for<'j> B<AssocType: 'j>:,

tests/ui/associated-type-bounds/bad-universal-in-impl-sig.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: associated type bounds are only allowed in where clauses and function signatures, not in impl header
1+
error: associated type bounds are only allowed in where clauses and function signatures, not in impl headers
22
--> $DIR/bad-universal-in-impl-sig.rs:10:16
33
|
44
LL | impl dyn Trait<Item: Trait2> {}

tests/ui/associated-type-bounds/inside-adt.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
1+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
22
--> $DIR/inside-adt.rs:5:29
33
|
44
LL | struct S1 { f: dyn Iterator<Item: Copy> }
55
| ^^^^^^^^^^
66

7-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
7+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
88
--> $DIR/inside-adt.rs:7:33
99
|
1010
LL | struct S2 { f: Box<dyn Iterator<Item: Copy>> }
1111
| ^^^^^^^^^^
1212

13-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
13+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
1414
--> $DIR/inside-adt.rs:9:29
1515
|
1616
LL | struct S3 { f: dyn Iterator<Item: 'static> }
1717
| ^^^^^^^^^^^^^
1818

19-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
19+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
2020
--> $DIR/inside-adt.rs:12:26
2121
|
2222
LL | enum E1 { V(dyn Iterator<Item: Copy>) }
2323
| ^^^^^^^^^^
2424

25-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
25+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
2626
--> $DIR/inside-adt.rs:14:30
2727
|
2828
LL | enum E2 { V(Box<dyn Iterator<Item: Copy>>) }
2929
| ^^^^^^^^^^
3030

31-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
31+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
3232
--> $DIR/inside-adt.rs:16:26
3333
|
3434
LL | enum E3 { V(dyn Iterator<Item: 'static>) }
3535
| ^^^^^^^^^^^^^
3636

37-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
37+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
3838
--> $DIR/inside-adt.rs:19:41
3939
|
4040
LL | union U1 { f: ManuallyDrop<dyn Iterator<Item: Copy>> }
4141
| ^^^^^^^^^^
4242

43-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
43+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
4444
--> $DIR/inside-adt.rs:21:45
4545
|
4646
LL | union U2 { f: ManuallyDrop<Box<dyn Iterator<Item: Copy>>> }
4747
| ^^^^^^^^^^
4848

49-
error: associated type bounds are only allowed in where clauses and function signatures, not in field type
49+
error: associated type bounds are only allowed in where clauses and function signatures, not in field types
5050
--> $DIR/inside-adt.rs:23:41
5151
|
5252
LL | union U3 { f: ManuallyDrop<dyn Iterator<Item: 'static>> }

tests/ui/async-await/in-trait/fn-not-async-err2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ trait MyTrait {
1111

1212
impl MyTrait for i32 {
1313
fn foo(&self) -> impl Future<Output = i32> {
14-
//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return [E0562]
14+
//~^ ERROR `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
1515
async { *self }
1616
}
1717
}

tests/ui/async-await/in-trait/fn-not-async-err2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `impl` method return types
22
--> $DIR/fn-not-async-err2.rs:13:22
33
|
44
LL | fn foo(&self) -> impl Future<Output = i32> {

tests/ui/feature-gates/feature-gate-associated_type_bounds.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,19 @@ LL | let _: impl Tr1<As1: Copy> = S1;
115115
= note: see issue #52662 <https://github.com/rust-lang/rust/issues/52662> for more information
116116
= help: add `#![feature(associated_type_bounds)]` to the crate attributes to enable
117117

118-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const type
118+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
119119
--> $DIR/feature-gate-associated_type_bounds.rs:55:14
120120
|
121121
LL | const _cdef: impl Tr1<As1: Copy> = S1;
122122
| ^^^^^^^^^^^^^^^^^^^
123123

124-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const type
124+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
125125
--> $DIR/feature-gate-associated_type_bounds.rs:61:15
126126
|
127127
LL | static _sdef: impl Tr1<As1: Copy> = S1;
128128
| ^^^^^^^^^^^^^^^^^^^
129129

130-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
130+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
131131
--> $DIR/feature-gate-associated_type_bounds.rs:68:12
132132
|
133133
LL | let _: impl Tr1<As1: Copy> = S1;

tests/ui/feature-gates/feature-gate-impl_trait_in_fn_trait_return.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
22
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:1:24
33
|
44
LL | fn f() -> impl Fn() -> impl Sized { || () }
@@ -7,7 +7,7 @@ LL | fn f() -> impl Fn() -> impl Sized { || () }
77
= note: see issue #99697 <https://github.com/rust-lang/rust/issues/99697> for more information
88
= help: add `#![feature(impl_trait_in_fn_trait_return)]` to the crate attributes to enable
99

10-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return
10+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `Fn` trait return types
1111
--> $DIR/feature-gate-impl_trait_in_fn_trait_return.rs:3:32
1212
|
1313
LL | fn g() -> &'static dyn Fn() -> impl Sized { &|| () }

tests/ui/feature-gates/feature-gate-return_position_impl_trait_in_trait.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
22
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:8:17
33
|
44
LL | fn bar() -> impl Sized;
@@ -7,7 +7,7 @@ LL | fn bar() -> impl Sized;
77
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
88
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
99

10-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
10+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
1111
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:9:21
1212
|
1313
LL | fn baz() -> Box<impl std::fmt::Display>;
@@ -16,7 +16,7 @@ LL | fn baz() -> Box<impl std::fmt::Display>;
1616
= note: see issue #91611 <https://github.com/rust-lang/rust/issues/91611> for more information
1717
= help: add `#![feature(return_position_impl_trait_in_trait)]` to the crate attributes to enable
1818

19-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return
19+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in trait method return types
2020
--> $DIR/feature-gate-return_position_impl_trait_in_trait.rs:15:23
2121
|
2222
LL | async fn bar() -> impl Sized;

tests/ui/impl-trait/issues/issue-54600.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
22
--> $DIR/issue-54600.rs:4:19
33
|
44
LL | let x: Option<impl Debug> = Some(44_u32);

tests/ui/impl-trait/issues/issue-54840.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
22
--> $DIR/issue-54840.rs:5:13
33
|
44
LL | let j: &impl Add = &i;

tests/ui/impl-trait/issues/issue-58504.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
22
--> $DIR/issue-58504.rs:10:16
33
|
44
LL | let gens: [impl Generator<Return=!, Yield=()>;2] = [ mk_gen(), mk_gen() ];

tests/ui/impl-trait/issues/issue-58956.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const type
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
22
--> $DIR/issue-58956.rs:7:11
33
|
44
LL | const _A: impl Lam = {
55
| ^^^^^^^^
66

7-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
7+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
88
--> $DIR/issue-58956.rs:9:17
99
|
1010
LL | let x: Wrap<impl Lam> = Wrap(B);

tests/ui/impl-trait/issues/issue-70971.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
22
--> $DIR/issue-70971.rs:2:14
33
|
44
LL | let x : (impl Copy,) = (true,);

tests/ui/impl-trait/issues/issue-79099.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LL | let f: impl core::future::Future<Output = u8> = async { 1 };
99
= help: pass `--edition 2021` to `rustc`
1010
= note: for more on editions, read https://doc.rust-lang.org/edition-guide
1111

12-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
12+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
1313
--> $DIR/issue-79099.rs:3:16
1414
|
1515
LL | let f: impl core::future::Future<Output = u8> = async { 1 };

tests/ui/impl-trait/issues/issue-83929-impl-trait-in-generic-default.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter default
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
22
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:1:16
33
|
44
LL | struct Foo<T = impl Copy>(T);
55
| ^^^^^^^^^
66

7-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter default
7+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in generic parameter defaults
88
--> $DIR/issue-83929-impl-trait-in-generic-default.rs:4:20
99
|
1010
LL | type Result<T, E = impl std::error::Error> = std::result::Result<T, E>;

tests/ui/impl-trait/issues/issue-84919.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
22
--> $DIR/issue-84919.rs:5:13
33
|
44
LL | let _x: impl Trait = ();

tests/ui/impl-trait/issues/issue-86642.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const type
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in const types
22
--> $DIR/issue-86642.rs:1:11
33
|
44
LL | static x: impl Fn(&str) -> Result<&str, ()> = move |source| {

tests/ui/impl-trait/issues/issue-87295.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable binding
1+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in variable bindings
22
--> $DIR/issue-87295.rs:16:31
33
|
44
LL | let _do_not_waste: Struct<impl Trait<Output = i32>> = Struct::new(());

tests/ui/impl-trait/nested_impl_trait.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ LL | fn bad(x: impl Into<u32>) -> impl Into<impl Debug> { x }
3434
| | nested `impl Trait` here
3535
| outer `impl Trait`
3636

37-
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return
37+
error[E0562]: `impl Trait` only allowed in function and inherent method return types, not in `fn` pointer return types
3838
--> $DIR/nested_impl_trait.rs:10:32
3939
|
4040
LL | fn bad_in_fn_syntax(x: fn() -> impl Into<impl Debug>) {}

0 commit comments

Comments
 (0)