Skip to content

Commit ff47e97

Browse files
committed
Merge branch 'master' into compiler/E0384-reduce-assertiveness
2 parents 0174dd6 + d408fdd commit ff47e97

Some content is hidden

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

47 files changed

+299
-135
lines changed

RELEASES.md

+9
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Libraries
5050
- [`io::Empty` now implements `io::Seek`.][78044]
5151
- [`rc::Weak<T>` and `sync::Weak<T>`'s methods such as `as_ptr` are now implemented for
5252
`T: ?Sized` types.][80764]
53+
- [`Div` and `Rem` by their `NonZero` variant is now implemented for all unsigned integers.][79134]
54+
5355

5456
Stabilized APIs
5557
---------------
@@ -72,6 +74,8 @@ Stabilized APIs
7274
- [`str::split_inclusive`]
7375
- [`sync::OnceState`]
7476
- [`task::Wake`]
77+
- [`VecDeque::range`]
78+
- [`VecDeque::range_mut`]
7579

7680
Cargo
7781
-----
@@ -115,6 +119,7 @@ Compatibility Notes
115119
- `thumbv7neon-unknown-linux-gnueabihf`
116120
- `armv7-unknown-linux-gnueabi`
117121
- `x86_64-unknown-linux-gnux32`
122+
- [`atomic::spin_loop_hint` has been deprecated.][80966] It's recommended to use `hint::spin_loop` instead.
118123

