Skip to content

Commit 87cbf0a

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

File tree

75 files changed

+790
-2111
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+790
-2111
lines changed

.gitmodules

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
url = https://github.com/rust-lang/rust-installer.git
44
[submodule "src/doc/nomicon"]
55
path = src/doc/nomicon
6-
url = https://github.com/rust-lang-nursery/nomicon.git
6+
url = https://github.com/rust-lang/nomicon.git
77
[submodule "src/tools/cargo"]
88
path = src/tools/cargo
99
url = https://github.com/rust-lang/cargo.git
1010
[submodule "src/doc/reference"]
1111
path = src/doc/reference
12-
url = https://github.com/rust-lang-nursery/reference.git
12+
url = https://github.com/rust-lang/reference.git
1313
[submodule "src/doc/book"]
1414
path = src/doc/book
1515
url = https://github.com/rust-lang/book.git
@@ -36,7 +36,7 @@
3636
url = https://github.com/rust-lang/rustc-guide.git
3737
[submodule "src/doc/edition-guide"]
3838
path = src/doc/edition-guide
39-
url = https://github.com/rust-lang-nursery/edition-guide.git
39+
url = https://github.com/rust-lang/edition-guide.git
4040
[submodule "src/llvm-project"]
4141
path = src/llvm-project
4242
url = https://github.com/rust-lang/llvm-project.git

src/libcore/iter/mod.rs

+14-21
Original file line numberDiff line numberDiff line change
@@ -118,26 +118,16 @@
118118
//!
119119
//! let mut counter = Counter::new();
120120
//!
121-
//! let x = counter.next().unwrap();
122-
//! println!("{}", x);
123-
//!
124-
//! let x = counter.next().unwrap();
125-
//! println!("{}", x);
126-
//!
127-
//! let x = counter.next().unwrap();
128-
//! println!("{}", x);
129-
//!
130-
//! let x = counter.next().unwrap();
131-
//! println!("{}", x);
132-
//!
133-
//! let x = counter.next().unwrap();
134-
//! println!("{}", x);
121+
//! assert_eq!(counter.next(), Some(1));
122+
//! assert_eq!(counter.next(), Some(2));
123+
//! assert_eq!(counter.next(), Some(3));
124+
//! assert_eq!(counter.next(), Some(4));
125+
//! assert_eq!(counter.next(), Some(5));
126+
//! assert_eq!(counter.next(), None);
135127
//! ```
136128
//!
137-
//! This will print `1` through `5`, each on their own line.
138-
//!
139-
//! Calling `next()` this way gets repetitive. Rust has a construct which can
140-
//! call `next()` on your iterator, until it reaches `None`. Let's go over that
129+
//! Calling [`next`] this way gets repetitive. Rust has a construct which can
130+
//! call [`next`] on your iterator, until it reaches `None`. Let's go over that
141131
//! next.
142132
//!
143133
//! Also note that `Iterator` provides a default implementation of methods such as `nth` and `fold`
@@ -253,20 +243,23 @@
253243
//! ```
254244
//!
255245
//! The idiomatic way to write a [`map`] for its side effects is to use a
256-
//! `for` loop instead:
246+
//! `for` loop or call the [`for_each`] method:
257247
//!
258248
//! ```
259249
//! let v = vec![1, 2, 3, 4, 5];
260250
//!
251+
//! v.iter().for_each(|x| println!("{}", x));
252+
//! // or
261253
//! for x in &v {
262254
//! println!("{}", x);
263255
//! }
264256
//! ```
265257
//!
266258
//! [`map`]: trait.Iterator.html#method.map
259+
//! [`for_each`]: trait.Iterator.html#method.for_each
267260
//!
268-
//! The two most common ways to evaluate an iterator are to use a `for` loop
269-
//! like this, or using the [`collect`] method to produce a new collection.
261+
//! Another common way to evaluate an iterator is to use the [`collect`]
262+
//! method to produce a new collection.
270263
//!
271264
//! [`collect`]: trait.Iterator.html#method.collect
272265
//!

