Skip to content

Commit 640c067

Browse files
authored
Merge pull request #707 from rust-lang/spell-check
Run cspell in the CI
2 parents b4be0b9 + 323432a commit 640c067

File tree

15 files changed

+143
-18
lines changed

15 files changed

+143
-18
lines changed

.cspell.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"allowCompoundWords": true,
3+
"dictionaries": ["cpp", "rust-extra", "rustc_codegen_gcc"],
4+
"dictionaryDefinitions": [
5+
{
6+
"name": "rust-extra",
7+
"path": "tools/cspell_dicts/rust.txt",
8+
"addWords": true
9+
},
10+
{
11+
"name": "rustc_codegen_gcc",
12+
"path": "tools/cspell_dicts/rustc_codegen_gcc.txt",
13+
"addWords": true
14+
}
15+
],
16+
"files": [
17+
"src/**/*.rs"
18+
],
19+
"ignorePaths": [
20+
"src/intrinsic/archs.rs",
21+
"src/intrinsic/llvm.rs"
22+
],
23+
"ignoreRegExpList": [
24+
"/(FIXME|NOTE|TODO)\\([^)]+\\)/",
25+
"__builtin_\\w*"
26+
]
27+
}

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ jobs:
117117
steps:
118118
- uses: actions/checkout@v4
119119
- uses: crate-ci/[email protected]
120+
- uses: streetsidesoftware/cspell-action@v7
120121

121122
build_system:
122123
runs-on: ubuntu-24.04

src/asm.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// cSpell:ignoreRegExp [afkspqvwy]reg
2+
13
use std::borrow::Cow;
24

35
use gccjit::{LValue, RValue, ToRValue, Type};
@@ -138,7 +140,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
138140
// `outputs.len() + inputs.len()`.
139141
let mut labels = vec![];
140142

141-
// Clobbers collected from `out("explicit register") _` and `inout("expl_reg") var => _`
143+
// Clobbers collected from `out("explicit register") _` and `inout("explicit_reg") var => _`
142144
let mut clobbers = vec![];
143145

