Skip to content

Commit

Permalink
Rollup merge of #124463 - gurry:rename-func, r=TaKO8Ki
Browse files Browse the repository at this point in the history
Rename `inhibit_union_abi_opt()` to `inhibits_union_abi_opt()`

`inihibit` seems to suggest that this function will inhibit optimizations whereas `inhibits` correctly indicates that it will merely _check_ that. With `inhibits` if conditions read more naturally e.g.:

```rust
if repr.inhibits_union_abi_opt() {
}
```
  • Loading branch information
matthiaskrgr authored Apr 28, 2024
2 parents a777138 + 4aafec1 commit 7ab3997
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ pub trait LayoutCalculator {
// If all the non-ZST fields have the same ABI and union ABI optimizations aren't
// disabled, we can use that common ABI for the union as a whole.
struct AbiMismatch;
let mut common_non_zst_abi_and_align = if repr.inhibit_union_abi_opt() {
let mut common_non_zst_abi_and_align = if repr.inhibits_union_abi_opt() {
// Can't optimize
Err(AbiMismatch)
} else {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_abi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ impl ReprOptions {
}

/// Returns `true` if this `#[repr()]` should inhibit union ABI optimisations.
pub fn inhibit_union_abi_opt(&self) -> bool {
pub fn inhibits_union_abi_opt(&self) -> bool {
self.c()
}
}
Expand Down

0 comments on commit 7ab3997

Please sign in to comment.