Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix typos #1192

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# See https://github.com/crate-ci/typos/blob/master/docs/reference.md to configure typos

[default]
extend-ignore-re = [
"__fpr",
"(?i)TYPDEF_DECL",
"ParmVarDecl",
"CharLits",
"hpe_",
"reachable_froms",
"(\\$ot|ot =|ot\\.| ot\\)|ot_ty)",
]

[default.extend-identifiers]
mapp = "mapp"
inouts = "inouts"

[default.extend-words]
clen = "clen"

[files]
extend-exclude = [
"examples/*",
"*.asc",
]
2 changes: 1 addition & 1 deletion c2rust-analyze/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ impl<'a, 'tcx> AnalysisCtxt<'a, 'tcx> {
/// - let r1 = std::ptr::addr_of!(x.field);
/// - let r2 = &x.field;
/// - let r3 = &(*p).field;
/// The following will NOT satisfy that critera:
/// The following will NOT satisfy that criteria:
/// - let r1 = x.field;
/// - let r2 = x.field + y;
pub fn has_field_projection(&self, rv: &Rvalue<'tcx>) -> bool {
Expand Down
10 changes: 5 additions & 5 deletions c2rust-refactor/gen/rewrite.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,18 +308,18 @@ def do_rewrite_impl(d):
yield ' fn rewrite(old: &Self, new: &Self, mut rcx: RewriteCtxtRef) -> bool {'
if has_field(d, 'id'):
yield ' trace!("{:?}: rewrite: begin (%s)", new.id);' % d.name
for strat in get_rewrite_strategies(d):
for strategy in get_rewrite_strategies(d):
yield ' let mark = rcx.mark();'
if has_field(d, 'id'):
yield ' trace!("{:?}: rewrite: try %s", new.id);' % strat
yield ' let ok = strategy::%s::rewrite(old, new, rcx.borrow());' % strat
yield ' trace!("{:?}: rewrite: try %s", new.id);' % strategy
yield ' let ok = strategy::%s::rewrite(old, new, rcx.borrow());' % strategy
yield ' if ok {'
if has_field(d, 'id'):
yield ' trace!("{:?}: rewrite: %s succeeded", new.id);' % strat
yield ' trace!("{:?}: rewrite: %s succeeded", new.id);' % strategy
yield ' return true;'
yield ' } else {'
if has_field(d, 'id'):
yield ' trace!("{:?}: rewrite: %s FAILED", new.id);' % strat
yield ' trace!("{:?}: rewrite: %s FAILED", new.id);' % strategy
yield ' rcx.rewind(mark);'
yield ' }'
yield ''
Expand Down
2 changes: 1 addition & 1 deletion c2rust-refactor/src/analysis/ownership/constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ impl<'lty, 'tcx> ConstraintSet<'lty> {
for (i, &pi) in ps.iter().enumerate() {
// This check handles cycles. Suppose `a <= b <= c <= a` and `d <= e`. We'd
// like to replace `min(a, b, c, d, e)` with `min(a, d)`. Without this check,
// we would end up with `min()`, becuase `a` eliminates `b` and `c`, `b` and
// we would end up with `min()`, because `a` eliminates `b` and `c`, `b` and
// `c` eliminate `a`, and `d` and `e` remove each other. This check doesn't
// cause us to miss any valid removals because if `a <= b` and `b <= x` then
// also `a <= x`.
Expand Down
10 changes: 5 additions & 5 deletions c2rust-refactor/tests/misc/analysis_type_eq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,28 @@ fn do_printf() {
}
}

struct Clonable1 {
struct Cloneable1 {
x: i32,
y: i32,
}

impl Clonable1 {
impl Cloneable1 {
fn get_x(&self) -> i32 {
self.x
}
}

impl Clone for Clonable1 {
impl Clone for Cloneable1 {
fn clone(&self) -> Self {
Clonable1 {
Cloneable1 {
x: self.x,
y: self.y,
}
}
}

#[derive(Clone)]
struct Clonable2 {
struct Cloneable2 {
x: i32,
y: i32,
}
Expand Down
12 changes: 7 additions & 5 deletions c2rust-transpile/src/c_ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,9 +324,11 @@ impl TypedAstContext {
match self.index(typ).kind {
CTypeKind::Typedef(decl) => match &self.index(decl).kind {
CDeclKind::Typedef {
name: nam, typ: ty, ..
name: name_,
typ: ty,
..
} => {
if nam == "__builtin_va_list" {
if name_ == "__builtin_va_list" {
true
} else {
self.is_builtin_va_list(ty.ctype)
Expand All @@ -352,11 +354,11 @@ impl TypedAstContext {
match resolved_ctype.kind {
Struct(record_id) => {
if let CDeclKind::Struct {
name: Some(ref nam),
name: Some(ref name_),
..
} = &self[record_id].kind
{
nam == "__va_list_tag" || nam == "__va_list"
name_ == "__va_list_tag" || name_ == "__va_list"
} else {
false
}
Expand Down Expand Up @@ -1682,7 +1684,7 @@ pub enum CTypeKind {
Half,
BFloat16,

// ARM Scalable Vector Extention types
// ARM Scalable Vector Extension types
// TODO: represent all the individual types in AArch64SVEACLETypes.def
UnhandledSveType,
}
Expand Down