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/typos@v1.32.0
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" };

0 commit comments

Comments
 (0)