Skip to content

Commit e8774b4

Browse files
authored
Rollup merge of rust-lang#47404 - integer32llc:reexport-to-re-export, r=steveklabnik
Standardize on "re-export" rather than "reexport" While working on the book with our editors, it was brought to our attention that we're not consistent with when we use "re-export" versus "reexport". For the book, we've decided (with our editors) to go with "re-export"; in prose, I think that looks better. In code, I'm fine with "reexport". However, the rustdoc generated section is currently "Reexports", so when we have a screenshot of generated documentation with the prose where we use "re-export", it's inconsistent. It's too late to fix this for the book because we're using 1.21.0 for the output in the book, and it's really only one spot so it's not a huge deal, but I'd like to advocate for changing the documentation header so that a future edition of the book can be consistent. The first commit here only changes the documentation section heading text and rustdoc documentation that references it. This is the commit that's most important to me. The second commit changes error messages and associated tests to also be consistent with the use of re-export. This is the next most important commit to me, but I could be argued out of this one because then it won't match code like the `macro_reexports` feature name, which ostensibly should change to `macro_re_exports` to be most consistent but I didn't want to change code. The last commit changes re-export anywhere else in prose: either in documentation comments or regular comments. This is least important as most of them aren't user-visible. Instances like these will likely sneak back in over time. I'm totally fine dropping this commit if anyone wants, but [the hobgoblins made me do it](http://www.bartleby.com/100/420.47.html) and it sets a good example. r? @steveklabnik
2 parents 67dac57 + e168aa3 commit e8774b4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+102
-99
lines changed

RELEASES.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ Compatibility Notes
577577
a warning.
578578
- [From the pound escape, lines consisting of multiple `#`s are
579579
now visible][41785]
580-
- [It is an error to reexport private enum variants][42460]. This is
580+
- [It is an error to re-export private enum variants][42460]. This is
581581
known to break a number of crates that depend on an older version of
582582
mustache.
583583
- [On Windows, if `VCINSTALLDIR` is set incorrectly, `rustc` will try
@@ -2251,10 +2251,10 @@ Rustdoc
22512251
-------
22522252

22532253
* [Fix empty implementation section on some module pages](https://github.com/rust-lang/rust/pull/34536)
2254-
* [Fix inlined renamed reexports in import lists](https://github.com/rust-lang/rust/pull/34479)
2254+
* [Fix inlined renamed re-exports in import lists](https://github.com/rust-lang/rust/pull/34479)
22552255
* [Fix search result layout for enum variants and struct fields](https://github.com/rust-lang/rust/pull/34477)
22562256
* [Fix issues with source links to external crates](https://github.com/rust-lang/rust/pull/34387)
2257-
* [Fix redirect pages for renamed reexports](https://github.com/rust-lang/rust/pull/34245)
2257+
* [Fix redirect pages for renamed re-exports](https://github.com/rust-lang/rust/pull/34245)
22582258

22592259
Tooling
22602260
-------
@@ -4988,7 +4988,7 @@ Version 0.10 (2014-04-03)
49884988
* std: The `vec` module has been renamed to `slice`.
49894989
* std: A new vector type, `Vec<T>`, has been added in preparation for DST.
49904990
This will become the only growable vector in the future.
4991-
* std: `std::io` now has more public-reexports. Types such as `BufferedReader`
4991+
* std: `std::io` now has more public re-exports. Types such as `BufferedReader`
49924992
are now found at `std::io::BufferedReader` instead of
49934993
`std::io::buffered::BufferedReader`.
49944994
* std: `print` and `println` are no longer in the prelude, the `print!` and
@@ -5079,8 +5079,8 @@ Version 0.10 (2014-04-03)
50795079
* render standalone markdown files.
50805080
* the --test flag tests all code blocks by default.
50815081
* exported macros are displayed.
5082-
* reexported types have their documentation inlined at the location of the
5083-
first reexport.
5082+
* re-exported types have their documentation inlined at the location of the
5083+
first re-export.
50845084
* search works across crates that have been rendered to the same output
50855085
directory.
50865086

@@ -5467,7 +5467,7 @@ Version 0.7 (2013-07-03)
54675467
incl. `any`, `all`. removed.
54685468
* std: The `finalize` method of `Drop` renamed to `drop`.
54695469
* std: The `drop` method now takes `&mut self` instead of `&self`.
5470-
* std: The prelude no longer reexports any modules, only types and traits.
5470+
* std: The prelude no longer re-exports any modules, only types and traits.
54715471
* std: Prelude additions: `print`, `println`, `FromStr`, `ApproxEq`, `Equiv`,
54725472
`Iterator`, `IteratorUtil`, many numeric traits, many tuple traits.
54735473
* std: New numeric traits: `Fractional`, `Real`, `RealExt`, `Integer`, `Ratio`,

src/doc/rustdoc/src/the-doc-attribute.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# The `#[doc]` attribute
22

33
The `#[doc]` attribute lets you control various aspects of how `rustdoc` does
4-
its job.
4+
its job.
55

66
The most basic function of `#[doc]` is to handle the actual documentation
77
text. That is, `///` is syntax sugar for `#[doc]`. This means that these two
@@ -143,7 +143,7 @@ pub mod bar {
143143
}
144144
```
145145

146-
The documentation will generate a "Reexports" section, and say `pub use bar::Bar;`, where
146+
The documentation will generate a "Re-exports" section, and say `pub use bar::Bar;`, where
147147
`Bar` is a link to its page.
148148

149149
If we change the `use` line like this:
@@ -184,7 +184,7 @@ mod bar {
184184
}
185185
```
186186

187-
Now we'll have a `Reexports` line, and `Bar` will not link to anywhere.
187+
Now we'll have a `Re-exports` line, and `Bar` will not link to anywhere.
188188

189189
## `#[doc(hidden)]`
190190

src/liballoc/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
//!
1616
//! This library, like libcore, is not intended for general usage, but rather as
1717
//! a building block of other libraries. The types and interfaces in this
18-
//! library are reexported through the [standard library](../std/index.html),
18+
//! library are re-exported through the [standard library](../std/index.html),
1919
//! and should not be used through this library.
2020
//!
2121
//! ## Boxed values
@@ -52,7 +52,7 @@
5252
//! ## Collections
5353
//!
5454
//! Implementations of the most common general purpose data structures are
55-
//! defined in this library. They are reexported through the
55+
//! defined in this library. They are re-exported through the
5656
//! [standard collections library](../std/collections/index.html).
5757
//!
5858
//! ## Heap interfaces

src/libcore/prelude/v1.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@
1616
1717
#![stable(feature = "core_prelude", since = "1.4.0")]
1818

19-
// Reexported core operators
19+
// Re-exported core operators
2020
#[stable(feature = "core_prelude", since = "1.4.0")]
2121
#[doc(no_inline)]
2222
pub use marker::{Copy, Send, Sized, Sync};
2323
#[stable(feature = "core_prelude", since = "1.4.0")]
2424
#[doc(no_inline)]
2525
pub use ops::{Drop, Fn, FnMut, FnOnce};
2626

27-
// Reexported functions
27+
// Re-exported functions
2828
#[stable(feature = "core_prelude", since = "1.4.0")]
2929
#[doc(no_inline)]
3030
pub use mem::drop;
3131

32-
// Reexported types and traits
32+
// Re-exported types and traits
3333
#[stable(feature = "core_prelude", since = "1.4.0")]
3434
#[doc(no_inline)]
3535
pub use clone::Clone;
@@ -55,7 +55,7 @@ pub use option::Option::{self, Some, None};
5555
#[doc(no_inline)]
5656
pub use result::Result::{self, Ok, Err};
5757

58-
// Reexported extension traits for primitive types
58+
// Re-exported extension traits for primitive types
5959
#[stable(feature = "core_prelude", since = "1.4.0")]
6060
#[doc(no_inline)]
6161
pub use slice::SliceExt;

src/libcore/slice/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// a lot of stuff defined here. Let's keep it clean.
2323
//
2424
// Since slices don't support inherent methods; all operations
25-
// on them are defined on traits, which are then reexported from
25+
// on them are defined on traits, which are then re-exported from
2626
// the prelude for convenience. So there are a lot of traits here.
2727
//
2828
// The layout of this file is thus:

src/librustc/hir/lowering.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2119,7 +2119,7 @@ impl<'a> LoweringContext<'a> {
21192119

21202120
// Privatize the degenerate import base, used only to check
21212121
// the stability of `use a::{};`, to avoid it showing up as
2122-
// a reexport by accident when `pub`, e.g. in documentation.
2122+
// a re-export by accident when `pub`, e.g. in documentation.
21232123
let path = P(self.lower_path(id, &prefix, ParamMode::Explicit, true));
21242124
*vis = hir::Inherited;
21252125
hir::ItemUse(path, hir::UseKind::ListStem)

src/librustc/lint/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ declare_lint! {
127127
declare_lint! {
128128
pub PUB_USE_OF_PRIVATE_EXTERN_CRATE,
129129
Deny,
130-
"detect public reexports of private extern crates"
130+
"detect public re-exports of private extern crates"
131131
}
132132

133133
declare_lint! {

src/librustc/middle/privacy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ pub enum AccessLevel {
2626
// public, then type `T` is reachable. Its values can be obtained by other crates
2727
// even if the type itself is not nameable.
2828
Reachable,
29-
// Public items + items accessible to other crates with help of `pub use` reexports
29+
// Public items + items accessible to other crates with help of `pub use` re-exports
3030
Exported,
31-
// Items accessible to other crates directly, without help of reexports
31+
// Items accessible to other crates directly, without help of re-exports
3232
Public,
3333
}
3434

src/librustc_metadata/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -702,8 +702,8 @@ impl<'a, 'tcx> CrateMetadata {
702702
let vis = self.get_visibility(child_index);
703703
let is_import = false;
704704
callback(def::Export { def, ident, vis, span, is_import });
705-
// For non-reexport structs and variants add their constructors to children.
706-
// Reexport lists automatically contain constructors when necessary.
705+
// For non-re-export structs and variants add their constructors to children.
706+
// Re-export lists automatically contain constructors when necessary.
707707
match def {
708708
Def::Struct(..) => {
709709
if let Some(ctor_def_id) = self.get_struct_ctor_def_id(child_index) {

src/librustc_privacy/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
219219
hir::ItemExternCrate(..) => {}
220220
// All nested items are checked by visit_item
221221
hir::ItemMod(..) => {}
222-
// Reexports are handled in visit_mod
222+
// Re-exports are handled in visit_mod
223223
hir::ItemUse(..) => {}
224224
// The interface is empty
225225
hir::ItemGlobalAsm(..) => {}
@@ -1049,7 +1049,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {
10491049

10501050
fn visit_item(&mut self, item: &'tcx hir::Item) {
10511051
match item.node {
1052-
// contents of a private mod can be reexported, so we need
1052+
// contents of a private mod can be re-exported, so we need
10531053
// to check internals.
10541054
hir::ItemMod(_) => {}
10551055

src/librustc_resolve/build_reduced_graph.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ impl<'a> Resolver<'a> {
683683
let (def, vis) = (binding.def(), binding.vis);
684684
self.macro_exports.push(Export { ident, def, vis, span, is_import: true });
685685
} else {
686-
span_err!(self.session, span, E0470, "reexported macro not found");
686+
span_err!(self.session, span, E0470, "re-exported macro not found");
687687
}
688688
}
689689
used
@@ -729,7 +729,7 @@ impl<'a> Resolver<'a> {
729729
}
730730
} else if attr.check_name("macro_reexport") {
731731
let bad_macro_reexport = |this: &mut Self, span| {
732-
span_err!(this.session, span, E0467, "bad macro reexport");
732+
span_err!(this.session, span, E0467, "bad macro re-export");
733733
};
734734
if let Some(names) = attr.meta_item_list() {
735735
for attr in names {

src/librustc_resolve/diagnostics.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ arguments.
13741374
"##,
13751375

13761376
E0467: r##"
1377-
Macro reexport declarations were empty or malformed.
1377+
Macro re-export declarations were empty or malformed.
13781378
13791379
Erroneous code examples:
13801380
@@ -1389,12 +1389,12 @@ extern crate core as other_macros_for_good;
13891389
This is a syntax error at the level of attribute declarations.
13901390
13911391
Currently, `macro_reexport` requires at least one macro name to be listed.
1392-
Unlike `macro_use`, listing no names does not reexport all macros from the
1392+
Unlike `macro_use`, listing no names does not re-export all macros from the
13931393
given crate.
13941394
13951395
Decide which macros you would like to export and list them properly.
13961396
1397-
These are proper reexport declarations:
1397+
These are proper re-export declarations:
13981398
13991399
```ignore (cannot-doctest-multicrate-project)
14001400
#[macro_reexport(some_macro, another_macro)]
@@ -1475,7 +1475,7 @@ extern crate some_crate; //ok!
14751475
"##,
14761476

14771477
E0470: r##"
1478-
A macro listed for reexport was not found.
1478+
A macro listed for re-export was not found.
14791479
14801480
Erroneous code example:
14811481
@@ -1493,7 +1493,7 @@ exported from the given crate.
14931493
14941494
This could be caused by a typo. Did you misspell the macro's name?
14951495
1496-
Double-check the names of the macros listed for reexport, and that the crate
1496+
Double-check the names of the macros listed for re-export, and that the crate
14971497
in question exports them.
14981498
14991499
A working version:

src/librustc_resolve/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2751,7 +2751,7 @@ impl<'a> Resolver<'a> {
27512751
let lint = lint::builtin::LEGACY_CONSTRUCTOR_VISIBILITY;
27522752
self.session.buffer_lint(lint, id, span,
27532753
"private struct constructors are not usable through \
2754-
reexports in outer modules",
2754+
re-exports in outer modules",
27552755
);
27562756
res = Some(PathResolution::new(ctor_def));
27572757
}

src/librustc_resolve/resolve_imports.rs

+11-10
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ pub enum ImportDirectiveSubclass<'a> {
4646
},
4747
GlobImport {
4848
is_prelude: bool,
49-
max_vis: Cell<ty::Visibility>, // The visibility of the greatest reexport.
50-
// n.b. `max_vis` is only used in `finalize_import` to check for reexport errors.
49+
max_vis: Cell<ty::Visibility>, // The visibility of the greatest re-export.
50+
// n.b. `max_vis` is only used in `finalize_import` to check for re-export errors.
5151
},
5252
ExternCrate(Option<Name>),
5353
MacroUse,
@@ -803,21 +803,22 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
803803
if !any_successful_reexport {
804804
let (ns, binding) = reexport_error.unwrap();
805805
if ns == TypeNS && binding.is_extern_crate() {
806-
let msg = format!("extern crate `{}` is private, and cannot be reexported \
807-
(error E0365), consider declaring with `pub`",
806+
let msg = format!("extern crate `{}` is private, and cannot be \
807+
re-exported (error E0365), consider declaring with \
808+
`pub`",
808809
ident);
809810
self.session.buffer_lint(PUB_USE_OF_PRIVATE_EXTERN_CRATE,
810811
directive.id,
811812
directive.span,
812813
&msg);
813814
} else if ns == TypeNS {
814815
struct_span_err!(self.session, directive.span, E0365,
815-
"`{}` is private, and cannot be reexported", ident)
816-
.span_label(directive.span, format!("reexport of private `{}`", ident))
816+
"`{}` is private, and cannot be re-exported", ident)
817+
.span_label(directive.span, format!("re-export of private `{}`", ident))
817818
.note(&format!("consider declaring type or module `{}` with `pub`", ident))
818819
.emit();
819820
} else {
820-
let msg = format!("`{}` is private, and cannot be reexported", ident);
821+
let msg = format!("`{}` is private, and cannot be re-exported", ident);
821822
let note_msg =
822823
format!("consider marking `{}` as `pub` in the imported module", ident);
823824
struct_span_err!(self.session, directive.span, E0364, "{}", &msg)
@@ -876,7 +877,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
876877
self.record_def(directive.id, PathResolution::new(module.def().unwrap()));
877878
}
878879

879-
// Miscellaneous post-processing, including recording reexports,
880+
// Miscellaneous post-processing, including recording re-exports,
880881
// reporting conflicts, and reporting unresolved imports.
881882
fn finalize_resolutions_in(&mut self, module: Module<'b>) {
882883
// Since import resolution is finished, globs will not define any more names.
@@ -932,12 +933,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
932933
!orig_binding.vis.is_at_least(binding.vis, &*self) {
933934
let msg = match directive.subclass {
934935
ImportDirectiveSubclass::SingleImport { .. } => {
935-
format!("variant `{}` is private and cannot be reexported",
936+
format!("variant `{}` is private and cannot be re-exported",
936937
ident)
937938
},
938939
ImportDirectiveSubclass::GlobImport { .. } => {
939940
let msg = "enum is private and its variants \
940-
cannot be reexported".to_owned();
941+
cannot be re-exported".to_owned();
941942
let error_id = (DiagnosticMessageId::ErrorId(0), // no code?!
942943
Some(binding.span),
943944
msg.clone());

src/librustdoc/clean/inline.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name)
8282
ret.extend(build_impls(cx, did));
8383
clean::ForeignTypeItem
8484
}
85-
// Never inline enum variants but leave them shown as reexports.
85+
// Never inline enum variants but leave them shown as re-exports.
8686
Def::Variant(..) => return None,
87-
// Assume that enum variants and struct types are reexported next to
87+
// Assume that enum variants and struct types are re-exported next to
8888
// their constructors.
8989
Def::VariantCtor(..) |
9090
Def::StructCtor(..) => return Some(Vec::new()),
@@ -368,7 +368,7 @@ fn build_module(cx: &DocContext, did: DefId) -> clean::Module {
368368
};
369369

370370
fn fill_in(cx: &DocContext, did: DefId, items: &mut Vec<clean::Item>) {
371-
// If we're reexporting a reexport it may actually reexport something in
371+
// If we're re-exporting a re-export it may actually re-export something in
372372
// two namespaces, so the target may be listed twice. Make sure we only
373373
// visit each node at most once.
374374
let mut visited = FxHashSet();

0 commit comments

Comments
 (0)