Skip to content

Commit 6451592

Browse files
committed
name the variant better
1 parent 8655cb8 commit 6451592

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

compiler/rustc_attr_parsing/src/attributes/codegen_attrs.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ impl<S: Stage> NoArgsAttributeParser<S> for NoMangleParser {
370370
pub(crate) struct UsedParser {
371371
first_compiler: Option<Span>,
372372
first_linker: Option<Span>,
373-
first_generic: Option<Span>,
373+
first_default: Option<Span>,
374374
}
375375

376376
// A custom `AttributeParser` is used rather than a Simple attribute parser because
@@ -383,7 +383,7 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
383383
template!(Word, List: &["compiler", "linker"]),
384384
|group: &mut Self, cx, args| {
385385
let used_by = match args {
386-
ArgParser::NoArgs => UsedBy::Any,
386+
ArgParser::NoArgs => UsedBy::Default,
387387
ArgParser::List(list) => {
388388
let Some(l) = list.single() else {
389389
cx.expected_single_argument(list.span);
@@ -432,18 +432,18 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
432432
let target = match used_by {
433433
UsedBy::Compiler => &mut group.first_compiler,
434434
UsedBy::Linker => {
435-
if let Some(prev) = group.first_generic {
435+
if let Some(prev) = group.first_default {
436436
cx.warn_unused_duplicate(prev, attr_span);
437437
return;
438438
}
439439
&mut group.first_linker
440440
}
441-
UsedBy::Any => {
441+
UsedBy::Default => {
442442
if let Some(prev) = group.first_linker {
443443
cx.warn_unused_duplicate(prev, attr_span);
444444
return;
445445
}
446-
&mut group.first_generic
446+
&mut group.first_default
447447
}
448448
};
449449

@@ -460,10 +460,10 @@ impl<S: Stage> AttributeParser<S> for UsedParser {
460460
fn finalize(self, _cx: &FinalizeContext<'_, '_, S>) -> Option<AttributeKind> {
461461
// If a specific form of `used` is specified, it takes precedence over generic `#[used]`.
462462
// If both `linker` and `compiler` are specified, use `linker`.
463-
Some(match (self.first_compiler, self.first_linker, self.first_generic) {
463+
Some(match (self.first_compiler, self.first_linker, self.first_default) {
464464
(_, Some(span), _) => AttributeKind::Used { used_by: UsedBy::Linker, span },
465465
(Some(span), _, _) => AttributeKind::Used { used_by: UsedBy::Compiler, span },
466-
(_, _, Some(span)) => AttributeKind::Used { used_by: UsedBy::Any, span },
466+
(_, _, Some(span)) => AttributeKind::Used { used_by: UsedBy::Default, span },
467467
(None, None, None) => return None,
468468
})
469469
}

compiler/rustc_codegen_ssa/src/codegen_attrs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ fn process_builtin_attrs(
263263
AttributeKind::Used { used_by, .. } => match used_by {
264264
UsedBy::Compiler => codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED_COMPILER,
265265
UsedBy::Linker => codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED_LINKER,
266-
UsedBy::Any => {
266+
UsedBy::Default => {
267267
let used_form = if tcx.sess.target.os == "illumos" {
268268
// illumos' `ld` doesn't support a section header that would represent
269269
// `#[used(linker)]`, see

compiler/rustc_hir/src/attrs/data_structures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ impl Deprecation {
152152
#[derive(Encodable, Decodable, Copy, Clone, Debug, PartialEq, Eq, Hash)]
153153
#[derive(HashStable_Generic, PrintAttribute)]
154154
pub enum UsedBy {
155-
Any,
155+
Default,
156156
Compiler,
157157
Linker,
158158
}

0 commit comments

Comments
 (0)