1
Fork 0

chore: Fix typos in 'compiler' (batch 2)

This commit is contained in:
Alexander Cyon 2024-09-02 07:50:22 +02:00
parent 78d5c04d9c
commit 00de006f22
No known key found for this signature in database
34 changed files with 54 additions and 54 deletions

View file

@ -32,7 +32,7 @@ pub fn eliminate<'tcx>(tcx: TyCtxt<'tcx>, body: &mut Body<'tcx>) {
let borrowed_locals = borrowed_locals(body);
// If the user requests complete debuginfo, mark the locals that appear in it as live, so
// we don't remove assignements to them.
// we don't remove assignments to them.
let mut always_live = debuginfo_locals(body);
always_live.union(&borrowed_locals);

View file

@ -38,7 +38,7 @@
//! not contain any indirection through a pointer or any indexing projections.
//!
//! * `p` and `q` must have the **same type**. If we replace a local with a subtype or supertype,
//! we may end up with a differnet vtable for that local. See the `subtyping-impacts-selection`
//! we may end up with a different vtable for that local. See the `subtyping-impacts-selection`
//! tests for an example where that causes issues.
//!
//! * We need to make sure that the goal of "merging the memory" is actually structurally possible

View file

@ -914,7 +914,7 @@ impl<'tcx> Visitor<'tcx> for CanConstProp {
fn visit_place(&mut self, place: &Place<'tcx>, mut context: PlaceContext, loc: Location) {
use rustc_middle::mir::visit::PlaceContext::*;
// Dereferencing just read the addess of `place.local`.
// Dereferencing just read the address of `place.local`.
if place.projection.first() == Some(&PlaceElem::Deref) {
context = NonMutatingUse(NonMutatingUseContext::Copy);
}

View file

@ -289,7 +289,7 @@ fn can_cast(
#[derive(Default)]
struct SimplifyToExp {
transfrom_kinds: Vec<TransfromKind>,
transform_kinds: Vec<TransformKind>,
}
#[derive(Clone, Copy)]
@ -302,17 +302,17 @@ enum ExpectedTransformKind<'tcx, 'a> {
Cast { place: &'a Place<'tcx>, ty: Ty<'tcx> },
}
enum TransfromKind {
enum TransformKind {
Same,
Cast,
}
impl From<ExpectedTransformKind<'_, '_>> for TransfromKind {
impl From<ExpectedTransformKind<'_, '_>> for TransformKind {
fn from(compare_type: ExpectedTransformKind<'_, '_>) -> Self {
match compare_type {
ExpectedTransformKind::Same(_) => TransfromKind::Same,
ExpectedTransformKind::SameByEq { .. } => TransfromKind::Same,
ExpectedTransformKind::Cast { .. } => TransfromKind::Cast,
ExpectedTransformKind::Same(_) => TransformKind::Same,
ExpectedTransformKind::SameByEq { .. } => TransformKind::Same,
ExpectedTransformKind::Cast { .. } => TransformKind::Cast,
}
}
}
@ -475,7 +475,7 @@ impl<'tcx> SimplifyMatch<'tcx> for SimplifyToExp {
}
}
}
self.transfrom_kinds = expected_transform_kinds.into_iter().map(|c| c.into()).collect();
self.transform_kinds = expected_transform_kinds.into_iter().map(|c| c.into()).collect();
Some(())
}
@ -493,13 +493,13 @@ impl<'tcx> SimplifyMatch<'tcx> for SimplifyToExp {
let (_, first) = targets.iter().next().unwrap();
let first = &bbs[first];
for (t, s) in iter::zip(&self.transfrom_kinds, &first.statements) {
for (t, s) in iter::zip(&self.transform_kinds, &first.statements) {
match (t, &s.kind) {
(TransfromKind::Same, _) => {
(TransformKind::Same, _) => {
patch.add_statement(parent_end, s.kind.clone());
}
(
TransfromKind::Cast,
TransformKind::Cast,
StatementKind::Assign(box (lhs, Rvalue::Use(Operand::Constant(f_c)))),
) => {
let operand = Operand::Copy(Place::from(discr_local));

View file

@ -498,7 +498,7 @@ impl<'tcx> Validator<'_, 'tcx> {
Some(x) if x != 0 => {} // okay
_ => return Err(Unpromotable), // value not known or 0 -- not okay
}
// Furthermore, for signed divison, we also have to exclude `int::MIN / -1`.
// Furthermore, for signed division, we also have to exclude `int::MIN / -1`.
if lhs_ty.is_signed() {
match rhs_val.map(|x| x.to_int(sz)) {
Some(-1) | None => {

View file

@ -345,7 +345,7 @@ fn fully_replacable_locals(ssa: &SsaLocals) -> BitSet<Local> {
replacable
}
/// Utility to help performing subtitution of `*pattern` by `target`.
/// Utility to help performing substitution of `*pattern` by `target`.
struct Replacer<'tcx> {
tcx: TyCtxt<'tcx>,
targets: IndexVec<Local, Value<'tcx>>,