144146
// We're trying to preallocate space for the template
@@ -203,7 +205,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
203205
// is also used as an in register, do not add it to the clobbers list.
204206
// it will be treated as a lateout register with `out_place: None`
205207
if !late {
206-
bug!("input registers can only be used as lateout regisers");
208+
bug!("input registers can only be used as lateout registers");
207209
}
208210
("r", dummy_output_type(self.cx, reg.reg_class()))
209211
} else {

src/back/lto.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@
1111
// does not remove it?
1212
//
1313
// TODO(antoyo): for performance, check which optimizations the C++ frontend enables.
14-
//
14+
// cSpell:disable
1515
// Fix these warnings:
1616
// /usr/bin/ld: warning: type of symbol `_RNvNvNvNtCs5JWOrf9uCus_5rayon11thread_pool19WORKER_THREAD_STATE7___getit5___KEY' changed from 1 to 6 in /tmp/ccKeUSiR.ltrans0.ltrans.o
1717
// /usr/bin/ld: warning: type of symbol `_RNvNvNvNvNtNtNtCsAj5i4SGTR7_3std4sync4mpmc5waker17current_thread_id5DUMMY7___getit5___KEY' changed from 1 to 6 in /tmp/ccKeUSiR.ltrans0.ltrans.o
1818
// /usr/bin/ld: warning: incremental linking of LTO and non-LTO objects; using -flinker-output=nolto-rel which will bypass whole program optimization
19+
// cSpell:enable
1920
use std::ffi::{CStr, CString};
2021
use std::fs::{self, File};
2122
use std::path::{Path, PathBuf};

src/back/write.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,15 @@ pub(crate) fn codegen(
186186

187187
if fat_lto {
188188
let lto_path = format!("{}.lto", path);
189+
// cSpell:disable
189190
// FIXME(antoyo): The LTO frontend generates the following warning:
190191
// ../build_sysroot/sysroot_src/library/core/src/num/dec2flt/lemire.rs:150:15: warning: type of ‘_ZN4core3num7dec2flt5table17POWER_OF_FIVE_12817ha449a68fb31379e4E’ does not match original declaration [-Wlto-type-mismatch]
191192
// 150 | let (lo5, hi5) = POWER_OF_FIVE_128[index];
192193
// | ^
193194
// lto1: note: ‘_ZN4core3num7dec2flt5table17POWER_OF_FIVE_12817ha449a68fb31379e4E’ was previously declared here
194195
//
195196
// This option is to mute it to make the UI tests pass with LTO enabled.
197+
// cSpell:enable
196198
context.add_driver_option("-Wno-lto-type-mismatch");
197199
// NOTE: this doesn't actually generate an executable. With the above
198200
// flags, it combines the .o files together in another .o.

src/builder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,13 +1034,13 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> {
10341034
let b_offset = a.size(self).align_to(b.align(self).abi);
10351035

10361036
let mut load = |i, scalar: &abi::Scalar, align| {
1037-
let llptr = if i == 0 {
1037+
let ptr = if i == 0 {
10381038
place.val.llval
10391039
} else {
10401040
self.inbounds_ptradd(place.val.llval, self.const_usize(b_offset.bytes()))
10411041
};
10421042
let llty = place.layout.scalar_pair_element_gcc_type(self, i);
1043-
let load = self.load(llty, llptr, align);
1043+
let load = self.load(llty, ptr, align);
10441044
scalar_load_metadata(self, load, scalar);
10451045
if scalar.is_bool() { self.trunc(load, self.type_i1()) } else { load }
10461046
};

src/callee.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>)
3434
unreachable!();
3535
/*
3636
// Create a fn pointer with the new signature.
37-
let ptrty = fn_abi.ptr_to_gcc_type(cx);
37+
let ptrtype = fn_abi.ptr_to_gcc_type(cx);
3838
3939
// This is subtle and surprising, but sometimes we have to bitcast
4040
// the resulting fn pointer. The reason has to do with external
@@ -59,7 +59,7 @@ pub fn get_fn<'gcc, 'tcx>(cx: &CodegenCx<'gcc, 'tcx>, instance: Instance<'tcx>)
5959
// This can occur on either a crate-local or crate-external
6060
// reference. It also occurs when testing libcore and in some
6161
// other weird situations. Annoying.
62-
if cx.val_ty(func) != ptrty {
62+
if cx.val_ty(func) != ptrtype {
6363
// TODO(antoyo): cast the pointer.
6464
func
6565
}

src/context.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,8 @@ impl<'gcc, 'tcx> MiscCodegenMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
443443
// `rust_eh_personality` function, but rather we wired it up to the
444444
// CRT's custom personality function, which forces LLVM to consider
445445
// landing pads as "landing pads for SEH".
446-
if let Some(llpersonality) = self.eh_personality.get() {
447-
return llpersonality;
446+
if let Some(personality_func) = self.eh_personality.get() {
447+
return personality_func;
448448
}
449449
let tcx = self.tcx;
450450
let func = match tcx.lang_items().eh_personality() {

src/gcc_util.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
150150
// To find a list of GCC's names, check https://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
151151
pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]> {
152152
let arch = if sess.target.arch == "x86_64" { "x86" } else { &*sess.target.arch };
153+
// cSpell:disable
153154
match (arch, s) {
154155
// FIXME: seems like x87 does not exist?
155156
("x86", "x87") => smallvec![],
@@ -188,6 +189,7 @@ pub fn to_gcc_features<'a>(sess: &Session, s: &'a str) -> SmallVec<[&'a str; 2]>
188189
("aarch64", "sve2-bitperm") => smallvec!["sve2-bitperm", "neon"],
189190
(_, s) => smallvec![s],
190191
}
192+
// cSpell:enable
191193
}
192194

193195
fn arch_to_gcc(name: &str) -> &str {

src/int.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//! This module exists because some integer types are not supported on some gcc platforms, e.g.
33
//! 128-bit integers on 32-bit platforms and thus require to be handled manually.
44
5+
// cSpell:words cmpti divti modti mulodi muloti udivti umodti
6+
57
use gccjit::{BinaryOp, ComparisonOp, FunctionType, Location, RValue, ToRValue, Type, UnaryOp};
68
use rustc_abi::{Endian, ExternAbi};
79
use rustc_codegen_ssa::common::{IntPredicate, TypeKind};
@@ -913,9 +915,11 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
913915

914916
debug_assert!(value_type.dyncast_array().is_some());
915917
let name_suffix = match self.type_kind(dest_typ) {
918+
// cSpell:disable
916919
TypeKind::Float => "tisf",
917920
TypeKind::Double => "tidf",
918921
TypeKind::FP128 => "titf",
922+
// cSpell:enable
919923
kind => panic!("cannot cast a non-native integer to type {:?}", kind),
920924
};
921925
let sign = if signed { "" } else { "un" };
@@ -957,8 +961,10 @@ impl<'gcc, 'tcx> CodegenCx<'gcc, 'tcx> {
957961

958962
debug_assert!(dest_typ.dyncast_array().is_some());
959963
let name_suffix = match self.type_kind(value_type) {
964+
// cSpell:disable
960965
TypeKind::Float => "sfti",
961966
TypeKind::Double => "dfti",
967+
// cSpell:enable
962968
kind => panic!("cannot cast a {:?} to non-native integer", kind),
963969
};
964970
let sign = if signed { "" } else { "uns" };

src/intrinsic/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tc
643643

644644
fn type_checked_load(
645645
&mut self,
646-
_llvtable: Self::Value,
646+
_vtable: Self::Value,
647647
_vtable_byte_offset: u64,
648648
_typeid: Self::Value,
649649
) -> Self::Value {
@@ -750,23 +750,23 @@ impl<'gcc, 'tcx> ArgAbiExt<'gcc, 'tcx> for ArgAbi<'tcx, Ty<'tcx>> {
750750
// We instead thus allocate some scratch space...
751751
let scratch_size = cast.size(bx);
752752
let scratch_align = cast.align(bx);
753-
let llscratch = bx.alloca(scratch_size, scratch_align);
754-
bx.lifetime_start(llscratch, scratch_size);
753+
let scratch = bx.alloca(scratch_size, scratch_align);
754+
bx.lifetime_start(scratch, scratch_size);
755755

756756
// ... where we first store the value...
757-
bx.store(val, llscratch, scratch_align);
757+
bx.store(val, scratch, scratch_align);
758758

759759
// ... and then memcpy it to the intended destination.
760760
bx.memcpy(
761761
dst.val.llval,
762762
self.layout.align.abi,
763-
llscratch,
763+
scratch,
764764
scratch_align,
765765
bx.const_usize(self.layout.size.bytes()),
766766
MemFlags::empty(),
767767
);
768768

769-
bx.lifetime_end(llscratch, scratch_size);
769+
bx.lifetime_end(scratch, scratch_size);
770770
}
771771
} else {
772772
OperandValue::Immediate(val).store(bx, dst);

src/intrinsic/simd.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1086,7 +1086,9 @@ pub fn generic_simd_intrinsic<'a, 'gcc, 'tcx>(
10861086
let (_, element_ty1) = arg_tys[1].simd_size_and_type(bx.tcx());
10871087
let (_, element_ty2) = arg_tys[2].simd_size_and_type(bx.tcx());
10881088
let (pointer_count, underlying_ty) = match *element_ty1.kind() {
1089-
ty::RawPtr(p_ty, mutbl) if p_ty == in_elem && mutbl == hir::Mutability::Mut => {
1089+
ty::RawPtr(p_ty, mutability)
1090+
if p_ty == in_elem && mutability == hir::Mutability::Mut =>
1091+
{
10901092
(ptr_count(element_ty1), non_ptr(element_ty1))
10911093
}
10921094
_ => {

src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
* TODO(antoyo): support #[inline] attributes.
44
* TODO(antoyo): support LTO (gcc's equivalent to Full LTO is -flto -flto-partition=one — https://documentation.suse.com/sbp/all/html/SBP-GCC-10/index.html).
55
* For Thin LTO, this might be helpful:
6+
// cspell:disable-next-line
67
* In gcc 4.6 -fwhopr was removed and became default with -flto. The non-whopr path can still be executed via -flto-partition=none.
78
* Or the new incremental LTO (https://www.phoronix.com/news/GCC-Incremental-LTO-Patches)?
89
*
9-
* Maybe some missing optizations enabled by rustc's LTO is in there: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
10+
* Maybe some missing optimizations enabled by rustc's LTO is in there: https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
11+
// cspell:disable-next-line
1012
* Like -fipa-icf (should be already enabled) and maybe -fdevirtualize-at-ltrans.
1113
* TODO: disable debug info always being emitted. Perhaps this slows down things?
1214
*
@@ -443,10 +445,11 @@ impl WriteBackendMethods for GccCodegenBackend {
443445
) -> Result<ModuleCodegen<Self::Module>, FatalError> {
444446
back::write::link(cgcx, dcx, modules)
445447
}
448+
446449
fn autodiff(
447450
_cgcx: &CodegenContext<Self>,
448451
_module: &ModuleCodegen<Self::Module>,
449-
_diff_fncs: Vec<AutoDiffItem>,
452+
_diff_functions: Vec<AutoDiffItem>,
450453
_config: &ModuleConfig,
451454
) -> Result<(), FatalError> {
452455
unimplemented!()
@@ -507,12 +510,14 @@ fn target_config(sess: &Session, target_info: &LockedTargetInfo) -> TargetConfig
507510
return false;
508511
}
509512
target_info.cpu_supports(feature)
513+
// cSpell:disable
510514
/*
511515
adx, aes, avx, avx2, avx512bf16, avx512bitalg, avx512bw, avx512cd, avx512dq, avx512er, avx512f, avx512fp16, avx512ifma,
512516
avx512pf, avx512vbmi, avx512vbmi2, avx512vl, avx512vnni, avx512vp2intersect, avx512vpopcntdq,
513517
bmi1, bmi2, cmpxchg16b, ermsb, f16c, fma, fxsr, gfni, lzcnt, movbe, pclmulqdq, popcnt, rdrand, rdseed, rtm,
514518
sha, sse, sse2, sse3, sse4.1, sse4.2, sse4a, ssse3, tbm, vaes, vpclmulqdq, xsave, xsavec, xsaveopt, xsaves
515519
*/
520+
// cSpell:enable
516521
})
517522
.map(Symbol::intern)
518523
.collect()

tools/cspell_dicts/rust.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
lateout
2+
repr
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
aapcs
2+
addo
3+
archs
4+
ashl
5+
ashr
6+
cgcx
7+
clzll
8+
cmse
9+
codegened
10+
csky
11+
ctlz
12+
ctpop
13+
cttz
14+
ctzll
15+
flto
16+
fmaximumf
17+
fmuladd
18+
fmuladdf
19+
fminimumf
20+
fmul
21+
fptosi
22+
fptosui
23+
fptoui
24+
fwrapv
25+
gimple
26+
hrtb
27+
immediates
28+
liblto
29+
llbb
30+
llcx
31+
llextra
32+
llfn
33+
lgcc
34+
llmod
35+
llresult
36+
llret
37+
ltrans
38+
llty
39+
llval
40+
llvals
41+
loong
42+
lshr
43+
masm
44+
maximumf
45+
maxnumf
46+
mavx
47+
mcmodel
48+
minimumf
49+
minnumf
50+
monomorphization
51+
monomorphizations
52+
monomorphized
53+
monomorphizing
54+
movnt
55+
mulo
56+
nvptx
57+
pointee
58+
powitf
59+
reassoc
60+
riscv
61+
rlib
62+
roundevenf
63+
rustc
64+
sitofp
65+
sizet
66+
spir
67+
subo
68+
sysv
69+
tbaa
70+
uitofp
71+
unord
72+
uninlined
73+
utrunc
74+
xabort
75+
zext

0 commit comments

Comments
 (0)