Skip to content

Commit e122009

Browse files
authoredOct 4, 2021
Rollup merge of rust-lang#89453 - waywardmonkeys:consistent-supertrait-usage, r=nagisa
Consistently use 'supertrait'. A subset of places referred to 'super-trait', so this changes them to all use 'supertrait'. This matches 'supertype' and some other usages. An exception is 'auto-trait' which is consistently used in that manner.
2 parents 9d081ce + 058a21d commit e122009

25 files changed

+88
-88
lines changed
 

‎compiler/rustc_driver/src/pretty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ trait PrinterSupport: pprust::PpAnn {
8888
/// Produces the pretty-print annotation object.
8989
///
9090
/// (Rust does not yet support upcasting from a trait object to
91-
/// an object for one of its super-traits.)
91+
/// an object for one of its supertraits.)
9292
fn pp_ann(&self) -> &dyn pprust::PpAnn;
9393
}
9494

@@ -104,7 +104,7 @@ trait HirPrinterSupport<'hir>: pprust_hir::PpAnn {
104104
/// Produces the pretty-print annotation object.
105105
///
106106
/// (Rust does not yet support upcasting from a trait object to
107-
/// an object for one of its super-traits.)
107+
/// an object for one of its supertraits.)
108108
fn pp_ann(&self) -> &dyn pprust_hir::PpAnn;
109109
}
110110

‎compiler/rustc_error_codes/src/error_codes/E0222.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ pub trait BoxCar : Box + Vehicle {}
1616
fn dent_object<COLOR>(c: dyn BoxCar<Color=COLOR>) {} // Invalid constraint
1717
```
1818

19-
In this example, `BoxCar` has two super-traits: `Vehicle` and `Box`. Both of
19+
In this example, `BoxCar` has two supertraits: `Vehicle` and `Box`. Both of
2020
these traits define an associated type `Color`. `BoxCar` inherits two types
21-
with that name from both super-traits. Because of this, we need to use the
21+
with that name from both supertraits. Because of this, we need to use the
2222
fully qualified path syntax to refer to the appropriate `Color` associated
2323
type, either `<BoxCar as Vehicle>::Color` or `<BoxCar as Box>::Color`, but this
2424
syntax is not allowed to be used in a function signature.

‎compiler/rustc_middle/src/ty/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2117,7 +2117,7 @@ impl<'tcx> TyCtxt<'tcx> {
21172117
})
21182118
}
21192119

2120-
/// Computes the def-ids of the transitive super-traits of `trait_def_id`. This (intentionally)
2120+
/// Computes the def-ids of the transitive supertraits of `trait_def_id`. This (intentionally)
21212121
/// does not compute the full elaborated super-predicates but just the set of def-ids. It is used
21222122
/// to identify which traits may define a given associated type to help avoid cycle errors.
21232123
/// Returns a `DefId` iterator.

‎compiler/rustc_middle/src/ty/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ impl<'tcx> Predicate<'tcx> {
599599
// where both `'x` and `'b` would have a DB index of 1.
600600
// The substitution from the input trait-ref is therefore going to be
601601
// `'a => 'x` (where `'x` has a DB index of 1).
602-
// - The super-trait-ref is `for<'b> Bar1<'a,'b>`, where `'a` is an
602+
// - The supertrait-ref is `for<'b> Bar1<'a,'b>`, where `'a` is an
603603
// early-bound parameter and `'b' is a late-bound parameter with a
604604
// DB index of 1.
605605
// - If we replace `'a` with `'x` from the input, it too will have

‎compiler/rustc_save_analysis/src/dump_visitor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ impl<'tcx> DumpVisitor<'tcx> {
682682
);
683683
}
684684

