]> git.lizzy.rs Git - rust.git/commitdiff
Rollup merge of #74534 - Mark-Simulacrum:rustdoc-stability, r=Manishearth
authorManish Goregaokar <manishsmail@gmail.com>
Mon, 20 Jul 2020 02:12:43 +0000 (19:12 -0700)
committerGitHub <noreply@github.com>
Mon, 20 Jul 2020 02:12:43 +0000 (19:12 -0700)
Only skip impls of foreign unstable traits

Previously unstable impls were skipped, which meant that any impl with an unstable method would get skipped.

Fixes #74531.

src/bootstrap/builder.rs
src/bootstrap/dist.rs
src/bootstrap/doc.rs
src/libcore/fmt/rt/v1.rs
src/librustc_middle/traits/specialization_graph.rs
src/libstd/io/mod.rs
src/libstd/keyword_docs.rs
src/test/ui/specialization/min_specialization/impl-on-nonexisting.rs [new file with mode: 0644]
src/test/ui/specialization/min_specialization/impl-on-nonexisting.stderr [new file with mode: 0644]
src/tools/publish_toolstate.py

index 70e5f6ac26fc13c8b0479192cff2f9df709e3639..737176c48f878ef5cb59a81a173cfb8ca6c5102e 100644 (file)
@@ -1444,6 +1444,10 @@ pub struct Cargo {
 }
 
 impl Cargo {
+    pub fn rustdocflag(&mut self, arg: &str) -> &mut Cargo {
+        self.rustdocflags.arg(arg);
+        self
+    }
     pub fn rustflag(&mut self, arg: &str) -> &mut Cargo {
         self.rustflags.arg(arg);
         self
@@ -1466,6 +1470,9 @@ pub fn args<I, S>(&mut self, args: I) -> &mut Cargo
     }
 
     pub fn env(&mut self, key: impl AsRef<OsStr>, value: impl AsRef<OsStr>) -> &mut Cargo {
+        // These are managed through rustflag/rustdocflag interfaces.
+        assert_ne!(key.as_ref(), "RUSTFLAGS");
+        assert_ne!(key.as_ref(), "RUSTDOCFLAGS");
         self.command.env(key.as_ref(), value.as_ref());
         self
     }
index af30747a9592e6dcaf4eccaa226ba34f0c1d06cb..ffdde85d7656b8d5d6eac4b7a16b1fda83969157 100644 (file)
@@ -1005,6 +1005,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
         // (essentially libstd and all of its path dependencies)
         let std_src_dirs = [
             "src/build_helper",
+            "src/backtrace",
             "src/liballoc",
             "src/libcore",
             "src/libpanic_abort",
index b051390fc2671f73b7fe1f134717b5e8a4bc4dec..f8a549afc88fb81da408d64ca8c9f7519fee8bf8 100644 (file)
@@ -527,11 +527,9 @@ fn run(self, builder: &Builder<'_>) {
 
         // Build cargo command.
         let mut cargo = builder.cargo(compiler, Mode::Rustc, SourceType::InTree, target, "doc");
-        cargo.env(
-            "RUSTDOCFLAGS",
-            "--document-private-items \
-            --enable-index-page -Zunstable-options",
-        );
+        cargo.rustdocflag("--document-private-items");
+        cargo.rustdocflag("--enable-index-page");
+        cargo.rustdocflag("-Zunstable-options");
         compile::rustc_cargo(builder, &mut cargo, target);
 
         // Only include compiler crates, no dependencies of those, such as `libc`.
@@ -624,7 +622,7 @@ fn run(self, builder: &Builder<'_>) {
         cargo.arg("--no-deps");
         cargo.arg("-p").arg("rustdoc");
 
-        cargo.env("RUSTDOCFLAGS", "--document-private-items");
+        cargo.rustdocflag("--document-private-items");
         builder.run(&mut cargo.into());
     }
 }
index f6460470bfe18e5e3aec17b90cbf39b1351835ec..37202b2774dc63d95086c9d7ef6d7fa3f6231742 100644 (file)
@@ -33,9 +33,13 @@ pub enum Alignment {
     Unknown,
 }
 
+/// Used by [width](https://doc.rust-lang.org/std/fmt/#width) and [precision](https://doc.rust-lang.org/std/fmt/#precision) specifiers.
 #[derive(Copy, Clone)]
 pub enum Count {
+    /// Specified with a literal number, stores the value
     Is(usize),
+    /// Specified using `$` and `*` syntaxes, stores the index into `args`
     Param(usize),
+    /// Not specified
     Implied,
 }
index f4961617b81c6e8365a4ee6ec6be635b19c5ba7b..c9aae8980076f1a81c3446a03b2d88b0c04fbb91 100644 (file)
@@ -1,5 +1,6 @@
 use crate::ich::{self, StableHashingContext};
 use crate::ty::fast_reject::SimplifiedType;
+use crate::ty::fold::TypeFoldable;
 use crate::ty::{self, TyCtxt};
 use rustc_data_structures::fx::FxHashMap;
 use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@@ -226,7 +227,8 @@ pub fn ancestors(
     start_from_impl: DefId,
 ) -> Result<Ancestors<'tcx>, ErrorReported> {
     let specialization_graph = tcx.specialization_graph_of(trait_def_id);
-    if specialization_graph.has_errored {
+
+    if specialization_graph.has_errored || tcx.type_of(start_from_impl).references_error() {
         Err(ErrorReported)
     } else {
         Ok(Ancestors {
index 823ce30febed425ac794e6e1440a203b43029edb..797318d95b7775f3d5e13011acc9401da7cfb1ee 100644 (file)
@@ -722,7 +722,9 @@ fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
     /// No guarantees are provided about the contents of `buf` when this
     /// function is called, implementations cannot rely on any property of the
     /// contents of `buf` being true. It is recommended that implementations
-    /// only write data to `buf` instead of reading its contents.
+    /// only write data to `buf` instead of reading its contents. The
+    /// documentation on [`read`] has a more detailed explanation on this
+    /// subject.
     ///
     /// # Errors
     ///
@@ -745,6 +747,7 @@ fn read_to_string(&mut self, buf: &mut String) -> Result<usize> {
     ///
     /// [`File`]s implement `Read`:
     ///
+    /// [`read`]: Read::read
     /// [`File`]: crate::fs::File
     ///
     /// ```no_run
index d985f10ccb486489fe65680c495e9127b851dbd7..e17771f57ecf2c54a6b0103aa6e2aeb32b1c9c55 100644 (file)
@@ -387,10 +387,11 @@ mod extern_keyword {}
 //
 /// A value of type [`bool`] representing logical **false**.
 ///
-/// The documentation for this keyword is [not yet complete]. Pull requests welcome!
+/// `false` is the logical opposite of [`true`].
 ///
-/// [`bool`]: primitive.bool.html
-/// [not yet complete]: https://github.com/rust-lang/rust/issues/34601
+/// See the documentation for [`true`] for more information.
+///
+/// [`true`]: keyword.true.html
 mod false_keyword {}
 
 #[doc(keyword = "fn")]
diff --git a/src/test/ui/specialization/min_specialization/impl-on-nonexisting.rs b/src/test/ui/specialization/min_specialization/impl-on-nonexisting.rs
new file mode 100644 (file)
index 0000000..77a6432
--- /dev/null
@@ -0,0 +1,7 @@
+#![feature(min_specialization)]
+
+trait Trait {}
+impl Trait for NonExistent {}
+//~^ ERROR cannot find type `NonExistent` in this scope
+
+fn main() {}
diff --git a/src/test/ui/specialization/min_specialization/impl-on-nonexisting.stderr b/src/test/ui/specialization/min_specialization/impl-on-nonexisting.stderr
new file mode 100644 (file)
index 0000000..b032ccb
--- /dev/null
@@ -0,0 +1,9 @@
+error[E0412]: cannot find type `NonExistent` in this scope
+  --> $DIR/impl-on-nonexisting.rs:4:16
+   |
+LL | impl Trait for NonExistent {}
+   |                ^^^^^^^^^^^ not found in this scope
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0412`.
index 72437e070044ce7aaf173136309d4fce87136a6f..c0631fcedd34973d259fce507d914851284e1eac 100755 (executable)
@@ -26,7 +26,7 @@ except ImportError:
 MAINTAINERS = {
     'miri': {'oli-obk', 'RalfJung', 'eddyb'},
     'rls': {'Xanewok'},
-    'rustfmt': {'topecongiro'},
+    'rustfmt': {'topecongiro', 'calebcartwright'},
     'book': {'carols10cents', 'steveklabnik'},
     'nomicon': {'frewsxcv', 'Gankra'},
     'reference': {'steveklabnik', 'Havvy', 'matthewjasper', 'ehuss'},