src/libcore/num/f32.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,10 @@ impl f32 {
466466
/// # Examples
467467
///
468468
/// ```
469-
/// #![feature(float_to_from_bytes)]
470469
/// let bytes = 12.5f32.to_be_bytes();
471470
/// assert_eq!(bytes, [0x41, 0x48, 0x00, 0x00]);
472471
/// ```
473-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
472+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
474473
#[inline]
475474
pub fn to_be_bytes(self) -> [u8; 4] {
476475
self.to_bits().to_be_bytes()
@@ -482,11 +481,10 @@ impl f32 {
482481
/// # Examples
483482
///
484483
/// ```
485-
/// #![feature(float_to_from_bytes)]
486484
/// let bytes = 12.5f32.to_le_bytes();
487485
/// assert_eq!(bytes, [0x00, 0x00, 0x48, 0x41]);
488486
/// ```
489-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
487+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
490488
#[inline]
491489
pub fn to_le_bytes(self) -> [u8; 4] {
492490
self.to_bits().to_le_bytes()
@@ -504,7 +502,6 @@ impl f32 {
504502
/// # Examples
505503
///
506504
/// ```
507-
/// #![feature(float_to_from_bytes)]
508505
/// let bytes = 12.5f32.to_ne_bytes();
509506
/// assert_eq!(
510507
/// bytes,
@@ -515,7 +512,7 @@ impl f32 {
515512
/// }
516513
/// );
517514
/// ```
518-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
515+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
519516
#[inline]
520517
pub fn to_ne_bytes(self) -> [u8; 4] {
521518
self.to_bits().to_ne_bytes()
@@ -526,11 +523,10 @@ impl f32 {
526523
/// # Examples
527524
///
528525
/// ```
529-
/// #![feature(float_to_from_bytes)]
530526
/// let value = f32::from_be_bytes([0x41, 0x48, 0x00, 0x00]);
531527
/// assert_eq!(value, 12.5);
532528
/// ```
533-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
529+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
534530
#[inline]
535531
pub fn from_be_bytes(bytes: [u8; 4]) -> Self {
536532
Self::from_bits(u32::from_be_bytes(bytes))
@@ -541,11 +537,10 @@ impl f32 {
541537
/// # Examples
542538
///
543539
/// ```
544-
/// #![feature(float_to_from_bytes)]
545540
/// let value = f32::from_le_bytes([0x00, 0x00, 0x48, 0x41]);
546541
/// assert_eq!(value, 12.5);
547542
/// ```
548-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
543+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
549544
#[inline]
550545
pub fn from_le_bytes(bytes: [u8; 4]) -> Self {
551546
Self::from_bits(u32::from_le_bytes(bytes))
@@ -563,15 +558,14 @@ impl f32 {
563558
/// # Examples
564559
///
565560
/// ```
566-
/// #![feature(float_to_from_bytes)]
567561
/// let value = f32::from_ne_bytes(if cfg!(target_endian = "big") {
568562
/// [0x41, 0x48, 0x00, 0x00]
569563
/// } else {
570564
/// [0x00, 0x00, 0x48, 0x41]
571565
/// });
572566
/// assert_eq!(value, 12.5);
573567
/// ```
574-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
568+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
575569
#[inline]
576570
pub fn from_ne_bytes(bytes: [u8; 4]) -> Self {
577571
Self::from_bits(u32::from_ne_bytes(bytes))

src/libcore/num/f64.rs

+6-12
Original file line numberDiff line numberDiff line change
@@ -479,11 +479,10 @@ impl f64 {
479479
/// # Examples
480480
///
481481
/// ```
482-
/// #![feature(float_to_from_bytes)]
483482
/// let bytes = 12.5f64.to_be_bytes();
484483
/// assert_eq!(bytes, [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
485484
/// ```
486-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
485+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
487486
#[inline]
488487
pub fn to_be_bytes(self) -> [u8; 8] {
489488
self.to_bits().to_be_bytes()
@@ -495,11 +494,10 @@ impl f64 {
495494
/// # Examples
496495
///
497496
/// ```
498-
/// #![feature(float_to_from_bytes)]
499497
/// let bytes = 12.5f64.to_le_bytes();
500498
/// assert_eq!(bytes, [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]);
501499
/// ```
502-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
500+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
503501
#[inline]
504502
pub fn to_le_bytes(self) -> [u8; 8] {
505503
self.to_bits().to_le_bytes()
@@ -517,7 +515,6 @@ impl f64 {
517515
/// # Examples
518516
///
519517
/// ```
520-
/// #![feature(float_to_from_bytes)]
521518
/// let bytes = 12.5f64.to_ne_bytes();
522519
/// assert_eq!(
523520
/// bytes,
@@ -528,7 +525,7 @@ impl f64 {
528525
/// }
529526
/// );
530527
/// ```
531-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
528+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
532529
#[inline]
533530
pub fn to_ne_bytes(self) -> [u8; 8] {
534531
self.to_bits().to_ne_bytes()
@@ -539,11 +536,10 @@ impl f64 {
539536
/// # Examples
540537
///
541538
/// ```
542-
/// #![feature(float_to_from_bytes)]
543539
/// let value = f64::from_be_bytes([0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);
544540
/// assert_eq!(value, 12.5);
545541
/// ```
546-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
542+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
547543
#[inline]
548544
pub fn from_be_bytes(bytes: [u8; 8]) -> Self {
549545
Self::from_bits(u64::from_be_bytes(bytes))
@@ -554,11 +550,10 @@ impl f64 {
554550
/// # Examples
555551
///
556552
/// ```
557-
/// #![feature(float_to_from_bytes)]
558553
/// let value = f64::from_le_bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]);
559554
/// assert_eq!(value, 12.5);
560555
/// ```
561-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
556+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
562557
#[inline]
563558
pub fn from_le_bytes(bytes: [u8; 8]) -> Self {
564559
Self::from_bits(u64::from_le_bytes(bytes))
@@ -576,15 +571,14 @@ impl f64 {
576571
/// # Examples
577572
///
578573
/// ```
579-
/// #![feature(float_to_from_bytes)]
580574
/// let value = f64::from_ne_bytes(if cfg!(target_endian = "big") {
581575
/// [0x40, 0x29, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
582576
/// } else {
583577
/// [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x29, 0x40]
584578
/// });
585579
/// assert_eq!(value, 12.5);
586580
/// ```
587-
#[unstable(feature = "float_to_from_bytes", issue = "60446")]
581+
#[stable(feature = "float_to_from_bytes", since = "1.40.0")]
588582
#[inline]
589583
pub fn from_ne_bytes(bytes: [u8; 8]) -> Self {
590584
Self::from_bits(u64::from_ne_bytes(bytes))

src/libcore/ops/try.rs

+15-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/// extracting those success or failure values from an existing instance and
66
/// creating a new instance from a success or failure value.
77
#[unstable(feature = "try_trait", issue = "42327")]
8-
#[rustc_on_unimplemented(
8+
#[cfg_attr(bootstrap, rustc_on_unimplemented(
99
on(all(
1010
any(from_method="from_error", from_method="from_ok"),
1111
from_desugaring="QuestionMark"),
@@ -17,7 +17,20 @@
1717
message="the `?` operator can only be applied to values \
1818
that implement `{Try}`",
1919
label="the `?` operator cannot be applied to type `{Self}`")
20-
)]
20+
))]
21+
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
22+
on(all(
23+
any(from_method="from_error", from_method="from_ok"),
24+
from_desugaring="QuestionMark"),
25+
message="the `?` operator can only be used in {ItemContext} \
26+
that returns `Result` or `Option` \
27+
(or another type that implements `{Try}`)",
28+
label="cannot use the `?` operator in {ItemContext} that returns `{Self}`"),
29+
on(all(from_method="into_result", from_desugaring="QuestionMark"),
30+
message="the `?` operator can only be applied to values \
31+
that implement `{Try}`",
32+
label="the `?` operator cannot be applied to type `{Self}`")
33+
))]
2134
#[doc(alias = "?")]
2235
pub trait Try {
2336
/// The type of this value when viewed as successful.

src/librustc/infer/error_reporting/nice_region_error/find_anon_type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
6262
&self,
6363
arg: &'tcx hir::Ty,
6464
br: &ty::BoundRegion,
65-
) -> Option<(&'tcx hir::Ty)> {
65+
) -> Option<&'tcx hir::Ty> {
6666
let mut nested_visitor = FindNestedTypeVisitor {
6767
tcx: self.tcx(),
6868
bound_region: *br,

src/librustc/session/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ impl Session {
312312
pub fn has_errors(&self) -> bool {
313313
self.diagnostic().has_errors()
314314
}
315+
pub fn has_errors_or_delayed_span_bugs(&self) -> bool {
316+
self.diagnostic().has_errors_or_delayed_span_bugs()
317+
}
315318
pub fn abort_if_errors(&self) {
316319
self.diagnostic().abort_if_errors();
317320
}

0 commit comments

Comments
 (0)