685-
// super-traits
685+
// supertraits
686686
for super_bound in trait_refs.iter() {
687687
let (def_id, sub_span) = match *super_bound {
688688
hir::GenericBound::Trait(ref trait_ref, _) => (

‎compiler/rustc_typeck/src/astconv/errors.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
199199

200200
/// When there are any missing associated types, emit an E0191 error and attempt to supply a
201201
/// reasonable suggestion on how to write it. For the case of multiple associated types in the
202-
/// same trait bound have the same name (as they come from different super-traits), we instead
202+
/// same trait bound have the same name (as they come from different supertraits), we instead
203203
/// emit a generic note suggesting using a `where` clause to constraint instead.
204204
pub(crate) fn complain_about_missing_associated_types(
205205
&self,
@@ -340,7 +340,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
340340
using the fully-qualified path to the associated types";
341341
if !where_constraints.is_empty() && suggestions.is_empty() {
342342
// If there are duplicates associated type names and a single trait bound do not
343-
// use structured suggestion, it means that there are multiple super-traits with
343+
// use structured suggestion, it means that there are multiple supertraits with
344344
// the same associated type name.
345345
err.help(where_msg);
346346
}

‎compiler/rustc_typeck/src/astconv/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
13191319
);
13201320
first_trait.label_with_exp_info(&mut err, "first non-auto trait", "first use");
13211321
err.help(&format!(
1322-
"consider creating a new trait with all of these as super-traits and using that \
1322+
"consider creating a new trait with all of these as supertraits and using that \
13231323
trait here instead: `trait NewTrait: {} {{}}`",
13241324
regular_traits
13251325
.iter()

‎compiler/rustc_typeck/src/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,7 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
964964
let trait_ref = ty::TraitRef::new(trait_def_id, trait_substs);
965965

966966
if self.tcx.is_trait_alias(trait_def_id) {
967-
// For trait aliases, assume all super-traits are relevant.
967+
// For trait aliases, assume all supertraits are relevant.
968968
let bounds = iter::once(ty::Binder::dummy(trait_ref));
969969
self.elaborate_bounds(bounds, |this, new_trait_ref, item| {
970970
let new_trait_ref = this.erase_late_bound_regions(new_trait_ref);

‎src/test/ui/associated-types/issue-22560.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ LL | type Test = dyn Add + Sub;
3232
| |
3333
| first non-auto trait
3434
|
35-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Add<[type error]> + Sub<[type error]> {}`
35+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<[type error]> + Sub<[type error]> {}`
3636
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
3737

3838
error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified

‎src/test/ui/associated-types/missing-associated-types.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | type Foo<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs>;
66
| |
77
| first non-auto trait
88
|
9-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
9+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Y<Rhs> {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

1212
error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `Add`), `Output` (from trait `Mul`), `Output` (from trait `Sub`) must be specified
@@ -35,7 +35,7 @@ LL | type Bar<Rhs> = dyn Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs>;
3535
| |
3636
| first non-auto trait
3737
|
38-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
38+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + X<Rhs> + Z<Rhs> {}`
3939
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
4040

4141
error[E0191]: the value of the associated types `A` (from trait `Z`), `B` (from trait `Z`), `Output` (from trait `Add`), `Output` (from trait `Div`), `Output` (from trait `Div`), `Output` (from trait `Mul`), `Output` (from trait `Sub`) must be specified
@@ -71,7 +71,7 @@ LL | type Baz<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Y<Rhs>;
7171
| |
7272
| first non-auto trait
7373
|
74-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Y<Rhs> {}`
74+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Y<Rhs> {}`
7575
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
7676

7777
error[E0191]: the value of the associated types `A` (from trait `Y`), `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified
@@ -99,7 +99,7 @@ LL | type Bat<Rhs> = dyn Add<Rhs> + Sub<Rhs> + Fine<Rhs>;
9999
| |
100100
| first non-auto trait
101101
|
102-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Fine<Rhs> {}`
102+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Add<Rhs> + Sub<Rhs> + Fine<Rhs> {}`
103103
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
104104

105105
error[E0191]: the value of the associated types `Output` (from trait `Add`), `Output` (from trait `Sub`) must be specified

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let _: Box<dyn std::io::Read + std::io::Write>;
66
| |
77
| first non-auto trait
88
|
9-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
9+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

1212
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -23,7 +23,7 @@ LL | let _: Box<dyn Foo>;
2323
| trait alias used in trait object type (additional use)
2424
| trait alias used in trait object type (first use)
2525
|
26-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
26+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: std::io::Read + std::io::Write {}`
2727
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
2828

2929
error: aborting due to 2 previous errors

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | size_of_copy::<dyn Misc + Copy>();
66
| |
77
| first non-auto trait
88
|
9-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Misc + Copy {}`
9+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Misc + Copy {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

1212
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -17,7 +17,7 @@ LL | size_of_copy::<dyn Misc + Copy>();
1717
| |
1818
| first non-auto trait
1919
|
20-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Misc + Copy {}`
20+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Misc + Copy {}`
2121
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
2222

2323
error[E0277]: the trait bound `dyn Misc: Copy` is not satisfied

‎src/test/ui/parser/trait-object-delimiters.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ LL | fn foo1(_: &dyn Drop + AsRef<str>) {}
5252
| |
5353
| first non-auto trait
5454
|
55-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
55+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
5656
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
5757

5858
error[E0224]: at least one trait is required for an object type
@@ -69,7 +69,7 @@ LL | fn foo5(_: &(dyn Drop + dyn AsRef<str>)) {}
6969
| |
7070
| first non-auto trait
7171
|
72-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
72+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Drop + AsRef<str> {}`
7373
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
7474

7575
error: aborting due to 9 previous errors

‎src/test/ui/parser/trait-object-trait-parens.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ LL | let _: Box<(Obj) + (?Sized) + (for<'a> Trait<'a>)>;
5252
| |
5353
| first non-auto trait
5454
|
55-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + for<'a> Trait<'a> {}`
55+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + for<'a> Trait<'a> {}`
5656
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
5757

5858
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -63,7 +63,7 @@ LL | let _: Box<?Sized + (for<'a> Trait<'a>) + (Obj)>;
6363
| |
6464
| first non-auto trait
6565
|
66-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
66+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
6767
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
6868

6969
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -74,7 +74,7 @@ LL | let _: Box<for<'a> Trait<'a> + (Obj) + (?Sized)>;
7474
| |
7575
| first non-auto trait
7676
|
77-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
77+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: for<'a> Trait<'a> + Obj {}`
7878
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
7979

8080
error: aborting due to 6 previous errors; 3 warnings emitted

‎src/test/ui/specialization/README-rpass.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Tests that specialization is working correctly:
88
- Specialization via concrete types vs unknown types
99
- In top level of the trait reference
1010
- Embedded within another type (`Vec<T>` vs `Vec<i32>`)
11-
- [Specialization based on super trait relationships](specialization-super-traits.rs)
11+
- [Specialization based on super trait relationships](specialization-supertraits.rs)
1212
- [On assoc fns](specialization-assoc-fns.rs)
1313
- [Ensure that impl order doesn't matter](specialization-out-of-order.rs)
1414

‎src/test/ui/specialization/specialization-super-traits.stderr ‎src/test/ui/specialization/specialization-supertraits.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
2-
--> $DIR/specialization-super-traits.rs:3:12
2+
--> $DIR/specialization-supertraits.rs:3:12
33
|
44
LL | #![feature(specialization)]
55
| ^^^^^^^^^^^^^^

‎src/test/ui/traits/alias/no-duplicates.stderr

+27-27
Large diffs are not rendered by default.

‎src/test/ui/traits/alias/no-extra-traits.stderr

+28-28
Large diffs are not rendered by default.

‎src/test/ui/traits/bad-sized.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let x: Vec<dyn Trait + Sized> = Vec::new();
66
| |
77
| first non-auto trait
88
|
9-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Trait + Sized {}`
9+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Trait + Sized {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

1212
error[E0277]: the size for values of type `dyn Trait` cannot be known at compilation time

‎src/test/ui/traits/wf-object/no-duplicates.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | type _0 = dyn Obj + Obj;
66
| |
77
| first non-auto trait
88
|
9-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
9+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
1010
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
1111

1212
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -17,7 +17,7 @@ LL | type _1 = dyn Send + Obj + Obj;
1717
| |
1818
| first non-auto trait
1919
|
20-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
20+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
2121
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
2222

2323
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -28,7 +28,7 @@ LL | type _2 = dyn Obj + Send + Obj;
2828
| |
2929
| first non-auto trait
3030
|
31-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
31+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: Obj + Obj {}`
3232
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
3333

3434
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -39,7 +39,7 @@ LL | type _4 = dyn for<'a> ObjL<'a> + for<'b> ObjL<'b>;
3939
| |
4040
| first non-auto trait
4141
|
42-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: for<'a> ObjL<'a> + for<'b> ObjL<'b> {}`
42+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: for<'a> ObjL<'a> + for<'b> ObjL<'b> {}`
4343
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
4444

4545
error[E0225]: only auto traits can be used as additional traits in a trait object
@@ -50,7 +50,7 @@ LL | type _5 = dyn ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)>;
5050
| |
5151
| first non-auto trait
5252
|
53-
= help: consider creating a new trait with all of these as super-traits and using that trait here instead: `trait NewTrait: ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)> {}`
53+
= help: consider creating a new trait with all of these as supertraits and using that trait here instead: `trait NewTrait: ObjT<for<'a> fn(&'a u8)> + ObjT<for<'b> fn(&'b u8)> {}`
5454
= note: auto-traits like `Send` and `Sync` are traits that have special properties; for more information on them, visit <https://doc.rust-lang.org/reference/special-types-and-traits.html#auto-traits>
5555

5656
error: aborting due to 5 previous errors

0 commit comments

Comments
 (0)
Please sign in to comment.