Skip to content

Commit

Permalink
Auto merge of rust-lang#73147 - Dylan-DPC:rollup-9saqhj5, r=Dylan-DPC
Browse files Browse the repository at this point in the history
Rollup of 8 pull requests

Successful merges:

 - rust-lang#71842 (doc: make impl block collapsible if it has an associated constant)
 - rust-lang#72912 (Add new E0758 error code)
 - rust-lang#73008 (Update RELEASES.md)
 - rust-lang#73090 (Use `LocalDefId` directly in `Resolver::export_map`)
 - rust-lang#73118 (Improve the wording in documentation of std::mem::drop)
 - rust-lang#73124 (Removed lifetime parameters from Explanation of E0207 )
 - rust-lang#73138 (Use shorthand linker strip arguments in order to support MacOS)
 - rust-lang#73143 (Update books)

Failed merges:

r? @ghost
  • Loading branch information
bors committed Jun 8, 2020
2 parents fd4b177 + 9890107 commit 5d39f1f
Show file tree
Hide file tree
Showing 23 changed files with 92 additions and 49 deletions.
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Compiler
--------
- [Rustc now respects the `-C codegen-units` flag in incremental mode.][70156]
Additionally when in incremental mode rustc defaults to 256 codegen units.
- [Refactored `catch_unwind`, to have zero-cost unless unwinding is enabled and
- [Refactored `catch_unwind` to have zero-cost, unless unwinding is enabled and
a panic is thrown.][67502]
- [Added tier 3\* support for the `aarch64-unknown-none` and
`aarch64-unknown-none-softfloat` targets.][68334]
Expand Down
2 changes: 1 addition & 1 deletion src/doc/book
Submodule book updated 72 files
+1 −1 CONTRIBUTING.md
+1 −0 ci/dictionary.txt
+5 −5 listings/ch10-generic-types-traits-and-lifetimes/listing-10-03/src/main.rs
+8 −8 listings/ch10-generic-types-traits-and-lifetimes/listing-10-04/src/main.rs
+2 −2 listings/ch10-generic-types-traits-and-lifetimes/listing-10-05/src/main.rs
+1 −1 listings/ch13-functional-features/listing-13-26/src/lib.rs
+1 −1 listings/ch13-functional-features/listing-13-27/src/lib.rs
+2 −2 listings/ch15-smart-pointers/listing-15-24/output.txt
+2 −2 listings/ch15-smart-pointers/listing-15-24/src/main.rs
+7 −7 src/appendix-04-useful-development-tools.md
+1 −0 src/appendix-06-translation.md
+2 −2 src/appendix-07-nightly-rust.md
+4 −4 src/ch01-01-installation.md
+4 −4 src/ch01-02-hello-world.md
+10 −9 src/ch01-03-hello-cargo.md
+12 −12 src/ch02-00-guessing-game-tutorial.md
+4 −4 src/ch03-01-variables-and-mutability.md
+2 −2 src/ch03-02-data-types.md
+7 −6 src/ch03-03-how-functions-work.md
+7 −7 src/ch03-05-control-flow.md
+1 −1 src/ch04-01-what-is-ownership.md
+4 −4 src/ch04-02-references-and-borrowing.md
+1 −1 src/ch04-03-slices.md
+1 −1 src/ch05-01-defining-structs.md
+3 −3 src/ch05-02-example-structs.md
+1 −1 src/ch06-01-defining-an-enum.md
+1 −1 src/ch06-02-match.md
+1 −1 src/ch07-01-packages-and-crates.md
+2 −2 src/ch07-03-paths-for-referring-to-an-item-in-the-module-tree.md
+4 −4 src/ch07-04-bringing-paths-into-scope-with-the-use-keyword.md
+2 −2 src/ch08-01-vectors.md
+2 −2 src/ch08-02-strings.md
+3 −3 src/ch09-01-unrecoverable-errors-with-panic.md
+2 −2 src/ch09-02-recoverable-errors-with-result.md
+5 −4 src/ch10-01-syntax.md
+1 −1 src/ch10-02-traits.md
+8 −11 src/ch10-03-lifetime-syntax.md
+13 −13 src/ch11-01-writing-tests.md
+9 −9 src/ch11-02-running-tests.md
+3 −3 src/ch11-03-test-organization.md
+5 −5 src/ch12-01-accepting-command-line-arguments.md
+1 −1 src/ch12-02-reading-a-file.md
+4 −4 src/ch12-03-improving-error-handling-and-modularity.md
+6 −6 src/ch12-04-testing-the-librarys-functionality.md
+18 −9 src/ch12-05-working-with-environment-variables.md
+2 −2 src/ch12-06-writing-to-stderr-instead-of-stdout.md
+4 −4 src/ch13-01-closures.md
+1 −1 src/ch13-02-iterators.md
+1 −1 src/ch14-01-release-profiles.md
+5 −5 src/ch14-02-publishing-to-crates-io.md
+9 −9 src/ch14-03-cargo-workspaces.md
+1 −1 src/ch14-04-installing-binaries.md
+1 −1 src/ch15-01-box.md
+3 −3 src/ch15-02-deref.md
+4 −4 src/ch15-03-drop.md
+2 −2 src/ch15-04-rc.md
+3 −3 src/ch15-05-interior-mutability.md
+1 −1 src/ch15-06-reference-cycles.md
+2 −2 src/ch16-01-threads.md
+1 −1 src/ch16-02-message-passing.md
+2 −2 src/ch16-03-shared-state.md
+2 −2 src/ch17-02-trait-objects.md
+2 −2 src/ch18-01-all-the-places-for-patterns.md
+2 −2 src/ch18-02-refutability.md
+1 −1 src/ch18-03-pattern-syntax.md
+2 −2 src/ch19-01-unsafe-rust.md
+5 −5 src/ch19-03-advanced-traits.md
+1 −1 src/ch19-05-advanced-functions-and-closures.md
+2 −2 src/ch19-06-macros.md
+2 −2 src/ch20-01-single-threaded.md
+6 −6 src/ch20-02-multithreaded.md
+3 −3 src/ch20-03-graceful-shutdown-and-cleanup.md
2 changes: 1 addition & 1 deletion src/doc/edition-guide
2 changes: 1 addition & 1 deletion src/doc/nomicon
2 changes: 1 addition & 1 deletion src/doc/reference
2 changes: 1 addition & 1 deletion src/libcore/mem/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ pub fn replace<T>(dest: &mut T, mut src: T) -> T {

/// Disposes of a value.
///
/// This does call the argument's implementation of [`Drop`][drop].
/// This does so by calling the argument's implementation of [`Drop`][drop].
///
/// This effectively does nothing for types which implement `Copy`, e.g.
/// integers. Such values are copied and _then_ moved into the function, so the
Expand Down
6 changes: 4 additions & 2 deletions src/librustc_codegen_ssa/back/linker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,10 +481,12 @@ impl<'a> Linker for GccLinker<'a> {
match strip {
Strip::None => {}
Strip::Debuginfo => {
self.linker_arg("--strip-debug");
// MacOS linker does not support longhand argument --strip-debug
self.linker_arg("-S");
}
Strip::Symbols => {
self.linker_arg("--strip-all");
// MacOS linker does not support longhand argument --strip-all
self.linker_arg("-s");
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/librustc_error_codes/error_codes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ E0751: include_str!("./error_codes/E0751.md"),
E0752: include_str!("./error_codes/E0752.md"),
E0753: include_str!("./error_codes/E0753.md"),
E0754: include_str!("./error_codes/E0754.md"),
E0758: include_str!("./error_codes/E0758.md"),
E0760: include_str!("./error_codes/E0760.md"),
;
// E0006, // merged with E0005
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_error_codes/error_codes/E0207.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
A type or lifetime parameter that is specified for `impl` is not constrained.
A type parameter that is specified for `impl` is not constrained.

Erroneous code example:

Expand All @@ -14,7 +14,7 @@ impl<T: Default> Foo {
}
```

Any type parameter or lifetime parameter of an `impl` must meet at least one of
Any type parameter parameter of an `impl` must meet at least one of
the following criteria:

- it appears in the _implementing type_ of the impl, e.g. `impl<T> Foo<T>`
Expand Down
20 changes: 20 additions & 0 deletions src/librustc_error_codes/error_codes/E0758.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
A multi-line (doc-)comment is unterminated.

Erroneous code example:

```compile_fail,E0758
/* I am not terminated!
```

The same goes for doc comments:

```compile_fail,E0758
/*! I am not terminated!
```

You need to end your multi-line comment with `*/` in order to fix this error:

```
/* I am terminated! */
/*! I am also terminated! */
```
13 changes: 11 additions & 2 deletions src/librustc_metadata/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -693,16 +693,25 @@ impl EncodeContext<'tcx> {
vis: &hir::Visibility<'_>,
) {
let tcx = self.tcx;
let def_id = tcx.hir().local_def_id(id).to_def_id();
let def_id = tcx.hir().local_def_id(id);
debug!("EncodeContext::encode_info_for_mod({:?})", def_id);

let data = ModData {
reexports: match tcx.module_exports(def_id) {
Some(exports) => self.lazy(exports),
Some(exports) => {
let hir_map = self.tcx.hir();
self.lazy(
exports
.iter()
.map(|export| export.map_id(|id| hir_map.as_local_hir_id(id))),
)
}
_ => Lazy::empty(),
},
};

let def_id = def_id.to_def_id();

record!(self.tables.kind[def_id] <- EntryKind::Mod(self.lazy(data)));
record!(self.tables.visibility[def_id] <- ty::Visibility::from_hir(vis, id, self.tcx));
record!(self.tables.span[def_id] <- self.tcx.def_span(def_id));
Expand Down
5 changes: 3 additions & 2 deletions src/librustc_middle/hir/exports.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::ty;

use rustc_data_structures::fx::FxHashMap;
use rustc_hir::def::Res;
use rustc_hir::def_id::DefIdMap;
use rustc_hir::def_id::LocalDefId;
use rustc_macros::HashStable;
use rustc_span::symbol::Ident;
use rustc_span::Span;
Expand All @@ -10,7 +11,7 @@ use std::fmt::Debug;

/// This is the replacement export map. It maps a module to all of the exports
/// within.
pub type ExportMap<Id> = DefIdMap<Vec<Export<Id>>>;
pub type ExportMap<Id> = FxHashMap<LocalDefId, Vec<Export<Id>>>;

#[derive(Copy, Clone, Debug, RustcEncodable, RustcDecodable, HashStable)]
pub struct Export<Id> {
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_middle/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,8 @@ rustc_queries! {
}

Other {
query module_exports(def_id: DefId) -> Option<&'tcx [Export<hir::HirId>]> {
desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id) }
query module_exports(def_id: LocalDefId) -> Option<&'tcx [Export<LocalDefId>]> {
desc { |tcx| "looking up items exported by `{}`", tcx.def_path_str(def_id.to_def_id()) }
eval_always
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_middle/ty/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

use crate::arena::Arena;
use crate::dep_graph::{self, DepConstructor, DepGraph};
use crate::hir::exports::Export;
use crate::hir::exports::ExportMap;
use crate::ich::{NodeIdHashingMode, StableHashingContext};
use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos};
use crate::lint::{struct_lint_level, LintDiagnosticBuilder, LintSource};
Expand Down Expand Up @@ -919,7 +919,7 @@ pub struct GlobalCtxt<'tcx> {
trait_map: FxHashMap<LocalDefId, FxHashMap<ItemLocalId, StableVec<TraitCandidate>>>,

/// Export map produced by name resolution.
export_map: FxHashMap<DefId, Vec<Export<hir::HirId>>>,
export_map: ExportMap<LocalDefId>,

pub(crate) untracked_crate: &'tcx hir::Crate<'tcx>,
pub(crate) definitions: &'tcx Definitions,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_middle/ty/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ pub struct ResolverOutputs {
pub trait_map: FxHashMap<hir::HirId, Vec<hir::TraitCandidate<hir::HirId>>>,
pub maybe_unused_trait_imports: FxHashSet<LocalDefId>,
pub maybe_unused_extern_crates: Vec<(LocalDefId, Span)>,
pub export_map: ExportMap<hir::HirId>,
pub export_map: ExportMap<LocalDefId>,
pub glob_map: FxHashMap<LocalDefId, FxHashSet<Symbol>>,
/// Extern prelude entries. The value is `true` if the entry was introduced
/// via `extern crate` item and not `--extern` option or compiler built-in.
Expand Down
10 changes: 9 additions & 1 deletion src/librustc_parse/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,15 @@ impl<'a> StringReader<'a> {
"unterminated block comment"
};
let last_bpos = self.pos;
self.fatal_span_(start, last_bpos, msg).raise();
self.sess
.span_diagnostic
.struct_span_fatal_with_code(
self.mk_sp(start, last_bpos),
msg,
error_code!(E0758),
)
.emit();
FatalError.raise();
}

if is_doc_comment {
Expand Down
8 changes: 5 additions & 3 deletions src/librustc_resolve/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1393,8 +1393,8 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
let is_good_import =
binding.is_import() && !binding.is_ambiguity() && !ident.span.from_expansion();
if is_good_import || binding.is_macro_def() {
let res = binding.res();
if res != Res::Err {
let res = binding.res().map_id(|id| this.definitions.local_def_id(id));
if res != def::Res::Err {
reexports.push(Export { ident, res, span: binding.span, vis: binding.vis });
}
}
Expand Down Expand Up @@ -1467,7 +1467,9 @@ impl<'a, 'b> ImportResolver<'a, 'b> {

if !reexports.is_empty() {
if let Some(def_id) = module.def_id() {
self.r.export_map.insert(def_id, reexports);
// Call to `expect_local` should be fine because current
// code is only called for local modules.
self.r.export_map.insert(def_id.expect_local(), reexports);
}
}
}
Expand Down
28 changes: 3 additions & 25 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -878,7 +878,7 @@ pub struct Resolver<'a> {

/// `CrateNum` resolutions of `extern crate` items.
extern_crate_map: FxHashMap<LocalDefId, CrateNum>,
export_map: ExportMap<NodeId>,
export_map: ExportMap<LocalDefId>,
trait_map: TraitMap<NodeId>,

/// A map from nodes to anonymous modules.
Expand Down Expand Up @@ -1281,18 +1281,7 @@ impl<'a> Resolver<'a> {
pub fn into_outputs(self) -> ResolverOutputs {
let definitions = self.definitions;
let extern_crate_map = self.extern_crate_map;
let export_map = self
.export_map
.into_iter()
.map(|(k, v)| {
(
k,
v.into_iter()
.map(|e| e.map_id(|id| definitions.node_id_to_hir_id(id)))
.collect(),
)
})
.collect();
let export_map = self.export_map;
let trait_map = self
.trait_map
.into_iter()
Expand Down Expand Up @@ -1330,18 +1319,7 @@ impl<'a> Resolver<'a> {
definitions: self.definitions.clone(),
cstore: Box::new(self.cstore().clone()),
extern_crate_map: self.extern_crate_map.clone(),
export_map: self
.export_map
.iter()
.map(|(&k, v)| {
(
k,
v.iter()
.map(|e| e.map_id(|id| self.definitions.node_id_to_hir_id(id)))
.collect(),
)
})
.collect(),
export_map: self.export_map.clone(),
trait_map: self
.trait_map
.iter()
Expand Down
4 changes: 3 additions & 1 deletion src/librustdoc/html/static/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,9 @@ function defocusSearchBar() {
if (!next) {
return;
}
if (next.getElementsByClassName("method").length > 0 && hasClass(e, "impl")) {
if (hasClass(e, "impl") &&
(next.getElementsByClassName("method").length > 0 ||
next.getElementsByClassName("associatedconstant").length > 0)) {
insertAfter(toggle.cloneNode(true), e.childNodes[e.childNodes.length - 1]);
}
};
Expand Down
1 change: 1 addition & 0 deletions src/test/ui/unterminated-comment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* //~ ERROR E0758
9 changes: 9 additions & 0 deletions src/test/ui/unterminated-comment.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0758]: unterminated block comment
--> $DIR/unterminated-comment.rs:1:1
|
LL | /*
| ^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0758`.
1 change: 1 addition & 0 deletions src/test/ui/unterminated-doc-comment.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/*! //~ ERROR E0758
9 changes: 9 additions & 0 deletions src/test/ui/unterminated-doc-comment.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
error[E0758]: unterminated block doc-comment
--> $DIR/unterminated-doc-comment.rs:1:1
|
LL | /*!
| ^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

For more information about this error, try `rustc --explain E0758`.

0 comments on commit 5d39f1f

Please sign in to comment.