Skip to content

Commit

Permalink
Auto merge of #66021 - tmandry:rollup-y13l6n9, r=tmandry
Browse files Browse the repository at this point in the history
Rollup of 16 pull requests

Successful merges:

 - #65112 (Add lint and tests for unnecessary parens around types)
 - #65470 (Don't hide ICEs from previous incremental compiles)
 - #65471 (Add long error explanation for E0578)
 - #65857 (rustdoc: Resolve module-level doc references more locally)
 - #65902 (Make ItemContext available for better diagnositcs)
 - #65914 (Use structured suggestion for unnecessary bounds in type aliases)
 - #65946 (Make `promote_consts` emit the errors when required promotion fails)
 - #65960 (doc: reword iter module example and mention other methods)
 - #65963 (update submodules to rust-lang)
 - #65972 (Fix libunwind build: Define __LITTLE_ENDIAN__ for LE targets)
 - #65977 (Fix incorrect diagnostics for expected type in E0271 with an associated type)
 - #65995 (Add error code E0743 for "C-variadic has been used on a non-foreign function")
 - #65997 (Fix outdated rustdoc of Once::init_locking function)
 - #66002 (Stabilize float_to_from_bytes feature)
 - #66005 (vxWorks: remove code related unix socket)
 - #66018 (Revert PR 64324: dylibs export generics again (for now))

Failed merges:

r? @ghost
  • Loading branch information
