setup CI and tidy to use typos for spellchecking and fix few typos

This commit is contained in:
klensy
2024-12-07 13:51:08 +03:00
parent f51c9870ba
commit c76d032f01
129 changed files with 326 additions and 175 deletions

23
.github/workflows/spellcheck.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
# This workflow runs spellcheck job
name: Spellcheck
on:
pull_request:
branches:
- "**"
jobs:
spellcheck:
name: run spellchecker
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- name: check typos
# sync version with src/tools/tidy/src/ext_tool_checks.rs in spellcheck_runner
uses: crate-ci/typos@v1.34.0
with:
# sync target files with src/tools/tidy/src/ext_tool_checks.rs in check_impl
files: ./compiler ./library ./src/bootstrap ./src/librustdoc
config: ./typos.toml

View File

@@ -36,6 +36,7 @@ path = [
"rustfmt.toml", "rustfmt.toml",
"rust-bors.toml", "rust-bors.toml",
"triagebot.toml", "triagebot.toml",
"typos.toml",
"x", "x",
"x.ps1", "x.ps1",
"x.py", "x.py",

View File

@@ -1344,7 +1344,7 @@ impl Expr {
} }
} }
/// Returns an expression with (when possible) *one* outter brace removed /// Returns an expression with (when possible) *one* outer brace removed
pub fn maybe_unwrap_block(&self) -> &Expr { pub fn maybe_unwrap_block(&self) -> &Expr {
if let ExprKind::Block(block, None) = &self.kind if let ExprKind::Block(block, None) = &self.kind
&& let [stmt] = block.stmts.as_slice() && let [stmt] = block.stmts.as_slice()

View File

@@ -142,7 +142,7 @@ macro_rules! common_visitor_and_walkers {
)? )?
// Methods in this trait have one of three forms, with the last two forms // Methods in this trait have one of three forms, with the last two forms
// only occuring on `MutVisitor`: // only occurring on `MutVisitor`:
// //
// fn visit_t(&mut self, t: &mut T); // common // fn visit_t(&mut self, t: &mut T); // common
// fn flat_map_t(&mut self, t: T) -> SmallVec<[T; 1]>; // rare // fn flat_map_t(&mut self, t: T) -> SmallVec<[T; 1]>; // rare

View File

@@ -1,6 +1,6 @@
ast_passes_abi_cannot_be_coroutine = ast_passes_abi_cannot_be_coroutine =
functions with the {$abi} ABI cannot be `{$coroutine_kind_str}` functions with the {$abi} ABI cannot be `{$coroutine_kind_str}`
.suggestion = remove the `{$coroutine_kind_str}` keyword from this definiton .suggestion = remove the `{$coroutine_kind_str}` keyword from this definition
ast_passes_abi_custom_safe_foreign_function = ast_passes_abi_custom_safe_foreign_function =
foreign functions with the "custom" ABI cannot be safe foreign functions with the "custom" ABI cannot be safe

View File

@@ -14,7 +14,7 @@ use crate::{fluent_generated, parse_version};
/// Emitter of a builtin lint from `cfg_matches`. /// Emitter of a builtin lint from `cfg_matches`.
/// ///
/// Used to support emiting a lint (currently on check-cfg), either: /// Used to support emitting a lint (currently on check-cfg), either:
/// - as an early buffered lint (in `rustc`) /// - as an early buffered lint (in `rustc`)
/// - or has a "normal" lint from HIR (in `rustdoc`) /// - or has a "normal" lint from HIR (in `rustdoc`)
pub trait CfgMatchesLintEmitter { pub trait CfgMatchesLintEmitter {

View File

@@ -187,7 +187,7 @@ impl Stage for Late {
} }
} }
/// used when parsing attributes for miscelaneous things *before* ast lowering /// used when parsing attributes for miscellaneous things *before* ast lowering
pub struct Early; pub struct Early;
/// used when parsing attributes during ast lowering /// used when parsing attributes during ast lowering
pub struct Late; pub struct Late;

View File

