Skip to content

Commit 55a9dc3

Browse files
authored
Unrolled build for rust-lang#121661
Rollup merge of rust-lang#121661 - surechen:change_attribute_to_local_20240226, r=lcnr Changing some attributes to only_local. Modified according to rust-lang/compiler-team#505. By running test cases, I found that modifying the attribute's only_local tag sometimes causes some unintuitive error reports, so I tend to split it into multiple PRs and edit a small number of attributes each time to prevent too many changes at once. Prevent possible subsequent difficulties in locating problems. r? ``@lcnr``
2 parents d377991 + 03a10a9 commit 55a9dc3

File tree

1 file changed

+41
-22
lines changed

1 file changed

+41
-22
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

+41-22
Original file line numberDiff line numberDiff line change
@@ -390,20 +390,21 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
390390

391391
// Entry point:
392392
gated!(unix_sigpipe, Normal, template!(Word, NameValueStr: "inherit|sig_ign|sig_dfl"), ErrorFollowing, experimental!(unix_sigpipe)),
393-
ungated!(start, Normal, template!(Word), WarnFollowing),
394-
ungated!(no_start, CrateLevel, template!(Word), WarnFollowing),
395-
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing),
393+
ungated!(start, Normal, template!(Word), WarnFollowing, @only_local: true),
394+
ungated!(no_start, CrateLevel, template!(Word), WarnFollowing, @only_local: true),
395+
ungated!(no_main, CrateLevel, template!(Word), WarnFollowing, @only_local: true),
396396

397397
// Modules, prelude, and resolution:
398-
ungated!(path, Normal, template!(NameValueStr: "file"), FutureWarnFollowing),
399-
ungated!(no_std, CrateLevel, template!(Word), WarnFollowing),
400-
ungated!(no_implicit_prelude, Normal, template!(Word), WarnFollowing),
398+
ungated!(path, Normal, template!(NameValueStr: "file"), FutureWarnFollowing, @only_local: true),
399+
ungated!(no_std, CrateLevel, template!(Word), WarnFollowing, @only_local: true),
400+
ungated!(no_implicit_prelude, Normal, template!(Word), WarnFollowing, @only_local: true),
401401
ungated!(non_exhaustive, Normal, template!(Word), WarnFollowing),
402402

403403
// Runtime
404404
ungated!(
405405
windows_subsystem, CrateLevel,
406-
template!(NameValueStr: "windows|console"), FutureWarnFollowing
406+
template!(NameValueStr: "windows|console"), FutureWarnFollowing,
407+
@only_local: true
407408
),
408409
ungated!(panic_handler, Normal, template!(Word), WarnFollowing), // RFC 2070
409410

@@ -416,13 +417,17 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
416417
DuplicatesOk, @only_local: true,
417418
),
418419
ungated!(track_caller, Normal, template!(Word), WarnFollowing),
419-
ungated!(instruction_set, Normal, template!(List: "set"), ErrorPreceding),
420+
ungated!(instruction_set, Normal, template!(List: "set"), ErrorPreceding, @only_local: true),
420421
gated!(
421422
no_sanitize, Normal,
422423
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
423-
experimental!(no_sanitize)
424+
@only_local: true, experimental!(no_sanitize)
425+
),
426+
gated!(
427+
coverage, Normal, template!(Word, List: "on|off"),
428+
WarnFollowing, @only_local: true,
429+
coverage_attribute, experimental!(coverage)
424430
),
425-
gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)),
426431

427432
ungated!(
428433
doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk
@@ -431,7 +436,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
431436
// Debugging
432437
ungated!(
433438
debugger_visualizer, Normal,
434-
template!(List: r#"natvis_file = "...", gdb_script_file = "...""#), DuplicatesOk
439+
template!(List: r#"natvis_file = "...", gdb_script_file = "...""#),
440+
DuplicatesOk, @only_local: true
435441
),
436442

437443
// ==========================================================================
@@ -455,26 +461,35 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
455461
marker_trait_attr, experimental!(marker)
456462
),
457463
gated!(
458-
thread_local, Normal, template!(Word), WarnFollowing,
464+
thread_local, Normal, template!(Word), WarnFollowing, @only_local: true,
459465
"`#[thread_local]` is an experimental feature, and does not currently handle destructors",
460466
),
461-
gated!(no_core, CrateLevel, template!(Word), WarnFollowing, experimental!(no_core)),
467+
gated!(
468+
no_core, CrateLevel, template!(Word), WarnFollowing,
469+
@only_local: true, experimental!(no_core)
470+
),
462471
// RFC 2412
463472
gated!(
464-
optimize, Normal, template!(List: "size|speed"), ErrorPreceding, optimize_attribute,
465-
experimental!(optimize),
473+
optimize, Normal, template!(List: "size|speed"), ErrorPreceding,
474+
@only_local: true, optimize_attribute, experimental!(optimize)
466475
),
467476

468-
gated!(ffi_pure, Normal, template!(Word), WarnFollowing, experimental!(ffi_pure)),
469-
gated!(ffi_const, Normal, template!(Word), WarnFollowing, experimental!(ffi_const)),
477+
gated!(
478+
ffi_pure, Normal, template!(Word), WarnFollowing,
479+
@only_local: true, experimental!(ffi_pure)
480+
),
481+
gated!(
482+
ffi_const, Normal, template!(Word), WarnFollowing,
483+
@only_local: true, experimental!(ffi_const)
484+
),
470485
gated!(
471486
register_tool, CrateLevel, template!(List: "tool1, tool2, ..."), DuplicatesOk,
472-
experimental!(register_tool),
487+
@only_local: true, experimental!(register_tool),
473488
),
474489

475490
gated!(
476491
cmse_nonsecure_entry, Normal, template!(Word), WarnFollowing,
477-
experimental!(cmse_nonsecure_entry)
492+
@only_local: true, experimental!(cmse_nonsecure_entry)
478493
),
479494
// RFC 2632
480495
gated!(
@@ -492,11 +507,14 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
492507
// `#[collapse_debuginfo]`
493508
gated!(
494509
collapse_debuginfo, Normal, template!(Word, List: "no|external|yes"), ErrorFollowing,
495-
experimental!(collapse_debuginfo)
510+
@only_local: true, experimental!(collapse_debuginfo)
496511
),
497512

498513
// RFC 2397
499-
gated!(do_not_recommend, Normal, template!(Word), WarnFollowing, experimental!(do_not_recommend)),
514+
gated!(
515+
do_not_recommend, Normal, template!(Word), WarnFollowing,
516+
@only_local: true, experimental!(do_not_recommend)
517+
),
500518

501519
// `#[cfi_encoding = ""]`
502520
gated!(
@@ -528,7 +546,8 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
528546
),
529547
ungated!(
530548
rustc_default_body_unstable, Normal,
531-
template!(List: r#"feature = "name", reason = "...", issue = "N""#), DuplicatesOk
549+
template!(List: r#"feature = "name", reason = "...", issue = "N""#),
550+
DuplicatesOk, @only_local: true
532551
),
533552
gated!(
534553
allow_internal_unstable, Normal, template!(Word, List: "feat1, feat2, ..."), DuplicatesOk,

0 commit comments

Comments
 (0)