Skip to content

Commit

Permalink
Rollup merge of rust-lang#132060 - joshtriplett:innermost-outermost, …
Browse files Browse the repository at this point in the history
…r=jieyouxu

"innermost", "outermost", "leftmost", and "rightmost" don't need hyphens

These are all standard dictionary words and don't require hyphenation.

-----

Encountered an instance of this in error messages and it bugged me, so I
figured I'd fix it across the entire codebase.
  • Loading branch information
fmease authored Oct 23, 2024
2 parents 2f19d5a + ecdc244 commit 5d4e688
Show file tree
Hide file tree
Showing 19 changed files with 45 additions and 45 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_gcc/src/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ impl<'tcx> LayoutGccExt<'tcx> for TyAndLayout<'tcx> {
/// `[T]` becomes `T`, while `str` and `Trait` turn into `i8` - this
/// is useful for indexing slices, as `&[T]`'s data pointer is `T*`.
/// If the type is an unsized struct, the regular layout is generated,
/// with the inner-most trailing unsized field using the "minimal unit"
/// with the innermost trailing unsized field using the "minimal unit"
/// of that field's type - this is useful for taking the address of
/// that field and ensuring the struct has the right alignment.
fn gcc_type<'gcc>(&self, cx: &CodegenCx<'gcc, 'tcx>) -> Type<'gcc> {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_llvm/src/type_of.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyAndLayout<'tcx> {
/// `[T]` becomes `T`, while `str` and `Trait` turn into `i8` - this
/// is useful for indexing slices, as `&[T]`'s data pointer is `T*`.
/// If the type is an unsized struct, the regular layout is generated,
/// with the inner-most trailing unsized field using the "minimal unit"
/// with the innermost trailing unsized field using the "minimal unit"
/// of that field's type - this is useful for taking the address of
/// that field and ensuring the struct has the right alignment.
fn llvm_type<'a>(&self, cx: &CodegenCx<'a, 'tcx>) -> &'a Type {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_codegen_ssa/src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ impl CrateInfo {
// below.
//
// In order to get this left-to-right dependency ordering, we use the reverse
// postorder of all crates putting the leaves at the right-most positions.
// postorder of all crates putting the leaves at the rightmost positions.
let mut compiler_builtins = None;
let mut used_crates: Vec<_> = tcx
.postorder_cnums(())
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_errors/src/emitter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ impl HumanReadableErrorType {
struct Margin {
/// The available whitespace in the left that can be consumed when centering.
pub whitespace_left: usize,
/// The column of the beginning of left-most span.
/// The column of the beginning of leftmost span.
pub span_left: usize,
/// The column of the end of right-most span.
/// The column of the end of rightmost span.
pub span_right: usize,
/// The beginning of the line to be displayed.
pub computed_left: usize,
Expand Down Expand Up @@ -128,7 +128,7 @@ impl Margin {
} else {
0
};
// We want to show as much as possible, max_line_len is the right-most boundary for the
// We want to show as much as possible, max_line_len is the rightmost boundary for the
// relevant code.
self.computed_right = max(max_line_len, self.computed_left);

Expand Down Expand Up @@ -685,7 +685,7 @@ impl HumanEmitter {
buffer.puts(line_offset, code_offset, "...", Style::LineNumber);
}
if margin.was_cut_right(line_len) {
// We have stripped some code after the right-most span end, make it clear we did so.
// We have stripped some code after the rightmost span end, make it clear we did so.
buffer.puts(line_offset, code_offset + taken - 3, "...", Style::LineNumber);
}
buffer.puts(line_offset, 0, &self.maybe_anonymized(line_index), Style::LineNumber);
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ expand_collapse_debuginfo_illegal =
illegal value for attribute #[collapse_debuginfo(no|external|yes)]
expand_count_repetition_misplaced =
`count` can not be placed inside the inner-most repetition
`count` can not be placed inside the innermost repetition
expand_crate_name_in_cfg_attr =
`crate_name` within an `#![cfg_attr]` attribute is forbidden
Expand Down
4 changes: 2 additions & 2 deletions compiler/rustc_expand/src/mbe/metavar_expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ pub(crate) enum MetaVarExpr {
/// Ignore a meta-variable for repetition without expansion.
Ignore(Ident),

/// The index of the repetition at a particular depth, where 0 is the inner-most
/// The index of the repetition at a particular depth, where 0 is the innermost
/// repetition. The `usize` is the depth.
Index(usize),

/// The length of the repetition at a particular depth, where 0 is the inner-most
/// The length of the repetition at a particular depth, where 0 is the innermost
/// repetition. The `usize` is the depth.
Len(usize),
}
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_expand/src/mbe/transcribe.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ fn lockstep_iter_size(
}
}

/// Used solely by the `count` meta-variable expression, counts the outer-most repetitions at a
/// Used solely by the `count` meta-variable expression, counts the outermost repetitions at a
/// given optional nested depth.
///
/// For example, a macro parameter of `$( { $( $foo:ident ),* } )*` called with `{ a, b } { c }`:
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_hir_typeck/src/upvar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2457,7 +2457,7 @@ fn truncate_capture_for_optimization(
) -> (Place<'_>, ty::UpvarCapture) {
let is_shared_ref = |ty: Ty<'_>| matches!(ty.kind(), ty::Ref(.., hir::Mutability::Not));

// Find the right-most deref (if any). All the projections that come after this
// Find the rightmost deref (if any). All the projections that come after this
// are fields or other "in-place pointer adjustments"; these refer therefore to
// data owned by whatever pointer is being dereferenced here.
let idx = place.projections.iter().rposition(|proj| ProjectionKind::Deref == proj.kind);
Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_mir_build/src/build/scope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1048,8 +1048,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// | +------------|outer_scope cache|--+ |
// +------------------------------|middle_scope cache|------+
//
// Now, a new, inner-most scope is added along with a new drop into
// both inner-most and outer-most scopes:
// Now, a new, innermost scope is added along with a new drop into
// both innermost and outermost scopes:
//
// +------------------------------------------------------------+
// | +----------------------------------+ |
Expand All @@ -1061,11 +1061,11 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
// +----=----------------|invalid middle_scope cache|-----------+
//
// If, when adding `drop(new)` we do not invalidate the cached blocks for both
// outer_scope and middle_scope, then, when building drops for the inner (right-most)
// outer_scope and middle_scope, then, when building drops for the inner (rightmost)
// scope, the old, cached blocks, without `drop(new)` will get used, producing the
// wrong results.
//
// Note that this code iterates scopes from the inner-most to the outer-most,
// Note that this code iterates scopes from the innermost to the outermost,
// invalidating caches of each scope visited. This way bare minimum of the
// caches gets invalidated. i.e., if a new drop is added into the middle scope, the
// cache of outer scope stays intact.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_dataflow/src/value_analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1177,7 +1177,7 @@ struct PlaceInfo<'tcx> {
/// The projection used to go from parent to this node (only None for root).
proj_elem: Option<TrackElem>,

/// The left-most child.
/// The leftmost child.
first_child: Option<PlaceIndex>,

/// Index of the sibling to the right of this node.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_parse/src/lexer/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ pub(super) fn report_suspicious_mismatch_block(
}
}

// Find the inner-most span candidate for final report
// Find the innermost span candidate for final report
let candidate_span =
matched_spans.into_iter().rev().find(|&(_, same_ident)| !same_ident).map(|(span, _)| span);

Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/append.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ impl<K, V> Root<K, V> {
}
open_node.push(key, value, right_tree);

// Go down to the right-most leaf again.
// Go down to the rightmost leaf again.
cur_node = open_node.forget_type().last_leaf_edge().into_node();
}

Expand Down
2 changes: 1 addition & 1 deletion library/alloc/src/collections/btree/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl<K, V> Root<K, V> {
pub fn fix_right_border_of_plentiful(&mut self) {
let mut cur_node = self.borrow_mut();
while let Internal(internal) = cur_node.force() {
// Check if right-most child is underfull.
// Check if rightmost child is underfull.
let mut last_kv = internal.last_kv().consider_for_balancing();
debug_assert!(last_kv.left_child_len() >= MIN_LEN * 2);
let right_child_len = last_kv.right_child_len();
Expand Down
4 changes: 2 additions & 2 deletions library/alloc/src/collections/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,7 +1521,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {
right_node.val_area_mut(..count - 1),
);

// Move the left-most stolen pair to the parent.
// Move the leftmost stolen pair to the parent.
let k = left_node.key_area_mut(new_left_len).assume_init_read();
let v = left_node.val_area_mut(new_left_len).assume_init_read();
let (k, v) = self.parent.replace_kv(k, v);
Expand Down Expand Up @@ -1570,7 +1570,7 @@ impl<'a, K: 'a, V: 'a> BalancingContext<'a, K, V> {

// Move leaf data.
{
// Move the right-most stolen pair to the parent.
// Move the rightmost stolen pair to the parent.
let k = right_node.key_area_mut(count - 1).assume_init_read();
let v = right_node.val_area_mut(count - 1).assume_init_read();
let (k, v) = self.parent.replace_kv(k, v);
Expand Down
2 changes: 1 addition & 1 deletion library/core/src/iter/adapters/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub use self::{
/// this can be useful for specializing [`FromIterator`] implementations or recovering the
/// remaining elements after an iterator has been partially exhausted.
///
/// Note that implementations do not necessarily have to provide access to the inner-most
/// Note that implementations do not necessarily have to provide access to the innermost
/// source of a pipeline. A stateful intermediate adapter might eagerly evaluate a part
/// of the pipeline and expose its internal storage as source.
///
Expand Down
2 changes: 1 addition & 1 deletion src/doc/rustc/src/symbol-mangling/v0.md
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ The compiler has some latitude in how an entity is encoded as long as the symbol
* Named functions, methods, and statics shall be represented by a *[path]* production.
* Paths should be rooted at the inner-most entity that can act as a path root.
* Paths should be rooted at the innermost entity that can act as a path root.
Roots can be crate-ids, inherent impls, trait impls, and (for items within default methods) trait definitions.
* The compiler is free to choose disambiguation indices and namespace tags from
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ fn main() {
macro_rules! one_nested_count_and_len {
( $( [ $( $l:literal ),* ] ),* ) => {
[
// outer-most repetition
// outermost repetition
$(
// inner-most repetition
// innermost repetition
$(
${ignore($l)} ${index()}, ${len()},
)*
Expand All @@ -23,34 +23,34 @@ fn main() {
[
// # ["foo"]

// ## inner-most repetition (first iteration)
// ## innermost repetition (first iteration)
//
// `index` is 0 because this is the first inner-most iteration.
// `len` is 1 because there is only one inner-most repetition, "foo".
// `index` is 0 because this is the first innermost iteration.
// `len` is 1 because there is only one innermost repetition, "foo".
0, 1,
// ## outer-most repetition (first iteration)
// ## outermost repetition (first iteration)
//
// `count` is 1 because of "foo", i,e, `$l` has only one repetition,
// `index` is 0 because this is the first outer-most iteration.
// `len` is 2 because there are 2 outer-most repetitions, ["foo"] and ["bar", "baz"]
// `index` is 0 because this is the first outermost iteration.
// `len` is 2 because there are 2 outermost repetitions, ["foo"] and ["bar", "baz"]
1, 0, 2,
// # ["bar", "baz"]

// ## inner-most repetition (first iteration)
// ## innermost repetition (first iteration)
//
// `index` is 0 because this is the first inner-most iteration
// `index` is 0 because this is the first innermost iteration
// `len` is 2 because there are repetitions, "bar" and "baz"
0, 2,
// ## inner-most repetition (second iteration)
// ## innermost repetition (second iteration)
//
// `index` is 1 because this is the second inner-most iteration
// `index` is 1 because this is the second innermost iteration
// `len` is 2 because there are repetitions, "bar" and "baz"
1, 2,
// ## outer-most repetition (second iteration)
// ## outermost repetition (second iteration)
//
// `count` is 2 because of "bar" and "baz", i,e, `$l` has two repetitions,
// `index` is 1 because this is the second outer-most iteration
// `len` is 2 because there are 2 outer-most repetitions, ["foo"] and ["bar", "baz"]
// `index` is 1 because this is the second outermost iteration
// `len` is 2 because there are 2 outermost repetitions, ["foo"] and ["bar", "baz"]
2, 1, 2,
// # last count

Expand All @@ -61,7 +61,7 @@ fn main() {

// Based on the above explanation, the following macros should be straightforward

// Grouped from the outer-most to the inner-most
// Grouped from the outermost to the innermost
macro_rules! three_nested_count {
( $( { $( [ $( ( $( $i:ident )* ) )* ] )* } )* ) => {
&[
Expand Down Expand Up @@ -156,7 +156,7 @@ fn main() {
][..]
);

// Grouped from the outer-most to the inner-most
// Grouped from the outermost to the innermost
macro_rules! three_nested_len {
( $( { $( [ $( ( $( $i:ident )* ) )* ] )* } )* ) => {
&[
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ macro_rules! curly__no_rhs_dollar__round {

macro_rules! curly__no_rhs_dollar__no_round {
( $i:ident ) => { ${ count($i) } };
//~^ ERROR `count` can not be placed inside the inner-most repetition
//~^ ERROR `count` can not be placed inside the innermost repetition
}

macro_rules! curly__rhs_dollar__no_round {
( $i:ident ) => { ${ count($i) } };
//~^ ERROR `count` can not be placed inside the inner-most repetition
//~^ ERROR `count` can not be placed inside the innermost repetition
}

#[rustfmt::skip] // autoformatters can break a few of the error traces
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/macros/rfc-3086-metavar-expr/syntax-errors.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,13 @@ error: expected identifier or string literal
LL | ( $( $i:ident ),* ) => { ${ {} } };
| ^^

error: `count` can not be placed inside the inner-most repetition
error: `count` can not be placed inside the innermost repetition
--> $DIR/syntax-errors.rs:12:24
|
LL | ( $i:ident ) => { ${ count($i) } };
| ^^^^^^^^^^^^^

error: `count` can not be placed inside the inner-most repetition
error: `count` can not be placed inside the innermost repetition
--> $DIR/syntax-errors.rs:17:24
|
LL | ( $i:ident ) => { ${ count($i) } };
Expand Down

0 comments on commit 5d4e688

Please sign in to comment.