@@ -562,7 +562,7 @@ mod llvm_enzyme {
/// so instead we manually build something that should pass the type checker. /// so instead we manually build something that should pass the type checker.
/// We also add a inline_asm line, as one more barrier for rustc to prevent inlining /// We also add a inline_asm line, as one more barrier for rustc to prevent inlining
/// or const propagation. inline_asm will also triggers an Enzyme crash if due to another /// or const propagation. inline_asm will also triggers an Enzyme crash if due to another
/// bug would ever try to accidentially differentiate this placeholder function body. /// bug would ever try to accidentally differentiate this placeholder function body.
/// Finally, we also add back_box usages of all input arguments, to prevent rustc /// Finally, we also add back_box usages of all input arguments, to prevent rustc
/// from optimizing any arguments away. /// from optimizing any arguments away.
fn gen_enzyme_body( fn gen_enzyme_body(
@@ -606,7 +606,7 @@ mod llvm_enzyme {
return body; return body;
} }
// Everything from here onwards just tries to fullfil the return type. Fun! // Everything from here onwards just tries to fulfil the return type. Fun!
// having an active-only return means we'll drop the original return type. // having an active-only return means we'll drop the original return type.
// So that can be treated identical to not having one in the first place. // So that can be treated identical to not having one in the first place.

View File

@@ -107,7 +107,7 @@ fn call_simple_intrinsic<'ll, 'tcx>(
sym::minimumf32 => ("llvm.minimum", &[bx.type_f32()]), sym::minimumf32 => ("llvm.minimum", &[bx.type_f32()]),
sym::minimumf64 => ("llvm.minimum", &[bx.type_f64()]), sym::minimumf64 => ("llvm.minimum", &[bx.type_f64()]),
// There are issues on x86_64 and aarch64 with the f128 variant, // There are issues on x86_64 and aarch64 with the f128 variant,
// let's instead use the instrinsic fallback body. // let's instead use the intrinsic fallback body.
// sym::minimumf128 => ("llvm.minimum", &[cx.type_f128()]), // sym::minimumf128 => ("llvm.minimum", &[cx.type_f128()]),
sym::maxnumf16 => ("llvm.maxnum", &[bx.type_f16()]), sym::maxnumf16 => ("llvm.maxnum", &[bx.type_f16()]),
sym::maxnumf32 => ("llvm.maxnum", &[bx.type_f32()]), sym::maxnumf32 => ("llvm.maxnum", &[bx.type_f32()]),
@@ -118,7 +118,7 @@ fn call_simple_intrinsic<'ll, 'tcx>(
sym::maximumf32 => ("llvm.maximum", &[bx.type_f32()]), sym::maximumf32 => ("llvm.maximum", &[bx.type_f32()]),
sym::maximumf64 => ("llvm.maximum", &[bx.type_f64()]), sym::maximumf64 => ("llvm.maximum", &[bx.type_f64()]),
// There are issues on x86_64 and aarch64 with the f128 variant, // There are issues on x86_64 and aarch64 with the f128 variant,
// let's instead use the instrinsic fallback body. // let's instead use the intrinsic fallback body.
// sym::maximumf128 => ("llvm.maximum", &[cx.type_f128()]), // sym::maximumf128 => ("llvm.maximum", &[cx.type_f128()]),
sym::copysignf16 => ("llvm.copysign", &[bx.type_f16()]), sym::copysignf16 => ("llvm.copysign", &[bx.type_f16()]),
sym::copysignf32 => ("llvm.copysign", &[bx.type_f32()]), sym::copysignf32 => ("llvm.copysign", &[bx.type_f32()]),

View File

@@ -40,7 +40,7 @@ unsafe extern "C" {
pub(crate) fn LLVMDumpValue(V: &Value); pub(crate) fn LLVMDumpValue(V: &Value);
pub(crate) fn LLVMGetFunctionCallConv(F: &Value) -> c_uint; pub(crate) fn LLVMGetFunctionCallConv(F: &Value) -> c_uint;
pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type; pub(crate) fn LLVMGetReturnType(T: &Type) -> &Type;
pub(crate) fn LLVMGetParams(Fnc: &Value, parms: *mut &Value); pub(crate) fn LLVMGetParams(Fnc: &Value, params: *mut &Value);
pub(crate) fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>; pub(crate) fn LLVMGetNamedFunction(M: &Module, Name: *const c_char) -> Option<&Value>;
} }

View File

@@ -861,7 +861,7 @@ fn emit_xtensa_va_arg<'ll, 'tcx>(
// On big-endian, for values smaller than the slot size we'd have to align the read to the end // On big-endian, for values smaller than the slot size we'd have to align the read to the end
// of the slot rather than the start. While the ISA and GCC support big-endian, all the Xtensa // of the slot rather than the start. While the ISA and GCC support big-endian, all the Xtensa
// targets supported by rustc are litte-endian so don't worry about it. // targets supported by rustc are little-endian so don't worry about it.
// if from_regsave { // if from_regsave {
// unsafe { *regsave_value_ptr } // unsafe { *regsave_value_ptr }

View File

@@ -289,7 +289,7 @@ codegen_ssa_thorin_missing_referenced_unit = unit {$unit} referenced by executab
codegen_ssa_thorin_missing_required_section = input object missing required section `{$section}` codegen_ssa_thorin_missing_required_section = input object missing required section `{$section}`
codegen_ssa_thorin_mixed_input_encodings = input objects haved mixed encodings codegen_ssa_thorin_mixed_input_encodings = input objects have mixed encodings
codegen_ssa_thorin_multiple_debug_info_section = multiple `.debug_info.dwo` sections codegen_ssa_thorin_multiple_debug_info_section = multiple `.debug_info.dwo` sections

View File

@@ -2767,7 +2767,7 @@ fn add_upstream_rust_crates(
if sess.target.is_like_aix { if sess.target.is_like_aix {
// Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override // Unlike ELF linkers, AIX doesn't feature `DT_SONAME` to override
// the dependency name when outputing a shared library. Thus, `ld` will // the dependency name when outputting a shared library. Thus, `ld` will
// use the full path to shared libraries as the dependency if passed it // use the full path to shared libraries as the dependency if passed it
// by default unless `noipath` is passed. // by default unless `noipath` is passed.
// https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command. // https://www.ibm.com/docs/en/aix/7.3?topic=l-ld-command.
@@ -3051,7 +3051,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
// Supported architecture names can be found in the source: // Supported architecture names can be found in the source:
// https://github.com/apple-oss-distributions/ld64/blob/ld64-951.9/src/abstraction/MachOFileAbstraction.hpp#L578-L648 // https://github.com/apple-oss-distributions/ld64/blob/ld64-951.9/src/abstraction/MachOFileAbstraction.hpp#L578-L648
// //
// Intentially verbose to ensure that the list always matches correctly // Intentionally verbose to ensure that the list always matches correctly
// with the list in the source above. // with the list in the source above.
let ld64_arch = match llvm_arch { let ld64_arch = match llvm_arch {
"armv7k" => "armv7k", "armv7k" => "armv7k",
@@ -3118,7 +3118,7 @@ fn add_apple_link_args(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavo
// We do not currently know the actual SDK version though, so we have a few options: // We do not currently know the actual SDK version though, so we have a few options:
// 1. Use the minimum version supported by rustc. // 1. Use the minimum version supported by rustc.
// 2. Use the same as the deployment target. // 2. Use the same as the deployment target.
// 3. Use an arbitary recent version. // 3. Use an arbitrary recent version.
// 4. Omit the version. // 4. Omit the version.
// //
// The first option is too low / too conservative, and means that users will not get the // The first option is too low / too conservative, and means that users will not get the

View File

@@ -301,7 +301,7 @@ pub(super) fn elf_e_flags(architecture: Architecture, sess: &Session) -> u32 {
"n32" if !is_32bit => e_flags |= elf::EF_MIPS_ABI2, "n32" if !is_32bit => e_flags |= elf::EF_MIPS_ABI2,
"n64" if !is_32bit => {} "n64" if !is_32bit => {}
"" if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32, "" if is_32bit => e_flags |= elf::EF_MIPS_ABI_O32,
"" => sess.dcx().fatal("LLVM ABI must be specifed for 64-bit MIPS targets"), "" => sess.dcx().fatal("LLVM ABI must be specified for 64-bit MIPS targets"),
s if is_32bit => { s if is_32bit => {
sess.dcx().fatal(format!("invalid LLVM ABI `{}` for 32-bit MIPS target", s)) sess.dcx().fatal(format!("invalid LLVM ABI `{}` for 32-bit MIPS target", s))
} }

View File

@@ -457,7 +457,7 @@ pub(crate) fn provide(providers: &mut Providers) {
// one, just keep it. // one, just keep it.
} }
_ => { _ => {
// Overwrite stabilite. // Overwrite stability.
occupied_entry.insert(stability); occupied_entry.insert(stability);
} }
} }

View File

@@ -87,7 +87,7 @@ pub trait BuilderMethods<'a, 'tcx>:
// //
// This function is opt-in for back ends. // This function is opt-in for back ends.
// //
// The default implementation calls `self.expect()` before emiting the branch // The default implementation calls `self.expect()` before emitting the branch
// by calling `self.cond_br()` // by calling `self.cond_br()`
fn cond_br_with_expect( fn cond_br_with_expect(
&mut self, &mut self,

View File

@@ -572,7 +572,7 @@ where
Right((local, offset, locals_addr, layout)) => { Right((local, offset, locals_addr, layout)) => {
if offset.is_some() { if offset.is_some() {
// This has been projected to a part of this local, or had the type changed. // This has been projected to a part of this local, or had the type changed.
// FIMXE: there are cases where we could still avoid allocating an mplace. // FIXME: there are cases where we could still avoid allocating an mplace.
Left(place.force_mplace(self)?) Left(place.force_mplace(self)?)
} else { } else {
debug_assert_eq!(locals_addr, self.frame().locals_addr()); debug_assert_eq!(locals_addr, self.frame().locals_addr());

View File

@@ -865,7 +865,7 @@ impl<'rt, 'tcx, M: Machine<'tcx>> ValidityVisitor<'rt, 'tcx, M> {
fn add_data_range(&mut self, ptr: Pointer<Option<M::Provenance>>, size: Size) { fn add_data_range(&mut self, ptr: Pointer<Option<M::Provenance>>, size: Size) {
if let Some(data_bytes) = self.data_bytes.as_mut() { if let Some(data_bytes) = self.data_bytes.as_mut() {
// We only have to store the offset, the rest is the same for all pointers here. // We only have to store the offset, the rest is the same for all pointers here.
// The logic is agnostic to wether the offset is relative or absolute as long as // The logic is agnostic to whether the offset is relative or absolute as long as
// it is consistent. // it is consistent.
let (_prov, offset) = ptr.into_raw_parts(); let (_prov, offset) = ptr.into_raw_parts();
// Add this. // Add this.

View File

@@ -69,7 +69,7 @@ fn check_validity_requirement_strict<'tcx>(
// require dereferenceability also require non-null, we don't actually get any false negatives // require dereferenceability also require non-null, we don't actually get any false negatives
// due to this. // due to this.
// The value we are validating is temporary and discarded at the end of this function, so // The value we are validating is temporary and discarded at the end of this function, so
// there is no point in reseting provenance and padding. // there is no point in resetting provenance and padding.
cx.validate_operand( cx.validate_operand(
&allocated.into(), &allocated.into(),
/*recursive*/ false, /*recursive*/ false,

View File

@@ -257,7 +257,7 @@ unsafe impl<K: Idx, #[may_dangle] V, I> Drop for VecCache<K, V, I> {
// we are also guaranteed to just need to deallocate any large arrays (not iterate over // we are also guaranteed to just need to deallocate any large arrays (not iterate over
// contents). // contents).
// //
// Confirm no need to deallocate invidual entries. Note that `V: Copy` is asserted on // Confirm no need to deallocate individual entries. Note that `V: Copy` is asserted on
// insert/lookup but not necessarily construction, primarily to avoid annoyingly propagating // insert/lookup but not necessarily construction, primarily to avoid annoyingly propagating
// the bounds into struct definitions everywhere. // the bounds into struct definitions everywhere.
assert!(!std::mem::needs_drop::<K>()); assert!(!std::mem::needs_drop::<K>());

View File

@@ -352,7 +352,7 @@ fn normalize<'a>(MdStream(stream): MdStream<'a>, linkdefs: &mut Vec<MdTree<'a>>)
let new_defs = stream.iter().filter(|tt| matches!(tt, MdTree::LinkDef { .. })); let new_defs = stream.iter().filter(|tt| matches!(tt, MdTree::LinkDef { .. }));
linkdefs.extend(new_defs.cloned()); linkdefs.extend(new_defs.cloned());
// Run plaintest expansions on types that need it, call this function on nested types // Run plaintext expansions on types that need it, call this function on nested types
for item in stream { for item in stream {
match item { match item {
MdTree::PlainText(txt) => expand_plaintext(txt, &mut new_stream, MdTree::PlainText), MdTree::PlainText(txt) => expand_plaintext(txt, &mut new_stream, MdTree::PlainText),

View File

@@ -681,7 +681,7 @@ impl server::Span for Rustc<'_, '_> {
.lookup_char_pos(span.lo()) .lookup_char_pos(span.lo())
.file .file
.name .name
.prefer_remapped_unconditionaly() .prefer_remapped_unconditionally()
.to_string() .to_string()
} }

View File

@@ -439,7 +439,7 @@ impl<'hir> ConstArg<'hir, AmbigArg> {
} }
impl<'hir> ConstArg<'hir> { impl<'hir> ConstArg<'hir> {
/// Converts a `ConstArg` in an unambigous position to one in an ambiguous position. This is /// Converts a `ConstArg` in an unambiguous position to one in an ambiguous position. This is
/// fallible as the [`ConstArgKind::Infer`] variant is not present in ambiguous positions. /// fallible as the [`ConstArgKind::Infer`] variant is not present in ambiguous positions.
/// ///
/// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if /// Functions accepting ambiguous consts will not handle the [`ConstArgKind::Infer`] variant, if
@@ -508,7 +508,7 @@ pub enum GenericArg<'hir> {
Lifetime(&'hir Lifetime), Lifetime(&'hir Lifetime),
Type(&'hir Ty<'hir, AmbigArg>), Type(&'hir Ty<'hir, AmbigArg>),
Const(&'hir ConstArg<'hir, AmbigArg>), Const(&'hir ConstArg<'hir, AmbigArg>),
/// Inference variables in [`GenericArg`] are always represnted by /// Inference variables in [`GenericArg`] are always represented by
/// `GenericArg::Infer` instead of the `Infer` variants on [`TyKind`] and /// `GenericArg::Infer` instead of the `Infer` variants on [`TyKind`] and
/// [`ConstArgKind`] as it is not clear until hir ty lowering whether a /// [`ConstArgKind`] as it is not clear until hir ty lowering whether a
/// `_` argument is a type or const argument. /// `_` argument is a type or const argument.
@@ -3323,7 +3323,7 @@ impl<'hir> Ty<'hir, AmbigArg> {
} }
impl<'hir> Ty<'hir> { impl<'hir> Ty<'hir> {
/// Converts a `Ty` in an unambigous position to one in an ambiguous position. This is /// Converts a `Ty` in an unambiguous position to one in an ambiguous position. This is
/// fallible as the [`TyKind::Infer`] variant is not present in ambiguous positions. /// fallible as the [`TyKind::Infer`] variant is not present in ambiguous positions.
/// ///
/// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if /// Functions accepting ambiguous types will not handle the [`TyKind::Infer`] variant, if
@@ -4224,7 +4224,7 @@ impl fmt::Display for Constness {
} }
} }
/// The actualy safety specified in syntax. We may treat /// The actual safety specified in syntax. We may treat
/// its safety different within the type system to create a /// its safety different within the type system to create a
/// "sound by default" system that needs checking this enum /// "sound by default" system that needs checking this enum
/// explicitly to allow unsafe operations. /// explicitly to allow unsafe operations.

View File

@@ -1088,7 +1088,7 @@ impl<'tcx> dyn HirTyLowerer<'tcx> + '_ {
// FIXME(#97583): Print associated item bindings properly (i.e., not as equality // FIXME(#97583): Print associated item bindings properly (i.e., not as equality
// predicates!). // predicates!).
// FIXME: Turn this into a structured, translateable & more actionable suggestion. // FIXME: Turn this into a structured, translatable & more actionable suggestion.
let mut where_bounds = vec![]; let mut where_bounds = vec![];
for bound in [bound, bound2].into_iter().chain(matching_candidates) { for bound in [bound, bound2].into_iter().chain(matching_candidates) {
let bound_id = bound.def_id(); let bound_id = bound.def_id();

View File

@@ -726,7 +726,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> {
Err(SelectionError::TraitDynIncompatible(_)) => { Err(SelectionError::TraitDynIncompatible(_)) => {
// Dyn compatibility errors in coercion will *always* be due to the // Dyn compatibility errors in coercion will *always* be due to the
// fact that the RHS of the coercion is a non-dyn compatible `dyn Trait` // fact that the RHS of the coercion is a non-dyn compatible `dyn Trait`
// writen in source somewhere (otherwise we will never have lowered // written in source somewhere (otherwise we will never have lowered
// the dyn trait from HIR to middle). // the dyn trait from HIR to middle).
// //
// There's no reason to emit yet another dyn compatibility error, // There's no reason to emit yet another dyn compatibility error,

View File

@@ -121,7 +121,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
_ => {} _ => {}
} }
// We want to emit an error if the const is not structurally resolveable // We want to emit an error if the const is not structurally resolvable
// as otherwise we can wind up conservatively proving `Copy` which may // as otherwise we can wind up conservatively proving `Copy` which may
// infer the repeat expr count to something that never required `Copy` in // infer the repeat expr count to something that never required `Copy` in
// the first place. // the first place.
@@ -2461,7 +2461,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
spans.push_span_label(param.param.span(), ""); spans.push_span_label(param.param.span(), "");
} }
} }
// Highligh each parameter being depended on for a generic type. // Highlight each parameter being depended on for a generic type.
for ((&(_, param), deps), &(_, expected_ty)) in for ((&(_, param), deps), &(_, expected_ty)) in
params_with_generics.iter().zip(&dependants).zip(formal_and_expected_inputs) params_with_generics.iter().zip(&dependants).zip(formal_and_expected_inputs)
{ {

View File

@@ -588,7 +588,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
let def_id = pick.item.def_id; let def_id = pick.item.def_id;
let method_predicates = self.tcx.predicates_of(def_id).instantiate(self.tcx, all_args); let method_predicates = self.tcx.predicates_of(def_id).instantiate(self.tcx, all_args);
debug!("method_predicates after instantitation = {:?}", method_predicates); debug!("method_predicates after instantiation = {:?}", method_predicates);
let sig = self.tcx.fn_sig(def_id).instantiate(self.tcx, all_args); let sig = self.tcx.fn_sig(def_id).instantiate(self.tcx, all_args);
debug!("type scheme instantiated, sig={:?}", sig); debug!("type scheme instantiated, sig={:?}", sig);

View File

@@ -375,7 +375,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// type parameters or early-bound regions. // type parameters or early-bound regions.
let tcx = self.tcx; let tcx = self.tcx;
// We use `Ident::with_dummy_span` since no built-in operator methods have // We use `Ident::with_dummy_span` since no built-in operator methods have
// any macro-specific hygeine, so the span's context doesn't really matter. // any macro-specific hygiene, so the span's context doesn't really matter.
let Some(method_item) = let Some(method_item) =
self.associated_value(trait_def_id, Ident::with_dummy_span(method_name)) self.associated_value(trait_def_id, Ident::with_dummy_span(method_name))
else { else {

View File

@@ -723,7 +723,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
// This is maximally flexible, allowing e.g., `Some(mut x) | &Some(mut x)`. // This is maximally flexible, allowing e.g., `Some(mut x) | &Some(mut x)`.
// In that example, `Some(mut x)` results in `Peel` whereas `&Some(mut x)` in `Reset`. // In that example, `Some(mut x)` results in `Peel` whereas `&Some(mut x)` in `Reset`.
| PatKind::Or(_) | PatKind::Or(_)
// Like or-patterns, guard patterns just propogate to their subpatterns. // Like or-patterns, guard patterns just propagate to their subpatterns.
| PatKind::Guard(..) => AdjustMode::Pass, | PatKind::Guard(..) => AdjustMode::Pass,
} }
} }

View File

@@ -566,7 +566,7 @@ impl Cursor<'_> {
} }
if !found { if !found {
// recovery strategy: a closing statement might have precending whitespace/newline // recovery strategy: a closing statement might have preceding whitespace/newline
// but not have enough dashes to properly close. In this case, we eat until there, // but not have enough dashes to properly close. In this case, we eat until there,
// and report a mismatch in the parser. // and report a mismatch in the parser.
let mut rest = self.as_str(); let mut rest = self.as_str();

View File

@@ -41,7 +41,7 @@ declare_lint! {
/// } /// }
/// ``` /// ```
/// ///
/// Otherwise try to find an alternative way to achive your goals using only raw pointers: /// Otherwise try to find an alternative way to achieve your goals using only raw pointers:
/// ///
/// ```rust /// ```rust
/// use std::ptr; /// use std::ptr;

View File

@@ -133,7 +133,7 @@ impl<'tcx> LateLintPass<'tcx> for DefaultCouldBeDerived {
// } // }
// } // }
// where `something()` would have to be a call or path. // where `something()` would have to be a call or path.
// We have nothing meaninful to do with this. // We have nothing meaningful to do with this.
return; return;
} }

View File

@@ -230,7 +230,7 @@ impl IfLetRescope {
} }
} }
} }
// At this point, any `if let` fragment in the cascade is definitely preceeded by `else`, // At this point, any `if let` fragment in the cascade is definitely preceded by `else`,
// so a opening bracket is mandatory before each `match`. // so a opening bracket is mandatory before each `match`.
add_bracket_to_match_head = true; add_bracket_to_match_head = true;
if let Some(alt) = alt { if let Some(alt) = alt {

View File

@@ -45,7 +45,7 @@ impl<'tcx> LateLintPass<'tcx> for InvalidReferenceCasting {
let init = cx.expr_or_init(e); let init = cx.expr_or_init(e);
let orig_cast = if init.span != e.span { Some(init.span) } else { None }; let orig_cast = if init.span != e.span { Some(init.span) } else { None };
// small cache to avoid recomputing needlesly computing peel_casts of init // small cache to avoid recomputing needlessly computing peel_casts of init
let mut peel_casts = { let mut peel_casts = {
let mut peel_casts_cache = None; let mut peel_casts_cache = None;
move || *peel_casts_cache.get_or_insert_with(|| peel_casts(cx, init)) move || *peel_casts_cache.get_or_insert_with(|| peel_casts(cx, init))

View File

@@ -1224,7 +1224,7 @@ declare_lint! {
/// ///
/// ### Explanation /// ### Explanation
/// ///
/// A public `use` declaration should not be used to publicly re-export a /// A public `use` declaration should not be used to publically re-export a
/// private `extern crate`. `pub extern crate` should be used instead. /// private `extern crate`. `pub extern crate` should be used instead.
/// ///
/// This was historically allowed, but is not the intended behavior /// This was historically allowed, but is not the intended behavior

View File

@@ -177,7 +177,7 @@ decl_derive! {
[PrintAttribute] => [PrintAttribute] =>
/// Derives `PrintAttribute` for `AttributeKind`. /// Derives `PrintAttribute` for `AttributeKind`.
/// This macro is pretty specific to `rustc_attr_data_structures` and likely not that useful in /// This macro is pretty specific to `rustc_attr_data_structures` and likely not that useful in
/// other places. It's deriving something close to `Debug` without printing some extraenous /// other places. It's deriving something close to `Debug` without printing some extraneous
/// things like spans. /// things like spans.
print_attribute::print_attribute print_attribute::print_attribute
} }

View File

@@ -273,8 +273,8 @@ fn add_query_desc_cached_impl(
// macro producing a higher order macro that has all its token in the macro declaration we lose // macro producing a higher order macro that has all its token in the macro declaration we lose
// any meaningful spans, resulting in rust-analyzer being unable to make the connection between // any meaningful spans, resulting in rust-analyzer being unable to make the connection between
// the query name and the corresponding providers field. The trick to fix this is to have // the query name and the corresponding providers field. The trick to fix this is to have
// `rustc_queries` emit a field access with the given name's span which allows it to succesfully // `rustc_queries` emit a field access with the given name's span which allows it to successfully
// show references / go to definition to the correspondig provider assignment which is usually // show references / go to definition to the corresponding provider assignment which is usually
// the more interesting place. // the more interesting place.
let ra_hint = quote! { let ra_hint = quote! {
let crate::query::Providers { #name: _, .. }; let crate::query::Providers { #name: _, .. };

View File

@@ -437,8 +437,8 @@ impl<'a> CrateLocator<'a> {
let (rlibs, rmetas, dylibs, interfaces) = let (rlibs, rmetas, dylibs, interfaces) =
candidates.entry(hash).or_default(); candidates.entry(hash).or_default();
{ {
// As a perforamnce optimisation we canonicalize the path and skip // As a performance optimisation we canonicalize the path and skip
// ones we've already seeen. This allows us to ignore crates // ones we've already seen. This allows us to ignore crates
// we know are exactual equal to ones we've already found. // we know are exactual equal to ones we've already found.
// Going to the same crate through different symlinks does not change the result. // Going to the same crate through different symlinks does not change the result.
let path = try_canonicalize(&spf.path) let path = try_canonicalize(&spf.path)

View File

@@ -116,7 +116,7 @@ impl<'tcx> From<ErrorHandled> for ValTreeCreationError<'tcx> {
impl<'tcx> From<InterpErrorInfo<'tcx>> for ValTreeCreationError<'tcx> { impl<'tcx> From<InterpErrorInfo<'tcx>> for ValTreeCreationError<'tcx> {
fn from(err: InterpErrorInfo<'tcx>) -> Self { fn from(err: InterpErrorInfo<'tcx>) -> Self {
// An error ocurred outside the const-eval query, as part of constructing the valtree. We // An error occurred outside the const-eval query, as part of constructing the valtree. We
// don't currently preserve the details of this error, since `InterpErrorInfo` cannot be put // don't currently preserve the details of this error, since `InterpErrorInfo` cannot be put
// into a query result and it can only be access of some mutable or external memory. // into a query result and it can only be access of some mutable or external memory.
let (_kind, backtrace) = err.into_parts(); let (_kind, backtrace) = err.into_parts();

View File

@@ -262,7 +262,7 @@ pub struct Body<'tcx> {
/// us to see the difference and forego optimization on the inlined promoted items. /// us to see the difference and forego optimization on the inlined promoted items.
pub phase: MirPhase, pub phase: MirPhase,
/// How many passses we have executed since starting the current phase. Used for debug output. /// How many passes we have executed since starting the current phase. Used for debug output.
pub pass_count: usize, pub pass_count: usize,
pub source: MirSource<'tcx>, pub source: MirSource<'tcx>,

View File

@@ -381,7 +381,7 @@ pub enum StatementKind<'tcx> {
/// computing these locals. /// computing these locals.
/// ///
/// If the local is already allocated, calling `StorageLive` again will implicitly free the /// If the local is already allocated, calling `StorageLive` again will implicitly free the
/// local and then allocate fresh uninitilized memory. If a local is already deallocated, /// local and then allocate fresh uninitialized memory. If a local is already deallocated,
/// calling `StorageDead` again is a NOP. /// calling `StorageDead` again is a NOP.
StorageLive(Local), StorageLive(Local),

View File

@@ -355,7 +355,7 @@ rustc_queries! {
/// Returns whether the type alias given by `DefId` is lazy. /// Returns whether the type alias given by `DefId` is lazy.
/// ///
/// I.e., if the type alias expands / ought to expand to a [free] [alias type] /// I.e., if the type alias expands / ought to expand to a [free] [alias type]
/// instead of the underyling aliased type. /// instead of the underlying aliased type.
/// ///
/// Relevant for features `lazy_type_alias` and `type_alias_impl_trait`. /// Relevant for features `lazy_type_alias` and `type_alias_impl_trait`.
/// ///

View File

@@ -71,7 +71,7 @@ pub enum InstanceKind<'tcx> {
/// - coroutines /// - coroutines
Item(DefId), Item(DefId),
/// An intrinsic `fn` item (with`#[rustc_instrinsic]`). /// An intrinsic `fn` item (with`#[rustc_intrinsic]`).
/// ///
/// Alongside `Virtual`, this is the only `InstanceKind` that does not have its own callable MIR. /// Alongside `Virtual`, this is the only `InstanceKind` that does not have its own callable MIR.
/// Instead, codegen and const eval "magically" evaluate calls to intrinsics purely in the /// Instead, codegen and const eval "magically" evaluate calls to intrinsics purely in the
@@ -445,10 +445,10 @@ impl<'tcx> fmt::Display for Instance<'tcx> {
} }
} }
// async_drop_in_place<T>::coroutine.poll, when T is a standart coroutine, // async_drop_in_place<T>::coroutine.poll, when T is a standard coroutine,
// should be resolved to this coroutine's future_drop_poll (through FutureDropPollShim proxy). // should be resolved to this coroutine's future_drop_poll (through FutureDropPollShim proxy).
// async_drop_in_place<async_drop_in_place<T>::coroutine>::coroutine.poll, // async_drop_in_place<async_drop_in_place<T>::coroutine>::coroutine.poll,
// when T is a standart coroutine, should be resolved to this coroutine's future_drop_poll. // when T is a standard coroutine, should be resolved to this coroutine's future_drop_poll.
// async_drop_in_place<async_drop_in_place<T>::coroutine>::coroutine.poll, // async_drop_in_place<async_drop_in_place<T>::coroutine>::coroutine.poll,
// when T is not a coroutine, should be resolved to the innermost // when T is not a coroutine, should be resolved to the innermost
// async_drop_in_place<T>::coroutine's poll function (through FutureDropPollShim proxy) // async_drop_in_place<T>::coroutine's poll function (through FutureDropPollShim proxy)

View File

@@ -70,7 +70,7 @@ fn true_significant_drop_ty<'tcx>(
} }
} }
/// Returns the list of types with a "potentially sigificant" that may be dropped /// Returns the list of types with a "potentially significant" that may be dropped
/// by dropping a value of type `ty`. /// by dropping a value of type `ty`.
#[instrument(level = "trace", skip(tcx, typing_env))] #[instrument(level = "trace", skip(tcx, typing_env))]
pub fn extract_component_raw<'tcx>( pub fn extract_component_raw<'tcx>(

View File

@@ -1676,7 +1676,7 @@ impl<'tcx> Ty<'tcx> {
/// This is particularly useful for getting the type of the result of /// This is particularly useful for getting the type of the result of
/// [`UnOp::PtrMetadata`](crate::mir::UnOp::PtrMetadata). /// [`UnOp::PtrMetadata`](crate::mir::UnOp::PtrMetadata).
/// ///
/// Panics if `self` is not dereferencable. /// Panics if `self` is not dereferenceable.
#[track_caller] #[track_caller]
pub fn pointee_metadata_ty_or_projection(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { pub fn pointee_metadata_ty_or_projection(self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> {
let Some(pointee_ty) = self.builtin_deref(true) else { let Some(pointee_ty) = self.builtin_deref(true) else {

View File

@@ -365,11 +365,11 @@ fn extend_type_not_partial_eq<'tcx>(
struct UsedParamsNeedInstantiationVisitor<'tcx> { struct UsedParamsNeedInstantiationVisitor<'tcx> {
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
typing_env: ty::TypingEnv<'tcx>, typing_env: ty::TypingEnv<'tcx>,
/// The user has written `impl PartialEq for Ty` which means it's non-structual. /// The user has written `impl PartialEq for Ty` which means it's non-structural.
adts_with_manual_partialeq: FxHashSet<Span>, adts_with_manual_partialeq: FxHashSet<Span>,
/// The type has no `PartialEq` implementation, neither manual or derived. /// The type has no `PartialEq` implementation, neither manual or derived.
adts_without_partialeq: FxHashSet<Span>, adts_without_partialeq: FxHashSet<Span>,
/// The user has written `impl PartialEq for Ty` which means it's non-structual, /// The user has written `impl PartialEq for Ty` which means it's non-structural,
/// but we don't have a span to point at, so we'll just add them as a `note`. /// but we don't have a span to point at, so we'll just add them as a `note`.
manual: FxHashSet<Ty<'tcx>>, manual: FxHashSet<Ty<'tcx>>,
/// The type has no `PartialEq` implementation, neither manual or derived, but /// The type has no `PartialEq` implementation, neither manual or derived, but

View File

@@ -310,7 +310,7 @@ fn insert_discr_cast_to_u128<'tcx>(
StatementKind::Assign(Box::new((discr_in_discr_ty, rvalue))), StatementKind::Assign(Box::new((discr_in_discr_ty, rvalue))),
)); ));
// Cast the discriminant to a u128 (base for comparisions of enum discriminants). // Cast the discriminant to a u128 (base for comparisons of enum discriminants).
let const_u128 = Ty::new_uint(tcx, ty::UintTy::U128); let const_u128 = Ty::new_uint(tcx, ty::UintTy::U128);
let rvalue = Rvalue::Cast(CastKind::IntToInt, Operand::Copy(discr_in_discr_ty), const_u128); let rvalue = Rvalue::Cast(CastKind::IntToInt, Operand::Copy(discr_in_discr_ty), const_u128);
let discr = local_decls.push(LocalDecl::with_source_info(const_u128, source_info)).into(); let discr = local_decls.push(LocalDecl::with_source_info(const_u128, source_info)).into();
@@ -445,7 +445,7 @@ fn insert_niche_check<'tcx>(
source_info, source_info,
); );
// Compare the discriminant agains the valid_range. // Compare the discriminant against the valid_range.
let start_const = Operand::Constant(Box::new(ConstOperand { let start_const = Operand::Constant(Box::new(ConstOperand {
span: source_info.span, span: source_info.span,
user_ty: None, user_ty: None,

View File

@@ -29,7 +29,7 @@
//! _b = some other value // also has VnIndex i //! _b = some other value // also has VnIndex i
//! ``` //! ```
//! //!
//! We consider it to be replacable by: //! We consider it to be replaceable by:
//! ```ignore (MIR) //! ```ignore (MIR)
//! _a = some value // has VnIndex i //! _a = some value // has VnIndex i
//! // some MIR //! // some MIR

View File

@@ -516,7 +516,7 @@ struct LocalLabel<'a> {
/// A custom `Subdiagnostic` implementation so that the notes are delivered in a specific order /// A custom `Subdiagnostic` implementation so that the notes are delivered in a specific order
impl Subdiagnostic for LocalLabel<'_> { impl Subdiagnostic for LocalLabel<'_> {
fn add_to_diag<G: rustc_errors::EmissionGuarantee>(self, diag: &mut rustc_errors::Diag<'_, G>) { fn add_to_diag<G: rustc_errors::EmissionGuarantee>(self, diag: &mut rustc_errors::Diag<'_, G>) {
// Becuase parent uses this field , we need to remove it delay before adding it. // Because parent uses this field , we need to remove it delay before adding it.
diag.remove_arg("name"); diag.remove_arg("name");
diag.arg("name", self.name); diag.arg("name", self.name);
diag.remove_arg("is_generated_name"); diag.remove_arg("is_generated_name");

View File

@@ -138,7 +138,7 @@ fn compute_replacement<'tcx>(
// reborrowed references. // reborrowed references.
let mut storage_to_remove = DenseBitSet::new_empty(body.local_decls.len()); let mut storage_to_remove = DenseBitSet::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. // Returns true iff we can use `place` as a pointee.
// //
@@ -204,7 +204,7 @@ fn compute_replacement<'tcx>(
let needs_unique = ty.is_mutable_ptr(); let needs_unique = ty.is_mutable_ptr();
// If this a mutable reference that we cannot fully replace, mark it as unknown. // 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"); debug!("not fully replaceable");
continue; continue;
} }
@@ -303,7 +303,7 @@ fn compute_replacement<'tcx>(
// This a reborrow chain, recursively allow the replacement. // 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. // and mark it as such.
if let &[PlaceElem::Deref] = &target.projection[..] { if let &[PlaceElem::Deref] = &target.projection[..] {
assert!(perform_opt); assert!(perform_opt);
@@ -313,7 +313,7 @@ fn compute_replacement<'tcx>(
} else if perform_opt { } else if perform_opt {
self.allowed_replacements.insert((target.local, loc)); self.allowed_replacements.insert((target.local, loc));
} else if needs_unique { } 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; self.targets[place.local] = Value::Unknown;
} }
} }
@@ -326,22 +326,22 @@ fn compute_replacement<'tcx>(
/// Compute the set of locals that can be fully replaced. /// 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). /// non-use position (like storage statements and debuginfo).
fn fully_replacable_locals(ssa: &SsaLocals) -> DenseBitSet<Local> { fn fully_replaceable_locals(ssa: &SsaLocals) -> DenseBitSet<Local> {
let mut replacable = DenseBitSet::new_empty(ssa.num_locals()); let mut replaceable = DenseBitSet::new_empty(ssa.num_locals());
// First pass: for each local, whether its uses can be fully replaced. // First pass: for each local, whether its uses can be fully replaced.
for local in ssa.locals() { for local in ssa.locals() {
if ssa.num_direct_uses(local) == 0 { 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. // 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`. /// Utility to help performing substitution of `*pattern` by `target`.

View File

@@ -31,7 +31,7 @@ pub(super) fn provide(providers: &mut Providers) {
providers.mir_shims = make_shim; providers.mir_shims = make_shim;
} }
// Replace Pin<&mut ImplCoroutine> accesses (_1.0) into Pin<&mut ProxyCoroutine> acceses // Replace Pin<&mut ImplCoroutine> accesses (_1.0) into Pin<&mut ProxyCoroutine> accesses
struct FixProxyFutureDropVisitor<'tcx> { struct FixProxyFutureDropVisitor<'tcx> {
tcx: TyCtxt<'tcx>, tcx: TyCtxt<'tcx>,
replace_to: Local, replace_to: Local,

View File

@@ -532,7 +532,7 @@ fn collect_items_rec<'tcx>(
}); });
} }
// Only updating `usage_map` for used items as otherwise we may be inserting the same item // Only updating `usage_map` for used items as otherwise we may be inserting the same item
// multiple times (if it is first 'mentioned' and then later actuall used), and the usage map // multiple times (if it is first 'mentioned' and then later actually used), and the usage map
// logic does not like that. // logic does not like that.
// This is part of the output of collection and hence only relevant for "used" items. // This is part of the output of collection and hence only relevant for "used" items.
// ("Mentioned" items are only considered internally during collection.) // ("Mentioned" items are only considered internally during collection.)

View File

@@ -893,7 +893,7 @@ fn mono_item_visibility<'tcx>(
// * First is weak lang items. These are basically mechanisms for // * First is weak lang items. These are basically mechanisms for
// libcore to forward-reference symbols defined later in crates like // libcore to forward-reference symbols defined later in crates like
// the standard library or `#[panic_handler]` definitions. The // the standard library or `#[panic_handler]` definitions. The
// definition of these weak lang items needs to be referencable by // definition of these weak lang items needs to be referenceable by
// libcore, so we're no longer a candidate for internalization. // libcore, so we're no longer a candidate for internalization.
// Removal of these functions can't be done by LLVM but rather must be // Removal of these functions can't be done by LLVM but rather must be
// done by the linker as it's a non-local decision. // done by the linker as it's a non-local decision.

View File

@@ -73,7 +73,7 @@ where
/// Register additional assumptions for aliases corresponding to `[const]` item bounds. /// Register additional assumptions for aliases corresponding to `[const]` item bounds.
/// ///
/// Unlike item bounds, they are not simply implied by the well-formedness of the alias. /// Unlike item bounds, they are not simply implied by the well-formedness of the alias.
/// Instead, they only hold if the const conditons on the alias also hold. This is why /// Instead, they only hold if the const conditions on the alias also hold. This is why
/// we also register the const conditions of the alias after matching the goal against /// we also register the const conditions of the alias after matching the goal against
/// the assumption. /// the assumption.
fn consider_additional_alias_assumptions( fn consider_additional_alias_assumptions(

View File

@@ -88,7 +88,7 @@ where
/// This takes the `shallow_certainty` which represents whether we're confident /// This takes the `shallow_certainty` which represents whether we're confident
/// that the final result of the current goal only depends on the nested goals. /// that the final result of the current goal only depends on the nested goals.
/// ///
/// In case this is `Certainy::Maybe`, there may still be additional nested goals /// In case this is `Certainty::Maybe`, there may still be additional nested goals
/// or inference constraints required for this candidate to be hold. The candidate /// or inference constraints required for this candidate to be hold. The candidate
/// always requires all already added constraints and nested goals. /// always requires all already added constraints and nested goals.
#[instrument(level = "trace", skip(self), ret)] #[instrument(level = "trace", skip(self), ret)]

View File

@@ -42,7 +42,7 @@ where
// Right now this includes both the impl and the assoc item where bounds, // Right now this includes both the impl and the assoc item where bounds,
// and I don't think the assoc item where-bounds are allowed to be coinductive. // and I don't think the assoc item where-bounds are allowed to be coinductive.
// //
// Projecting to the IAT also "steps out the impl contructor", so we would have // Projecting to the IAT also "steps out the impl constructor", so we would have
// to be very careful when changing the impl where-clauses to be productive. // to be very careful when changing the impl where-clauses to be productive.
self.add_goals( self.add_goals(
GoalSource::Misc, GoalSource::Misc,

View File

@@ -1301,7 +1301,7 @@ where
D: SolverDelegate<Interner = I>, D: SolverDelegate<Interner = I>,
I: Interner, I: Interner,
{ {
/// FIXME(#57893): For backwards compatability with the old trait solver implementation, /// FIXME(#57893): For backwards compatibility with the old trait solver implementation,
/// we need to handle overlap between builtin and user-written impls for trait objects. /// we need to handle overlap between builtin and user-written impls for trait objects.
/// ///
/// This overlap is unsound in general and something which we intend to fix separately. /// This overlap is unsound in general and something which we intend to fix separately.

View File

@@ -537,7 +537,7 @@ passes_no_sanitize =
`#[no_sanitize({$attr_str})]` should be applied to {$accepted_kind} `#[no_sanitize({$attr_str})]` should be applied to {$accepted_kind}
.label = not {$accepted_kind} .label = not {$accepted_kind}
passes_non_exaustive_with_default_field_values = passes_non_exhaustive_with_default_field_values =
`#[non_exhaustive]` can't be used to annotate items with default field values `#[non_exhaustive]` can't be used to annotate items with default field values
.label = this struct has default field values .label = this struct has default field values

View File

@@ -1199,7 +1199,7 @@ fn check_mod_deathness(tcx: TyCtxt<'_>, module: LocalModDefId) {
let def_kind = tcx.def_kind(item.owner_id); let def_kind = tcx.def_kind(item.owner_id);
let mut dead_codes = Vec::new(); let mut dead_codes = Vec::new();
// Only diagnose unused assoc items in inherient impl and used trait, // Only diagnose unused assoc items in inherent impl and used trait,
// for unused assoc items in impls of trait, // for unused assoc items in impls of trait,
// we have diagnosed them in the trait if they are unused, // we have diagnosed them in the trait if they are unused,
// for unused assoc items in unused trait, // for unused assoc items in unused trait,

View File

@@ -157,7 +157,7 @@ pub(crate) struct NonExhaustiveWrongLocation {
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(passes_non_exaustive_with_default_field_values)] #[diag(passes_non_exhaustive_with_default_field_values)]
pub(crate) struct NonExhaustiveWithDefaultFieldValues { pub(crate) struct NonExhaustiveWithDefaultFieldValues {
#[primary_span] #[primary_span]
pub attr_span: Span, pub attr_span: Span,

View File

@@ -70,7 +70,7 @@
//! # Constructors and fields //! # Constructors and fields
//! //!
//! In the value `Pair(Some(0), true)`, `Pair` is called the constructor of the value, and `Some(0)` //! In the value `Pair(Some(0), true)`, `Pair` is called the constructor of the value, and `Some(0)`
//! and `true` are its fields. Every matcheable value can be decomposed in this way. Examples of //! and `true` are its fields. Every matchable value can be decomposed in this way. Examples of
//! constructors are: `Some`, `None`, `(,)` (the 2-tuple constructor), `Foo {..}` (the constructor //! constructors are: `Some`, `None`, `(,)` (the 2-tuple constructor), `Foo {..}` (the constructor
//! for a struct `Foo`), and `2` (the constructor for the number `2`). //! for a struct `Foo`), and `2` (the constructor for the number `2`).
//! //!
@@ -102,7 +102,7 @@
//! [`Constructor::is_covered_by`]. //! [`Constructor::is_covered_by`].
//! //!
//! Note 1: variable bindings (like the `x` in `Some(x)`) match anything, so we treat them as wildcards. //! Note 1: variable bindings (like the `x` in `Some(x)`) match anything, so we treat them as wildcards.
//! Note 2: this only applies to matcheable values. For example a value of type `Rc<u64>` can't be //! Note 2: this only applies to matchable values. For example a value of type `Rc<u64>` can't be
//! deconstructed that way. //! deconstructed that way.
//! //!
//! //!

View File

@@ -1342,7 +1342,7 @@ impl DepNodeColorMap {
/// This tries to atomically mark a node green and assign `index` as the new /// This tries to atomically mark a node green and assign `index` as the new
/// index. This returns `Ok` if `index` gets assigned, otherwise it returns /// index. This returns `Ok` if `index` gets assigned, otherwise it returns
/// the alreadly allocated index in `Err`. /// the already allocated index in `Err`.
#[inline] #[inline]
pub(super) fn try_mark_green( pub(super) fn try_mark_green(
&self, &self,

View File

@@ -878,12 +878,12 @@ pub(crate) struct MacroExpandedExternCrateCannotShadowExternArguments {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(resolve_elided_anonymous_lifetime_report_error, code = E0637)] #[diag(resolve_elided_anonymous_lifetime_report_error, code = E0637)]
pub(crate) struct ElidedAnonymousLivetimeReportError { pub(crate) struct ElidedAnonymousLifetimeReportError {
#[primary_span] #[primary_span]
#[label] #[label]
pub(crate) span: Span, pub(crate) span: Span,
#[subdiagnostic] #[subdiagnostic]
pub(crate) suggestion: Option<ElidedAnonymousLivetimeReportErrorSuggestion>, pub(crate) suggestion: Option<ElidedAnonymousLifetimeReportErrorSuggestion>,
} }
#[derive(Diagnostic)] #[derive(Diagnostic)]
@@ -897,7 +897,7 @@ pub(crate) struct LendingIteratorReportError {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(resolve_anonymous_lifetime_non_gat_report_error)] #[diag(resolve_anonymous_lifetime_non_gat_report_error)]
pub(crate) struct AnonymousLivetimeNonGatReportError { pub(crate) struct AnonymousLifetimeNonGatReportError {
#[primary_span] #[primary_span]
#[label] #[label]
pub(crate) lifetime: Span, pub(crate) lifetime: Span,
@@ -908,7 +908,7 @@ pub(crate) struct AnonymousLivetimeNonGatReportError {
resolve_elided_anonymous_lifetime_report_error_suggestion, resolve_elided_anonymous_lifetime_report_error_suggestion,
applicability = "machine-applicable" applicability = "machine-applicable"
)] )]
pub(crate) struct ElidedAnonymousLivetimeReportErrorSuggestion { pub(crate) struct ElidedAnonymousLifetimeReportErrorSuggestion {
#[suggestion_part(code = "for<'a> ")] #[suggestion_part(code = "for<'a> ")]
pub(crate) lo: Span, pub(crate) lo: Span,
#[suggestion_part(code = "'a ")] #[suggestion_part(code = "'a ")]
@@ -917,7 +917,7 @@ pub(crate) struct ElidedAnonymousLivetimeReportErrorSuggestion {
#[derive(Diagnostic)] #[derive(Diagnostic)]
#[diag(resolve_explicit_anonymous_lifetime_report_error, code = E0637)] #[diag(resolve_explicit_anonymous_lifetime_report_error, code = E0637)]
pub(crate) struct ExplicitAnonymousLivetimeReportError { pub(crate) struct ExplicitAnonymousLifetimeReportError {
#[primary_span] #[primary_span]
#[label] #[label]
pub(crate) span: Span, pub(crate) span: Span,

View File

@@ -1892,7 +1892,7 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
.. ..
} = rib.kind } = rib.kind
{ {
Some(errors::ElidedAnonymousLivetimeReportErrorSuggestion { Some(errors::ElidedAnonymousLifetimeReportErrorSuggestion {
lo: span.shrink_to_lo(), lo: span.shrink_to_lo(),
hi: lifetime.ident.span.shrink_to_hi(), hi: lifetime.ident.span.shrink_to_hi(),
}) })
@@ -1918,18 +1918,18 @@ impl<'a, 'ast, 'ra, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
ty: ty.span, ty: ty.span,
}); });
} else { } else {
self.r.dcx().emit_err(errors::AnonymousLivetimeNonGatReportError { self.r.dcx().emit_err(errors::AnonymousLifetimeNonGatReportError {
lifetime: lifetime.ident.span, lifetime: lifetime.ident.span,
}); });
} }
} else { } else {
self.r.dcx().emit_err(errors::ElidedAnonymousLivetimeReportError { self.r.dcx().emit_err(errors::ElidedAnonymousLifetimeReportError {
span: lifetime.ident.span, span: lifetime.ident.span,
suggestion, suggestion,
}); });
} }
} else { } else {
self.r.dcx().emit_err(errors::ExplicitAnonymousLivetimeReportError { self.r.dcx().emit_err(errors::ExplicitAnonymousLifetimeReportError {
span: lifetime.ident.span, span: lifetime.ident.span,
}); });
}; };

View File

@@ -627,7 +627,7 @@ pub fn source_span_for_markdown_range_inner(
let fragment = &fragments[i]; let fragment = &fragments[i];
let sp = fragment.span; let sp = fragment.span;
// we need to calculate the span start, // we need to calculate the span start,
// then use that in our calulations for the span end // then use that in our calculations for the span end
let lo = sp.lo() + BytePos(match_start as u32); let lo = sp.lo() + BytePos(match_start as u32);
return Some(( return Some((
sp.with_lo(lo).with_hi(lo + BytePos((md_range.end - md_range.start) as u32)), sp.with_lo(lo).with_hi(lo + BytePos((md_range.end - md_range.start) as u32)),

View File

@@ -21,7 +21,7 @@ use thin_vec::ThinVec;
/// [utf8]: https://en.wikipedia.org/w/index.php?title=UTF-8&oldid=1058865525#Codepage_layout /// [utf8]: https://en.wikipedia.org/w/index.php?title=UTF-8&oldid=1058865525#Codepage_layout
const STR_SENTINEL: u8 = 0xC1; const STR_SENTINEL: u8 = 0xC1;
/// For byte strings there are no bytes that canot occur. Just use this value /// For byte strings there are no bytes that cannot occur. Just use this value
/// as a best-effort sentinel. There is no validation skipped so the potential /// as a best-effort sentinel. There is no validation skipped so the potential
/// for badness is lower than in the `STR_SENTINEL` case. /// for badness is lower than in the `STR_SENTINEL` case.
const BYTE_STR_SENTINEL: u8 = 0xC2; const BYTE_STR_SENTINEL: u8 = 0xC2;

View File

@@ -190,7 +190,7 @@ pub struct CoverageOptions {
/// to keep supporting this flag, remove it. /// to keep supporting this flag, remove it.
pub no_mir_spans: bool, pub no_mir_spans: bool,
/// `-Zcoverage-options=discard-all-spans-in-codegen`: During codgen, /// `-Zcoverage-options=discard-all-spans-in-codegen`: During codegen,
/// discard all coverage spans as though they were invalid. Needed by /// discard all coverage spans as though they were invalid. Needed by
/// regression tests for #133606, because we don't have an easy way to /// regression tests for #133606, because we don't have an easy way to
/// reproduce it from actual source code. /// reproduce it from actual source code.

View File

@@ -1545,7 +1545,7 @@ impl RemapFileNameExt for rustc_span::FileName {
"one and only one scope should be passed to for_scope" "one and only one scope should be passed to for_scope"
); );
if sess.opts.unstable_opts.remap_path_scope.contains(scope) { if sess.opts.unstable_opts.remap_path_scope.contains(scope) {
self.prefer_remapped_unconditionaly() self.prefer_remapped_unconditionally()
} else { } else {
self.prefer_local() self.prefer_local()
} }

View File

@@ -1600,7 +1600,7 @@ pub struct VariantIdx(usize);
index_impl!(VariantIdx); index_impl!(VariantIdx);
crate_def! { crate_def! {
/// Hold infomation about an Opaque definition, particularly useful in `RPITIT`. /// Hold information about an Opaque definition, particularly useful in `RPITIT`.
#[derive(Serialize)] #[derive(Serialize)]
pub OpaqueDef; pub OpaqueDef;
} }

View File

@@ -418,7 +418,7 @@ impl FileName {
} }
} }
pub fn prefer_remapped_unconditionaly(&self) -> FileNameDisplay<'_> { pub fn prefer_remapped_unconditionally(&self) -> FileNameDisplay<'_> {
FileNameDisplay { inner: self, display_pref: FileNameDisplayPreference::Remapped } FileNameDisplay { inner: self, display_pref: FileNameDisplayPreference::Remapped }
} }

View File

@@ -2398,7 +2398,7 @@ pub const STDLIB_STABLE_CRATES: &[Symbol] = &[sym::std, sym::core, sym::alloc, s
#[derive(Copy, Clone, Eq, HashStable_Generic, Encodable, Decodable)] #[derive(Copy, Clone, Eq, HashStable_Generic, Encodable, Decodable)]
pub struct Ident { pub struct Ident {
// `name` should never be the empty symbol. If you are considering that, // `name` should never be the empty symbol. If you are considering that,
// you are probably conflating "empty identifer with "no identifier" and // you are probably conflating "empty identifier with "no identifier" and
// you should use `Option<Ident>` instead. // you should use `Option<Ident>` instead.
pub name: Symbol, pub name: Symbol,
pub span: Span, pub span: Span,

View File

@@ -46,7 +46,7 @@ where
} }
if arg.layout.is_single_vector_element(cx, size) { if arg.layout.is_single_vector_element(cx, size) {
// pass non-transparant wrappers around a vector as `PassMode::Cast` // pass non-transparent wrappers around a vector as `PassMode::Cast`
arg.cast_to(Reg { kind: RegKind::Vector, size }); arg.cast_to(Reg { kind: RegKind::Vector, size });
return; return;
} }

View File

@@ -4432,7 +4432,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
candidate_impls: &[ImplCandidate<'tcx>], candidate_impls: &[ImplCandidate<'tcx>],
span: Span, span: Span,
) { ) {
// We can only suggest the slice coersion for function and binary operation arguments, // We can only suggest the slice coercion for function and binary operation arguments,
// since the suggestion would make no sense in turbofish or call // since the suggestion would make no sense in turbofish or call
let (ObligationCauseCode::BinOp { .. } | ObligationCauseCode::FunctionArg { .. }) = let (ObligationCauseCode::BinOp { .. } | ObligationCauseCode::FunctionArg { .. }) =
obligation.cause.code() obligation.cause.code()

View File

@@ -643,7 +643,7 @@ impl Subdiagnostic for AddLifetimeParamsSuggestion<'_> {
// Do not suggest constraining the `&self` param, but rather the return type. // Do not suggest constraining the `&self` param, but rather the return type.
// If that is wrong (because it is not sufficient), a follow up error will tell the // If that is wrong (because it is not sufficient), a follow up error will tell the
// user to fix it. This way we lower the chances of *over* constraining, but still // user to fix it. This way we lower the chances of *over* constraining, but still
// get the cake of "correctly" contrained in two steps. // get the cake of "correctly" constrained in two steps.
visitor.visit_ty_unambig(self.ty_sup); visitor.visit_ty_unambig(self.ty_sup);
} }
visitor.visit_ty_unambig(self.ty_sub); visitor.visit_ty_unambig(self.ty_sub);

View File

@@ -31,7 +31,7 @@ use crate::traits::{
/// ///
/// Currently that is `Self` in supertraits. This is needed /// Currently that is `Self` in supertraits. This is needed
/// because `dyn_compatibility_violations` can't be used during /// because `dyn_compatibility_violations` can't be used during
/// type collection, as type collection is needed for `dyn_compatiblity_violations` itself. /// type collection, as type collection is needed for `dyn_compatibility_violations` itself.
#[instrument(level = "debug", skip(tcx), ret)] #[instrument(level = "debug", skip(tcx), ret)]
pub fn hir_ty_lowering_dyn_compatibility_violations( pub fn hir_ty_lowering_dyn_compatibility_violations(
tcx: TyCtxt<'_>, tcx: TyCtxt<'_>,

View File

@@ -56,7 +56,7 @@ pub fn evaluate_host_effect_obligation<'tcx>(
Err(EvaluationFailure::NoSolution) => {} Err(EvaluationFailure::NoSolution) => {}
} }
match evaluate_host_effect_from_selection_candiate(selcx, obligation) { match evaluate_host_effect_from_selection_candidate(selcx, obligation) {
Ok(result) => return Ok(result), Ok(result) => return Ok(result),
Err(EvaluationFailure::Ambiguous) => return Err(EvaluationFailure::Ambiguous), Err(EvaluationFailure::Ambiguous) => return Err(EvaluationFailure::Ambiguous),
Err(EvaluationFailure::NoSolution) => {} Err(EvaluationFailure::NoSolution) => {}
@@ -333,7 +333,7 @@ fn evaluate_host_effect_for_destruct_goal<'tcx>(
.collect()) .collect())
} }
fn evaluate_host_effect_from_selection_candiate<'tcx>( fn evaluate_host_effect_from_selection_candidate<'tcx>(
selcx: &mut SelectionContext<'_, 'tcx>, selcx: &mut SelectionContext<'_, 'tcx>,
obligation: &HostEffectObligation<'tcx>, obligation: &HostEffectObligation<'tcx>,
) -> Result<ThinVec<PredicateObligation<'tcx>>, EvaluationFailure> { ) -> Result<ThinVec<PredicateObligation<'tcx>>, EvaluationFailure> {

View File

@@ -481,7 +481,7 @@ pub enum EvaluateConstErr {
/// some unevaluated constant with either generic parameters or inference variables in its /// some unevaluated constant with either generic parameters or inference variables in its
/// generic arguments. /// generic arguments.
HasGenericsOrInfers, HasGenericsOrInfers,
/// The type this constant evalauted to is not valid for use in const generics. This should /// The type this constant evaluated to is not valid for use in const generics. This should
/// always result in an error when checking the constant is correctly typed for the parameter /// always result in an error when checking the constant is correctly typed for the parameter
/// it is an argument to, so a bug is delayed when encountering this. /// it is an argument to, so a bug is delayed when encountering this.
InvalidConstParamTy(ErrorGuaranteed), InvalidConstParamTy(ErrorGuaranteed),

View File

@@ -904,7 +904,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
let goal_kind = let goal_kind =
self.tcx().async_fn_trait_kind_from_def_id(obligation.predicate.def_id()).unwrap(); self.tcx().async_fn_trait_kind_from_def_id(obligation.predicate.def_id()).unwrap();
// If we have not yet determiend the `ClosureKind` of the closure or coroutine-closure, // If we have not yet determined the `ClosureKind` of the closure or coroutine-closure,
// then additionally register an `AsyncFnKindHelper` goal which will fail if the kind // then additionally register an `AsyncFnKindHelper` goal which will fail if the kind
// is constrained to an insufficient type later on. // is constrained to an insufficient type later on.
if let Some(closure_kind) = self.infcx.shallow_resolve(kind_ty).to_opt_closure_kind() { if let Some(closure_kind) = self.infcx.shallow_resolve(kind_ty).to_opt_closure_kind() {

View File

@@ -179,7 +179,7 @@ impl<'tcx> OpaqueTypeCollector<'tcx> {
} }
} }
/// Checks the `#[define_opaque]` attributes on items and collectes opaques to define /// Checks the `#[define_opaque]` attributes on items and collects opaques to define
/// from the referenced types. /// from the referenced types.
#[instrument(level = "trace", skip(self))] #[instrument(level = "trace", skip(self))]
fn collect_taits_from_defines_attr(&mut self) { fn collect_taits_from_defines_attr(&mut self) {

View File

@@ -13,7 +13,7 @@ use crate::{self as ty, Interner};
/// slightly different typing rules depending on the current context. See the /// slightly different typing rules depending on the current context. See the
/// doc comment for each variant for how and why they are used. /// doc comment for each variant for how and why they are used.
/// ///
/// In most cases you can get the correct typing mode automically via: /// In most cases you can get the correct typing mode automatically via:
/// - `mir::Body::typing_mode` /// - `mir::Body::typing_mode`
/// - `rustc_lint::LateContext::typing_mode` /// - `rustc_lint::LateContext::typing_mode`
/// ///

View File

@@ -390,8 +390,8 @@ impl PathsToNested {
/// ///
/// They are used when checking whether reevaluating a global cache /// They are used when checking whether reevaluating a global cache
/// would encounter a cycle or use a provisional cache entry given the /// would encounter a cycle or use a provisional cache entry given the
/// currentl search graph state. We need to disable the global cache /// current search graph state. We need to disable the global cache
/// in this case as it could otherwise result in behaviorial differences. /// in this case as it could otherwise result in behavioral differences.
/// Cycles can impact behavior. The cycle ABA may have different final /// Cycles can impact behavior. The cycle ABA may have different final
/// results from a the cycle BAB depending on the cycle root. /// results from a the cycle BAB depending on the cycle root.
/// ///
@@ -513,7 +513,7 @@ pub struct SearchGraph<D: Delegate<Cx = X>, X: Cx = <D as Delegate>::Cx> {
/// ///
/// `nested_goals` are only used when checking whether global cache entries /// `nested_goals` are only used when checking whether global cache entries
/// are applicable. This only cares about whether a goal is actually accessed. /// are applicable. This only cares about whether a goal is actually accessed.
/// Given that the usage of the provisional cache is fully determinstic, we /// Given that the usage of the provisional cache is fully deterministic, we
/// don't need to track the nested goals used while computing a provisional /// don't need to track the nested goals used while computing a provisional
/// cache entry. /// cache entry.
enum UpdateParentGoalCtxt<'a, X: Cx> { enum UpdateParentGoalCtxt<'a, X: Cx> {

View File

@@ -589,7 +589,7 @@ impl fmt::Display for i128 {
} }
impl u128 { impl u128 {
/// Format optimized for u128. Computation of 128 bits is limited by proccessing /// Format optimized for u128. Computation of 128 bits is limited by processing
/// in batches of 16 decimals at a time. /// in batches of 16 decimals at a time.
#[doc(hidden)] #[doc(hidden)]
#[unstable( #[unstable(

View File

@@ -459,7 +459,7 @@ pub const fn unlikely(b: bool) -> bool {
/// Therefore, implementations must not require the user to uphold /// Therefore, implementations must not require the user to uphold
/// any safety invariants. /// any safety invariants.
/// ///
/// The public form of this instrinsic is [`core::hint::select_unpredictable`]. /// The public form of this intrinsic is [`core::hint::select_unpredictable`].
/// However unlike the public form, the intrinsic will not drop the value that /// However unlike the public form, the intrinsic will not drop the value that
/// is not selected. /// is not selected.
#[unstable(feature = "core_intrinsics", issue = "none")] #[unstable(feature = "core_intrinsics", issue = "none")]
@@ -2290,7 +2290,7 @@ where
/// used inside the `if const`. /// used inside the `if const`.
/// Note that the two arms of this `if` really each become their own function, which is why the /// Note that the two arms of this `if` really each become their own function, which is why the
/// macro supports setting attributes for those functions. The runtime function is always /// macro supports setting attributes for those functions. The runtime function is always
/// markes as `#[inline]`. /// marked as `#[inline]`.
/// ///
/// See [`const_eval_select()`] for the rules and requirements around that intrinsic. /// See [`const_eval_select()`] for the rules and requirements around that intrinsic.
pub(crate) macro const_eval_select { pub(crate) macro const_eval_select {
@@ -2530,7 +2530,7 @@ pub const unsafe fn const_deallocate(_ptr: *mut u8, _size: usize, _align: usize)
/// Returns whether we should perform contract-checking at runtime. /// Returns whether we should perform contract-checking at runtime.
/// ///
/// This is meant to be similar to the ub_checks intrinsic, in terms /// This is meant to be similar to the ub_checks intrinsic, in terms
/// of not prematurely commiting at compile-time to whether contract /// of not prematurely committing at compile-time to whether contract
/// checking is turned on, so that we can specify contracts in libstd /// checking is turned on, so that we can specify contracts in libstd
/// and let an end user opt into turning them on. /// and let an end user opt into turning them on.
#[rustc_const_unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)] #[rustc_const_unstable(feature = "contracts_internals", issue = "128044" /* compiler-team#759 */)]

View File

@@ -160,7 +160,7 @@ pub unsafe fn simd_funnel_shl<T>(a: T, b: T, shift: T) -> T;
#[rustc_nounwind] #[rustc_nounwind]
pub unsafe fn simd_funnel_shr<T>(a: T, b: T, shift: T) -> T; pub unsafe fn simd_funnel_shr<T>(a: T, b: T, shift: T) -> T;
/// "Ands" vectors elementwise. /// "And"s vectors elementwise.
/// ///
/// `T` must be a vector of integers. /// `T` must be a vector of integers.
#[rustc_intrinsic] #[rustc_intrinsic]
@@ -522,7 +522,7 @@ pub unsafe fn simd_reduce_max<T, U>(x: T) -> U;
#[rustc_nounwind] #[rustc_nounwind]
pub unsafe fn simd_reduce_min<T, U>(x: T) -> U; pub unsafe fn simd_reduce_min<T, U>(x: T) -> U;
/// Logical "ands" all elements together. /// Logical "and"s all elements together.
/// ///
/// `T` must be a vector of integers or floats. /// `T` must be a vector of integers or floats.
/// ///

View File

@@ -281,7 +281,7 @@ impl<'a> BorrowedCursor<'a> {
/// Panics if there are less than `n` bytes initialized. /// Panics if there are less than `n` bytes initialized.
#[inline] #[inline]
pub fn advance(&mut self, n: usize) -> &mut Self { pub fn advance(&mut self, n: usize) -> &mut Self {
// The substraction cannot underflow by invariant of this type. // The subtraction cannot underflow by invariant of this type.
assert!(n <= self.buf.init - self.buf.filled); assert!(n <= self.buf.init - self.buf.filled);
self.buf.filled += n; self.buf.filled += n;

View File

@@ -89,7 +89,7 @@
#![allow(internal_features)] #![allow(internal_features)]
#![deny(ffi_unwind_calls)] #![deny(ffi_unwind_calls)]
#![warn(unreachable_pub)] #![warn(unreachable_pub)]
// Do not check link redundancy on bootstraping phase // Do not check link redundancy on bootstrapping phase
#![allow(rustdoc::redundant_explicit_links)] #![allow(rustdoc::redundant_explicit_links)]
#![warn(rustdoc::unescaped_backticks)] #![warn(rustdoc::unescaped_backticks)]
// //

View File

@@ -109,7 +109,7 @@ pub trait RawFloat:
/// Round-to-even only happens for negative values of q /// Round-to-even only happens for negative values of q
/// when q ≥ 4 in the 64-bit case and when q ≥ 17 in /// when q ≥ 4 in the 64-bit case and when q ≥ 17 in
/// the 32-bitcase. /// the 32-bit case.
/// ///
/// When q ≥ 0,we have that 5^q ≤ 2m+1. In the 64-bit case,we /// When q ≥ 0,we have that 5^q ≤ 2m+1. In the 64-bit case,we
/// have 5^q ≤ 2m+1 ≤ 2^54 or q ≤ 23. In the 32-bit case,we have /// have 5^q ≤ 2m+1 ≤ 2^54 or q ≤ 23. In the 32-bit case,we have
@@ -119,7 +119,7 @@ pub trait RawFloat:
/// so (2m+1)×5^q < 2^64. We have that 2m+1 > 2^53 (64-bit case) /// so (2m+1)×5^q < 2^64. We have that 2m+1 > 2^53 (64-bit case)
/// or 2m+1 > 2^24 (32-bit case). Hence,we must have 2^53×5^q < 2^64 /// or 2m+1 > 2^24 (32-bit case). Hence,we must have 2^53×5^q < 2^64
/// (64-bit) and 2^24×5^q < 2^64 (32-bit). Hence we have 5^q < 2^11 /// (64-bit) and 2^24×5^q < 2^64 (32-bit). Hence we have 5^q < 2^11
/// or q ≥ 4 (64-bit case) and 5^q < 2^40 or q ≥ 17 (32-bitcase). /// or q ≥ 4 (64-bit case) and 5^q < 2^40 or q ≥ 17 (32-bit case).
/// ///
/// Thus we have that we only need to round ties to even when /// Thus we have that we only need to round ties to even when
/// we have that q ∈ [4,23](in the 64-bit case) or q∈[17,10] /// we have that q ∈ [4,23](in the 64-bit case) or q∈[17,10]
@@ -143,7 +143,7 @@ pub trait RawFloat:
/// smaller than `10^SMALLEST_POWER_OF_TEN`, which will round to zero. /// smaller than `10^SMALLEST_POWER_OF_TEN`, which will round to zero.
/// ///
/// The smallest power of ten is represented by `⌊log10(2^-n / (2^64 - 1))⌋`, where `n` is /// The smallest power of ten is represented by `⌊log10(2^-n / (2^64 - 1))⌋`, where `n` is
/// the smallest power of two. The `2^64 - 1)` denomenator comes from the number of values /// the smallest power of two. The `2^64 - 1)` denominator comes from the number of values
/// that are representable by the intermediate storage format. I don't actually know _why_ /// that are representable by the intermediate storage format. I don't actually know _why_
/// the storage format is relevant here. /// the storage format is relevant here.
/// ///

View File

@@ -792,7 +792,7 @@
//! //!
//! 1. *Structural [`Unpin`].* A struct can be [`Unpin`] only if all of its //! 1. *Structural [`Unpin`].* A struct can be [`Unpin`] only if all of its
//! structurally-pinned fields are, too. This is [`Unpin`]'s behavior by default. //! structurally-pinned fields are, too. This is [`Unpin`]'s behavior by default.
//! However, as a libray author, it is your responsibility not to write something like //! However, as a library author, it is your responsibility not to write something like
//! <code>impl\<T> [Unpin] for Struct\<T> {}</code> and then offer a method that provides //! <code>impl\<T> [Unpin] for Struct\<T> {}</code> and then offer a method that provides
//! structural pinning to an inner field of `T`, which may not be [`Unpin`]! (Adding *any* //! structural pinning to an inner field of `T`, which may not be [`Unpin`]! (Adding *any*
//! projection operation requires unsafe code, so the fact that [`Unpin`] is a safe trait does //! projection operation requires unsafe code, so the fact that [`Unpin`] is a safe trait does

View File

@@ -29,7 +29,7 @@ impl<T: PointeeSized> *const T {
if const #[rustc_allow_const_fn_unstable(const_raw_ptr_comparison)] { if const #[rustc_allow_const_fn_unstable(const_raw_ptr_comparison)] {
match (ptr).guaranteed_eq(null_mut()) { match (ptr).guaranteed_eq(null_mut()) {
Some(res) => res, Some(res) => res,
// To remain maximally convervative, we stop execution when we don't // To remain maximally conservative, we stop execution when we don't
// know whether the pointer is null or not. // know whether the pointer is null or not.
// We can *not* return `false` here, that would be unsound in `NonNull::new`! // We can *not* return `false` here, that would be unsound in `NonNull::new`!
None => panic!("null-ness of this pointer cannot be determined in const context"), None => panic!("null-ness of this pointer cannot be determined in const context"),
@@ -49,7 +49,7 @@ impl<T: PointeeSized> *const T {
self as _ self as _
} }
/// Try to cast to a pointer of another type by checking aligment. /// Try to cast to a pointer of another type by checking alignment.
/// ///
/// If the pointer is properly aligned to the target type, it will be /// If the pointer is properly aligned to the target type, it will be
/// cast to the target type. Otherwise, `None` is returned. /// cast to the target type. Otherwise, `None` is returned.

View File

@@ -32,7 +32,7 @@ impl<T: PointeeSized> *mut T {
self as _ self as _
} }
/// Try to cast to a pointer of another type by checking aligment. /// Try to cast to a pointer of another type by checking alignment.
/// ///
/// If the pointer is properly aligned to the target type, it will be /// If the pointer is properly aligned to the target type, it will be
/// cast to the target type. Otherwise, `None` is returned. /// cast to the target type. Otherwise, `None` is returned.

View File

@@ -497,7 +497,7 @@ impl<T: PointeeSized> NonNull<T> {
unsafe { NonNull { pointer: self.as_ptr() as *mut U } } unsafe { NonNull { pointer: self.as_ptr() as *mut U } }
} }
/// Try to cast to a pointer of another type by checking aligment. /// Try to cast to a pointer of another type by checking alignment.
/// ///
/// If the pointer is properly aligned to the target type, it will be /// If the pointer is properly aligned to the target type, it will be
/// cast to the target type. Otherwise, `None` is returned. /// cast to the target type. Otherwise, `None` is returned.

View File

@@ -23,7 +23,7 @@ fn test_f16_integer_decode() {
fn test_f32_integer_decode() { fn test_f32_integer_decode() {
assert_eq!(3.14159265359f32.integer_decode(), (13176795, -22, 1)); assert_eq!(3.14159265359f32.integer_decode(), (13176795, -22, 1));
assert_eq!((-8573.5918555f32).integer_decode(), (8779358, -10, -1)); assert_eq!((-8573.5918555f32).integer_decode(), (8779358, -10, -1));
// Set 2^100 directly instead of using powf, because it doesn't guarentee precision // Set 2^100 directly instead of using powf, because it doesn't guarantee precision
assert_eq!(1.2676506e30_f32.integer_decode(), (8388608, 77, 1)); assert_eq!(1.2676506e30_f32.integer_decode(), (8388608, 77, 1));
assert_eq!(0f32.integer_decode(), (0, -150, 1)); assert_eq!(0f32.integer_decode(), (0, -150, 1));
assert_eq!((-0f32).integer_decode(), (0, -150, -1)); assert_eq!((-0f32).integer_decode(), (0, -150, -1));
@@ -40,7 +40,7 @@ fn test_f32_integer_decode() {
fn test_f64_integer_decode() { fn test_f64_integer_decode() {
assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906, -51, 1)); assert_eq!(3.14159265359f64.integer_decode(), (7074237752028906, -51, 1));
assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931, -39, -1)); assert_eq!((-8573.5918555f64).integer_decode(), (4713381968463931, -39, -1));
// Set 2^100 directly instead of using powf, because it doesn't guarentee precision // Set 2^100 directly instead of using powf, because it doesn't guarantee precision
assert_eq!(1.2676506002282294e30_f64.integer_decode(), (4503599627370496, 48, 1)); assert_eq!(1.2676506002282294e30_f64.integer_decode(), (4503599627370496, 48, 1));
assert_eq!(0f64.integer_decode(), (0, -1075, 1)); assert_eq!(0f64.integer_decode(), (0, -1075, 1));
assert_eq!((-0f64).integer_decode(), (0, -1075, -1)); assert_eq!((-0f64).integer_decode(), (0, -1075, -1));

View File

@@ -3091,7 +3091,7 @@ pub fn read_dir<P: AsRef<Path>>(path: P) -> io::Result<ReadDir> {
/// On UNIX-like systems, this function will update the permission bits /// On UNIX-like systems, this function will update the permission bits
/// of the file pointed to by the symlink. /// of the file pointed to by the symlink.
/// ///
/// Note that this behavior can lead to privalage escalation vulnerabilites, /// Note that this behavior can lead to privalage escalation vulnerabilities,
/// where the ability to create a symlink in one directory allows you to /// where the ability to create a symlink in one directory allows you to
/// cause the permissions of another file or directory to be modified. /// cause the permissions of another file or directory to be modified.
/// ///

View File

@@ -385,7 +385,7 @@ pub trait ChildExt: Sealed {
/// # Errors /// # Errors
/// ///
/// This function will return an error if the signal is invalid. The integer values associated /// This function will return an error if the signal is invalid. The integer values associated
/// with signals are implemenation-specific, so it's encouraged to use a crate that provides /// with signals are implementation-specific, so it's encouraged to use a crate that provides
/// posix bindings. /// posix bindings.
/// ///
/// # Examples /// # Examples

View File

@@ -140,7 +140,7 @@ impl Socket {
0 => {} 0 => {}
_ => { _ => {
// WASI poll does not return POLLHUP or POLLERR in revents. Check if the // WASI poll does not return POLLHUP or POLLERR in revents. Check if the
// connnection actually succeeded and return ok only when the socket is // connection actually succeeded and return ok only when the socket is
// ready and no errors were found. // ready and no errors were found.
if let Some(e) = self.take_error()? { if let Some(e) = self.take_error()? {
return Err(e); return Err(e);

View File

@@ -487,7 +487,7 @@ impl<T> OwnedProtocol<T> {
let protocol: *mut T = Box::into_raw(Box::new(protocol)); let protocol: *mut T = Box::into_raw(Box::new(protocol));
let mut handle: r_efi::efi::Handle = crate::ptr::null_mut(); let mut handle: r_efi::efi::Handle = crate::ptr::null_mut();
// FIXME: Move into r-efi once extended_varargs_abi_support is stablized // FIXME: Move into r-efi once extended_varargs_abi_support is stabilized
let func: BootInstallMultipleProtocolInterfaces = let func: BootInstallMultipleProtocolInterfaces =
unsafe { crate::mem::transmute((*bt.as_ptr()).install_multiple_protocol_interfaces) }; unsafe { crate::mem::transmute((*bt.as_ptr()).install_multiple_protocol_interfaces) };
@@ -521,7 +521,7 @@ impl<T> Drop for OwnedProtocol<T> {
// Do not deallocate a runtime protocol // Do not deallocate a runtime protocol
if let Some(bt) = boot_services() { if let Some(bt) = boot_services() {
let bt: NonNull<r_efi::efi::BootServices> = bt.cast(); let bt: NonNull<r_efi::efi::BootServices> = bt.cast();
// FIXME: Move into r-efi once extended_varargs_abi_support is stablized // FIXME: Move into r-efi once extended_varargs_abi_support is stabilized
let func: BootUninstallMultipleProtocolInterfaces = unsafe { let func: BootUninstallMultipleProtocolInterfaces = unsafe {
crate::mem::transmute((*bt.as_ptr()).uninstall_multiple_protocol_interfaces) crate::mem::transmute((*bt.as_ptr()).uninstall_multiple_protocol_interfaces)
}; };
@@ -645,7 +645,7 @@ pub(crate) fn get_device_path_from_map(map: &Path) -> io::Result<BorrowedDeviceP
} }
/// Helper for UEFI Protocols which are created and destroyed using /// Helper for UEFI Protocols which are created and destroyed using
/// [EFI_SERVICE_BINDING_PROTCOL](https://uefi.org/specs/UEFI/2.11/11_Protocols_UEFI_Driver_Model.html#efi-service-binding-protocol) /// [EFI_SERVICE_BINDING_PROTOCOL](https://uefi.org/specs/UEFI/2.11/11_Protocols_UEFI_Driver_Model.html#efi-service-binding-protocol)
pub(crate) struct ServiceProtocol { pub(crate) struct ServiceProtocol {
service_guid: r_efi::efi::Guid, service_guid: r_efi::efi::Guid,
handle: NonNull<crate::ffi::c_void>, handle: NonNull<crate::ffi::c_void>,

View File

@@ -10,7 +10,7 @@ pub fn is_sep_byte(b: u8) -> bool {
b == b'/' || b == b'\\' b == b'/' || b == b'\\'
} }
/// Cygwin allways prefers `/` over `\`, and it always converts all `/` to `\` /// Cygwin always prefers `/` over `\`, and it always converts all `/` to `\`
/// internally when calling Win32 APIs. Therefore, the server component of path /// internally when calling Win32 APIs. Therefore, the server component of path
/// `\\?\UNC\localhost/share` is `localhost/share` on Win32, but `localhost` /// `\\?\UNC\localhost/share` is `localhost/share` on Win32, but `localhost`
/// on Cygwin. /// on Cygwin.

View File

@@ -15,7 +15,7 @@
//! bytes, while the non-blocking pool, once initialized using the blocking //! bytes, while the non-blocking pool, once initialized using the blocking
//! pool, uses a CPRNG to return an unlimited number of random bytes. With a //! pool, uses a CPRNG to return an unlimited number of random bytes. With a
//! strong enough CPRNG however, the entropy estimation didn't contribute that //! strong enough CPRNG however, the entropy estimation didn't contribute that
//! much towards security while being an excellent vector for DoS attacs. Thus, //! much towards security while being an excellent vector for DoS attacks. Thus,
//! the blocking pool was removed in kernel version 5.6.[^2] That patch did not //! the blocking pool was removed in kernel version 5.6.[^2] That patch did not
//! magically increase the quality of the non-blocking pool, however, so we can //! magically increase the quality of the non-blocking pool, however, so we can
//! safely consider it strong enough even in older kernel versions and use it //! safely consider it strong enough even in older kernel versions and use it
@@ -30,7 +30,7 @@
//! data the system has available at the time. //! data the system has available at the time.
//! //!
//! So in conclusion, we always want the output of the non-blocking pool, but //! So in conclusion, we always want the output of the non-blocking pool, but
//! may need to wait until it is initalized. The default behavior of `getrandom` //! may need to wait until it is initialized. The default behavior of `getrandom`
//! is to wait until the non-blocking pool is initialized and then draw from there, //! is to wait until the non-blocking pool is initialized and then draw from there,
//! so if `getrandom` is available, we use its default to generate the bytes. For //! so if `getrandom` is available, we use its default to generate the bytes. For
//! `HashMap`, however, we need to specify the `GRND_INSECURE` flags, but that //! `HashMap`, however, we need to specify the `GRND_INSECURE` flags, but that

View File

@@ -6,7 +6,7 @@ pub fn fill_bytes(_: &mut [u8]) {
pub fn hashmap_random_keys() -> (u64, u64) { pub fn hashmap_random_keys() -> (u64, u64) {
// Use allocation addresses for a bit of randomness. This isn't // Use allocation addresses for a bit of randomness. This isn't
// particularily secure, but there isn't really an alternative. // particularly secure, but there isn't really an alternative.
let stack = 0u8; let stack = 0u8;
let heap = Box::new(0u8); let heap = Box::new(0u8);
let k1 = ptr::from_ref(&stack).addr() as u64; let k1 = ptr::from_ref(&stack).addr() as u64;

View File

@@ -6,7 +6,7 @@ use crate::thread::Thread;
crate::thread_local! { crate::thread_local! {
/// A thread local linked list of spawn hooks. /// A thread local linked list of spawn hooks.
/// ///
/// It is a linked list of Arcs, such that it can very cheaply be inhereted by spawned threads. /// It is a linked list of Arcs, such that it can very cheaply be inherited by spawned threads.
/// ///
/// (That technically makes it a set of linked lists with shared tails, so a linked tree.) /// (That technically makes it a set of linked lists with shared tails, so a linked tree.)
static SPAWN_HOOKS: Cell<SpawnHooks> = const { Cell::new(SpawnHooks { first: None }) }; static SPAWN_HOOKS: Cell<SpawnHooks> = const { Cell::new(SpawnHooks { first: None }) };

Some files were not shown because too many files have changed in this diff Show More