Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
klensy committed Dec 7, 2024
1 parent 5290542 commit 70744fd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion compiler/rustc_feature/src/accepted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ declare_features! (
(accepted, self_in_typedefs, "1.32.0", Some(49303)),
/// Allows `Self` struct constructor (RFC 2302).
(accepted, self_struct_ctor, "1.32.0", Some(51994)),
/// Shortern the tail expression lifetime
/// Shorten the tail expression lifetime
(accepted, shorter_tail_lifetimes, "1.84.0", Some(123739)),
/// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
(accepted, slice_patterns, "1.42.0", Some(62254)),
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_mir_transform/src/gvn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
//! _b = some other value // also has VnIndex i
//! ```
//!
//! We consider it to be replacable by:
//! We consider it to be replaceable by:
//! ```ignore (MIR)
//! _a = some value // has VnIndex i
//! // some MIR
Expand Down
20 changes: 10 additions & 10 deletions compiler/rustc_mir_transform/src/ref_prop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ fn compute_replacement<'tcx>(
// reborrowed references.
let mut storage_to_remove = BitSet::new_empty(body.local_decls.len());

let fully_replacable_locals = fully_replacable_locals(ssa);
let fully_replaceable_locals = fully_replaceable_locals(ssa);

// Returns true iff we can use `place` as a pointee.
//
Expand Down Expand Up @@ -200,7 +200,7 @@ fn compute_replacement<'tcx>(
let needs_unique = ty.is_mutable_ptr();

// If this a mutable reference that we cannot fully replace, mark it as unknown.
if needs_unique && !fully_replacable_locals.contains(local) {
if needs_unique && !fully_replaceable_locals.contains(local) {
debug!("not fully replaceable");
continue;
}
Expand Down Expand Up @@ -299,7 +299,7 @@ fn compute_replacement<'tcx>(

// This a reborrow chain, recursively allow the replacement.
//
// This also allows to detect cases where `target.local` is not replacable,
// This also allows to detect cases where `target.local` is not replaceable,
// and mark it as such.
if let &[PlaceElem::Deref] = &target.projection[..] {
assert!(perform_opt);
Expand All @@ -309,7 +309,7 @@ fn compute_replacement<'tcx>(
} else if perform_opt {
self.allowed_replacements.insert((target.local, loc));
} else if needs_unique {
// This mutable reference is not fully replacable, so drop it.
// This mutable reference is not fully replaceable, so drop it.
self.targets[place.local] = Value::Unknown;
}
}
Expand All @@ -322,22 +322,22 @@ fn compute_replacement<'tcx>(

/// Compute the set of locals that can be fully replaced.
///
/// We consider a local to be replacable iff it's only used in a `Deref` projection `*_local` or
/// We consider a local to be replaceable iff it's only used in a `Deref` projection `*_local` or
/// non-use position (like storage statements and debuginfo).
fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet<Local> {
let mut replacable = BitSet::new_empty(ssa.num_locals());
fn fully_replaceable_locals(ssa: &SsaLocals) -> BitSet<Local> {
let mut replaceable = BitSet::new_empty(ssa.num_locals());

// First pass: for each local, whether its uses can be fully replaced.
for local in ssa.locals() {
if ssa.num_direct_uses(local) == 0 {
replacable.insert(local);
replaceable.insert(local);
}
}

// Second pass: a local can only be fully replaced if all its copies can.
ssa.meet_copy_equivalence(&mut replacable);
ssa.meet_copy_equivalence(&mut replaceable);

replacable
replaceable
}

/// Utility to help performing substitution of `*pattern` by `target`.
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_pattern_analysis/src/usefulness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
//! [`Constructor::is_covered_by`].
//!
//! Note 1: variable bindings (like the `x` in `Some(x)`) match anything, so we treat them as wildcards.
//! Note 2: this only applies to matchable values. For example a value of type `Rc<u64>` can't be
//! Note 2: this only applies to matcheable values. For example a value of type `Rc<u64>` can't be
//! deconstructed that way.
//!
//!
Expand Down
7 changes: 4 additions & 3 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
[files]
extend-exclude = [
# ./compiler excludes
# exclude git (sub)modules and generated content
"compiler/rustc_codegen_gcc",
"compiler/rustc_codegen_cranelift",
"compiler/rustc_baked_icu_data",
]

[default.extend-words]
# Add exclusions here, lines should be like `x = "x"`, where `x` is excluded word.
#
# Also see docs: https://github.com/crate-ci/typos/blob/v1.28.2/docs/reference.md
thir = "thir"
padd = "padd"
rplace = "rplace"
Expand All @@ -22,9 +25,7 @@ makro = "makro"
optin = "optin"
parm = "parm"
EXCED = "EXCED"
Shortern = "Shortern"
unparseable = "unparseable"
replacable = "replacable"
matcheable = "matcheable"

[default]
Expand Down

0 comments on commit 70744fd

Please sign in to comment.