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

Lines changed: 9 additions & 0 deletions
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
[feature-resolver@2.0]: 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

Lines changed: 7 additions & 4 deletions
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

Lines changed: 17 additions & 15 deletions
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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`.

0 commit comments

Comments
 (0)