Skip to content

Commit 74bd73a

Browse files
committed
rename rustc_legacy_const_generics to make it more clear that it is (soft) deprecated
1 parent d1ed52b commit 74bd73a

File tree

6 files changed

+19
-18
lines changed

6 files changed

+19
-18
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ pub static BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
11621162
rustc_promotable, Normal, template!(Word), WarnFollowing,
11631163
EncodeCrossCrate::No, ),
11641164
rustc_attr!(
1165-
rustc_legacy_const_generics, Normal, template!(List: &["N"]), ErrorFollowing,
1165+
rustc_deprecated_legacy_const_generics, Normal, template!(List: &["N"]), ErrorFollowing,
11661166
EncodeCrossCrate::Yes,
11671167
),
11681168
// Do not const-check this function's body. It will always get replaced during CTFE via `hook_special_const_fn`.

compiler/rustc_passes/messages.ftl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,11 @@ passes_rustc_force_inline_coro =
521521
attribute cannot be applied to a `async`, `gen` or `async gen` function
522522
.label = `async`, `gen` or `async gen` function
523523
524-
passes_rustc_legacy_const_generics_index =
525-
#[rustc_legacy_const_generics] must have one index for each generic parameter
524+
passes_rustc_deprecated_legacy_const_generics_index =
525+
#[rustc_deprecated_legacy_const_generics] must have one index for each generic parameter
526526
.label = generic parameters
527527
528-
passes_rustc_legacy_const_generics_index_exceed =
528+
passes_rustc_deprecated_legacy_const_generics_index_exceed =
529529
index exceeds number of arguments
530530
.label = there {$arg_count ->
531531
[one] is
@@ -535,11 +535,11 @@ passes_rustc_legacy_const_generics_index_exceed =
535535
*[other] arguments
536536
}
537537
538-
passes_rustc_legacy_const_generics_index_negative =
538+
passes_rustc_deprecated_legacy_const_generics_index_negative =
539539
arguments should be non-negative integers
540540
541-
passes_rustc_legacy_const_generics_only =
542-
#[rustc_legacy_const_generics] functions must only have const generics
541+
passes_rustc_deprecated_legacy_const_generics_only =
542+
#[rustc_deprecated_legacy_const_generics] functions must only have const generics
543543
.label = non-const generic parameter
544544
545545
passes_rustc_lint_opt_deny_field_access =

compiler/rustc_passes/src/check_attr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
303303
[sym::rustc_never_returns_null_ptr, ..] => {
304304
self.check_applied_to_fn_or_method(hir_id, attr.span(), span, target)
305305
}
306-
[sym::rustc_legacy_const_generics, ..] => {
307-
self.check_rustc_legacy_const_generics(hir_id, attr, span, target, item)
306+
[sym::rustc_deprecated_legacy_const_generics, ..] => {
307+
self.check_rustc_deprecated_legacy_const_generics(hir_id, attr, span, target, item)
308308
}
309309
[sym::rustc_lint_query_instability, ..] => {
310310
self.check_applied_to_fn_or_method(hir_id, attr.span(), span, target)
@@ -1423,8 +1423,8 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
14231423
}
14241424
}
14251425

1426-
/// Checks if `#[rustc_legacy_const_generics]` is applied to a function and has a valid argument.
1427-
fn check_rustc_legacy_const_generics(
1426+
/// Checks if `#[rustc_deprecated_legacy_const_generics]` is applied to a function and has a valid argument.
1427+
fn check_rustc_deprecated_legacy_const_generics(
14281428
&self,
14291429
hir_id: HirId,
14301430
attr: &Attribute,

compiler/rustc_passes/src/errors.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ pub(crate) struct NoLink {
406406
}
407407

408408
#[derive(Diagnostic)]
409-
#[diag(passes_rustc_legacy_const_generics_only)]
409+
#[diag(passes_rustc_deprecated_legacy_const_generics_only)]
410410
pub(crate) struct RustcLegacyConstGenericsOnly {
411411
#[primary_span]
412412
pub attr_span: Span,
@@ -415,7 +415,7 @@ pub(crate) struct RustcLegacyConstGenericsOnly {
415415
}
416416

417417
#[derive(Diagnostic)]
418-
#[diag(passes_rustc_legacy_const_generics_index)]
418+
#[diag(passes_rustc_deprecated_legacy_const_generics_index)]
419419
pub(crate) struct RustcLegacyConstGenericsIndex {
420420
#[primary_span]
421421
pub attr_span: Span,
@@ -424,7 +424,7 @@ pub(crate) struct RustcLegacyConstGenericsIndex {
424424
}
425425

426426
#[derive(Diagnostic)]
427-
#[diag(passes_rustc_legacy_const_generics_index_exceed)]
427+
#[diag(passes_rustc_deprecated_legacy_const_generics_index_exceed)]
428428
pub(crate) struct RustcLegacyConstGenericsIndexExceed {
429429
#[primary_span]
430430
#[label]
@@ -433,7 +433,7 @@ pub(crate) struct RustcLegacyConstGenericsIndexExceed {
433433
}
434434

435435
#[derive(Diagnostic)]
436-
#[diag(passes_rustc_legacy_const_generics_index_negative)]
436+
#[diag(passes_rustc_deprecated_legacy_const_generics_index_negative)]
437437
pub(crate) struct RustcLegacyConstGenericsIndexNegative {
438438
#[primary_span]
439439
pub invalid_args: Vec<Span>,

compiler/rustc_resolve/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2352,7 +2352,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
23522352
}
23532353

23542354
/// Checks if an expression refers to a function marked with
2355-
/// `#[rustc_legacy_const_generics]` and returns the argument index list
2355+
/// `#[rustc_deprecated_legacy_const_generics]` and returns the argument index list
23562356
/// from the attribute.
23572357
fn legacy_const_generic_args(&mut self, expr: &Expr) -> Option<Vec<usize>> {
23582358
if let ExprKind::Path(None, path) = &expr.kind {
@@ -2375,7 +2375,8 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
23752375
return v.clone();
23762376
}
23772377

2378-
let attr = self.tcx.get_attr(def_id, sym::rustc_legacy_const_generics)?;
2378+
let attr =
2379+
self.tcx.get_attr(def_id, sym::rustc_deprecated_legacy_const_generics)?;
23792380
let mut ret = Vec::new();
23802381
for meta in attr.meta_item_list()? {
23812382
match meta.lit()?.kind {

compiler/rustc_span/src/symbol.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,6 +1872,7 @@ symbols! {
18721872
rustc_default_body_unstable,
18731873
rustc_delayed_bug_from_inside_query,
18741874
rustc_deny_explicit_impl,
1875+
rustc_deprecated_legacy_const_generics,
18751876
rustc_deprecated_safe_2024,
18761877
rustc_diagnostic_item,
18771878
rustc_diagnostic_macros,
@@ -1900,7 +1901,6 @@ symbols! {
19001901
rustc_layout,
19011902
rustc_layout_scalar_valid_range_end,
19021903
rustc_layout_scalar_valid_range_start,
1903-
rustc_legacy_const_generics,
19041904
rustc_lint_diagnostics,
19051905
rustc_lint_opt_deny_field_access,
19061906
rustc_lint_opt_ty,

0 commit comments

Comments
 (0)