summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-15 16:24:19 +0000
committerbors <bors@rust-lang.org>2019-04-15 16:24:19 +0000
commit07133ac70cca85b2f91aedb76a21ece524bc0cb4 (patch)
treecfebf7d3b0fee04927f6274b02d2a78d3c00bb62
parent9217fe0e2f04d61dd29c9aaebee2c993705e1d26 (diff)
parent6434fe9ef58fbb59b23fa9bc667d98fb5c91ab0f (diff)
downloadrust-07133ac70cca85b2f91aedb76a21ece524bc0cb4.tar.gz
Auto merge of #59991 - Centril:rollup-bqxt4w3, r=Centril
Rollup of 6 pull requests Successful merges: - #59648 (Add must_use annotations to Result::is_ok and is_err) - #59748 (Add summary and reference to Rust trademark guide) - #59779 (Uplift `get_def_path` from Clippy) - #59955 (bump stdsimd; make intra_doc_link_resolution_failure an error again; make lints more consistent) - #59978 (rustdoc: Remove default keyword from re-exported trait methods) - #59989 (Fix links to Atomic* in RELEASES.md) Failed merges: r? @ghost
-rw-r--r--README.md16
-rw-r--r--RELEASES.md18
-rw-r--r--src/liballoc/borrow.rs1
-rw-r--r--src/liballoc/boxed.rs1
-rw-r--r--src/liballoc/lib.rs9
-rw-r--r--src/liballoc/slice.rs10
-rw-r--r--src/libcore/lib.rs2
-rw-r--r--src/libcore/option.rs2
-rw-r--r--src/libcore/result.rs2
-rw-r--r--src/librustc/lint/context.rs32
-rw-r--r--src/librustc/lint/internal.rs2
-rw-r--r--src/librustc_data_structures/owning_ref/mod.rs12
-rw-r--r--src/librustdoc/clean/mod.rs6
-rw-r--r--src/libstd/lib.rs7
-rw-r--r--src/libstd/sync/mpsc/mod.rs2
m---------src/stdsimd0
-rw-r--r--src/test/run-pass/issues/issue-18353.rs2
-rw-r--r--src/test/rustdoc/default-trait-method.rs26
-rw-r--r--src/test/rustdoc/default_trait_method.rs15
-rw-r--r--src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs16
-rw-r--r--src/test/rustdoc/inline_cross/default-trait-method.rs20
21 files changed, 154 insertions, 47 deletions
diff --git a/README.md b/README.md
index 55e6e8d7f18..f6f796911b8 100644
--- a/README.md
+++ b/README.md
@@ -261,3 +261,19 @@ BSD-like licenses.
See [LICENSE-APACHE](LICENSE-APACHE), [LICENSE-MIT](LICENSE-MIT), and
[COPYRIGHT](COPYRIGHT) for details.
+
+## Trademark
+[trademark]: #trademark
+
+The Rust programming language is an open source, community project governed
+by a core team. It is also sponsored by the Mozilla Foundation (“Mozilla”),
+which owns and protects the Rust and Cargo trademarks and logos
+(the “Rust Trademarks”).
+
+If you want to use these names or brands, please read the [media guide][media-guide].
+
+Third-party logos may be subject to third-party copyrights and trademarks. See
+[Licenses][policies-licenses] for details.
+
+[media-guide]: https://www.rust-lang.org/policies/media-guide
+[policies-licenses]: https://www.rust-lang.org/policies/licenses
diff --git a/RELEASES.md b/RELEASES.md
index fcaaa73bdc0..24461742ad8 100644
--- a/RELEASES.md
+++ b/RELEASES.md
@@ -113,15 +113,15 @@ Compatibility Notes
[56470]: https://github.com/rust-lang/rust/pull/56470/
[cargo/6654]: https://github.com/rust-lang/cargo/pull/6654/
[`Any::type_id`]: https://doc.rust-lang.org/std/any/trait.Any.html#tymethod.type_id
-[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#tymethod.type_id
-[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI16.html
-[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI32.html
-[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI64.html
-[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicI8.html
-[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU16.html
-[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU32.html
-[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU64.html
-[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/atomic/struct.AtomicU8.html
+[`Error::type_id`]: https://doc.rust-lang.org/std/error/trait.Error.html#method.type_id
+[`atomic::AtomicI16`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI16.html
+[`atomic::AtomicI32`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI32.html
+[`atomic::AtomicI64`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI64.html
+[`atomic::AtomicI8`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicI8.html
+[`atomic::AtomicU16`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU16.html
+[`atomic::AtomicU32`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU32.html
+[`atomic::AtomicU64`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU64.html
+[`atomic::AtomicU8`]: https://doc.rust-lang.org/std/sync/atomic/struct.AtomicU8.html
[`convert::Infallible`]: https://doc.rust-lang.org/std/convert/enum.Infallible.html
[`convert::TryFrom`]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html
[`convert::TryInto`]: https://doc.rust-lang.org/std/convert/trait.TryInto.html
diff --git a/src/liballoc/borrow.rs b/src/liballoc/borrow.rs
index ee1799fad8e..d5e15b3719c 100644
--- a/src/liballoc/borrow.rs
+++ b/src/liballoc/borrow.rs
@@ -32,6 +32,7 @@ impl<'a, B: ?Sized> Borrow<B> for Cow<'a, B>
/// from any borrow of a given type.
#[stable(feature = "rust1", since = "1.0.0")]
pub trait ToOwned {
+ /// The resulting type after obtaining ownership.
#[stable(feature = "rust1", since = "1.0.0")]
type Owned: Borrow<Self>;
diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs
index 6a6a9146e24..8a3950718d7 100644
--- a/src/liballoc/boxed.rs
+++ b/src/liballoc/boxed.rs
@@ -760,6 +760,7 @@ impl<A, F: Fn<A> + ?Sized> Fn<A> for Box<F> {
#[unstable(feature = "fnbox",
reason = "will be deprecated if and when `Box<FnOnce>` becomes usable", issue = "28796")]
pub trait FnBox<A>: FnOnce<A> {
+ /// Performs the call operation.
fn call_box(self: Box<Self>, args: A) -> Self::Output;
}
diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs
index 7f3acc933d4..63b3fbbdaef 100644
--- a/src/liballoc/lib.rs
+++ b/src/liballoc/lib.rs
@@ -58,12 +58,13 @@
#![no_std]
#![needs_allocator]
-#![deny(rust_2018_idioms)]
-#![allow(explicit_outlives_requirements)]
-
#![warn(deprecated_in_future)]
-#![warn(intra_doc_link_resolution_failure)]
+#![warn(missing_docs)]
#![warn(missing_debug_implementations)]
+#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
+
+#![deny(rust_2018_idioms)]
+#![allow(explicit_outlives_requirements)]
#![cfg_attr(not(test), feature(generator_trait))]
#![cfg_attr(test, feature(test))]
diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs
index f4b2d463778..6eac8487401 100644
--- a/src/liballoc/slice.rs
+++ b/src/liballoc/slice.rs
@@ -570,6 +570,16 @@ pub trait SliceConcatExt<T: ?Sized> {
#[stable(feature = "rename_connect_to_join", since = "1.3.0")]
fn join(&self, sep: &T) -> Self::Output;
+ /// Flattens a slice of `T` into a single value `Self::Output`, placing a
+ /// given separator between each.
+ ///
+ /// # Examples
+ ///
+ /// ```
+ /// # #![allow(deprecated)]
+ /// assert_eq!(["hello", "world"].connect(" "), "hello world");
+ /// assert_eq!([[1, 2], [3, 4]].connect(&0), [1, 2, 0, 3, 4]);
+ /// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(since = "1.3.0", reason = "renamed to join")]
fn connect(&self, sep: &T) -> Self::Output;
diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs
index 63688e70c45..615549f47bb 100644
--- a/src/libcore/lib.rs
+++ b/src/libcore/lib.rs
@@ -60,8 +60,8 @@
#![warn(deprecated_in_future)]
#![warn(missing_docs)]
-#![warn(intra_doc_link_resolution_failure)]
#![warn(missing_debug_implementations)]
+#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]
diff --git a/src/libcore/option.rs b/src/libcore/option.rs
index 3da92c0a05a..68ef087d84b 100644
--- a/src/libcore/option.rs
+++ b/src/libcore/option.rs
@@ -178,6 +178,7 @@ impl<T> Option<T> {
/// ```
///
/// [`Some`]: #variant.Some
+ #[must_use]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_some(&self) -> bool {
@@ -200,6 +201,7 @@ impl<T> Option<T> {
/// ```
///
/// [`None`]: #variant.None
+ #[must_use]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_none(&self) -> bool {
diff --git a/src/libcore/result.rs b/src/libcore/result.rs
index 9b7b8368986..e22a9ebbca4 100644
--- a/src/libcore/result.rs
+++ b/src/libcore/result.rs
@@ -277,6 +277,7 @@ impl<T, E> Result<T, E> {
/// let x: Result<i32, &str> = Err("Some error message");
/// assert_eq!(x.is_ok(), false);
/// ```
+ #[must_use]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_ok(&self) -> bool {
@@ -301,6 +302,7 @@ impl<T, E> Result<T, E> {
/// let x: Result<i32, &str> = Err("Some error message");
/// assert_eq!(x.is_err(), true);
/// ```
+ #[must_use]
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn is_err(&self) -> bool {
diff --git a/src/librustc/lint/context.rs b/src/librustc/lint/context.rs
index 15ea6403e38..4b615345a26 100644
--- a/src/librustc/lint/context.rs
+++ b/src/librustc/lint/context.rs
@@ -755,8 +755,31 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
}
/// Check if a `DefId`'s path matches the given absolute type path usage.
+ ///
+ /// # Examples
+ /// ```rust,ignore (no `cx` or `def_id` available)
+ /// if cx.match_def_path(def_id, &["core", "option", "Option"]) {
+ /// // The given `def_id` is that of an `Option` type
+ /// }
+ /// ```
// Uplifted from rust-lang/rust-clippy
- pub fn match_path(&self, def_id: DefId, path: &[&str]) -> bool {
+ pub fn match_def_path(&self, def_id: DefId, path: &[&str]) -> bool {
+ let names = self.get_def_path(def_id);
+
+ names.len() == path.len() && names.into_iter().zip(path.iter()).all(|(a, &b)| *a == *b)
+ }
+
+ /// Gets the absolute path of `def_id` as a vector of `&str`.
+ ///
+ /// # Examples
+ /// ```rust,ignore (no `cx` or `def_id` available)
+ /// let def_path = cx.get_def_path(def_id);
+ /// if let &["core", "option", "Option"] = &def_path[..] {
+ /// // The given `def_id` is that of an `Option` type
+ /// }
+ /// ```
+ // Uplifted from rust-lang/rust-clippy
+ pub fn get_def_path(&self, def_id: DefId) -> Vec<LocalInternedString> {
pub struct AbsolutePathPrinter<'a, 'tcx> {
pub tcx: TyCtxt<'a, 'tcx, 'tcx>,
}
@@ -856,10 +879,9 @@ impl<'a, 'tcx> LateContext<'a, 'tcx> {
}
}
- let names = AbsolutePathPrinter { tcx: self.tcx }.print_def_path(def_id, &[]).unwrap();
-
- names.len() == path.len()
- && names.into_iter().zip(path.iter()).all(|(a, &b)| *a == *b)
+ AbsolutePathPrinter { tcx: self.tcx }
+ .print_def_path(def_id, &[])
+ .unwrap()
}
}
diff --git a/src/librustc/lint/internal.rs b/src/librustc/lint/internal.rs
index 0bafa93011e..91f1bee26de 100644
--- a/src/librustc/lint/internal.rs
+++ b/src/librustc/lint/internal.rs
@@ -100,7 +100,7 @@ fn lint_ty_kind_usage(cx: &LateContext<'_, '_>, segment: &PathSegment) -> bool {
if segment.ident.as_str() == "TyKind" {
if let Some(def) = segment.def {
if let Some(did) = def.opt_def_id() {
- return cx.match_path(did, &["rustc", "ty", "sty", "TyKind"]);
+ return cx.match_def_path(did, &["rustc", "ty", "sty", "TyKind"]);
}
}
}
diff --git a/src/librustc_data_structures/owning_ref/mod.rs b/src/librustc_data_structures/owning_ref/mod.rs
index 236559dcd7c..0301891c9b2 100644
--- a/src/librustc_data_structures/owning_ref/mod.rs
+++ b/src/librustc_data_structures/owning_ref/mod.rs
@@ -1471,7 +1471,7 @@ mod tests {
let x = Box::new(123_i32);
let y: Box<dyn Any> = x;
- OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok();
+ assert!(OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok());
}
#[test]
@@ -1481,7 +1481,7 @@ mod tests {
let x = Box::new(123_i32);
let y: Box<dyn Any> = x;
- OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err();
+ assert!(!OwningRef::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err());
}
}
@@ -1868,7 +1868,7 @@ mod tests {
let x = Box::new(123_i32);
let y: Box<dyn Any> = x;
- OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_ok();
+ assert!(OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_ok());
}
#[test]
@@ -1878,7 +1878,7 @@ mod tests {
let x = Box::new(123_i32);
let y: Box<dyn Any> = x;
- OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_err();
+ assert!(!OwningRefMut::new(y).try_map_mut(|x| x.downcast_mut::<i32>().ok_or(())).is_err());
}
#[test]
@@ -1888,7 +1888,7 @@ mod tests {
let x = Box::new(123_i32);
let y: Box<dyn Any> = x;
- OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok();
+ assert!(OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_ok());
}
#[test]
@@ -1898,7 +1898,7 @@ mod tests {
let x = Box::new(123_i32);
let y: Box<dyn Any> = x;
- OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err();
+ assert!(!OwningRefMut::new(y).try_map(|x| x.downcast_ref::<i32>().ok_or(())).is_err());
}
#[test]
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs
index e994c661fdc..80e796b0af7 100644
--- a/src/librustdoc/clean/mod.rs
+++ b/src/librustdoc/clean/mod.rs
@@ -2325,6 +2325,10 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
} else {
hir::Constness::NotConst
};
+ let defaultness = match self.container {
+ ty::ImplContainer(_) => Some(self.defaultness),
+ ty::TraitContainer(_) => None,
+ };
MethodItem(Method {
generics,
decl,
@@ -2334,7 +2338,7 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
constness,
asyncness: hir::IsAsync::NotAsync,
},
- defaultness: Some(self.defaultness),
+ defaultness,
all_types,
ret_types,
})
diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs
index ee6ba3f438f..62bc1991cc9 100644
--- a/src/libstd/lib.rs
+++ b/src/libstd/lib.rs
@@ -205,9 +205,10 @@
// Don't link to std. We are std.
#![no_std]
-#![deny(missing_docs)]
-#![deny(intra_doc_link_resolution_failure)]
-#![deny(missing_debug_implementations)]
+//#![warn(deprecated_in_future)] // FIXME: std still has quite a few uses of `mem::uninitialized`
+#![warn(missing_docs)]
+#![warn(missing_debug_implementations)]
+#![deny(intra_doc_link_resolution_failure)] // rustdoc is run without -D warnings
#![deny(rust_2018_idioms)]
#![allow(explicit_outlives_requirements)]
diff --git a/src/libstd/sync/mpsc/mod.rs b/src/libstd/sync/mpsc/mod.rs
index bc32b8e47b3..685c7909ff2 100644
--- a/src/libstd/sync/mpsc/mod.rs
+++ b/src/libstd/sync/mpsc/mod.rs
@@ -1005,7 +1005,7 @@ impl<T> SyncSender<T> {
/// thread::spawn(move || {
/// // This will return an error and send
/// // no message if the buffer is full
- /// sync_sender2.try_send(3).is_err();
+ /// let _ = sync_sender2.try_send(3);
/// });
///
/// let mut msg;
diff --git a/src/stdsimd b/src/stdsimd
-Subproject 2792b45c975880038240d477adb0d66f760ac04
+Subproject 2323a858f060a0d2a39786a619885608017d538
diff --git a/src/test/run-pass/issues/issue-18353.rs b/src/test/run-pass/issues/issue-18353.rs
index aaa896b66c5..3d15c9980c3 100644
--- a/src/test/run-pass/issues/issue-18353.rs
+++ b/src/test/run-pass/issues/issue-18353.rs
@@ -11,5 +11,5 @@ struct Str {
fn main() {
let str: Option<&Str> = None;
- str.is_some();
+ let _ = str.is_some();
}
diff --git a/src/test/rustdoc/default-trait-method.rs b/src/test/rustdoc/default-trait-method.rs
new file mode 100644
index 00000000000..3d6ebef5a1d
--- /dev/null
+++ b/src/test/rustdoc/default-trait-method.rs
@@ -0,0 +1,26 @@
+#![feature(specialization)]
+
+// @has default_trait_method/trait.Item.html
+// @has - '//*[@id="tymethod.foo"]' 'fn foo()'
+// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
+// @has - '//*[@id="tymethod.bar"]' 'fn bar()'
+// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
+// @has - '//*[@id="method.baz"]' 'fn baz()'
+// @!has - '//*[@id="method.baz"]' 'default fn baz()'
+pub trait Item {
+ fn foo();
+ fn bar();
+ fn baz() {}
+}
+
+// @has default_trait_method/struct.Foo.html
+// @has - '//*[@id="method.foo"]' 'default fn foo()'
+// @has - '//*[@id="method.bar"]' 'fn bar()'
+// @!has - '//*[@id="method.bar"]' 'default fn bar()'
+// @has - '//*[@id="method.baz"]' 'fn baz()'
+// @!has - '//*[@id="method.baz"]' 'default fn baz()'
+pub struct Foo;
+impl Item for Foo {
+ default fn foo() {}
+ fn bar() {}
+}
diff --git a/src/test/rustdoc/default_trait_method.rs b/src/test/rustdoc/default_trait_method.rs
deleted file mode 100644
index dfbd8f2210f..00000000000
--- a/src/test/rustdoc/default_trait_method.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-#![feature(specialization)]
-
-pub trait Item {
- fn foo();
- fn bar();
-}
-
-// @has default_trait_method/trait.Item.html
-// @has - '//*[@id="method.foo"]' 'default fn foo()'
-// @has - '//*[@id="method.bar"]' 'fn bar()'
-// @!has - '//*[@id="method.bar"]' 'default fn bar()'
-impl<T: ?Sized> Item for T {
- default fn foo() {}
- fn bar() {}
-}
diff --git a/src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs b/src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs
new file mode 100644
index 00000000000..ce60bbfb4b0
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/auxiliary/default-trait-method.rs
@@ -0,0 +1,16 @@
+#![feature(specialization)]
+
+#![crate_name = "foo"]
+
+pub trait Item {
+ fn foo();
+ fn bar();
+ fn baz() {}
+}
+
+pub struct Foo;
+
+impl Item for Foo {
+ default fn foo() {}
+ fn bar() {}
+}
diff --git a/src/test/rustdoc/inline_cross/default-trait-method.rs b/src/test/rustdoc/inline_cross/default-trait-method.rs
new file mode 100644
index 00000000000..a4ec73a127d
--- /dev/null
+++ b/src/test/rustdoc/inline_cross/default-trait-method.rs
@@ -0,0 +1,20 @@
+// aux-build:default-trait-method.rs
+
+extern crate foo;
+
+// @has default_trait_method/trait.Item.html
+// @has - '//*[@id="tymethod.foo"]' 'fn foo()'
+// @!has - '//*[@id="tymethod.foo"]' 'default fn foo()'
+// @has - '//*[@id="tymethod.bar"]' 'fn bar()'
+// @!has - '//*[@id="tymethod.bar"]' 'default fn bar()'
+// @has - '//*[@id="method.baz"]' 'fn baz()'
+// @!has - '//*[@id="method.baz"]' 'default fn baz()'
+pub use foo::Item;
+
+// @has default_trait_method/struct.Foo.html
+// @has - '//*[@id="method.foo"]' 'default fn foo()'
+// @has - '//*[@id="method.bar"]' 'fn bar()'
+// @!has - '//*[@id="method.bar"]' 'default fn bar()'
+// @has - '//*[@id="method.baz"]' 'fn baz()'
+// @!has - '//*[@id="method.baz"]' 'default fn baz()'
+pub use foo::Foo;