Skip to content

Commit

Permalink
Rollup merge of rust-lang#47404 - integer32llc:reexport-to-re-export,…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
kennytm committed Jan 17, 2018
2 parents 67dac57 + e168aa3 commit e8774b4
Show file tree
Hide file tree
Showing 42 changed files with 102 additions and 99 deletions.
14 changes: 7 additions & 7 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ Compatibility Notes
a warning.
- [From the pound escape, lines consisting of multiple `#`s are
now visible][41785]
- [It is an error to reexport private enum variants][42460]. This is
- [It is an error to re-export private enum variants][42460]. This is
known to break a number of crates that depend on an older version of
mustache.
- [On Windows, if `VCINSTALLDIR` is set incorrectly, `rustc` will try
Expand Down Expand Up @@ -2251,10 +2251,10 @@ Rustdoc
-------

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

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

Expand Down Expand Up @@ -5467,7 +5467,7 @@ Version 0.7 (2013-07-03)
incl. `any`, `all`. removed.
* std: The `finalize` method of `Drop` renamed to `drop`.
* std: The `drop` method now takes `&mut self` instead of `&self`.
* std: The prelude no longer reexports any modules, only types and traits.
* std: The prelude no longer re-exports any modules, only types and traits.
* std: Prelude additions: `print`, `println`, `FromStr`, `ApproxEq`, `Equiv`,
`Iterator`, `IteratorUtil`, many numeric traits, many tuple traits.
* std: New numeric traits: `Fractional`, `Real`, `RealExt`, `Integer`, `Ratio`,
Expand Down
6 changes: 3 additions & 3 deletions src/doc/rustdoc/src/the-doc-attribute.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The `#[doc]` attribute

The `#[doc]` attribute lets you control various aspects of how `rustdoc` does
its job.
its job.

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

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

If we change the `use` line like this:
Expand Down Expand Up @@ -184,7 +184,7 @@ mod bar {
}
```

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

## `#[doc(hidden)]`

Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//!
//! This library, like libcore, is not intended for general usage, but rather as
//! a building block of other libraries. The types and interfaces in this
//! library are reexported through the [standard library](../std/index.html),
//! library are re-exported through the [standard library](../std/index.html),
//! and should not be used through this library.
//!
//! ## Boxed values
Expand Down Expand Up @@ -52,7 +52,7 @@
//! ## Collections
//!
//! Implementations of the most common general purpose data structures are
//! defined in this library. They are reexported through the
//! defined in this library. They are re-exported through the
//! [standard collections library](../std/collections/index.html).
//!
//! ## Heap interfaces
Expand Down
8 changes: 4 additions & 4 deletions src/libcore/prelude/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@

#![stable(feature = "core_prelude", since = "1.4.0")]

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

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

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

// Reexported extension traits for primitive types
// Re-exported extension traits for primitive types
#[stable(feature = "core_prelude", since = "1.4.0")]
#[doc(no_inline)]
pub use slice::SliceExt;
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/slice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
// a lot of stuff defined here. Let's keep it clean.
//
// Since slices don't support inherent methods; all operations
// on them are defined on traits, which are then reexported from
// on them are defined on traits, which are then re-exported from
// the prelude for convenience. So there are a lot of traits here.
//
// The layout of this file is thus:
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2119,7 +2119,7 @@ impl<'a> LoweringContext<'a> {

// Privatize the degenerate import base, used only to check
// the stability of `use a::{};`, to avoid it showing up as
// a reexport by accident when `pub`, e.g. in documentation.
// a re-export by accident when `pub`, e.g. in documentation.
let path = P(self.lower_path(id, &prefix, ParamMode::Explicit, true));
*vis = hir::Inherited;
hir::ItemUse(path, hir::UseKind::ListStem)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/lint/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ declare_lint! {
declare_lint! {
pub PUB_USE_OF_PRIVATE_EXTERN_CRATE,
Deny,
"detect public reexports of private extern crates"
"detect public re-exports of private extern crates"
}

declare_lint! {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ pub enum AccessLevel {
// public, then type `T` is reachable. Its values can be obtained by other crates
// even if the type itself is not nameable.
Reachable,
// Public items + items accessible to other crates with help of `pub use` reexports
// Public items + items accessible to other crates with help of `pub use` re-exports
Exported,
// Items accessible to other crates directly, without help of reexports
// Items accessible to other crates directly, without help of re-exports
Public,
}

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_metadata/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,8 +702,8 @@ impl<'a, 'tcx> CrateMetadata {
let vis = self.get_visibility(child_index);
let is_import = false;
callback(def::Export { def, ident, vis, span, is_import });
// For non-reexport structs and variants add their constructors to children.
// Reexport lists automatically contain constructors when necessary.
// For non-re-export structs and variants add their constructors to children.
// Re-export lists automatically contain constructors when necessary.
match def {
Def::Struct(..) => {
if let Some(ctor_def_id) = self.get_struct_ctor_def_id(child_index) {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_privacy/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EmbargoVisitor<'a, 'tcx> {
hir::ItemExternCrate(..) => {}
// All nested items are checked by visit_item
hir::ItemMod(..) => {}
// Reexports are handled in visit_mod
// Re-exports are handled in visit_mod
hir::ItemUse(..) => {}
// The interface is empty
hir::ItemGlobalAsm(..) => {}
Expand Down Expand Up @@ -1049,7 +1049,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ObsoleteVisiblePrivateTypesVisitor<'a, 'tcx> {

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

Expand Down
4 changes: 2 additions & 2 deletions src/librustc_resolve/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ impl<'a> Resolver<'a> {
let (def, vis) = (binding.def(), binding.vis);
self.macro_exports.push(Export { ident, def, vis, span, is_import: true });
} else {
span_err!(self.session, span, E0470, "reexported macro not found");
span_err!(self.session, span, E0470, "re-exported macro not found");
}
}
used
Expand Down Expand Up @@ -729,7 +729,7 @@ impl<'a> Resolver<'a> {
}
} else if attr.check_name("macro_reexport") {
let bad_macro_reexport = |this: &mut Self, span| {
span_err!(this.session, span, E0467, "bad macro reexport");
span_err!(this.session, span, E0467, "bad macro re-export");
};
if let Some(names) = attr.meta_item_list() {
for attr in names {
Expand Down
10 changes: 5 additions & 5 deletions src/librustc_resolve/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,7 +1374,7 @@ arguments.
"##,

E0467: r##"
Macro reexport declarations were empty or malformed.
Macro re-export declarations were empty or malformed.
Erroneous code examples:
Expand All @@ -1389,12 +1389,12 @@ extern crate core as other_macros_for_good;
This is a syntax error at the level of attribute declarations.
Currently, `macro_reexport` requires at least one macro name to be listed.
Unlike `macro_use`, listing no names does not reexport all macros from the
Unlike `macro_use`, listing no names does not re-export all macros from the
given crate.
Decide which macros you would like to export and list them properly.
These are proper reexport declarations:
These are proper re-export declarations:
```ignore (cannot-doctest-multicrate-project)
#[macro_reexport(some_macro, another_macro)]
Expand Down Expand Up @@ -1475,7 +1475,7 @@ extern crate some_crate; //ok!
"##,

E0470: r##"
A macro listed for reexport was not found.
A macro listed for re-export was not found.
Erroneous code example:
Expand All @@ -1493,7 +1493,7 @@ exported from the given crate.
This could be caused by a typo. Did you misspell the macro's name?
Double-check the names of the macros listed for reexport, and that the crate
Double-check the names of the macros listed for re-export, and that the crate
in question exports them.
A working version:
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2751,7 +2751,7 @@ impl<'a> Resolver<'a> {
let lint = lint::builtin::LEGACY_CONSTRUCTOR_VISIBILITY;
self.session.buffer_lint(lint, id, span,
"private struct constructors are not usable through \
reexports in outer modules",
re-exports in outer modules",
);
res = Some(PathResolution::new(ctor_def));
}
Expand Down
21 changes: 11 additions & 10 deletions src/librustc_resolve/resolve_imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub enum ImportDirectiveSubclass<'a> {
},
GlobImport {
is_prelude: bool,
max_vis: Cell<ty::Visibility>, // The visibility of the greatest reexport.
// n.b. `max_vis` is only used in `finalize_import` to check for reexport errors.
max_vis: Cell<ty::Visibility>, // The visibility of the greatest re-export.
// n.b. `max_vis` is only used in `finalize_import` to check for re-export errors.
},
ExternCrate(Option<Name>),
MacroUse,
Expand Down Expand Up @@ -803,21 +803,22 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
if !any_successful_reexport {
let (ns, binding) = reexport_error.unwrap();
if ns == TypeNS && binding.is_extern_crate() {
let msg = format!("extern crate `{}` is private, and cannot be reexported \
(error E0365), consider declaring with `pub`",
let msg = format!("extern crate `{}` is private, and cannot be \
re-exported (error E0365), consider declaring with \
`pub`",
ident);
self.session.buffer_lint(PUB_USE_OF_PRIVATE_EXTERN_CRATE,
directive.id,
directive.span,
&msg);
} else if ns == TypeNS {
struct_span_err!(self.session, directive.span, E0365,
"`{}` is private, and cannot be reexported", ident)
.span_label(directive.span, format!("reexport of private `{}`", ident))
"`{}` is private, and cannot be re-exported", ident)
.span_label(directive.span, format!("re-export of private `{}`", ident))
.note(&format!("consider declaring type or module `{}` with `pub`", ident))
.emit();
} else {
let msg = format!("`{}` is private, and cannot be reexported", ident);
let msg = format!("`{}` is private, and cannot be re-exported", ident);
let note_msg =
format!("consider marking `{}` as `pub` in the imported module", ident);
struct_span_err!(self.session, directive.span, E0364, "{}", &msg)
Expand Down Expand Up @@ -876,7 +877,7 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
self.record_def(directive.id, PathResolution::new(module.def().unwrap()));
}

// Miscellaneous post-processing, including recording reexports,
// Miscellaneous post-processing, including recording re-exports,
// reporting conflicts, and reporting unresolved imports.
fn finalize_resolutions_in(&mut self, module: Module<'b>) {
// Since import resolution is finished, globs will not define any more names.
Expand Down Expand Up @@ -932,12 +933,12 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> {
!orig_binding.vis.is_at_least(binding.vis, &*self) {
let msg = match directive.subclass {
ImportDirectiveSubclass::SingleImport { .. } => {
format!("variant `{}` is private and cannot be reexported",
format!("variant `{}` is private and cannot be re-exported",
ident)
},
ImportDirectiveSubclass::GlobImport { .. } => {
let msg = "enum is private and its variants \
cannot be reexported".to_owned();
cannot be re-exported".to_owned();
let error_id = (DiagnosticMessageId::ErrorId(0), // no code?!
Some(binding.span),
msg.clone());
Expand Down
6 changes: 3 additions & 3 deletions src/librustdoc/clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name)
ret.extend(build_impls(cx, did));
clean::ForeignTypeItem
}
// Never inline enum variants but leave them shown as reexports.
// Never inline enum variants but leave them shown as re-exports.
Def::Variant(..) => return None,
// Assume that enum variants and struct types are reexported next to
// Assume that enum variants and struct types are re-exported next to
// their constructors.
Def::VariantCtor(..) |
Def::StructCtor(..) => return Some(Vec::new()),
Expand Down Expand Up @@ -368,7 +368,7 @@ fn build_module(cx: &DocContext, did: DefId) -> clean::Module {
};

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

0 comments on commit e8774b4

Please sign in to comment.