bors committed Nov 1, 2019
2 parents 01e5d91 + d6e35d1 commit 87cbf0a
Show file tree
Hide file tree
Showing 75 changed files with 790 additions and 2,111 deletions.
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
url = https://github.com/rust-lang/rust-installer.git
[submodule "src/doc/nomicon"]
path = src/doc/nomicon
url = https://github.com/rust-lang-nursery/nomicon.git
url = https://github.com/rust-lang/nomicon.git
[submodule "src/tools/cargo"]
path = src/tools/cargo
url = https://github.com/rust-lang/cargo.git
[submodule "src/doc/reference"]
path = src/doc/reference
url = https://github.com/rust-lang-nursery/reference.git
url = https://github.com/rust-lang/reference.git
[submodule "src/doc/book"]
path = src/doc/book
url = https://github.com/rust-lang/book.git
Expand All @@ -36,7 +36,7 @@
url = https://github.com/rust-lang/rustc-guide.git
[submodule "src/doc/edition-guide"]
path = src/doc/edition-guide
url = https://github.com/rust-lang-nursery/edition-guide.git
url = https://github.com/rust-lang/edition-guide.git
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
Expand Down
35 changes: 14 additions & 21 deletions src/libcore/iter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,26 +118,16 @@
//!
//! let mut counter = Counter::new();
//!
//! let x = counter.next().unwrap();
//! println!("{}", x);
//!
//! let x = counter.next().unwrap();
//! println!("{}", x);
//!
//! let x = counter.next().unwrap();
//! println!("{}", x);
//!
//! let x = counter.next().unwrap();
//! println!("{}", x);
//!
//! let x = counter.next().unwrap();
//! println!("{}", x);
//! assert_eq!(counter.next(), Some(1));
//! assert_eq!(counter.next(), Some(2));
//! assert_eq!(counter.next(), Some(3));
//! assert_eq!(counter.next(), Some(4));
//! assert_eq!(counter.next(), Some(5));
//! assert_eq!(counter.next(), None);
//! ```
//!
//! This will print `1` through `5`, each on their own line.
//!
//! Calling `next()` this way gets repetitive. Rust has a construct which can
//! call `next()` on your iterator, until it reaches `None`. Let's go over that
//! Calling [`next`] this way gets repetitive. Rust has a construct which can
//! call [`next`] on your iterator, until it reaches `None`. Let's go over that
//! next.
//!
//! Also note that `Iterator` provides a default implementation of methods such as `nth` and `fold`
Expand Down Expand Up @@ -253,20 +243,23 @@
//! ```
//!
//! The idiomatic way to write a [`map`] for its side effects is to use a
//! `for` loop instead:
//! `for` loop or call the [`for_each`] method:
//!
//! ```
//! let v = vec![1, 2, 3, 4, 5];
//!
//! v.iter().for_each(|x| println!("{}", x));
//! // or
//! for x in &v {
//! println!("{}", x);
//! }
//! ```
//!
//! [`map`]: trait.Iterator.html#method.map
//! [`for_each`]: trait.Iterator.html#method.for_each
//!
//! The two most common ways to evaluate an iterator are to use a `for` loop
//! like this, or using the [`collect`] method to produce a new collection.
//! Another common way to evaluate an iterator is to use the [`collect`]
//! method to produce a new collection.
//!
//! [`collect`]: trait.Iterator.html#method.collect
//!
Expand Down
18 changes: 6 additions & 12 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,10 @@ impl f32 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let bytes = 12.5f32.to_be_bytes();
/// assert_eq!(bytes, [0x41, 0x48, 0x00, 0x00]);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn to_be_bytes(self) -> [u8; 4] {
self.to_bits().to_be_bytes()
Expand All @@ -482,11 +481,10 @@ impl f32 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let bytes = 12.5f32.to_le_bytes();
/// assert_eq!(bytes, [0x00, 0x00, 0x48, 0x41]);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn to_le_bytes(self) -> [u8; 4] {
self.to_bits().to_le_bytes()
Expand All @@ -504,7 +502,6 @@ impl f32 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let bytes = 12.5f32.to_ne_bytes();
/// assert_eq!(
/// bytes,
Expand All @@ -515,7 +512,7 @@ impl f32 {
/// }
/// );
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn to_ne_bytes(self) -> [u8; 4] {
self.to_bits().to_ne_bytes()
Expand All @@ -526,11 +523,10 @@ impl f32 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let value = f32::from_be_bytes([0x41, 0x48, 0x00, 0x00]);
/// assert_eq!(value, 12.5);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn from_be_bytes(bytes: [u8; 4]) -> Self {
Self::from_bits(u32::from_be_bytes(bytes))
Expand All @@ -541,11 +537,10 @@ impl f32 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let value = f32::from_le_bytes([0x00, 0x00, 0x48, 0x41]);
/// assert_eq!(value, 12.5);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn from_le_bytes(bytes: [u8; 4]) -> Self {
Self::from_bits(u32::from_le_bytes(bytes))
Expand All @@ -563,15 +558,14 @@ impl f32 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let value = f32::from_ne_bytes(if cfg!(target_endian = "big") {
/// [0x41, 0x48, 0x00, 0x00]
/// } else {
/// [0x00, 0x00, 0x48, 0x41]
/// });
/// assert_eq!(value, 12.5);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn from_ne_bytes(bytes: [u8; 4]) -> Self {
Self::from_bits(u32::from_ne_bytes(bytes))
Expand Down
18 changes: 6 additions & 12 deletions src/libcore/num/f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -479,11 +479,10 @@ impl f64 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let bytes = 12.5f64.to_be_bytes();
/// assert_eq!(bytes, [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn to_be_bytes(self) -> [u8; 8] {
self.to_bits().to_be_bytes()
Expand All @@ -495,11 +494,10 @@ impl f64 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let bytes = 12.5f64.to_le_bytes();
/// assert_eq!(bytes, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn to_le_bytes(self) -> [u8; 8] {
self.to_bits().to_le_bytes()
Expand All @@ -517,7 +515,6 @@ impl f64 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let bytes = 12.5f64.to_ne_bytes();
/// assert_eq!(
/// bytes,
Expand All @@ -528,7 +525,7 @@ impl f64 {
/// }
/// );
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn to_ne_bytes(self) -> [u8; 8] {
self.to_bits().to_ne_bytes()
Expand All @@ -539,11 +536,10 @@ impl f64 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let value = f64::from_be_bytes([0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
/// assert_eq!(value, 12.5);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn from_be_bytes(bytes: [u8; 8]) -> Self {
Self::from_bits(u64::from_be_bytes(bytes))
Expand All @@ -554,11 +550,10 @@ impl f64 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let value = f64::from_le_bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]);
/// assert_eq!(value, 12.5);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn from_le_bytes(bytes: [u8; 8]) -> Self {
Self::from_bits(u64::from_le_bytes(bytes))
Expand All @@ -576,15 +571,14 @@ impl f64 {
/// # Examples
///
/// ```
/// #![feature(float_to_from_bytes)]
/// let value = f64::from_ne_bytes(if cfg!(target_endian = "big") {
/// [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
/// } else {
/// [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]
/// });
/// assert_eq!(value, 12.5);
/// ```
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
#[inline]
pub fn from_ne_bytes(bytes: [u8; 8]) -> Self {
Self::from_bits(u64::from_ne_bytes(bytes))
Expand Down
17 changes: 15 additions & 2 deletions src/libcore/ops/try.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/// extracting those success or failure values from an existing instance and
/// creating a new instance from a success or failure value.
#[unstable(feature = "try_trait", issue = "42327")]
#[rustc_on_unimplemented(
#[cfg_attr(bootstrap, rustc_on_unimplemented(
on(all(
any(from_method="from_error", from_method="from_ok"),
from_desugaring="QuestionMark"),
Expand All @@ -17,7 +17,20 @@
message="the `?` operator can only be applied to values \
that implement `{Try}`",
label="the `?` operator cannot be applied to type `{Self}`")
)]
))]
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
on(all(
any(from_method="from_error", from_method="from_ok"),
from_desugaring="QuestionMark"),
message="the `?` operator can only be used in {ItemContext} \
that returns `Result` or `Option` \
(or another type that implements `{Try}`)",
label="cannot use the `?` operator in {ItemContext} that returns `{Self}`"),
on(all(from_method="into_result", from_desugaring="QuestionMark"),
message="the `?` operator can only be applied to values \
that implement `{Try}`",
label="the `?` operator cannot be applied to type `{Self}`")
))]
#[doc(alias = "?")]
pub trait Try {
/// The type of this value when viewed as successful.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
&self,
arg: &'tcx hir::Ty,
br: &ty::BoundRegion,
) -> Option<(&'tcx hir::Ty)> {
) -> Option<&'tcx hir::Ty> {
let mut nested_visitor = FindNestedTypeVisitor {
tcx: self.tcx(),
bound_region: *br,
Expand Down
3 changes: 3 additions & 0 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ impl Session {
pub fn has_errors(&self) -> bool {
self.diagnostic().has_errors()
}
pub fn has_errors_or_delayed_span_bugs(&self) -> bool {
self.diagnostic().has_errors_or_delayed_span_bugs()
}
pub fn abort_if_errors(&self) {
self.diagnostic().abort_if_errors();
}
Expand Down
Loading

0 comments on commit 87cbf0a

Please sign in to comment.