From ca0d1b0556b1ad0b015ff18724b64f47d2ed8625 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Thu, 24 Mar 2022 21:44:39 -0700 Subject: [PATCH 1/6] Document Linux kernel handoff in std::io::copy and std::fs::copy --- library/std/src/fs.rs | 10 ++++++++-- library/std/src/io/copy.rs | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index d4e103ab525..9daf694d68b 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1729,10 +1729,16 @@ pub fn rename, Q: AsRef>(from: P, to: Q) -> io::Result<()> /// This function currently corresponds to the `open` function in Unix /// with `O_RDONLY` for `from` and `O_WRONLY`, `O_CREAT`, and `O_TRUNC` for `to`. /// `O_CLOEXEC` is set for returned file descriptors. +/// +/// On Linux (including Android), this function attempts to use `copy_file_range(2)`, +/// and falls back to reading and writing if that is not possible. +/// /// On Windows, this function currently corresponds to `CopyFileEx`. Alternate /// NTFS streams are copied but only the size of the main stream is returned by -/// this function. On MacOS, this function corresponds to `fclonefileat` and -/// `fcopyfile`. +/// this function. +/// +/// On MacOS, this function corresponds to `fclonefileat` and `fcopyfile`. +/// /// Note that, this [may change in the future][changes]. /// /// [changes]: io#platform-specific-behavior diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs index 6ab96662305..d446af0dad3 100644 --- a/library/std/src/io/copy.rs +++ b/library/std/src/io/copy.rs @@ -39,6 +39,12 @@ use crate::mem::MaybeUninit; /// Ok(()) /// } /// ``` +/// +/// # Platform-specific behavior +/// +/// On Linux (including Android), this function uses `copy_file_range(2)`, +/// `sendfile(2)` or `splice(2)` syscalls to move data directly between file +/// descriptors if possible. #[stable(feature = "rust1", since = "1.0.0")] pub fn copy(reader: &mut R, writer: &mut W) -> Result where From 00cae6dbdbd31267b925824d30cee9486f84e476 Mon Sep 17 00:00:00 2001 From: Joshua Nelson Date: Tue, 29 Mar 2022 13:50:17 -0500 Subject: [PATCH 2/6] Clarify how `src/tools/x` searches for python --- src/tools/x/src/main.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/x/src/main.rs b/src/tools/x/src/main.rs index 8c47559b369..57d548f313d 100644 --- a/src/tools/x/src/main.rs +++ b/src/tools/x/src/main.rs @@ -26,6 +26,7 @@ fn python() -> &'static str { let mut python3 = false; for dir in env::split_paths(&val) { + // `python` should always take precedence over python2 / python3 if it exists if dir.join(PYTHON).exists() { return PYTHON; } @@ -34,11 +35,14 @@ fn python() -> &'static str { python3 |= dir.join(PYTHON3).exists(); } + // try 3 before 2 if python3 { PYTHON3 } else if python2 { PYTHON2 } else { + // We would have returned early if we found that python is installed ... + // maybe this should panic with an error instead? PYTHON } } From b41054eda3741305c7ea19549da2f4d182683cee Mon Sep 17 00:00:00 2001 From: Jane Lusby Date: Tue, 29 Mar 2022 17:10:49 -0700 Subject: [PATCH 3/6] fix since field version for termination stabilization --- library/std/src/process.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/library/std/src/process.rs b/library/std/src/process.rs index d3c8d864b0c..771461a5908 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -1705,17 +1705,17 @@ impl crate::error::Error for ExitStatusError {} /// } /// ``` #[derive(Clone, Copy, Debug)] -#[stable(feature = "process_exitcode", since = "1.60.0")] +#[stable(feature = "process_exitcode", since = "1.61.0")] pub struct ExitCode(imp::ExitCode); -#[stable(feature = "process_exitcode", since = "1.60.0")] +#[stable(feature = "process_exitcode", since = "1.61.0")] impl ExitCode { /// The canonical `ExitCode` for successful termination on this platform. /// /// Note that a `()`-returning `main` implicitly results in a successful /// termination, so there's no need to return this from `main` unless /// you're also returning other possible codes. - #[stable(feature = "process_exitcode", since = "1.60.0")] + #[stable(feature = "process_exitcode", since = "1.61.0")] pub const SUCCESS: ExitCode = ExitCode(imp::ExitCode::SUCCESS); /// The canonical `ExitCode` for unsuccessful termination on this platform. @@ -1723,7 +1723,7 @@ impl ExitCode { /// If you're only returning this and `SUCCESS` from `main`, consider /// instead returning `Err(_)` and `Ok(())` respectively, which will /// return the same codes (but will also `eprintln!` the error). - #[stable(feature = "process_exitcode", since = "1.60.0")] + #[stable(feature = "process_exitcode", since = "1.61.0")] pub const FAILURE: ExitCode = ExitCode(imp::ExitCode::FAILURE); } @@ -1747,7 +1747,7 @@ impl ExitCode { } } -#[stable(feature = "process_exitcode", since = "1.60.0")] +#[stable(feature = "process_exitcode", since = "1.61.0")] impl From for ExitCode { /// Construct an `ExitCode` from an arbitrary u8 value. fn from(code: u8) -> Self { @@ -2092,7 +2092,7 @@ pub fn id() -> u32 { /// standard library's runtime for convenience. Other runtimes are not required /// to provide similar functionality. #[cfg_attr(not(test), lang = "termination")] -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] #[rustc_on_unimplemented( message = "`main` has invalid return type `{Self}`", label = "`main` can only return types that implement `{Termination}`" @@ -2100,11 +2100,11 @@ pub fn id() -> u32 { pub trait Termination { /// Is called to get the representation of the value as status code. /// This status code is returned to the operating system. - #[stable(feature = "termination_trait_lib", since = "1.60.0")] + #[stable(feature = "termination_trait_lib", since = "1.61.0")] fn report(self) -> ExitCode; } -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for () { #[inline] fn report(self) -> ExitCode { @@ -2112,7 +2112,7 @@ impl Termination for () { } } -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for Result<(), E> { fn report(self) -> ExitCode { match self { @@ -2122,14 +2122,14 @@ impl Termination for Result<(), E> { } } -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for ! { fn report(self) -> ExitCode { self } } -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for Result { fn report(self) -> ExitCode { let Err(err) = self; @@ -2138,7 +2138,7 @@ impl Termination for Result { } } -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for Result { fn report(self) -> ExitCode { let Err(err) = self; @@ -2146,7 +2146,7 @@ impl Termination for Result { } } -#[stable(feature = "termination_trait_lib", since = "1.60.0")] +#[stable(feature = "termination_trait_lib", since = "1.61.0")] impl Termination for ExitCode { #[inline] fn report(self) -> ExitCode { From eb04cb7961e21520533c36469bb6fed7dd66d753 Mon Sep 17 00:00:00 2001 From: Martin Pool Date: Tue, 29 Mar 2022 19:43:40 -0700 Subject: [PATCH 4/6] Warn that platform-specific behavior may change --- library/std/src/fs.rs | 2 +- library/std/src/io/copy.rs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/std/src/fs.rs b/library/std/src/fs.rs index 9daf694d68b..46acd0ee4c5 100644 --- a/library/std/src/fs.rs +++ b/library/std/src/fs.rs @@ -1739,7 +1739,7 @@ pub fn rename, Q: AsRef>(from: P, to: Q) -> io::Result<()> /// /// On MacOS, this function corresponds to `fclonefileat` and `fcopyfile`. /// -/// Note that, this [may change in the future][changes]. +/// Note that platform-specific behavior [may change in the future][changes]. /// /// [changes]: io#platform-specific-behavior /// diff --git a/library/std/src/io/copy.rs b/library/std/src/io/copy.rs index d446af0dad3..1a10245e4a5 100644 --- a/library/std/src/io/copy.rs +++ b/library/std/src/io/copy.rs @@ -45,6 +45,10 @@ use crate::mem::MaybeUninit; /// On Linux (including Android), this function uses `copy_file_range(2)`, /// `sendfile(2)` or `splice(2)` syscalls to move data directly between file /// descriptors if possible. +/// +/// Note that platform-specific behavior [may change in the future][changes]. +/// +/// [changes]: crate::io#platform-specific-behavior #[stable(feature = "rust1", since = "1.0.0")] pub fn copy(reader: &mut R, writer: &mut W) -> Result where From cbe43794125b8d6349c04b7731c2d19e778a45d2 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 30 Mar 2022 01:39:38 -0400 Subject: [PATCH 5/6] Spellchecking some comments This PR attempts to clean up some minor spelling mistakes in comments --- compiler/rustc_apfloat/src/ieee.rs | 2 +- compiler/rustc_ast_lowering/src/lib.rs | 2 +- compiler/rustc_ast_passes/src/ast_validation.rs | 2 +- .../rustc_borrowck/src/diagnostics/outlives_suggestion.rs | 2 +- compiler/rustc_borrowck/src/diagnostics/region_errors.rs | 2 +- compiler/rustc_borrowck/src/invalidation.rs | 2 +- compiler/rustc_borrowck/src/lib.rs | 6 +++--- compiler/rustc_borrowck/src/region_infer/mod.rs | 4 ++-- compiler/rustc_borrowck/src/type_check/mod.rs | 2 +- compiler/rustc_builtin_macros/src/cfg_eval.rs | 2 +- compiler/rustc_builtin_macros/src/deriving/clone.rs | 2 +- compiler/rustc_builtin_macros/src/edition_panic.rs | 2 +- .../example/arbitrary_self_types_pointers_and_wrappers.rs | 2 +- compiler/rustc_codegen_gcc/Readme.md | 2 +- .../example/arbitrary_self_types_pointers_and_wrappers.rs | 2 +- compiler/rustc_codegen_gcc/src/builder.rs | 4 ++-- compiler/rustc_codegen_gcc/src/context.rs | 2 +- compiler/rustc_codegen_gcc/src/intrinsic/mod.rs | 2 +- compiler/rustc_codegen_llvm/src/context.rs | 2 +- compiler/rustc_codegen_llvm/src/intrinsic.rs | 2 +- compiler/rustc_codegen_ssa/src/back/link.rs | 6 +++--- compiler/rustc_codegen_ssa/src/back/symbol_export.rs | 2 +- compiler/rustc_const_eval/src/interpret/intern.rs | 2 +- compiler/rustc_const_eval/src/interpret/memory.rs | 2 +- compiler/rustc_const_eval/src/interpret/place.rs | 2 +- compiler/rustc_const_eval/src/interpret/step.rs | 2 +- compiler/rustc_const_eval/src/interpret/terminator.rs | 2 +- .../rustc_const_eval/src/transform/check_consts/check.rs | 2 +- .../src/transform/check_consts/qualifs.rs | 2 +- compiler/rustc_const_eval/src/util/call_kind.rs | 2 +- compiler/rustc_data_structures/src/stable_hasher.rs | 2 +- .../src/transitive_relation/tests.rs | 2 +- compiler/rustc_errors/src/styled_buffer.rs | 2 +- compiler/rustc_expand/src/config.rs | 2 +- compiler/rustc_expand/src/expand.rs | 2 +- compiler/rustc_expand/src/lib.rs | 2 +- compiler/rustc_expand/src/mbe.rs | 2 +- compiler/rustc_hir/src/hir.rs | 4 ++-- compiler/rustc_incremental/src/persist/save.rs | 2 +- compiler/rustc_middle/src/mir/interpret/allocation.rs | 2 +- compiler/rustc_mir_build/src/build/expr/as_place.rs | 2 +- compiler/rustc_parse/src/parser/attr.rs | 2 +- compiler/rustc_parse/src/parser/attr_wrapper.rs | 8 ++++---- compiler/rustc_trait_selection/src/traits/auto_trait.rs | 8 ++++---- src/bootstrap/CHANGELOG.md | 2 +- src/bootstrap/builder.rs | 2 +- src/bootstrap/compile.rs | 2 +- src/test/ui/impl-trait/xcrate.rs | 2 +- 48 files changed, 61 insertions(+), 61 deletions(-) diff --git a/compiler/rustc_apfloat/src/ieee.rs b/compiler/rustc_apfloat/src/ieee.rs index 96277950cfe..3db8adb2a24 100644 --- a/compiler/rustc_apfloat/src/ieee.rs +++ b/compiler/rustc_apfloat/src/ieee.rs @@ -461,7 +461,7 @@ impl fmt::Display for IeeeFloat { (combined / 10) as u32 as Limb }); - // Reduce the sigificand to avoid wasting time dividing 0's. + // Reduce the significand to avoid wasting time dividing 0's. while sig.last() == Some(&0) { sig.pop(); } diff --git a/compiler/rustc_ast_lowering/src/lib.rs b/compiler/rustc_ast_lowering/src/lib.rs index abf1bc739a3..d684a0e67e2 100644 --- a/compiler/rustc_ast_lowering/src/lib.rs +++ b/compiler/rustc_ast_lowering/src/lib.rs @@ -634,7 +634,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> { // This can happen when trying to lower the return type `x` in erroneous code like // async fn foo(x: u8) -> x {} // In that case, `x` is lowered as a function parameter, and the return type is lowered as - // an opaque type as a synthetized HIR owner. + // an opaque type as a synthesized HIR owner. res.unwrap_or(Res::Err) } diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index aba0b6a7463..0a712eb6cb7 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -622,7 +622,7 @@ impl<'a> AstValidator<'a> { } } - /// Reject C-varadic type unless the function is foreign, + /// Reject C-variadic type unless the function is foreign, /// or free and `unsafe extern "C"` semantically. fn check_c_varadic_type(&self, fk: FnKind<'a>) { match (fk.ctxt(), fk.header()) { diff --git a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs index de50f907eff..c1c325adb7f 100644 --- a/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs +++ b/compiler/rustc_borrowck/src/diagnostics/outlives_suggestion.rs @@ -55,7 +55,7 @@ impl OutlivesSuggestionBuilder { | RegionNameSource::NamedFreeRegion(..) | RegionNameSource::Static => true, - // Don't give suggestions for upvars, closure return types, or other unnamable + // Don't give suggestions for upvars, closure return types, or other unnameable // regions. RegionNameSource::SynthesizedFreeEnvRegion(..) | RegionNameSource::AnonRegionFromArgument(..) diff --git a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs index 1df7e826343..e63450a1f58 100644 --- a/compiler/rustc_borrowck/src/diagnostics/region_errors.rs +++ b/compiler/rustc_borrowck/src/diagnostics/region_errors.rs @@ -176,7 +176,7 @@ impl<'a, 'tcx> MirBorrowckCtxt<'a, 'tcx> { // FIXME. We should handle this case better. It // indicates that we have e.g., some region variable // whose value is like `'a+'b` where `'a` and `'b` are - // distinct unrelated univesal regions that are not + // distinct unrelated universal regions that are not // known to outlive one another. It'd be nice to have // some examples where this arises to decide how best // to report it; we could probably handle it by diff --git a/compiler/rustc_borrowck/src/invalidation.rs b/compiler/rustc_borrowck/src/invalidation.rs index 73ced63e4d7..1a789009f06 100644 --- a/compiler/rustc_borrowck/src/invalidation.rs +++ b/compiler/rustc_borrowck/src/invalidation.rs @@ -365,7 +365,7 @@ impl<'cx, 'tcx> InvalidationGenerator<'cx, 'tcx> { // borrow); so don't check if they interfere. // // NOTE: *reservations* do conflict with themselves; - // thus aren't injecting unsoundenss w/ this check.) + // thus aren't injecting unsoundness w/ this check.) (Activation(_, activating), _) if activating == borrow_index => { // Activating a borrow doesn't generate any invalidations, since we // have already taken the reservation diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs index 6f78c816093..13584048f09 100644 --- a/compiler/rustc_borrowck/src/lib.rs +++ b/compiler/rustc_borrowck/src/lib.rs @@ -1046,7 +1046,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { // borrow); so don't check if they interfere. // // NOTE: *reservations* do conflict with themselves; - // thus aren't injecting unsoundenss w/ this check.) + // thus aren't injecting unsoundness w/ this check.) (Activation(_, activating), _) if activating == borrow_index => { debug!( "check_access_for_conflict place_span: {:?} sd: {:?} rw: {:?} \ @@ -1105,7 +1105,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ); // rust-lang/rust#56254 - This was previously permitted on // the 2018 edition so we emit it as a warning. We buffer - // these sepately so that we only emit a warning if borrow + // these separately so that we only emit a warning if borrow // checking was otherwise successful. this.reservation_warnings .insert(bi, (place_span.0, place_span.1, location, bk, borrow.clone())); @@ -1586,7 +1586,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> { ) { debug!("check_if_reassignment_to_immutable_state({:?})", local); - // Check if any of the initializiations of `local` have happened yet: + // Check if any of the initializations of `local` have happened yet: if let Some(init_index) = self.is_local_ever_initialized(local, flow_state) { // And, if so, report an error. let init = &self.move_data.inits[init_index]; diff --git a/compiler/rustc_borrowck/src/region_infer/mod.rs b/compiler/rustc_borrowck/src/region_infer/mod.rs index 20f54d04777..47da1da978c 100644 --- a/compiler/rustc_borrowck/src/region_infer/mod.rs +++ b/compiler/rustc_borrowck/src/region_infer/mod.rs @@ -787,7 +787,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { let universe_a = self.scc_universes[scc_a]; // Quick check: if scc_b's declared universe is a subset of - // scc_a's declared univese (typically, both are ROOT), then + // scc_a's declared universe (typically, both are ROOT), then // it cannot contain any problematic universe elements. if universe_a.can_name(self.scc_universes[scc_b]) { return true; @@ -1991,7 +1991,7 @@ impl<'tcx> RegionInferenceContext<'tcx> { .iter() .find_map(|constraint| { if let ConstraintCategory::Predicate(predicate_span) = constraint.category { - // We currentl'y doesn't store the `DefId` in the `ConstraintCategory` + // We currently do not store the `DefId` in the `ConstraintCategory` // for performances reasons. The error reporting code used by NLL only // uses the span, so this doesn't cause any problems at the moment. Some(ObligationCauseCode::BindingObligation( diff --git a/compiler/rustc_borrowck/src/type_check/mod.rs b/compiler/rustc_borrowck/src/type_check/mod.rs index a7cf25d43d2..47c7ac3094f 100644 --- a/compiler/rustc_borrowck/src/type_check/mod.rs +++ b/compiler/rustc_borrowck/src/type_check/mod.rs @@ -2640,7 +2640,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> { // we have to solve them here where we instantiate the // closure. // - // Despite the opacity of the previous parapgrah, this is + // Despite the opacity of the previous paragraph, this is // actually relatively easy to understand in terms of the // desugaring. A closure gets desugared to a struct, and // these extra requirements are basically like where diff --git a/compiler/rustc_builtin_macros/src/cfg_eval.rs b/compiler/rustc_builtin_macros/src/cfg_eval.rs index 3c8f8f1854b..7637bf7edc8 100644 --- a/compiler/rustc_builtin_macros/src/cfg_eval.rs +++ b/compiler/rustc_builtin_macros/src/cfg_eval.rs @@ -137,7 +137,7 @@ impl CfgEval<'_, '_> { } // The majority of parsed attribute targets will never need to have early cfg-expansion - // run (e.g. they are not part of a `#[derive]` or `#[cfg_eval]` macro inoput). + // run (e.g. they are not part of a `#[derive]` or `#[cfg_eval]` macro input). // Therefore, we normally do not capture the necessary information about `#[cfg]` // and `#[cfg_attr]` attributes during parsing. // diff --git a/compiler/rustc_builtin_macros/src/deriving/clone.rs b/compiler/rustc_builtin_macros/src/deriving/clone.rs index fd26a376f91..c952fc0a866 100644 --- a/compiler/rustc_builtin_macros/src/deriving/clone.rs +++ b/compiler/rustc_builtin_macros/src/deriving/clone.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_clone( // - the item is a union with Copy fields // Unions with generic parameters still can derive Clone because they require Copy // for deriving, Clone alone is not enough. - // Whever Clone is implemented for fields is irrelevant so we don't assert it. + // Wherever Clone is implemented for fields is irrelevant so we don't assert it. let bounds; let substructure; let is_shallow; diff --git a/compiler/rustc_builtin_macros/src/edition_panic.rs b/compiler/rustc_builtin_macros/src/edition_panic.rs index 518b88dec6a..ea0e768a58f 100644 --- a/compiler/rustc_builtin_macros/src/edition_panic.rs +++ b/compiler/rustc_builtin_macros/src/edition_panic.rs @@ -70,7 +70,7 @@ fn expand<'cx>( } pub fn use_panic_2021(mut span: Span) -> bool { - // To determine the editon, we check the first span up the expansion + // To determine the edition, we check the first span up the expansion // stack that does not have #[allow_internal_unstable(edition_panic)]. // (To avoid using the edition of e.g. the assert!() or debug_assert!() definition.) loop { diff --git a/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs b/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs index e9876837dd8..d270fec6b71 100644 --- a/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs +++ b/compiler/rustc_codegen_cranelift/example/arbitrary_self_types_pointers_and_wrappers.rs @@ -36,7 +36,7 @@ impl, U> DispatchFromDyn> for Wrapper {} trait Trait { // This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable - // without unsized_locals), but wrappers arond `Self` currently are not. + // without unsized_locals), but wrappers around `Self` currently are not. // FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented // fn wrapper(self: Wrapper) -> i32; fn ptr_wrapper(self: Ptr>) -> i32; diff --git a/compiler/rustc_codegen_gcc/Readme.md b/compiler/rustc_codegen_gcc/Readme.md index 27b30e0fd1b..fe23a267696 100644 --- a/compiler/rustc_codegen_gcc/Readme.md +++ b/compiler/rustc_codegen_gcc/Readme.md @@ -12,7 +12,7 @@ A secondary goal is to check if using the gcc backend will provide any run-time ## Building **This requires a patched libgccjit in order to work. -The patches in [this repostory](https://github.com/antoyo/libgccjit-patches) need to be applied. +The patches in [this repository](https://github.com/antoyo/libgccjit-patches) need to be applied. (Those patches should work when applied on master, but in case it doesn't work, they are known to work when applied on 079c23cfe079f203d5df83fea8e92a60c7d7e878.) You can also use my [fork of gcc](https://github.com/antoyo/gcc) which already includes these patches.** diff --git a/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs b/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs index ddeb752f93e..3af0ba09e0b 100644 --- a/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs +++ b/compiler/rustc_codegen_gcc/example/arbitrary_self_types_pointers_and_wrappers.rs @@ -37,7 +37,7 @@ impl, U> DispatchFromDyn> for Wrapper {} trait Trait { // This method isn't object-safe yet. Unsized by-value `self` is object-safe (but not callable - // without unsized_locals), but wrappers arond `Self` currently are not. + // without unsized_locals), but wrappers around `Self` currently are not. // FIXME (mikeyhew) uncomment this when unsized rvalues object-safety is implemented // fn wrapper(self: Wrapper) -> i32; fn ptr_wrapper(self: Ptr>) -> i32; diff --git a/compiler/rustc_codegen_gcc/src/builder.rs b/compiler/rustc_codegen_gcc/src/builder.rs index b2f46e92ecc..21c7d420b20 100644 --- a/compiler/rustc_codegen_gcc/src/builder.rs +++ b/compiler/rustc_codegen_gcc/src/builder.rs @@ -508,7 +508,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn exactsdiv(&mut self, a: RValue<'gcc>, b: RValue<'gcc>) -> RValue<'gcc> { - // TODO(antoyo): posion if not exact. + // TODO(antoyo): poison if not exact. // FIXME(antoyo): rustc_codegen_ssa::mir::intrinsic uses different types for a and b but they // should be the same. let typ = a.get_type().to_signed(self); @@ -1252,7 +1252,7 @@ impl<'a, 'gcc, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'gcc, 'tcx> { } fn do_not_inline(&mut self, _llret: RValue<'gcc>) { - // FIMXE(bjorn3): implement + // FIXME(bjorn3): implement } fn set_span(&mut self, _span: Span) {} diff --git a/compiler/rustc_codegen_gcc/src/context.rs b/compiler/rustc_codegen_gcc/src/context.rs index 5e5b9e7e9b1..edbe7122bdd 100644 --- a/compiler/rustc_codegen_gcc/src/context.rs +++ b/compiler/rustc_codegen_gcc/src/context.rs @@ -110,7 +110,7 @@ pub struct CodegenCx<'gcc, 'tcx> { /// NOTE: a hack is used because the rustc API is not suitable to libgccjit and as such, /// `const_undef()` returns struct as pointer so that they can later be assigned a value. /// As such, this set remembers which of these pointers were returned by this function so that - /// they can be deferenced later. + /// they can be dereferenced later. /// FIXME(antoyo): fix the rustc API to avoid having this hack. pub structs_as_pointer: RefCell>>, } diff --git a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs index 08e584a46f3..68a05d95ef7 100644 --- a/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs +++ b/compiler/rustc_codegen_gcc/src/intrinsic/mod.rs @@ -340,7 +340,7 @@ impl<'a, 'gcc, 'tcx> IntrinsicCallMethods<'tcx> for Builder<'a, 'gcc, 'tcx> { } fn assume(&mut self, value: Self::Value) { - // TODO(antoyo): switch to asumme when it exists. + // TODO(antoyo): switch to assume when it exists. // Or use something like this: // #define __assume(cond) do { if (!(cond)) __builtin_unreachable(); } while (0) self.expect(value, true); diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 9fbc33d4b05..2b76bfdb5ec 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -360,7 +360,7 @@ impl<'ll, 'tcx> CodegenCx<'ll, 'tcx> { // feasible. The compiler may be able to get around this, but it may // involve some invasive changes to deal with this. // - // The flipside of this situation is that whenever you link to a dll and + // The flip side of this situation is that whenever you link to a dll and // you import a function from it, the import should be tagged with // `dllimport`. At this time, however, the compiler does not emit // `dllimport` for any declarations other than constants (where it is diff --git a/compiler/rustc_codegen_llvm/src/intrinsic.rs b/compiler/rustc_codegen_llvm/src/intrinsic.rs index 7f804ab5e63..10df671baa2 100644 --- a/compiler/rustc_codegen_llvm/src/intrinsic.rs +++ b/compiler/rustc_codegen_llvm/src/intrinsic.rs @@ -1113,7 +1113,7 @@ fn generic_simd_intrinsic<'ll, 'tcx>( && len.try_eval_usize(bx.tcx, ty::ParamEnv::reveal_all()) == Some(expected_bytes) => { - // Zero-extend iN to the array lengh: + // Zero-extend iN to the array length: let ze = bx.zext(i_, bx.type_ix(expected_bytes * 8)); // Convert the integer to a byte array diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index 9cc06ac0319..dbbbbd5ecc0 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -709,7 +709,7 @@ fn link_natively<'a, B: ArchiveBuilder<'a>>( let out = String::from_utf8_lossy(&out); // Check to see if the link failed with an error message that indicates it - // doesn't recognize the -no-pie option. If so, reperform the link step + // doesn't recognize the -no-pie option. If so, re-perform the link step // without it. This is safe because if the linker doesn't support -no-pie // then it should not default to linking executables as pie. Different // versions of gcc seem to use different quotes in the error message so @@ -1049,7 +1049,7 @@ fn escape_string(s: &[u8]) -> String { fn add_sanitizer_libraries(sess: &Session, crate_type: CrateType, linker: &mut dyn Linker) { // On macOS the runtimes are distributed as dylibs which should be linked to // both executables and dynamic shared objects. Everywhere else the runtimes - // are currently distributed as static liraries which should be linked to + // are currently distributed as static libraries which should be linked to // executables only. let needs_runtime = match crate_type { CrateType::Executable => true, @@ -1850,7 +1850,7 @@ fn linker_with_args<'a, B: ArchiveBuilder<'a>>( // Upstream rust libraries and their nobundle static libraries add_upstream_rust_crates::(cmd, sess, codegen_results, crate_type, tmpdir); - // Upstream dymamic native libraries linked with `#[link]` attributes at and `-l` + // Upstream dynamic native libraries linked with `#[link]` attributes at and `-l` // command line options. // If -Zlink-native-libraries=false is set, then the assumption is that an // external build system already has the native dependencies defined, and it diff --git a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs index 8191d8b5e49..765bd877db1 100644 --- a/compiler/rustc_codegen_ssa/src/back/symbol_export.rs +++ b/compiler/rustc_codegen_ssa/src/back/symbol_export.rs @@ -91,7 +91,7 @@ fn reachable_non_generics_provider(tcx: TyCtxt<'_>, cnum: CrateNum) -> DefIdMap< if !generics.requires_monomorphization(tcx) // Functions marked with #[inline] are codegened with "internal" // linkage and are not exported unless marked with an extern - // inidicator + // indicator && (!Instance::mono(tcx, def_id.to_def_id()).def.generates_cgu_internal_copy(tcx) || tcx.codegen_fn_attrs(def_id.to_def_id()).contains_extern_indicator()) { diff --git a/compiler/rustc_const_eval/src/interpret/intern.rs b/compiler/rustc_const_eval/src/interpret/intern.rs index 43ab74f4b88..f1acb9e41c4 100644 --- a/compiler/rustc_const_eval/src/interpret/intern.rs +++ b/compiler/rustc_const_eval/src/interpret/intern.rs @@ -73,7 +73,7 @@ struct IsStaticOrFn; /// Intern an allocation without looking at its children. /// `mode` is the mode of the environment where we found this pointer. -/// `mutablity` is the mutability of the place to be interned; even if that says +/// `mutability` is the mutability of the place to be interned; even if that says /// `immutable` things might become mutable if `ty` is not frozen. /// `ty` can be `None` if there is no potential interior mutability /// to account for (e.g. for vtables). diff --git a/compiler/rustc_const_eval/src/interpret/memory.rs b/compiler/rustc_const_eval/src/interpret/memory.rs index 871b7578abd..4a235809119 100644 --- a/compiler/rustc_const_eval/src/interpret/memory.rs +++ b/compiler/rustc_const_eval/src/interpret/memory.rs @@ -1011,7 +1011,7 @@ impl<'mir, 'tcx, M: Machine<'mir, 'tcx>> Memory<'mir, 'tcx, M> { let src_parts = self.get_ptr_access(src, size, src_align)?; let dest_parts = self.get_ptr_access(dest, size * num_copies, dest_align)?; // `Size` multiplication - // FIXME: we look up both allocations twice here, once ebfore for the `check_ptr_access` + // FIXME: we look up both allocations twice here, once before for the `check_ptr_access` // and once below to get the underlying `&[mut] Allocation`. // Source alloc preparations and access hooks. diff --git a/compiler/rustc_const_eval/src/interpret/place.rs b/compiler/rustc_const_eval/src/interpret/place.rs index b1784b12c65..5b8d74b4307 100644 --- a/compiler/rustc_const_eval/src/interpret/place.rs +++ b/compiler/rustc_const_eval/src/interpret/place.rs @@ -876,7 +876,7 @@ where if src.layout.size != dest.layout.size { // FIXME: This should be an assert instead of an error, but if we transmute within an // array length computation, `typeck` may not have yet been run and errored out. In fact - // most likey we *are* running `typeck` right now. Investigate whether we can bail out + // most likely we *are* running `typeck` right now. Investigate whether we can bail out // on `typeck_results().has_errors` at all const eval entry points. debug!("Size mismatch when transmuting!\nsrc: {:#?}\ndest: {:#?}", src, dest); self.tcx.sess.delay_span_bug( diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs index 0701e0ded97..4272bfd5d6c 100644 --- a/compiler/rustc_const_eval/src/interpret/step.rs +++ b/compiler/rustc_const_eval/src/interpret/step.rs @@ -39,7 +39,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { /// /// This is used by [priroda](https://github.com/oli-obk/priroda) /// - /// This is marked `#inline(always)` to work around adverserial codegen when `opt-level = 3` + /// This is marked `#inline(always)` to work around adversarial codegen when `opt-level = 3` #[inline(always)] pub fn step(&mut self) -> InterpResult<'tcx, bool> { if self.stack().is_empty() { diff --git a/compiler/rustc_const_eval/src/interpret/terminator.rs b/compiler/rustc_const_eval/src/interpret/terminator.rs index 57a93ed4d55..d33358499e2 100644 --- a/compiler/rustc_const_eval/src/interpret/terminator.rs +++ b/compiler/rustc_const_eval/src/interpret/terminator.rs @@ -329,7 +329,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> { // Compute callee information using the `instance` returned by // `find_mir_or_eval_fn`. - // FIXME: for variadic support, do we have to somehow determine calle's extra_args? + // FIXME: for variadic support, do we have to somehow determine callee's extra_args? let callee_fn_abi = self.fn_abi_of_instance(instance, ty::List::empty())?; if callee_fn_abi.c_variadic != caller_fn_abi.c_variadic { diff --git a/compiler/rustc_const_eval/src/transform/check_consts/check.rs b/compiler/rustc_const_eval/src/transform/check_consts/check.rs index 223b3ad0cf9..5e31e075e73 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/check.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/check.rs @@ -942,7 +942,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> { if callee_is_unstable_unmarked { trace!("callee_is_unstable_unmarked"); // We do not use `const` modifiers for intrinsic "functions", as intrinsics are - // `extern` funtions, and these have no way to get marked `const`. So instead we + // `extern` functions, and these have no way to get marked `const`. So instead we // use `rustc_const_(un)stable` attributes to mean that the intrinsic is `const` if self.ccx.is_const_stable_const_fn() || is_intrinsic { self.check_op(ops::FnCallUnstable(callee, None)); diff --git a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs index 1e02129855e..9fd94dc334f 100644 --- a/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs +++ b/compiler/rustc_const_eval/src/transform/check_consts/qualifs.rs @@ -56,7 +56,7 @@ pub trait Qualif { /// Returns `true` if *any* value of the given type could possibly have this `Qualif`. /// /// This function determines `Qualif`s when we cannot do a value-based analysis. Since qualif - /// propagation is context-insenstive, this includes function arguments and values returned + /// propagation is context-insensitive, this includes function arguments and values returned /// from a call to another function. /// /// It also determines the `Qualif`s for primitive types. diff --git a/compiler/rustc_const_eval/src/util/call_kind.rs b/compiler/rustc_const_eval/src/util/call_kind.rs index 2165989b398..60b45856f51 100644 --- a/compiler/rustc_const_eval/src/util/call_kind.rs +++ b/compiler/rustc_const_eval/src/util/call_kind.rs @@ -45,7 +45,7 @@ pub enum CallKind<'tcx> { }, /// A call to `Fn(..)::call(..)`, desugared from `my_closure(a, b, c)` FnCall { fn_trait_id: DefId, self_ty: Ty<'tcx> }, - /// A call to an operator trait, desuraged from operator syntax (e.g. `a << b`) + /// A call to an operator trait, desugared from operator syntax (e.g. `a << b`) Operator { self_arg: Option, trait_id: DefId, self_ty: Ty<'tcx> }, DerefCoercion { /// The `Span` of the `Target` associated type diff --git a/compiler/rustc_data_structures/src/stable_hasher.rs b/compiler/rustc_data_structures/src/stable_hasher.rs index 31d6a42cf28..e8d81d4b937 100644 --- a/compiler/rustc_data_structures/src/stable_hasher.rs +++ b/compiler/rustc_data_structures/src/stable_hasher.rs @@ -623,7 +623,7 @@ pub enum NodeIdHashingMode { /// result, it needs to include `HashingControls` as part /// of the key, to ensure that is does not produce an incorrect /// result (for example, using a `Fingerprint` produced while -/// hashing `Span`s when a `Fingeprint` without `Span`s is +/// hashing `Span`s when a `Fingerprint` without `Span`s is /// being requested) #[derive(Clone, Hash, Eq, PartialEq, Debug)] pub struct HashingControls { diff --git a/compiler/rustc_data_structures/src/transitive_relation/tests.rs b/compiler/rustc_data_structures/src/transitive_relation/tests.rs index f63b1be1ddc..e1f4c7ee073 100644 --- a/compiler/rustc_data_structures/src/transitive_relation/tests.rs +++ b/compiler/rustc_data_structures/src/transitive_relation/tests.rs @@ -96,7 +96,7 @@ fn mubs_best_choice2() { // // mubs(0,3) = [2] - // Like the precedecing test, but in this case intersection is [2, + // Like the preceding test, but in this case intersection is [2, // 1], and hence we rely on the first pare down call. let mut relation = TransitiveRelation::default(); diff --git a/compiler/rustc_errors/src/styled_buffer.rs b/compiler/rustc_errors/src/styled_buffer.rs index e262d95bb70..9abdb5fc97c 100644 --- a/compiler/rustc_errors/src/styled_buffer.rs +++ b/compiler/rustc_errors/src/styled_buffer.rs @@ -26,7 +26,7 @@ impl StyledBuffer { StyledBuffer { lines: vec![] } } - /// Returns content of `StyledBuffer` splitted by lines and line styles + /// Returns content of `StyledBuffer` split by lines and line styles pub fn render(&self) -> Vec> { // Tabs are assumed to have been replaced by spaces in calling code. debug_assert!(self.lines.iter().all(|r| !r.iter().any(|sc| sc.chr == '\t'))); diff --git a/compiler/rustc_expand/src/config.rs b/compiler/rustc_expand/src/config.rs index 762198887cf..fa628cd9ebd 100644 --- a/compiler/rustc_expand/src/config.rs +++ b/compiler/rustc_expand/src/config.rs @@ -414,7 +414,7 @@ impl<'a> StripUnconfigured<'a> { }; trees.push((AttrAnnotatedTokenTree::Token(bang_token), Spacing::Alone)); } - // We don't really have a good span to use for the syntheized `[]` + // We don't really have a good span to use for the synthesized `[]` // in `#[attr]`, so just use the span of the `#` token. let bracket_group = AttrAnnotatedTokenTree::Delimited( DelimSpan::from_single(pound_span), diff --git a/compiler/rustc_expand/src/expand.rs b/compiler/rustc_expand/src/expand.rs index fe4698d09fd..c3f7f4f27e5 100644 --- a/compiler/rustc_expand/src/expand.rs +++ b/compiler/rustc_expand/src/expand.rs @@ -1847,7 +1847,7 @@ impl<'a, 'b> MutVisitor for InvocationCollector<'a, 'b> { if node.is_expr() { // The only way that we can end up with a `MacCall` expression statement, // (as opposed to a `StmtKind::MacCall`) is if we have a macro as the - // traiing expression in a block (e.g. `fn foo() { my_macro!() }`). + // trailing expression in a block (e.g. `fn foo() { my_macro!() }`). // Record this information, so that we can report a more specific // `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` lint if needed. // See #78991 for an investigation of treating macros in this position diff --git a/compiler/rustc_expand/src/lib.rs b/compiler/rustc_expand/src/lib.rs index 14b3f720f83..791ba560607 100644 --- a/compiler/rustc_expand/src/lib.rs +++ b/compiler/rustc_expand/src/lib.rs @@ -36,7 +36,7 @@ crate mod mbe; // HACK(Centril, #64197): These shouldn't really be here. // Rather, they should be with their respective modules which are defined in other crates. // However, since for now constructing a `ParseSess` sorta requires `config` from this crate, -// these tests will need to live here in the iterim. +// these tests will need to live here in the interim. #[cfg(test)] mod tests; diff --git a/compiler/rustc_expand/src/mbe.rs b/compiler/rustc_expand/src/mbe.rs index 0f7a8a9ed75..c89015b4c6b 100644 --- a/compiler/rustc_expand/src/mbe.rs +++ b/compiler/rustc_expand/src/mbe.rs @@ -41,7 +41,7 @@ impl Delimited { } /// Returns a `self::TokenTree` with a `Span` corresponding to the closing delimiter. Panics if - /// the delimeter is `NoDelim`. + /// the delimiter is `NoDelim`. fn close_tt(&self) -> &TokenTree { let tt = self.all_tts.last().unwrap(); debug_assert!(matches!( diff --git a/compiler/rustc_hir/src/hir.rs b/compiler/rustc_hir/src/hir.rs index 64ce196e440..19fc77fb74b 100644 --- a/compiler/rustc_hir/src/hir.rs +++ b/compiler/rustc_hir/src/hir.rs @@ -1118,7 +1118,7 @@ pub type BinOp = Spanned; #[derive(Copy, Clone, PartialEq, Encodable, Debug, HashStable_Generic)] pub enum UnOp { - /// The `*` operator (deferencing). + /// The `*` operator (dereferencing). Deref, /// The `!` operator (logical negation). Not, @@ -1611,7 +1611,7 @@ impl Expr<'_> { | ExprKind::Index(base, _) | ExprKind::AddrOf(.., base) | ExprKind::Cast(base, _) => { - // This isn't exactly true for `Index` and all `Unnary`, but we are using this + // This isn't exactly true for `Index` and all `Unary`, but we are using this // method exclusively for diagnostics and there's a *cultural* pressure against // them being used only for its side-effects. base.can_have_side_effects() diff --git a/compiler/rustc_incremental/src/persist/save.rs b/compiler/rustc_incremental/src/persist/save.rs index 9601a49267f..20ffde90064 100644 --- a/compiler/rustc_incremental/src/persist/save.rs +++ b/compiler/rustc_incremental/src/persist/save.rs @@ -146,7 +146,7 @@ fn encode_query_cache(tcx: TyCtxt<'_>, encoder: &mut FileEncoder) -> FileEncodeR /// Builds the dependency graph. /// -/// This function breates the *staging dep-graph*. When the dep-graph is modified by a query +/// This function creates the *staging dep-graph*. When the dep-graph is modified by a query /// execution, the new dependency information is not kept in memory but directly /// output to this file. `save_dep_graph` then finalizes the staging dep-graph /// and moves it to the permanent dep-graph path diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index 17ff52cefcf..8814f0d301b 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -164,7 +164,7 @@ impl Allocation { let bytes = Box::<[u8]>::try_new_zeroed_slice(size.bytes_usize()).map_err(|_| { // This results in an error that can happen non-deterministically, since the memory // available to the compiler can change between runs. Normally queries are always - // deterministic. However, we can be non-determinstic here because all uses of const + // deterministic. However, we can be non-deterministic here because all uses of const // evaluation (including ConstProp!) will make compilation fail (via hard error // or ICE) upon encountering a `MemoryExhausted` error. if panic_on_fail { diff --git a/compiler/rustc_mir_build/src/build/expr/as_place.rs b/compiler/rustc_mir_build/src/build/expr/as_place.rs index 10d241ee24c..3b3120cf04b 100644 --- a/compiler/rustc_mir_build/src/build/expr/as_place.rs +++ b/compiler/rustc_mir_build/src/build/expr/as_place.rs @@ -192,7 +192,7 @@ fn find_capture_matching_projections<'a, 'tcx>( is_ancestor_or_same_capture(&possible_ancestor_proj_kinds, &hir_projections) })?; - // Convert index to be from the presepective of the entire closure_min_captures map + // Convert index to be from the perspective of the entire closure_min_captures map // instead of just the root variable capture list Some((compute_capture_idx(closure_min_captures, var_hir_id, idx), capture)) } diff --git a/compiler/rustc_parse/src/parser/attr.rs b/compiler/rustc_parse/src/parser/attr.rs index 754ae12bbea..9865588cff4 100644 --- a/compiler/rustc_parse/src/parser/attr.rs +++ b/compiler/rustc_parse/src/parser/attr.rs @@ -304,7 +304,7 @@ impl<'a> Parser<'a> { // this replace range with it, removing the inner attribute from the final // `AttrAnnotatedTokenStream`. Inner attributes are stored in the parsed AST note. // During macro expansion, they are selectively inserted back into the - // token stream (the first inner attribute is remoevd each time we invoke the + // token stream (the first inner attribute is removed each time we invoke the // corresponding macro). let range = start_pos..end_pos; if let Capturing::Yes = self.capture_state.capturing { diff --git a/compiler/rustc_parse/src/parser/attr_wrapper.rs b/compiler/rustc_parse/src/parser/attr_wrapper.rs index f0ec86ca64a..5ee9c339bb7 100644 --- a/compiler/rustc_parse/src/parser/attr_wrapper.rs +++ b/compiler/rustc_parse/src/parser/attr_wrapper.rs @@ -188,7 +188,7 @@ impl<'a> Parser<'a> { /// /// Note: If your callback consumes an opening delimiter /// (including the case where you call `collect_tokens` - /// when the current token is an opening delimeter), + /// when the current token is an opening delimiter), /// you must also consume the corresponding closing delimiter. /// /// That is, you can consume @@ -260,7 +260,7 @@ impl<'a> Parser<'a> { // We also call `has_cfg_or_cfg_attr` at the beginning of this function, // but we only bail out if there's no possibility of inner attributes // (!R::SUPPORTS_CUSTOM_INNER_ATTRS) - // We only catpure about `#[cfg]` or `#[cfg_attr]` in `capture_cfg` + // We only capture about `#[cfg]` or `#[cfg_attr]` in `capture_cfg` // mode - during normal parsing, we don't need any special capturing // for those attributes, since they're builtin. && !(self.capture_cfg && has_cfg_or_cfg_attr(ret.attrs())) @@ -382,7 +382,7 @@ impl<'a> Parser<'a> { if matches!(self.capture_state.capturing, Capturing::No) { self.capture_state.replace_ranges.clear(); // We don't clear `inner_attr_ranges`, as doing so repeatedly - // had a measureable performance impact. Most inner attributes that + // had a measurable performance impact. Most inner attributes that // we insert will get removed - when we drop the parser, we'll free // up the memory used by any attributes that we didn't remove from the map. } @@ -418,7 +418,7 @@ fn make_token_stream( stack.push(FrameData { open: span, open_delim: delim, inner: vec![] }); } FlatToken::Token(Token { kind: TokenKind::CloseDelim(delim), span }) => { - // HACK: If we enconter a mismatched `None` delimiter at the top + // HACK: If we encounter a mismatched `None` delimiter at the top // level, just ignore it. if matches!(delim, DelimToken::NoDelim) && (stack.len() == 1 diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index ee9983ee8b8..8c15765c0c1 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -288,7 +288,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { ) -> Option<(ty::ParamEnv<'tcx>, ty::ParamEnv<'tcx>)> { let tcx = infcx.tcx; - // Don't try to proess any nested obligations involving predicates + // Don't try to process any nested obligations involving predicates // that are already in the `ParamEnv` (modulo regions): we already // know that they must hold. for predicate in param_env.caller_bounds() { @@ -688,7 +688,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { predicate ); - // Under unusual circumstances, we can end up with a self-refeential + // Under unusual circumstances, we can end up with a self-referential // projection predicate. For example: // ::Value == ::Value // Not only is displaying this to the user pointless, @@ -767,7 +767,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { // We only care about sub-obligations // when we started out trying to unify // some inference variables. See the comment above - // for more infomration + // for more information if p.term().skip_binder().has_infer_types() { if !self.evaluate_nested_obligations( ty, @@ -784,7 +784,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { } Ok(Ok(None)) => { // It's ok not to make progress when have no inference variables - - // in that case, we were only performing unifcation to check if an + // in that case, we were only performing unification to check if an // error occurred (which would indicate that it's impossible for our // type to implement the auto trait). // However, we should always make progress (either by generating diff --git a/src/bootstrap/CHANGELOG.md b/src/bootstrap/CHANGELOG.md index 2bc7ffb0c50..5324c6bde4e 100644 --- a/src/bootstrap/CHANGELOG.md +++ b/src/bootstrap/CHANGELOG.md @@ -10,7 +10,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - `llvm-libunwind` now accepts `in-tree` (formerly true), `system` or `no` (formerly false) [#77703](https://github.com/rust-lang/rust/pull/77703) - The options `infodir`, `localstatedir`, and `gpg-password-file` are no longer allowed in config.toml. Previously, they were ignored without warning. Note that `infodir` and `localstatedir` are still accepted by `./configure`, with a warning. [#82451](https://github.com/rust-lang/rust/pull/82451) - Add options for enabling overflow checks, one for std (`overflow-checks-std`) and one for everything else (`overflow-checks`). Both default to false. -- Change the names for `dist` commmands to match the component they generate. [#90684](https://github.com/rust-lang/rust/pull/90684) +- Change the names for `dist` commands to match the component they generate. [#90684](https://github.com/rust-lang/rust/pull/90684) ### Non-breaking changes diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index e7511888114..e816f9b4c07 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -594,7 +594,7 @@ impl<'a> Builder<'a> { dist::RustDev, dist::Extended, // It seems that PlainSourceTarball somehow changes how some of the tools - // perceive their dependencies (see #93033) which would invaliate fingerprints + // perceive their dependencies (see #93033) which would invalidate fingerprints // and force us to rebuild tools after vendoring dependencies. // To work around this, create the Tarball after building all the tools. dist::PlainSourceTarball, diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index e030e0bc1cf..f3eef9a1e63 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -701,7 +701,7 @@ pub fn rustc_cargo_env(builder: &Builder<'_>, cargo: &mut Cargo, target: TargetS // // Note that this is disabled if LLVM itself is disabled or we're in a check // build. If we are in a check build we still go ahead here presuming we've - // detected that LLVM is alreay built and good to go which helps prevent + // detected that LLVM is already built and good to go which helps prevent // busting caches (e.g. like #71152). if builder.config.llvm_enabled() && (builder.kind != Kind::Check diff --git a/src/test/ui/impl-trait/xcrate.rs b/src/test/ui/impl-trait/xcrate.rs index b73d2946c2b..fe106ff0557 100644 --- a/src/test/ui/impl-trait/xcrate.rs +++ b/src/test/ui/impl-trait/xcrate.rs @@ -5,7 +5,7 @@ extern crate xcrate; fn main() { -// NOTE line below commeted out due to issue #45994 +// NOTE line below commented out due to issue #45994 // assert_eq!(xcrate::fourway_add(1)(2)(3)(4), 10); xcrate::return_closure_accessing_internal_fn()(); } From 7682f88fbcbe8baf1c06f56767d368d79a8e7078 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 30 Mar 2022 01:42:10 -0400 Subject: [PATCH 6/6] Spellchecking compiler code Address some spelling mistakes in strings, private function names, and function params. --- compiler/rustc_ast_passes/src/ast_validation.rs | 4 ++-- compiler/rustc_borrowck/src/dataflow.rs | 4 ++-- compiler/rustc_codegen_cranelift/scripts/rustup.sh | 2 +- compiler/rustc_codegen_gcc/rustup.sh | 2 +- .../src/debuginfo/metadata/enums/cpp_like.rs | 2 +- compiler/rustc_hir/src/definitions.rs | 2 +- compiler/rustc_middle/src/mir/interpret/allocation.rs | 2 +- compiler/rustc_trait_selection/src/traits/auto_trait.rs | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/compiler/rustc_ast_passes/src/ast_validation.rs b/compiler/rustc_ast_passes/src/ast_validation.rs index aba0b6a7463..3107dd448f4 100644 --- a/compiler/rustc_ast_passes/src/ast_validation.rs +++ b/compiler/rustc_ast_passes/src/ast_validation.rs @@ -624,7 +624,7 @@ impl<'a> AstValidator<'a> { /// Reject C-varadic type unless the function is foreign, /// or free and `unsafe extern "C"` semantically. - fn check_c_varadic_type(&self, fk: FnKind<'a>) { + fn check_c_variadic_type(&self, fk: FnKind<'a>) { match (fk.ctxt(), fk.header()) { (Some(FnCtxt::Foreign), _) => return, (Some(FnCtxt::Free), Some(header)) => match header.ext { @@ -1504,7 +1504,7 @@ impl<'a> Visitor<'a> for AstValidator<'a> { }; self.check_fn_decl(fk.decl(), self_semantic); - self.check_c_varadic_type(fk); + self.check_c_variadic_type(fk); // Functions cannot both be `const async` if let Some(FnHeader { diff --git a/compiler/rustc_borrowck/src/dataflow.rs b/compiler/rustc_borrowck/src/dataflow.rs index f0036f09c38..684eba82667 100644 --- a/compiler/rustc_borrowck/src/dataflow.rs +++ b/compiler/rustc_borrowck/src/dataflow.rs @@ -407,10 +407,10 @@ impl<'tcx> rustc_mir_dataflow::GenKillAnalysis<'tcx> for Borrows<'_, 'tcx> { fn terminator_effect( &self, trans: &mut impl GenKill, - teminator: &mir::Terminator<'tcx>, + terminator: &mir::Terminator<'tcx>, _location: Location, ) { - if let mir::TerminatorKind::InlineAsm { operands, .. } = &teminator.kind { + if let mir::TerminatorKind::InlineAsm { operands, .. } = &terminator.kind { for op in operands { if let mir::InlineAsmOperand::Out { place: Some(place), .. } | mir::InlineAsmOperand::InOut { out_place: Some(place), .. } = *op diff --git a/compiler/rustc_codegen_cranelift/scripts/rustup.sh b/compiler/rustc_codegen_cranelift/scripts/rustup.sh index cc34c080886..bc4c06ed7d2 100755 --- a/compiler/rustc_codegen_cranelift/scripts/rustup.sh +++ b/compiler/rustc_codegen_cranelift/scripts/rustup.sh @@ -11,7 +11,7 @@ case $1 in sed -i "s/\"nightly-.*\"/\"nightly-${TOOLCHAIN}\"/" rust-toolchain rustup component add rustfmt || true - echo "=> Uninstalling all old nighlies" + echo "=> Uninstalling all old nightlies" for nightly in $(rustup toolchain list | grep nightly | grep -v "$TOOLCHAIN" | grep -v nightly-x86_64); do rustup toolchain uninstall "$nightly" done diff --git a/compiler/rustc_codegen_gcc/rustup.sh b/compiler/rustc_codegen_gcc/rustup.sh index 01ce5bb78be..11d39a122f5 100755 --- a/compiler/rustc_codegen_gcc/rustup.sh +++ b/compiler/rustc_codegen_gcc/rustup.sh @@ -10,7 +10,7 @@ case $1 in rustup toolchain install --profile minimal nightly-${TOOLCHAIN} # Sanity check to see if the nightly exists echo nightly-${TOOLCHAIN} > rust-toolchain - echo "=> Uninstalling all old nighlies" + echo "=> Uninstalling all old nightlies" for nightly in $(rustup toolchain list | grep nightly | grep -v $TOOLCHAIN | grep -v nightly-x86_64); do rustup toolchain uninstall $nightly done diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs index e9772cd78d7..31bb9ed3185 100644 --- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs +++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/cpp_like.rs @@ -356,7 +356,7 @@ fn build_union_fields_for_direct_tag_generator<'ll, 'tcx>( generator_type_di_node: &'ll DIType, ) -> SmallVec<&'ll DIType> { let Variants::Multiple { tag_encoding: TagEncoding::Direct, tag_field, .. } = generator_type_and_layout.variants else { - bug!("This function only supports layouts with direcly encoded tags.") + bug!("This function only supports layouts with directly encoded tags.") }; let (generator_def_id, generator_substs) = match generator_type_and_layout.ty.kind() { diff --git a/compiler/rustc_hir/src/definitions.rs b/compiler/rustc_hir/src/definitions.rs index 4c93d661fd2..1ff9395c589 100644 --- a/compiler/rustc_hir/src/definitions.rs +++ b/compiler/rustc_hir/src/definitions.rs @@ -56,7 +56,7 @@ impl DefPathTable { // // See the documentation for DefPathHash for more information. panic!( - "found DefPathHash collsion between {:?} and {:?}. \ + "found DefPathHash collision between {:?} and {:?}. \ Compilation cannot continue.", def_path1, def_path2 ); diff --git a/compiler/rustc_middle/src/mir/interpret/allocation.rs b/compiler/rustc_middle/src/mir/interpret/allocation.rs index 17ff52cefcf..ec27ce5ea9a 100644 --- a/compiler/rustc_middle/src/mir/interpret/allocation.rs +++ b/compiler/rustc_middle/src/mir/interpret/allocation.rs @@ -171,7 +171,7 @@ impl Allocation { panic!("Allocation::uninit called with panic_on_fail had allocation failure") } ty::tls::with(|tcx| { - tcx.sess.delay_span_bug(DUMMY_SP, "exhausted memory during interpreation") + tcx.sess.delay_span_bug(DUMMY_SP, "exhausted memory during interpretation") }); InterpError::ResourceExhaustion(ResourceExhaustionInfo::MemoryExhausted) })?; diff --git a/compiler/rustc_trait_selection/src/traits/auto_trait.rs b/compiler/rustc_trait_selection/src/traits/auto_trait.rs index ee9983ee8b8..32516af9223 100644 --- a/compiler/rustc_trait_selection/src/traits/auto_trait.rs +++ b/compiler/rustc_trait_selection/src/traits/auto_trait.rs @@ -683,7 +683,7 @@ impl<'tcx> AutoTraitFinder<'tcx> { && is_new_pred { debug!( - "evaluate_nested_obligations: adding projection predicate\ + "evaluate_nested_obligations: adding projection predicate \ to computed_preds: {:?}", predicate );