Skip to content

Commit c5e344f

Browse files
committed
Auto merge of rust-lang#86920 - JohnTitor:rollup-buvzpkr, r=JohnTitor
Rollup of 8 pull requests Successful merges: - rust-lang#80918 (Add Integer::log variants) - rust-lang#86717 (Rename some Rust 2021 lints to better names ) - rust-lang#86819 (Clean up rustdoc IDs) - rust-lang#86880 (Test ManuallyDrop::clone_from.) - rust-lang#86906 (Replace deprecated compare_and_swap and fix typo in core::sync::atomic::{fence, compiler_fence} docs) - rust-lang#86907 (Migrate `cpu-usage-over-time.py` to Python 3) - rust-lang#86916 (rewrote documentation for thread::yield_now()) - rust-lang#86919 (Update books) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents c0bd5a5 + 5196885 commit c5e344f

File tree

88 files changed

+842
-299
lines changed

Some content is hidden

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

88 files changed

+842
-299
lines changed

compiler/rustc_expand/src/mbe/macro_rules.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ use rustc_data_structures::fx::FxHashMap;
1818
use rustc_data_structures::sync::Lrc;
1919
use rustc_errors::{Applicability, DiagnosticBuilder};
2020
use rustc_feature::Features;
21-
use rustc_lint_defs::builtin::{OR_PATTERNS_BACK_COMPAT, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS};
21+
use rustc_lint_defs::builtin::{
22+
RUST_2021_INCOMPATIBLE_OR_PATTERNS, SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
23+
};
2224
use rustc_lint_defs::BuiltinLintDiagnostics;
2325
use rustc_parse::parser::Parser;
2426
use rustc_session::parse::ParseSess;
@@ -975,7 +977,7 @@ fn check_matcher_core(
975977
Some(NonterminalKind::PatParam { inferred: false }),
976978
));
977979
sess.buffer_lint_with_diagnostic(
978-
&OR_PATTERNS_BACK_COMPAT,
980+
&RUST_2021_INCOMPATIBLE_OR_PATTERNS,
979981
span,
980982
ast::CRATE_NODE_ID,
981983
"the meaning of the `pat` fragment specifier is changing in Rust 2021, which may affect this macro",

compiler/rustc_lint/src/lib.rs

+3
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ fn register_builtins(store: &mut LintStore, no_interleave_lints: bool) {
325325
store.register_renamed("redundant_semicolon", "redundant_semicolons");
326326
store.register_renamed("overlapping_patterns", "overlapping_range_endpoints");
327327
store.register_renamed("safe_packed_borrows", "unaligned_references");
328+
store.register_renamed("disjoint_capture_migration", "rust_2021_incompatible_closure_captures");
329+
store.register_renamed("or_patterns_back_compat", "rust_2021_incompatible_or_patterns");
330+
store.register_renamed("non_fmt_panic", "non_fmt_panics");
328331

329332
// These were moved to tool lints, but rustc still sees them when compiling normally, before
330333
// tool lints are registered, so `check_tool_name_for_backwards_compat` doesn't work. Use

compiler/rustc_lint/src/non_fmt_panic.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use rustc_span::edition::Edition;
99
use rustc_span::{hygiene, sym, symbol::kw, symbol::SymbolStr, InnerSpan, Span, Symbol};
1010

1111
declare_lint! {
12-
/// The `non_fmt_panic` lint detects `panic!(..)` invocations where the first
12+
/// The `non_fmt_panics` lint detects `panic!(..)` invocations where the first
1313
/// argument is not a formatting string.
1414
///
1515
/// ### Example
@@ -29,7 +29,7 @@ declare_lint! {
2929
/// an `i32` as message.
3030
///
3131
/// Rust 2021 always interprets the first argument as format string.
32-
NON_FMT_PANIC,
32+
NON_FMT_PANICS,
3333
Warn,
3434
"detect single-argument panic!() invocations in which the argument is not a format string",
3535
@future_incompatible = FutureIncompatibleInfo {
@@ -39,7 +39,7 @@ declare_lint! {
3939
report_in_external_macro
4040
}
4141

42-
declare_lint_pass!(NonPanicFmt => [NON_FMT_PANIC]);
42+
declare_lint_pass!(NonPanicFmt => [NON_FMT_PANICS]);
4343

4444
impl<'tcx> LateLintPass<'tcx> for NonPanicFmt {
4545
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
@@ -91,7 +91,7 @@ fn check_panic<'tcx>(cx: &LateContext<'tcx>, f: &'tcx hir::Expr<'tcx>, arg: &'tc
9191
arg_span = expn.call_site;
9292
}
9393

94-
cx.struct_span_lint(NON_FMT_PANIC, arg_span, |lint| {
94+
cx.struct_span_lint(NON_FMT_PANICS, arg_span, |lint| {
9595
let mut l = lint.build("panic message is not a string literal");
9696
l.note("this usage of panic!() is deprecated; it will be a hard error in Rust 2021");
9797
l.note("for more information, see <https://doc.rust-lang.org/nightly/edition-guide/rust-2021/panic-macro-consistency.html>");
@@ -174,7 +174,7 @@ fn check_panic_str<'tcx>(
174174
[] => vec![fmt_span],
175175
v => v.iter().map(|span| fmt_span.from_inner(*span)).collect(),
176176
};
177-
cx.struct_span_lint(NON_FMT_PANIC, arg_spans, |lint| {
177+
cx.struct_span_lint(NON_FMT_PANICS, arg_spans, |lint| {
178178
let mut l = lint.build(match n_arguments {
179179
1 => "panic message contains an unused formatting placeholder",
180180
_ => "panic message contains unused formatting placeholders",
@@ -208,7 +208,7 @@ fn check_panic_str<'tcx>(
208208
Some(v) if v.len() == 1 => "panic message contains a brace",
209209
_ => "panic message contains braces",
210210
};
211-
cx.struct_span_lint(NON_FMT_PANIC, brace_spans.unwrap_or_else(|| vec![span]), |lint| {
211+
cx.struct_span_lint(NON_FMT_PANICS, brace_spans.unwrap_or_else(|| vec![span]), |lint| {
212212
let mut l = lint.build(msg);
213213
l.note("this message is not used as a format string, but will be in Rust 2021");
214214
if span.contains(arg.span) {

compiler/rustc_lint_defs/src/builtin.rs

+17-17
Original file line numberDiff line numberDiff line change
@@ -2967,13 +2967,13 @@ declare_lint_pass! {
29672967
MISSING_ABI,
29682968
INVALID_DOC_ATTRIBUTES,
29692969
SEMICOLON_IN_EXPRESSIONS_FROM_MACROS,
2970-
DISJOINT_CAPTURE_MIGRATION,
2970+
RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
29712971
LEGACY_DERIVE_HELPERS,
29722972
PROC_MACRO_BACK_COMPAT,
2973-
OR_PATTERNS_BACK_COMPAT,
2973+
RUST_2021_INCOMPATIBLE_OR_PATTERNS,
29742974
LARGE_ASSIGNMENTS,
2975-
FUTURE_PRELUDE_COLLISION,
2976-
RESERVED_PREFIX,
2975+
RUST_2021_PRELUDE_COLLISIONS,
2976+
RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
29772977
UNSUPPORTED_CALLING_CONVENTIONS,
29782978
]
29792979
}
@@ -3002,7 +3002,7 @@ declare_lint! {
30023002
}
30033003

30043004
declare_lint! {
3005-
/// The `disjoint_capture_migration` lint detects variables that aren't completely
3005+
/// The `rust_2021_incompatible_closure_captures` lint detects variables that aren't completely
30063006
/// captured in Rust 2021 and affect the Drop order of at least one path starting at this variable.
30073007
/// It can also detect when a variable implements a trait, but one of its field does not and
30083008
/// the field is captured by a closure and used with the assumption that said field implements
@@ -3011,7 +3011,7 @@ declare_lint! {
30113011
/// ### Example of drop reorder
30123012
///
30133013
/// ```rust,compile_fail
3014-
/// # #![deny(disjoint_capture_migration)]
3014+
/// # #![deny(rust_2021_incompatible_closure_captures)]
30153015
/// # #![allow(unused)]
30163016
/// struct FancyInteger(i32);
30173017
///
@@ -3046,7 +3046,7 @@ declare_lint! {
30463046
/// ### Example of auto-trait
30473047
///
30483048
/// ```rust,compile_fail
3049-
/// #![deny(disjoint_capture_migration)]
3049+
/// #![deny(rust_2021_incompatible_closure_captures)]
30503050
/// use std::thread;
30513051
///
30523052
/// struct Pointer(*mut i32);
@@ -3068,7 +3068,7 @@ declare_lint! {
30683068
/// In the above example, only `fptr.0` is captured in Rust 2021.
30693069
/// The field is of type *mut i32 which doesn't implement Send, making the code invalid as the
30703070
/// field cannot be sent between thread safely.
3071-
pub DISJOINT_CAPTURE_MIGRATION,
3071+
pub RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
30723072
Allow,
30733073
"detects closures affected by Rust 2021 changes",
30743074
@future_incompatible = FutureIncompatibleInfo {
@@ -3183,12 +3183,12 @@ declare_lint! {
31833183
}
31843184

31853185
declare_lint! {
3186-
/// The `or_patterns_back_compat` lint detects usage of old versions of or-patterns.
3186+
/// The `rust_2021_incompatible_or_patterns` lint detects usage of old versions of or-patterns.
31873187
///
31883188
/// ### Example
31893189
///
31903190
/// ```rust,compile_fail
3191-
/// #![deny(or_patterns_back_compat)]
3191+
/// #![deny(rust_2021_incompatible_or_patterns)]
31923192
/// macro_rules! match_any {
31933193
/// ( $expr:expr , $( $( $pat:pat )|+ => $expr_arm:expr ),+ ) => {
31943194
/// match $expr {
@@ -3211,7 +3211,7 @@ declare_lint! {
32113211
/// ### Explanation
32123212
///
32133213
/// In Rust 2021, the pat matcher will match new patterns, which include the | character.
3214-
pub OR_PATTERNS_BACK_COMPAT,
3214+
pub RUST_2021_INCOMPATIBLE_OR_PATTERNS,
32153215
Allow,
32163216
"detects usage of old versions of or-patterns",
32173217
@future_incompatible = FutureIncompatibleInfo {
@@ -3221,13 +3221,13 @@ declare_lint! {
32213221
}
32223222

32233223
declare_lint! {
3224-
/// The `future_prelude_collision` lint detects the usage of trait methods which are ambiguous
3224+
/// The `rust_2021_prelude_collisions` lint detects the usage of trait methods which are ambiguous
32253225
/// with traits added to the prelude in future editions.
32263226
///
32273227
/// ### Example
32283228
///
32293229
/// ```rust,compile_fail
3230-
/// #![deny(future_prelude_collision)]
3230+
/// #![deny(rust_2021_prelude_collisions)]
32313231
///
32323232
/// trait Foo {
32333233
/// fn try_into(self) -> Result<String, !>;
@@ -3259,7 +3259,7 @@ declare_lint! {
32593259
/// is called directly on a type.
32603260
///
32613261
/// [prelude changes]: https://blog.rust-lang.org/inside-rust/2021/03/04/planning-rust-2021.html#prelude-changes
3262-
pub FUTURE_PRELUDE_COLLISION,
3262+
pub RUST_2021_PRELUDE_COLLISIONS,
32633263
Allow,
32643264
"detects the usage of trait methods which are ambiguous with traits added to the \
32653265
prelude in future editions",
@@ -3270,13 +3270,13 @@ declare_lint! {
32703270
}
32713271

32723272
declare_lint! {
3273-
/// The `reserved_prefix` lint detects identifiers that will be parsed as a
3273+
/// The `rust_2021_prefixes_incompatible_syntax` lint detects identifiers that will be parsed as a
32743274
/// prefix instead in Rust 2021.
32753275
///
32763276
/// ### Example
32773277
///
32783278
/// ```rust,compile_fail
3279-
/// #![deny(reserved_prefix)]
3279+
/// #![deny(rust_2021_prefixes_incompatible_syntax)]
32803280
///
32813281
/// macro_rules! m {
32823282
/// (z $x:expr) => ();
@@ -3295,7 +3295,7 @@ declare_lint! {
32953295
///
32963296
/// This lint suggests to add whitespace between the `z` and `"hey"` tokens
32973297
/// to keep them separated in Rust 2021.
3298-
pub RESERVED_PREFIX,
3298+
pub RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
32993299
Allow,
33003300
"identifiers that will be parsed as a prefix in Rust 2021",
33013301
@future_incompatible = FutureIncompatibleInfo {

compiler/rustc_parse/src/lexer/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_ast::tokenstream::{Spacing, TokenStream};
44
use rustc_errors::{error_code, Applicability, DiagnosticBuilder, FatalError, PResult};
55
use rustc_lexer::unescape::{self, Mode};
66
use rustc_lexer::{Base, DocStyle, RawStrError};
7-
use rustc_session::lint::builtin::RESERVED_PREFIX;
7+
use rustc_session::lint::builtin::RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX;
88
use rustc_session::lint::BuiltinLintDiagnostics;
99
use rustc_session::parse::ParseSess;
1010
use rustc_span::symbol::{sym, Symbol};
@@ -526,7 +526,7 @@ impl<'a> StringReader<'a> {
526526
} else {
527527
// Before Rust 2021, only emit a lint for migration.
528528
self.sess.buffer_lint_with_diagnostic(
529-
&RESERVED_PREFIX,
529+
&RUST_2021_PREFIXES_INCOMPATIBLE_SYNTAX,
530530
prefix_span,
531531
ast::CRATE_NODE_ID,
532532
&msg,

compiler/rustc_typeck/src/check/method/prelude2021.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use rustc_ast::Mutability;
55
use rustc_errors::Applicability;
66
use rustc_hir as hir;
77
use rustc_middle::ty::{Ref, Ty};
8-
use rustc_session::lint::builtin::FUTURE_PRELUDE_COLLISION;
8+
use rustc_session::lint::builtin::RUST_2021_PRELUDE_COLLISIONS;
99
use rustc_span::symbol::kw::Underscore;
1010
use rustc_span::symbol::{sym, Ident};
1111
use rustc_span::Span;
@@ -67,7 +67,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
6767
// Inherent impls only require not relying on autoref and autoderef in order to
6868
// ensure that the trait implementation won't be used
6969
self.tcx.struct_span_lint_hir(
70-
FUTURE_PRELUDE_COLLISION,
70+
RUST_2021_PRELUDE_COLLISIONS,
7171
self_expr.hir_id,
7272
self_expr.span,
7373
|lint| {
@@ -128,7 +128,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
128128
// trait implementations require full disambiguation to not clash with the new prelude
129129
// additions (i.e. convert from dot-call to fully-qualified call)
130130
self.tcx.struct_span_lint_hir(
131-
FUTURE_PRELUDE_COLLISION,
131+
RUST_2021_PRELUDE_COLLISIONS,
132132
call_expr.hir_id,
133133
call_expr.span,
134134
|lint| {
@@ -212,7 +212,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
212212
return;
213213
}
214214

215-
self.tcx.struct_span_lint_hir(FUTURE_PRELUDE_COLLISION, expr_id, span, |lint| {
215+
self.tcx.struct_span_lint_hir(RUST_2021_PRELUDE_COLLISIONS, expr_id, span, |lint| {
216216
// "type" refers to either a type or, more likely, a trait from which
217217
// the associated function or method is from.
218218
let trait_path = self.trait_path_or_bare_name(span, expr_id, pick.item.container.id());

compiler/rustc_typeck/src/check/upvar.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
171171

172172
let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
173173

174-
if should_do_disjoint_capture_migration_analysis(self.tcx, closure_hir_id) {
174+
if should_do_rust_2021_incompatible_closure_captures_analysis(self.tcx, closure_hir_id) {
175175
self.perform_2229_migration_anaysis(closure_def_id, body_id, capture_clause, span);
176176
}
177177

@@ -503,7 +503,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
503503
let local_def_id = closure_def_id.expect_local();
504504
let closure_hir_id = self.tcx.hir().local_def_id_to_hir_id(local_def_id);
505505
self.tcx.struct_span_lint_hir(
506-
lint::builtin::DISJOINT_CAPTURE_MIGRATION,
506+
lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES,
507507
closure_hir_id,
508508
span,
509509
|lint| {
@@ -1820,8 +1820,12 @@ fn var_name(tcx: TyCtxt<'_>, var_hir_id: hir::HirId) -> Symbol {
18201820
tcx.hir().name(var_hir_id)
18211821
}
18221822

1823-
fn should_do_disjoint_capture_migration_analysis(tcx: TyCtxt<'_>, closure_id: hir::HirId) -> bool {
1824-
let (level, _) = tcx.lint_level_at_node(lint::builtin::DISJOINT_CAPTURE_MIGRATION, closure_id);
1823+
fn should_do_rust_2021_incompatible_closure_captures_analysis(
1824+
tcx: TyCtxt<'_>,
1825+
closure_id: hir::HirId,
1826+
) -> bool {
1827+
let (level, _) =
1828+
tcx.lint_level_at_node(lint::builtin::RUST_2021_INCOMPATIBLE_CLOSURE_CAPTURES, closure_id);
18251829

18261830
!matches!(level, lint::Level::Allow)
18271831
}

library/core/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@
164164
#![feature(no_niche)] // rust-lang/rust#68303
165165
#![feature(no_coverage)] // rust-lang/rust#84605
166166
#![deny(unsafe_op_in_unsafe_fn)]
167-
#![deny(or_patterns_back_compat)]
167+
#![cfg_attr(bootstrap, deny(or_patterns_back_compat))]
168+
#![cfg_attr(not(bootstrap), deny(rust_2021_incompatible_or_patterns))]
168169

169170
// allow using `core::` in intra-doc links
170171
#[allow(unused_extern_crates)]

0 commit comments

Comments
 (0)