Skip to content

Commit

Permalink
Rename OptimizeAttr::None to Default
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed Jan 24, 2025
1 parent 7a9661d commit 5ac95a5
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
6 changes: 4 additions & 2 deletions compiler/rustc_attr_data_structures/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ pub enum InstructionSetAttr {
ArmT32,
}

#[derive(Clone, Encodable, Decodable, Debug, HashStable_Generic)]
#[derive(Clone, Encodable, Decodable, Debug, PartialEq, Eq, HashStable_Generic, Default)]
pub enum OptimizeAttr {
None,
/// No `#[optimize(..)]` attribute
#[default]
Default,
/// `#[optimize(none)]`
DoNotOptimize,
/// `#[optimize(speed)]`
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ pub(crate) fn llfn_attrs_from_instance<'ll, 'tcx>(
let mut to_add = SmallVec::<[_; 16]>::new();

match codegen_fn_attrs.optimize {
OptimizeAttr::None => {
OptimizeAttr::Default => {
to_add.extend(default_optimisation_attrs(cx));
}
OptimizeAttr::DoNotOptimize => {
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_ssa/src/codegen_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
codegen_fn_attrs.inline = InlineAttr::Never;
}

codegen_fn_attrs.optimize = attrs.iter().fold(OptimizeAttr::None, |ia, attr| {
codegen_fn_attrs.optimize = attrs.iter().fold(OptimizeAttr::Default, |ia, attr| {
if !attr.has_name(sym::optimize) {
return ia;
}
Expand All @@ -587,7 +587,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
inline_span = Some(attr.span);
if items.len() != 1 {
err(attr.span, "expected one argument");
OptimizeAttr::None
OptimizeAttr::Default
} else if list_contains_name(items, sym::size) {
OptimizeAttr::Size
} else if list_contains_name(items, sym::speed) {
Expand All @@ -596,10 +596,10 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
OptimizeAttr::DoNotOptimize
} else {
err(items[0].span(), "invalid argument");
OptimizeAttr::None
OptimizeAttr::Default
}
} else {
OptimizeAttr::None
OptimizeAttr::Default
}
});

Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_middle/src/middle/codegen_fn_attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ impl CodegenFnAttrs {
CodegenFnAttrs {
flags: CodegenFnAttrFlags::empty(),
inline: InlineAttr::None,
optimize: OptimizeAttr::None,
optimize: OptimizeAttr::Default,
export_name: None,
link_name: None,
link_ordinal: None,
Expand Down

0 comments on commit 5ac95a5

Please sign in to comment.