diff options
| author | bors <bors@rust-lang.org> | 2025-01-26 00:47:18 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-01-26 00:47:18 +0000 |
| commit | 2f0ad2a71e4a4528bb80bcb24bf8fa4e50cb87c2 (patch) | |
| tree | e4b820f7ab8fc7ba6f6b3f8a77493dbebb0337b4 /compiler | |
| parent | 6fb03584cf6d915cc5527f45037ca009f4273c4c (diff) | |
| parent | 08c4d6369b5f00e6e1626ce82f76b2584dffa657 (diff) | |
| download | rust-2f0ad2a71e4a4528bb80bcb24bf8fa4e50cb87c2.tar.gz rust-2f0ad2a71e4a4528bb80bcb24bf8fa4e50cb87c2.zip | |
Auto merge of #136070 - matthiaskrgr:rollup-b5enbuz, r=matthiaskrgr
Rollup of 7 pull requests Successful merges: - #134300 (remove long-deprecated no-op attributes no_start and crate_id) - #134373 (Improve and expand documentation of pipes) - #135934 (Include missing item in the 1.81 release notes) - #136005 (ports last few library files to new intrinsic style) - #136016 (Improve check-cfg expected names diagnostic) - #136039 (docs: fix typo in std::pin overview) - #136056 (Fix typo in const stability error message) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_const_eval/messages.ftl | 2 | ||||
| -rw-r--r-- | compiler/rustc_feature/src/builtin_attrs.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_lint/messages.ftl | 2 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/builtin.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/early/diagnostics/check_cfg.rs | 29 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/lints.rs | 13 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 2 |
7 files changed, 28 insertions, 36 deletions
diff --git a/compiler/rustc_const_eval/messages.ftl b/compiler/rustc_const_eval/messages.ftl index d4bfb781320..485c8696342 100644 --- a/compiler/rustc_const_eval/messages.ftl +++ b/compiler/rustc_const_eval/messages.ftl @@ -416,7 +416,7 @@ const_eval_unsized_local = unsized locals are not supported const_eval_unstable_const_fn = `{$def_path}` is not yet stable as a const fn const_eval_unstable_in_stable_exposed = const function that might be (indirectly) exposed to stable cannot use `#[feature({$gate})]` - .is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unsafe features + .is_function_call = mark the callee as `#[rustc_const_stable_indirect]` if it does not itself require any unstable features .unstable_sugg = if the {$is_function_call2 -> [true] caller *[false] function diff --git a/compiler/rustc_feature/src/builtin_attrs.rs b/compiler/rustc_feature/src/builtin_attrs.rs index 966f7730918..17433eed9e7 100644 --- a/compiler/rustc_feature/src/builtin_attrs.rs +++ b/compiler/rustc_feature/src/builtin_attrs.rs @@ -408,11 +408,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ crate_type, CrateLevel, template!(NameValueStr: "bin|lib|..."), DuplicatesOk, EncodeCrossCrate::No, ), - // crate_id is deprecated - ungated!( - crate_id, CrateLevel, template!(NameValueStr: "ignored"), FutureWarnFollowing, - EncodeCrossCrate::No, - ), // ABI, linking, symbols, and FFI ungated!( @@ -448,7 +443,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[ ), // Entry point: - ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No), ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, EncodeCrossCrate::No), // Modules, prelude, and resolution: diff --git a/compiler/rustc_lint/messages.ftl b/compiler/rustc_lint/messages.ftl index 64c8f00cc83..7e64f7f002f 100644 --- a/compiler/rustc_lint/messages.ftl +++ b/compiler/rustc_lint/messages.ftl @@ -69,12 +69,10 @@ lint_builtin_const_no_mangle = const items should never be `#[no_mangle]` lint_builtin_decl_unsafe_fn = declaration of an `unsafe` function lint_builtin_decl_unsafe_method = declaration of an `unsafe` method -lint_builtin_deprecated_attr_default_suggestion = remove this attribute lint_builtin_deprecated_attr_link = use of deprecated attribute `{$name}`: {$reason}. See {$link} .msg_suggestion = {$msg} .default_suggestion = remove this attribute -lint_builtin_deprecated_attr_used = use of deprecated attribute `{$name}`: no longer used lint_builtin_deref_nullptr = dereferencing a null pointer .label = this code causes undefined behavior when executed diff --git a/compiler/rustc_lint/src/builtin.rs b/compiler/rustc_lint/src/builtin.rs index fb3cf5afad0..876ef944d65 100644 --- a/compiler/rustc_lint/src/builtin.rs +++ b/compiler/rustc_lint/src/builtin.rs @@ -20,7 +20,7 @@ use rustc_abi::BackendRepr; use rustc_ast::tokenstream::{TokenStream, TokenTree}; use rustc_ast::visit::{FnCtxt, FnKind}; use rustc_ast::{self as ast, *}; -use rustc_ast_pretty::pprust::{self, expr_to_string}; +use rustc_ast_pretty::pprust::expr_to_string; use rustc_errors::{Applicability, LintDiagnostic}; use rustc_feature::{AttributeGate, BuiltinAttribute, GateIssue, Stability, deprecated_attributes}; use rustc_hir as hir; @@ -49,7 +49,7 @@ use rustc_trait_selection::traits::{self}; use crate::errors::BuiltinEllipsisInclusiveRangePatterns; use crate::lints::{ BuiltinAnonymousParams, BuiltinConstNoMangle, BuiltinDeprecatedAttrLink, - BuiltinDeprecatedAttrLinkSuggestion, BuiltinDeprecatedAttrUsed, BuiltinDerefNullptr, + BuiltinDeprecatedAttrLinkSuggestion, BuiltinDerefNullptr, BuiltinEllipsisInclusiveRangePatternsLint, BuiltinExplicitOutlives, BuiltinExplicitOutlivesSuggestion, BuiltinFeatureIssueNote, BuiltinIncompleteFeatures, BuiltinIncompleteFeaturesHelp, BuiltinInternalFeatures, BuiltinKeywordIdents, @@ -848,12 +848,6 @@ impl EarlyLintPass for DeprecatedAttr { return; } } - if attr.has_name(sym::no_start) || attr.has_name(sym::crate_id) { - cx.emit_span_lint(DEPRECATED, attr.span, BuiltinDeprecatedAttrUsed { - name: pprust::path_to_string(&attr.get_normal_item().path), - suggestion: attr.span, - }); - } } } diff --git a/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs b/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs index eebb131599a..da6dd8161ee 100644 --- a/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs +++ b/compiler/rustc_lint/src/early/diagnostics/check_cfg.rs @@ -10,19 +10,35 @@ use crate::lints; const MAX_CHECK_CFG_NAMES_OR_VALUES: usize = 35; +enum FilterWellKnownNames { + Yes, + No, +} + fn sort_and_truncate_possibilities( sess: &Session, mut possibilities: Vec<Symbol>, + filter_well_known_names: FilterWellKnownNames, ) -> (Vec<Symbol>, usize) { + let possibilities_len = possibilities.len(); + let n_possibilities = if sess.opts.unstable_opts.check_cfg_all_expected { possibilities.len() } else { + match filter_well_known_names { + FilterWellKnownNames::Yes => { + possibilities.retain(|cfg_name| { + !sess.psess.check_config.well_known_names.contains(cfg_name) + }); + } + FilterWellKnownNames::No => {} + }; std::cmp::min(possibilities.len(), MAX_CHECK_CFG_NAMES_OR_VALUES) }; possibilities.sort_by(|s1, s2| s1.as_str().cmp(s2.as_str())); - let and_more = possibilities.len().saturating_sub(n_possibilities); + let and_more = possibilities_len.saturating_sub(n_possibilities); possibilities.truncate(n_possibilities); (possibilities, and_more) } @@ -198,8 +214,10 @@ pub(super) fn unexpected_cfg_name( } else { vec![] }; + + let (possibilities, and_more) = + sort_and_truncate_possibilities(sess, possibilities, FilterWellKnownNames::Yes); let expected_names = if !possibilities.is_empty() { - let (possibilities, and_more) = sort_and_truncate_possibilities(sess, possibilities); let possibilities: Vec<_> = possibilities.into_iter().map(|s| Ident::new(s, name_span)).collect(); Some(lints::unexpected_cfg_name::ExpectedNames { @@ -269,8 +287,11 @@ pub(super) fn unexpected_cfg_value( // for names as the possibilities could be very long let code_sugg = if !possibilities.is_empty() { let expected_values = { - let (possibilities, and_more) = - sort_and_truncate_possibilities(sess, possibilities.clone()); + let (possibilities, and_more) = sort_and_truncate_possibilities( + sess, + possibilities.clone(), + FilterWellKnownNames::No, + ); lints::unexpected_cfg_value::ExpectedValues { name, have_none_possibility, diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 84a6272198f..0b7d1f45f2a 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -178,19 +178,6 @@ pub(crate) enum BuiltinDeprecatedAttrLinkSuggestion<'a> { } #[derive(LintDiagnostic)] -#[diag(lint_builtin_deprecated_attr_used)] -pub(crate) struct BuiltinDeprecatedAttrUsed { - pub name: String, - #[suggestion( - lint_builtin_deprecated_attr_default_suggestion, - style = "short", - code = "", - applicability = "machine-applicable" - )] - pub suggestion: Span, -} - -#[derive(LintDiagnostic)] #[diag(lint_builtin_unused_doc_comment)] pub(crate) struct BuiltinUnusedDocComment<'a> { pub kind: &'a str, diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index aa22d0f706d..1fb15fe9800 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -707,7 +707,6 @@ symbols! { coverage, coverage_attribute, cr, - crate_id, crate_in_paths, crate_local, crate_name, @@ -1390,7 +1389,6 @@ symbols! { no_mangle, no_sanitize, no_stack_check, - no_start, no_std, nomem, non_ascii_idents, |