119124
Internal Only
120125
-------------
@@ -145,6 +150,8 @@ Internal Only
145150
[80764]: https://github.com/rust-lang/rust/pull/80764
146151
[80749]: https://github.com/rust-lang/rust/pull/80749
147152
[80662]: https://github.com/rust-lang/rust/pull/80662
153+
[79134]: https://github.com/rust-lang/rust/pull/79134
154+
[80966]: https://github.com/rust-lang/rust/pull/80966
148155
[cargo/8997]: https://github.com/rust-lang/cargo/pull/8997
149156
[cargo/9112]: https://github.com/rust-lang/cargo/pull/9112
150157
[[email protected]]: https://doc.rust-lang.org/nightly/cargo/reference/features.html#feature-resolver-version-2
@@ -166,6 +173,8 @@ Internal Only
166173
[`Seek::stream_position`]: https://doc.rust-lang.org/nightly/std/io/trait.Seek.html#method.stream_position
167174
[`Peekable::next_if`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if
168175
[`Peekable::next_if_eq`]: https://doc.rust-lang.org/nightly/std/iter/struct.Peekable.html#method.next_if_eq
176+
[`VecDeque::range`]: https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#method.range
177+
[`VecDeque::range_mut`]: https://doc.rust-lang.org/nightly/std/collections/struct.VecDeque.html#method.range_mut
169178

170179
Version 1.50.0 (2021-02-11)
171180
============================

compiler/rustc_lint/src/builtin.rs

+7-4
Original file line numberDiff line numberDiff line change
@@ -857,19 +857,18 @@ declare_lint! {
857857
/// ```
858858
///
859859
/// This syntax is now a hard error in the 2018 edition. In the 2015
860-
/// edition, this lint is "allow" by default, because the old code is
861-
/// still valid, and warning for all old code can be noisy. This lint
860+
/// edition, this lint is "warn" by default. This lint
862861
/// enables the [`cargo fix`] tool with the `--edition` flag to
863862
/// automatically transition old code from the 2015 edition to 2018. The
864-
/// tool will switch this lint to "warn" and will automatically apply the
863+
/// tool will run this lint and automatically apply the
865864
/// suggested fix from the compiler (which is to add `_` to each
866865
/// parameter). This provides a completely automated way to update old
867866
/// code for a new edition. See [issue #41686] for more details.
868867
///
869868
/// [issue #41686]: https://github.com/rust-lang/rust/issues/41686
870869
/// [`cargo fix`]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
871870
pub ANONYMOUS_PARAMETERS,
872-
Allow,
871+
Warn,
873872
"detects anonymous parameters",
874873
@future_incompatible = FutureIncompatibleInfo {
875874
reference: "issue #41686 <https://github.com/rust-lang/rust/issues/41686>",
@@ -884,6 +883,10 @@ declare_lint_pass!(
884883

885884
impl EarlyLintPass for AnonymousParameters {
886885
fn check_trait_item(&mut self, cx: &EarlyContext<'_>, it: &ast::AssocItem) {
886+
if cx.sess.edition() != Edition::Edition2015 {
887+
// This is a hard error in future editions; avoid linting and erroring
888+
return;
889+
}
887890
if let ast::AssocItemKind::Fn(box FnKind(_, ref sig, _, _)) = it.kind {
888891
for arg in sig.decl.inputs.iter() {
889892
if let ast::PatKind::Ident(_, ident, None) = arg.pat.kind {

compiler/rustc_parse/src/parser/diagnostics.rs

+17-15
Original file line numberDiff line numberDiff line change
@@ -666,21 +666,23 @@ impl<'a> Parser<'a> {
666666
);
667667
match x {
668668
Ok((_, _, false)) => {
669-
self.bump(); // `>`
670-
match self.parse_expr() {
671-
Ok(_) => {
672-
e.span_suggestion_verbose(
673-
binop.span.shrink_to_lo(),
674-
TURBOFISH_SUGGESTION_STR,
675-
"::".to_string(),
676-
Applicability::MaybeIncorrect,
677-
);
678-
e.emit();
679-
*expr = self.mk_expr_err(expr.span.to(self.prev_token.span));
680-
return Ok(());
681-
}
682-
Err(mut err) => {
683-
err.cancel();
669+
if self.eat(&token::Gt) {
670+
match self.parse_expr() {
671+
Ok(_) => {
672+
e.span_suggestion_verbose(
673+
binop.span.shrink_to_lo(),
674+
TURBOFISH_SUGGESTION_STR,
675+
"::".to_string(),
676+
Applicability::MaybeIncorrect,
677+
);
678+
e.emit();
679+
*expr =
680+
self.mk_expr_err(expr.span.to(self.prev_token.span));
681+
return Ok(());
682+
}
683+
Err(mut err) => {
684+
err.cancel();
685+
}
684686
}
685687
}
686688
}

compiler/rustc_target/src/spec/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,8 @@ impl Target {
14461446

14471447
let get_req_field = |name: &str| {
14481448
obj.find(name)
1449-
.map(|s| s.as_string())
1450-
.and_then(|os| os.map(|s| s.to_string()))
1449+
.and_then(Json::as_string)
1450+
.map(str::to_string)
14511451
.ok_or_else(|| format!("Field {} in target specification is required", name))
14521452
};
14531453

compiler/rustc_typeck/src/astconv/generics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
8282
if param_type.is_suggestable() {
8383
err.span_suggestion(
8484
tcx.def_span(src_def_id),
85-
"consider changing this type paramater to a `const`-generic",
85+
"consider changing this type parameter to be a `const` generic",
8686
format!("const {}: {}", param_name, param_type),
8787
Applicability::MaybeIncorrect,
8888
);

library/alloc/src/collections/btree/map.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,6 @@ impl<K, V> BTreeMap<K, V> {
940940
/// # Examples
941941
///
942942
/// ```
943-
/// #![feature(btree_retain)]
944943
/// use std::collections::BTreeMap;
945944
///
946945
/// let mut map: BTreeMap<i32, i32> = (0..8).map(|x| (x, x*10)).collect();
@@ -949,7 +948,7 @@ impl<K, V> BTreeMap<K, V> {
949948
/// assert!(map.into_iter().eq(vec![(0, 0), (2, 20), (4, 40), (6, 60)]));
950949
/// ```
951950
#[inline]
952-
#[unstable(feature = "btree_retain", issue = "79025")]
951+
#[stable(feature = "btree_retain", since = "1.53.0")]
953952
pub fn retain<F>(&mut self, mut f: F)
954953
where
955954
K: Ord,

library/alloc/src/collections/btree/set.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,6 @@ impl<T> BTreeSet<T> {
851851
/// # Examples
852852
///
853853
/// ```
854-
/// #![feature(btree_retain)]
855854
/// use std::collections::BTreeSet;
856855
///
857856
/// let xs = [1, 2, 3, 4, 5, 6];
@@ -860,7 +859,7 @@ impl<T> BTreeSet<T> {
860859
/// set.retain(|&k| k % 2 == 0);
861860
/// assert!(set.iter().eq([2, 4, 6].iter()));
862861
/// ```
863-
#[unstable(feature = "btree_retain", issue = "79025")]
862+
#[stable(feature = "btree_retain", since = "1.53.0")]
864863
pub fn retain<F>(&mut self, mut f: F)
865864
where
866865
T: Ord,

library/alloc/src/vec/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2567,7 +2567,7 @@ impl<T, A: Allocator> Vec<T, A> {
25672567
/// # let some_predicate = |x: &mut i32| { *x == 2 || *x == 3 || *x == 6 };
25682568
/// # let mut vec = vec![1, 2, 3, 4, 5, 6];
25692569
/// let mut i = 0;
2570-
/// while i != vec.len() {
2570+
/// while i < vec.len() {
25712571
/// if some_predicate(&mut vec[i]) {
25722572
/// let val = vec.remove(i);
25732573
/// // your code here

library/core/src/fmt/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2268,7 +2268,7 @@ impl<T: ?Sized + Debug> Debug for RefMut<'_, T> {
22682268
}
22692269

22702270
#[stable(feature = "core_impl_debug", since = "1.9.0")]
2271-
impl<T: ?Sized + Debug> Debug for UnsafeCell<T> {
2271+
impl<T: ?Sized> Debug for UnsafeCell<T> {
22722272
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
22732273
f.pad("UnsafeCell")
22742274
}

library/core/src/intrinsics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,7 @@ extern "rust-intrinsic" {
15431543
/// let num_trailing = unsafe { cttz_nonzero(x) };
15441544
/// assert_eq!(num_trailing, 3);
15451545
/// ```
1546-
#[rustc_const_unstable(feature = "const_cttz", issue = "none")]
1546+
#[rustc_const_stable(feature = "const_cttz", since = "1.53.0")]
15471547
pub fn cttz_nonzero<T: Copy>(x: T) -> T;
15481548

15491549
/// Reverses the bytes in an integer type `T`.

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@
7979
#![feature(const_int_unchecked_arith)]
8080
#![feature(const_mut_refs)]
8181
#![feature(const_refs_to_cell)]
82-
#![feature(const_cttz)]
8382
#![feature(const_panic)]
8483
#![feature(const_pin)]
8584
#![feature(const_fn)]

library/core/src/num/f32.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ impl f32 {
500500
/// Returns `true` if the number is [subnormal].
501501
///
502502
/// ```
503-
/// #![feature(is_subnormal)]
504503
/// let min = f32::MIN_POSITIVE; // 1.17549435e-38f32
505504
/// let max = f32::MAX;
506505
/// let lower_than_min = 1.0e-40_f32;
@@ -516,7 +515,7 @@ impl f32 {
516515
/// assert!(lower_than_min.is_subnormal());
517516
/// ```
518517
/// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number
519-
#[unstable(feature = "is_subnormal", issue = "79288")]
518+
#[stable(feature = "is_subnormal", since = "1.53.0")]
520519
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
521520
#[inline]
522521
pub const fn is_subnormal(self) -> bool {

library/core/src/num/f64.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,6 @@ impl f64 {
499499
/// Returns `true` if the number is [subnormal].
500500
///
501501
/// ```
502-
/// #![feature(is_subnormal)]
503502
/// let min = f64::MIN_POSITIVE; // 2.2250738585072014e-308_f64
504503
/// let max = f64::MAX;
505504
/// let lower_than_min = 1.0e-308_f64;
@@ -515,7 +514,7 @@ impl f64 {
515514
/// assert!(lower_than_min.is_subnormal());
516515
/// ```
517516
/// [subnormal]: https://en.wikipedia.org/wiki/Denormal_number
518-
#[unstable(feature = "is_subnormal", issue = "79288")]
517+
#[stable(feature = "is_subnormal", since = "1.53.0")]
519518
#[rustc_const_unstable(feature = "const_float_classify", issue = "72505")]
520519
#[inline]
521520
pub const fn is_subnormal(self) -> bool {

library/core/src/num/nonzero.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,12 @@ macro_rules! nonzero_leading_trailing_zeros {
191191
/// Basic usage:
192192
///
193193
/// ```
194-
/// #![feature(nonzero_leading_trailing_zeros)]
195194
#[doc = concat!("let n = std::num::", stringify!($Ty), "::new(", stringify!($LeadingTestExpr), ").unwrap();")]
196195
///
197196
/// assert_eq!(n.leading_zeros(), 0);
198197
/// ```
199-
#[unstable(feature = "nonzero_leading_trailing_zeros", issue = "79143")]
200-
#[rustc_const_unstable(feature = "nonzero_leading_trailing_zeros", issue = "79143")]
198+
#[stable(feature = "nonzero_leading_trailing_zeros", since = "1.53.0")]
199+
#[rustc_const_stable(feature = "nonzero_leading_trailing_zeros", since = "1.53.0")]
201200
#[inline]
202201
pub const fn leading_zeros(self) -> u32 {
203202
// SAFETY: since `self` can not be zero it is safe to call ctlz_nonzero
@@ -214,13 +213,12 @@ macro_rules! nonzero_leading_trailing_zeros {
214213
/// Basic usage:
215214
///
216215
/// ```
217-
/// #![feature(nonzero_leading_trailing_zeros)]
218216
#[doc = concat!("let n = std::num::", stringify!($Ty), "::new(0b0101000).unwrap();")]
219217
///
220218
/// assert_eq!(n.trailing_zeros(), 3);
221219
/// ```
222-
#[unstable(feature = "nonzero_leading_trailing_zeros", issue = "79143")]
223-
#[rustc_const_unstable(feature = "nonzero_leading_trailing_zeros", issue = "79143")]
220+
#[stable(feature = "nonzero_leading_trailing_zeros", since = "1.53.0")]
221+
#[rustc_const_stable(feature = "nonzero_leading_trailing_zeros", since = "1.53.0")]
224222
#[inline]
225223
pub const fn trailing_zeros(self) -> u32 {
226224
// SAFETY: since `self` can not be zero it is safe to call cttz_nonzero

library/core/src/time.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -124,14 +124,13 @@ impl Duration {
124124
/// # Examples
125125
///
126126
/// ```
127-
/// #![feature(duration_zero)]
128127
/// use std::time::Duration;
129128
///
130129
/// let duration = Duration::ZERO;
131130
/// assert!(duration.is_zero());
132131
/// assert_eq!(duration.as_nanos(), 0);
133132
/// ```
134-
#[unstable(feature = "duration_zero", issue = "73544")]
133+
#[stable(feature = "duration_zero", since = "1.53.0")]
135134
pub const ZERO: Duration = Duration::from_nanos(0);
136135

137136
/// The maximum duration.
@@ -269,7 +268,6 @@ impl Duration {
269268
/// # Examples
270269
///
271270
/// ```
272-
/// #![feature(duration_zero)]
273271
/// use std::time::Duration;
274272
///
275273
/// assert!(Duration::ZERO.is_zero());
@@ -281,7 +279,8 @@ impl Duration {
281279
/// assert!(!Duration::from_nanos(1).is_zero());
282280
/// assert!(!Duration::from_secs(1).is_zero());
283281
/// ```
284-
#[unstable(feature = "duration_zero", issue = "73544")]
282+
#[stable(feature = "duration_zero", since = "1.53.0")]
283+
#[rustc_const_stable(feature = "duration_zero", since = "1.53.0")]
285284
#[inline]
286285
pub const fn is_zero(&self) -> bool {
287286
self.secs == 0 && self.nanos == 0
@@ -536,7 +535,6 @@ impl Duration {
536535
/// # Examples
537536
///
538537
/// ```
539-
/// #![feature(duration_zero)]
540538
/// use std::time::Duration;
541539
///
542540
/// assert_eq!(Duration::new(0, 1).saturating_sub(Duration::new(0, 0)), Duration::new(0, 1));

library/core/tests/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#![feature(div_duration)]
2525
#![feature(duration_consts_2)]
2626
#![feature(duration_constants)]
27-
#![feature(duration_zero)]
2827
#![feature(exact_size_is_empty)]
2928
#![feature(extern_types)]
3029
#![feature(flt2dec)]
@@ -67,7 +66,6 @@
6766
#![feature(ptr_metadata)]
6867
#![feature(once_cell)]
6968
#![feature(unsized_tuple_coercion)]
70-
#![feature(nonzero_leading_trailing_zeros)]
7169
#![feature(const_option)]
7270
#![feature(integer_atomics)]
7371
#![feature(slice_group_by)]

library/std/src/io/buffered/bufreader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<R: Seek> BufReader<R> {
234234
/// the buffer will not be flushed, allowing for more efficient seeks.
235235
/// This method does not return the location of the underlying reader, so the caller
236236
/// must track this information themselves if it is required.
237-
#[unstable(feature = "bufreader_seek_relative", issue = "31100")]
237+
#[stable(feature = "bufreader_seek_relative", since = "1.53.0")]
238238
pub fn seek_relative(&mut self, offset: i64) -> io::Result<()> {
239239
let pos = self.pos as u64;
240240
if offset < 0 {

library/std/src/keyword_docs.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1768,6 +1768,7 @@ mod super_keyword {}
17681768
/// In the 2015 edition the parameters pattern was not needed for traits:
17691769
///
17701770
/// ```rust,edition2015
1771+
/// # #![allow(anonymous_parameters)]
17711772
/// trait Tr {
17721773
/// fn f(i32);
17731774
/// }

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@
261261
#![cfg_attr(not(bootstrap), feature(doc_notable_trait))]
262262
#![feature(dropck_eyepatch)]
263263
#![feature(duration_constants)]
264-
#![feature(duration_zero)]
265264
#![feature(edition_panic)]
266265
#![feature(exact_size_is_empty)]
267266
#![feature(exhaustive_patterns)]

src/librustdoc/passes/bare_urls.rs

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ impl<'a, 'tcx> DocFolder for BareUrlsLinter<'a, 'tcx> {
7373
.unwrap_or(item.span.inner());
7474
cx.tcx.struct_span_lint_hir(crate::lint::BARE_URLS, hir_id, sp, |lint| {
7575
lint.build(msg)
76+
.note("bare URLs are not automatically turned into clickable links")
7677
.span_suggestion(
7778
sp,
7879
"use an automatic link instead",

0 commit comments

Comments
 (0)