diff --git a/library/alloc/src/rc.rs b/library/alloc/src/rc.rs index 116df63f94b69..1c61050147d81 100644 --- a/library/alloc/src/rc.rs +++ b/library/alloc/src/rc.rs @@ -2101,7 +2101,7 @@ impl Unpin for Rc {} /// /// - This function is safe for any argument if `T` is sized, and /// - if `T` is unsized, the pointer must have appropriate pointer metadata -/// aquired from the real instance that you are getting this offset for. +/// acquired from the real instance that you are getting this offset for. unsafe fn data_offset(ptr: *const T) -> isize { // Align the unsized value to the end of the `RcBox`. // Because it is ?Sized, it will always be the last field in memory. diff --git a/library/alloc/src/sync.rs b/library/alloc/src/sync.rs index 58cab9c5c6388..343a17b002f57 100644 --- a/library/alloc/src/sync.rs +++ b/library/alloc/src/sync.rs @@ -2255,7 +2255,7 @@ impl Unpin for Arc {} /// /// - This function is safe for any argument if `T` is sized, and /// - if `T` is unsized, the pointer must have appropriate pointer metadata -/// aquired from the real instance that you are getting this offset for. +/// acquired from the real instance that you are getting this offset for. unsafe fn data_offset(ptr: *const T) -> isize { // Align the unsized value to the end of the `ArcInner`. // Because it is `?Sized`, it will always be the last field in memory. diff --git a/library/alloc/tests/boxed.rs b/library/alloc/tests/boxed.rs index 5377485da8f3b..851ca17a36548 100644 --- a/library/alloc/tests/boxed.rs +++ b/library/alloc/tests/boxed.rs @@ -37,7 +37,7 @@ fn box_clone_and_clone_from_equivalence() { /// This test might give a false positive in case the box realocates, but the alocator keeps the /// original pointer. /// -/// On the other hand it won't give a false negative, if it fails than the memory was definitly not +/// On the other hand it won't give a false negative, if it fails than the memory was definitely not /// reused #[test] fn box_clone_from_ptr_stability() { diff --git a/library/std/src/alloc.rs b/library/std/src/alloc.rs index ecfaaeace513e..c44ce9873d508 100644 --- a/library/std/src/alloc.rs +++ b/library/std/src/alloc.rs @@ -189,7 +189,7 @@ unsafe impl AllocRef for System { ReallocPlacement::MayMove if layout.size() == 0 => { let new_layout = // SAFETY: The new size and layout alignement guarantees - // are transfered to the caller (they come from parameters). + // are transferred to the caller (they come from parameters). // // See the preconditions for `Layout::from_size_align` to // see what must be checked. @@ -254,7 +254,7 @@ unsafe impl AllocRef for System { // // See `GlobalAlloc::realloc` for more informations about the // guarantees expected by this method. `ptr`, `layout` and - // `new_size` are parameters and the responsability for their + // `new_size` are parameters and the responsibility for their // correctness is left to the caller. // // `realloc` probably checks for `new_size < size` or something diff --git a/library/std/src/keyword_docs.rs b/library/std/src/keyword_docs.rs index 1fa438747c165..c98008688ab4f 100644 --- a/library/std/src/keyword_docs.rs +++ b/library/std/src/keyword_docs.rs @@ -1363,7 +1363,7 @@ mod self_upper_keyword {} /// /// let r1 = &FOO as *const _; /// let r2 = &FOO as *const _; -/// // With a strictly read-only static, references will have the same adress +/// // With a strictly read-only static, references will have the same address /// assert_eq!(r1, r2); /// // A static item can be used just like a variable in many cases /// println!("{:?}", FOO); diff --git a/library/std/src/sync/once.rs b/library/std/src/sync/once.rs index 64260990824b8..714ec3e878617 100644 --- a/library/std/src/sync/once.rs +++ b/library/std/src/sync/once.rs @@ -81,7 +81,7 @@ // see the changes to drop the `Waiter` struct correctly. // * There is one place where the two atomics `Once.state_and_queue` and // `Waiter.signaled` come together, and might be reordered by the compiler or -// processor. Because both use Aquire ordering such a reordering is not +// processor. Because both use Acquire ordering such a reordering is not // allowed, so no need for SeqCst. use crate::cell::Cell; diff --git a/library/stdarch b/library/stdarch index 311d56cd91609..d6822f9c433bd 160000 --- a/library/stdarch +++ b/library/stdarch @@ -1 +1 @@ -Subproject commit 311d56cd91609c1c1c0370cbd2ece8e3048653a5 +Subproject commit d6822f9c433bd70f786b157f17beaf64ee28d83a diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs index 2ead5d0a37f9c..bb5b9296c0aa7 100644 --- a/src/bootstrap/test.rs +++ b/src/bootstrap/test.rs @@ -1158,13 +1158,19 @@ impl Step for Compiletest { cmd.arg("--quiet"); } + let mut llvm_components_passed = false; + let mut copts_passed = false; if builder.config.llvm_enabled() { let llvm_config = builder.ensure(native::Llvm { target: builder.config.build }); if !builder.config.dry_run { let llvm_version = output(Command::new(&llvm_config).arg("--version")); + let llvm_components = output(Command::new(&llvm_config).arg("--components")); // Remove trailing newline from llvm-config output. - let llvm_version = llvm_version.trim_end(); - cmd.arg("--llvm-version").arg(llvm_version); + cmd.arg("--llvm-version") + .arg(llvm_version.trim()) + .arg("--llvm-components") + .arg(llvm_components.trim()); + llvm_components_passed = true; } if !builder.is_rust_llvm(target) { cmd.arg("--system-llvm"); @@ -1182,15 +1188,13 @@ impl Step for Compiletest { // Only pass correct values for these flags for the `run-make` suite as it // requires that a C++ compiler was configured which isn't always the case. if !builder.config.dry_run && suite == "run-make-fulldeps" { - let llvm_components = output(Command::new(&llvm_config).arg("--components")); cmd.arg("--cc") .arg(builder.cc(target)) .arg("--cxx") .arg(builder.cxx(target).unwrap()) .arg("--cflags") - .arg(builder.cflags(target, GitRepo::Rustc).join(" ")) - .arg("--llvm-components") - .arg(llvm_components.trim()); + .arg(builder.cflags(target, GitRepo::Rustc).join(" ")); + copts_passed = true; if let Some(ar) = builder.ar(target) { cmd.arg("--ar").arg(ar); } @@ -1220,15 +1224,11 @@ impl Step for Compiletest { } } - if suite != "run-make-fulldeps" { - cmd.arg("--cc") - .arg("") - .arg("--cxx") - .arg("") - .arg("--cflags") - .arg("") - .arg("--llvm-components") - .arg(""); + if !llvm_components_passed { + cmd.arg("--llvm-components").arg(""); + } + if !copts_passed { + cmd.arg("--cc").arg("").arg("--cxx").arg("").arg("--cflags").arg(""); } if builder.remote_tested(target) { diff --git a/src/librustc_ast_pretty/pprust.rs b/src/librustc_ast_pretty/pprust.rs index b0edb1ca41d20..4b228629ad719 100644 --- a/src/librustc_ast_pretty/pprust.rs +++ b/src/librustc_ast_pretty/pprust.rs @@ -450,7 +450,9 @@ pub trait PrintState<'a>: std::ops::Deref + std::ops::Dere fn print_comment(&mut self, cmnt: &comments::Comment) { match cmnt.style { comments::Mixed => { - self.zerobreak(); + if !self.is_beginning_of_line() { + self.zerobreak(); + } if let Some((last, lines)) = cmnt.lines.split_last() { self.ibox(0); diff --git a/src/librustc_infer/infer/combine.rs b/src/librustc_infer/infer/combine.rs index 5b4d91de3ca92..133c4bf2db5f7 100644 --- a/src/librustc_infer/infer/combine.rs +++ b/src/librustc_infer/infer/combine.rs @@ -166,7 +166,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> { return self.unify_const_variable(!a_is_expected, vid, a); } (ty::ConstKind::Unevaluated(..), _) if self.tcx.lazy_normalization() => { - // FIXME(#59490): Need to remove the leak check to accomodate + // FIXME(#59490): Need to remove the leak check to accommodate // escaping bound variables here. if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() { relation.const_equate_obligation(a, b); @@ -174,7 +174,7 @@ impl<'infcx, 'tcx> InferCtxt<'infcx, 'tcx> { return Ok(b); } (_, ty::ConstKind::Unevaluated(..)) if self.tcx.lazy_normalization() => { - // FIXME(#59490): Need to remove the leak check to accomodate + // FIXME(#59490): Need to remove the leak check to accommodate // escaping bound variables here. if !a.has_escaping_bound_vars() && !b.has_escaping_bound_vars() { relation.const_equate_obligation(a, b); diff --git a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs index 4fa6d9d239424..0125e0f48e885 100644 --- a/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs +++ b/src/librustc_infer/infer/error_reporting/nice_region_error/static_impl_trait.rs @@ -195,7 +195,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { } } if let (Some(ident), true) = (override_error_code, fn_returns.is_empty()) { - // Provide a more targetted error code and description. + // Provide a more targeted error code and description. err.code(rustc_errors::error_code!(E0772)); err.set_primary_message(&format!( "{} has {} but calling `{}` introduces an implicit `'static` lifetime \ diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index 8d8fb8c3c6098..a33f920603592 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -422,7 +422,7 @@ trait UnusedDelimLint { lhs_needs_parens || (followed_by_block && match inner.kind { - ExprKind::Ret(_) | ExprKind::Break(..) => true, + ExprKind::Ret(_) | ExprKind::Break(..) | ExprKind::Yield(..) => true, _ => parser::contains_exterior_struct_lit(&inner), }) } diff --git a/src/librustc_metadata/rmeta/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs index 49aaa845bc226..352b8bff7e2fb 100644 --- a/src/librustc_metadata/rmeta/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -267,7 +267,7 @@ impl<'a, 'tcx> SpecializedEncoder for EncodeContext<'a, 'tcx> { // real code should never need to care about this. // // 2. Using `Span::def_site` or `Span::mixed_site` will not - // include any hygiene information associated with the defintion + // include any hygiene information associated with the definition // site. This means that a proc-macro cannot emit a `$crate` // identifier which resolves to one of its dependencies, // which also should never come up in practice. diff --git a/src/librustc_middle/ty/util.rs b/src/librustc_middle/ty/util.rs index db78fa535cf42..07221082048fb 100644 --- a/src/librustc_middle/ty/util.rs +++ b/src/librustc_middle/ty/util.rs @@ -585,7 +585,7 @@ struct OpaqueTypeExpander<'tcx> { found_recursion: bool, /// Whether or not to check for recursive opaque types. /// This is `true` when we're explicitly checking for opaque type - /// recursion, and 'false' otherwise to avoid unecessary work. + /// recursion, and 'false' otherwise to avoid unnecessary work. check_recursion: bool, tcx: TyCtxt<'tcx>, } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index f68473480630b..f1a7338d11fd9 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -524,7 +524,7 @@ impl<'tcx> Validator<'_, 'tcx> { // The `is_empty` predicate is introduced to exclude the case // where the projection operations are [ .field, * ]. // The reason is because promotion will be illegal if field - // accesses preceed the dereferencing. + // accesses precede the dereferencing. // Discussion can be found at // https://github.com/rust-lang/rust/pull/74945#discussion_r463063247 // There may be opportunity for generalization, but this needs to be diff --git a/src/librustc_mir_build/thir/pattern/mod.rs b/src/librustc_mir_build/thir/pattern/mod.rs index bdefaadfdfe56..daff10eb194f8 100644 --- a/src/librustc_mir_build/thir/pattern/mod.rs +++ b/src/librustc_mir_build/thir/pattern/mod.rs @@ -133,7 +133,7 @@ crate enum PatKind<'tcx> { var: hir::HirId, ty: Ty<'tcx>, subpattern: Option>, - /// Is this the leftmost occurance of the binding, i.e., is `var` the + /// Is this the leftmost occurrence of the binding, i.e., is `var` the /// `HirId` of this pattern? is_primary: bool, }, diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs index 620a04b45b0e4..9fcdd46539c46 100644 --- a/src/librustc_session/config.rs +++ b/src/librustc_session/config.rs @@ -1717,7 +1717,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options { } // `-Z instrument-coverage` implies: - // * `-Z symbol-mangling-version=v0` - to ensure consistent and reversable name mangling. + // * `-Z symbol-mangling-version=v0` - to ensure consistent and reversible name mangling. // Note, LLVM coverage tools can analyze coverage over multiple runs, including some // changes to source code; so mangled names must be consistent across compilations. // * `-C link-dead-code` - so unexecuted code is still counted as zero, rather than be diff --git a/src/librustc_session/parse.rs b/src/librustc_session/parse.rs index 1b232d7b14dce..9cdb7e966fef8 100644 --- a/src/librustc_session/parse.rs +++ b/src/librustc_session/parse.rs @@ -63,7 +63,7 @@ impl GatedSpans { #[derive(Default)] pub struct SymbolGallery { - /// All symbols occurred and their first occurrance span. + /// All symbols occurred and their first occurrence span. pub symbols: Lock>, } diff --git a/src/librustc_span/hygiene.rs b/src/librustc_span/hygiene.rs index 13bc1751831b9..a03ac4e1fdba1 100644 --- a/src/librustc_span/hygiene.rs +++ b/src/librustc_span/hygiene.rs @@ -891,7 +891,7 @@ impl UseSpecializedDecodable for ExpnId {} #[derive(Default)] pub struct HygieneEncodeContext { - /// All `SyntaxContexts` for which we have writen `SyntaxContextData` into crate metadata. + /// All `SyntaxContexts` for which we have written `SyntaxContextData` into crate metadata. /// This is `None` after we finish encoding `SyntaxContexts`, to ensure /// that we don't accidentally try to encode any more `SyntaxContexts` serialized_ctxts: Lock>, @@ -961,7 +961,7 @@ pub struct HygieneDecodeContext { // Maps serialized `SyntaxContext` ids to a `SyntaxContext` in the current // global `HygieneData`. When we deserialize a `SyntaxContext`, we need to create // a new id in the global `HygieneData`. This map tracks the ID we end up picking, - // so that multiple occurences of the same serialized id are decoded to the same + // so that multiple occurrences of the same serialized id are decoded to the same // `SyntaxContext` remapped_ctxts: Lock>>, // The same as `remapepd_ctxts`, but for `ExpnId`s diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index c7e9b97e2dbde..db8cdfc5b20d6 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -456,7 +456,7 @@ impl<'f, 'tcx> Coerce<'f, 'tcx> { // // Both of these trigger a special `CoerceUnsized`-related error (E0376) // - // We can take advantage of this fact to avoid performing unecessary work. + // We can take advantage of this fact to avoid performing unnecessary work. // If either `source` or `target` is a type variable, then any applicable impl // would need to be generic over the self-type (`impl CoerceUnsized for T`) // or generic over the `CoerceUnsized` type parameter (`impl CoerceUnsized for diff --git a/src/test/assembly/asm/aarch64-modifiers.rs b/src/test/assembly/asm/aarch64-modifiers.rs index c2484e9b6d0a6..150997ee807da 100644 --- a/src/test/assembly/asm/aarch64-modifiers.rs +++ b/src/test/assembly/asm/aarch64-modifiers.rs @@ -2,6 +2,7 @@ // assembly-output: emit-asm // compile-flags: -O // compile-flags: --target aarch64-unknown-linux-gnu +// needs-llvm-components: aarch64 #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/aarch64-types.rs b/src/test/assembly/asm/aarch64-types.rs index ce2f0082a06b1..b78a8cbb559b4 100644 --- a/src/test/assembly/asm/aarch64-types.rs +++ b/src/test/assembly/asm/aarch64-types.rs @@ -1,6 +1,7 @@ // no-system-llvm // assembly-output: emit-asm // compile-flags: --target aarch64-unknown-linux-gnu +// needs-llvm-components: aarch64 #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/arm-modifiers.rs b/src/test/assembly/asm/arm-modifiers.rs index b71503d0a535e..ad4ab63f265a7 100644 --- a/src/test/assembly/asm/arm-modifiers.rs +++ b/src/test/assembly/asm/arm-modifiers.rs @@ -3,6 +3,7 @@ // compile-flags: -O // compile-flags: --target armv7-unknown-linux-gnueabihf // compile-flags: -C target-feature=+neon +// needs-llvm-components: arm #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/arm-types.rs b/src/test/assembly/asm/arm-types.rs index 1e338f56c4dd7..07e25a38e4583 100644 --- a/src/test/assembly/asm/arm-types.rs +++ b/src/test/assembly/asm/arm-types.rs @@ -2,6 +2,7 @@ // assembly-output: emit-asm // compile-flags: --target armv7-unknown-linux-gnueabihf // compile-flags: -C target-feature=+neon +// needs-llvm-components: arm #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/hexagon-types.rs b/src/test/assembly/asm/hexagon-types.rs index ba2d8a363cd4e..b6b3b54cd7101 100644 --- a/src/test/assembly/asm/hexagon-types.rs +++ b/src/test/assembly/asm/hexagon-types.rs @@ -1,6 +1,7 @@ // no-system-llvm // assembly-output: emit-asm // compile-flags: --target hexagon-unknown-linux-musl +// needs-llvm-components: hexagon #![feature(no_core, lang_items, rustc_attrs, repr_simd)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/nvptx-types.rs b/src/test/assembly/asm/nvptx-types.rs index 4ee79d1bcc839..77fd5141357e2 100644 --- a/src/test/assembly/asm/nvptx-types.rs +++ b/src/test/assembly/asm/nvptx-types.rs @@ -2,6 +2,7 @@ // assembly-output: emit-asm // compile-flags: --target nvptx64-nvidia-cuda // compile-flags: --crate-type cdylib +// needs-llvm-components: nvptx #![feature(no_core, lang_items, rustc_attrs)] #![no_core] diff --git a/src/test/assembly/asm/riscv-modifiers.rs b/src/test/assembly/asm/riscv-modifiers.rs index 8c816e3220b74..b6735153b5dcf 100644 --- a/src/test/assembly/asm/riscv-modifiers.rs +++ b/src/test/assembly/asm/riscv-modifiers.rs @@ -3,6 +3,7 @@ // compile-flags: -O // compile-flags: --target riscv64gc-unknown-linux-gnu // compile-flags: -C target-feature=+f +// needs-llvm-components: riscv #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/src/test/assembly/asm/riscv-types.rs b/src/test/assembly/asm/riscv-types.rs index 449213471cc6f..0ff0bf1f94982 100644 --- a/src/test/assembly/asm/riscv-types.rs +++ b/src/test/assembly/asm/riscv-types.rs @@ -4,6 +4,7 @@ //[riscv64] compile-flags: --target riscv64imac-unknown-none-elf //[riscv32] compile-flags: --target riscv32imac-unknown-none-elf // compile-flags: -C target-feature=+d +// needs-llvm-components: riscv #![feature(no_core, lang_items, rustc_attrs)] #![crate_type = "rlib"] diff --git a/src/test/codegen/abi-efiapi.rs b/src/test/codegen/abi-efiapi.rs index 7c61b7809901f..1c0b77ad9c727 100644 --- a/src/test/codegen/abi-efiapi.rs +++ b/src/test/codegen/abi-efiapi.rs @@ -1,12 +1,14 @@ // Checks if the correct annotation for the efiapi ABI is passed to llvm. -// revisions:x86_64 i686 arm - +// revisions:x86_64 i686 aarch64 arm riscv // min-llvm-version: 9.0 +// needs-llvm-components: aarch64 arm riscv //[x86_64] compile-flags: --target x86_64-unknown-uefi //[i686] compile-flags: --target i686-unknown-linux-musl +//[aarch64] compile-flags: --target aarch64-unknown-none //[arm] compile-flags: --target armv7r-none-eabi +//[riscv] compile-flags: --target riscv64gc-unknown-none-elf // compile-flags: -C no-prepopulate-passes #![crate_type = "lib"] @@ -22,6 +24,8 @@ trait Copy { } //x86_64: define win64cc void @has_efiapi //i686: define void @has_efiapi +//aarch64: define void @has_efiapi //arm: define void @has_efiapi +//riscv: define void @has_efiapi #[no_mangle] pub extern "efiapi" fn has_efiapi() {} diff --git a/src/test/codegen/avr/avr-func-addrspace.rs b/src/test/codegen/avr/avr-func-addrspace.rs index 7759d9603a5a4..6d25ca56f1488 100644 --- a/src/test/codegen/avr/avr-func-addrspace.rs +++ b/src/test/codegen/avr/avr-func-addrspace.rs @@ -1,4 +1,5 @@ // compile-flags: -O --target=avr-unknown-unknown --crate-type=rlib +// needs-llvm-components: avr // This test validates that function pointers can be stored in global variables // and called upon. It ensures that Rust emits function pointers in the correct diff --git a/src/test/pretty/block-comment-wchar.pp b/src/test/pretty/block-comment-wchar.pp index 9317b36ba497b..2bfcdd75e15cf 100644 --- a/src/test/pretty/block-comment-wchar.pp +++ b/src/test/pretty/block-comment-wchar.pp @@ -73,7 +73,6 @@ */ - /* */ /* @@ -81,7 +80,6 @@ Space 6+2: compare A Ogham Space Mark 6+2: compare B */ - /* */ /* diff --git a/src/test/pretty/issue-74745.rs b/src/test/pretty/issue-74745.rs new file mode 100644 index 0000000000000..e255cd6caa865 --- /dev/null +++ b/src/test/pretty/issue-74745.rs @@ -0,0 +1,5 @@ +// ignore-tidy-trailing-newlines +// pretty-compare-only + +/* +*/ \ No newline at end of file diff --git a/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs b/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs index c6b794de19526..51e1af359cdcc 100644 --- a/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs +++ b/src/test/ui/consts/const_in_pattern/warn_corner_cases.rs @@ -10,7 +10,7 @@ // const-evaluator computes a value that *does* meet the conditions for // structural-match, but the const expression itself has abstractions (like // calls to const functions) that may fit better with a type-based analysis -// rather than a committment to a specific value. +// rather than a commitment to a specific value. #![warn(indirect_structural_match)] diff --git a/src/test/ui/consts/issue-73976-polymorphic.rs b/src/test/ui/consts/issue-73976-polymorphic.rs index 518036c9dbeec..b3d8610ff5173 100644 --- a/src/test/ui/consts/issue-73976-polymorphic.rs +++ b/src/test/ui/consts/issue-73976-polymorphic.rs @@ -1,5 +1,5 @@ // This test is from #73976. We previously did not check if a type is monomorphized -// before calculating its type id, which leads to the bizzare behaviour below that +// before calculating its type id, which leads to the bizarre behaviour below that // TypeId of a generic type does not match itself. // // This test case should either run-pass or be rejected at compile time. diff --git a/src/test/ui/issues/issue-37131.rs b/src/test/ui/issues/issue-37131.rs index aa3b6ea86bbe0..ac2d1d1ed8b73 100644 --- a/src/test/ui/issues/issue-37131.rs +++ b/src/test/ui/issues/issue-37131.rs @@ -3,6 +3,7 @@ // compile-flags: --target=thumbv6m-none-eabi // ignore-arm +// needs-llvm-components: arm // error-pattern:target may not be installed fn main() { } diff --git a/src/test/ui/issues/issue-49851/compiler-builtins-error.rs b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs index 9449376513fd5..ddb070ddf9fae 100644 --- a/src/test/ui/issues/issue-49851/compiler-builtins-error.rs +++ b/src/test/ui/issues/issue-49851/compiler-builtins-error.rs @@ -1,6 +1,7 @@ //~ ERROR 1:1: 1:1: can't find crate for `core` [E0463] // compile-flags: --target thumbv7em-none-eabihf +// needs-llvm-components: arm #![deny(unsafe_code)] #![deny(warnings)] #![no_std] diff --git a/src/test/ui/issues/issue-50993.rs b/src/test/ui/issues/issue-50993.rs index d38eb82667812..e6a9451a060cd 100644 --- a/src/test/ui/issues/issue-50993.rs +++ b/src/test/ui/issues/issue-50993.rs @@ -1,4 +1,5 @@ // compile-flags: --crate-type dylib --target thumbv7em-none-eabihf +// needs-llvm-components: arm // build-pass // error-pattern: dropping unsupported crate type `dylib` for target `thumbv7em-none-eabihf` diff --git a/src/test/ui/lint/issue-74883-unused-paren-baren-yield.rs b/src/test/ui/lint/issue-74883-unused-paren-baren-yield.rs new file mode 100644 index 0000000000000..02182ec299321 --- /dev/null +++ b/src/test/ui/lint/issue-74883-unused-paren-baren-yield.rs @@ -0,0 +1,33 @@ +#![feature(generator_trait)] +#![feature(generators)] +#![deny(unused_braces, unused_parens)] + +use std::ops::Generator; +use std::pin::Pin; + +fn main() { + let mut x = |_| { + while let Some(_) = (yield) {} + while let Some(_) = {yield} {} + + // Only warn these cases + while let Some(_) = ({yield}) {} //~ ERROR: unnecessary parentheses + while let Some(_) = ((yield)) {} //~ ERROR: unnecessary parentheses + {{yield}}; //~ ERROR: unnecessary braces + {( yield )}; //~ ERROR: unnecessary parentheses + + // FIXME: Reduce duplicate warnings. + // Perhaps we should tweak checks in `BlockRetValue`? + while let Some(_) = {(yield)} {} + //~^ ERROR: unnecessary braces + //~| ERROR: unnecessary parentheses + while let Some(_) = {{yield}} {} + //~^ ERROR: unnecessary braces + //~| ERROR: unnecessary braces + + // FIXME: It'd be great if we could also warn them. + ((yield)); + ({ yield }); + }; + let _ = Pin::new(&mut x).resume(Some(5)); +} diff --git a/src/test/ui/lint/issue-74883-unused-paren-baren-yield.stderr b/src/test/ui/lint/issue-74883-unused-paren-baren-yield.stderr new file mode 100644 index 0000000000000..267cc9e031a11 --- /dev/null +++ b/src/test/ui/lint/issue-74883-unused-paren-baren-yield.stderr @@ -0,0 +1,62 @@ +error: unnecessary parentheses around `let` scrutinee expression + --> $DIR/issue-74883-unused-paren-baren-yield.rs:14:29 + | +LL | while let Some(_) = ({yield}) {} + | ^^^^^^^^^ help: remove these parentheses + | +note: the lint level is defined here + --> $DIR/issue-74883-unused-paren-baren-yield.rs:3:24 + | +LL | #![deny(unused_braces, unused_parens)] + | ^^^^^^^^^^^^^ + +error: unnecessary parentheses around `let` scrutinee expression + --> $DIR/issue-74883-unused-paren-baren-yield.rs:15:29 + | +LL | while let Some(_) = ((yield)) {} + | ^^^^^^^^^ help: remove these parentheses + +error: unnecessary braces around block return value + --> $DIR/issue-74883-unused-paren-baren-yield.rs:16:10 + | +LL | {{yield}}; + | ^^^^^^^ help: remove these braces + | +note: the lint level is defined here + --> $DIR/issue-74883-unused-paren-baren-yield.rs:3:9 + | +LL | #![deny(unused_braces, unused_parens)] + | ^^^^^^^^^^^^^ + +error: unnecessary parentheses around block return value + --> $DIR/issue-74883-unused-paren-baren-yield.rs:17:10 + | +LL | {( yield )}; + | ^^^^^^^^^ help: remove these parentheses + +error: unnecessary braces around `let` scrutinee expression + --> $DIR/issue-74883-unused-paren-baren-yield.rs:21:29 + | +LL | while let Some(_) = {(yield)} {} + | ^^^^^^^^^ help: remove these braces + +error: unnecessary parentheses around block return value + --> $DIR/issue-74883-unused-paren-baren-yield.rs:21:30 + | +LL | while let Some(_) = {(yield)} {} + | ^^^^^^^ help: remove these parentheses + +error: unnecessary braces around `let` scrutinee expression + --> $DIR/issue-74883-unused-paren-baren-yield.rs:24:29 + | +LL | while let Some(_) = {{yield}} {} + | ^^^^^^^^^ help: remove these braces + +error: unnecessary braces around block return value + --> $DIR/issue-74883-unused-paren-baren-yield.rs:24:30 + | +LL | while let Some(_) = {{yield}} {} + | ^^^^^^^ help: remove these braces + +error: aborting due to 8 previous errors + diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs index 4f90bd98c63e5..034499145b780 100644 --- a/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs +++ b/src/test/ui/lint/lint-nonstandard-style-unicode-1.rs @@ -23,7 +23,7 @@ struct _ヒb; struct __χa; //~^ ERROR type `__χa` should have an upper camel case name -// Besides this, we cannot have two continous underscores in the middle. +// Besides this, we cannot have two continuous underscores in the middle. struct 对__否; //~^ ERROR type `对__否` should have an upper camel case name diff --git a/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs b/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs index 813e0ea5c5708..0b52a5fde35dc 100644 --- a/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs +++ b/src/test/ui/lint/lint-nonstandard-style-unicode-2.rs @@ -18,7 +18,7 @@ fn 编程() {} fn Ц() {} //~^ ERROR function `Ц` should have a snake case name -// besides this, you cannot use continous underscores in the middle +// besides this, you cannot use continuous underscores in the middle fn 分__隔() {} //~^ ERROR function `分__隔` should have a snake case name diff --git a/src/test/ui/proc-macro/crt-static.rs b/src/test/ui/proc-macro/crt-static.rs index 97f6265e3089b..4f11f81b00bfa 100644 --- a/src/test/ui/proc-macro/crt-static.rs +++ b/src/test/ui/proc-macro/crt-static.rs @@ -1,4 +1,4 @@ -// Test proc-macro crate can be built without addtional RUSTFLAGS +// Test proc-macro crate can be built without additional RUSTFLAGS // on musl target // override -Ctarget-feature=-crt-static from compiletest // compile-flags: -Ctarget-feature= diff --git a/src/tools/clippy/tests/ui/formatting.rs b/src/tools/clippy/tests/ui/formatting.rs index 078811b8d882b..f54b3f2bfe28a 100644 --- a/src/tools/clippy/tests/ui/formatting.rs +++ b/src/tools/clippy/tests/ui/formatting.rs @@ -149,7 +149,7 @@ fn main() { 1 + 2, 3 - 4, 5 ]; - // lint if it doesnt + // lint if it doesn't let _ = &[ -1 -4, diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs index 2ab764eb9207c..047fbe9da14fe 100644 --- a/src/tools/compiletest/src/header.rs +++ b/src/tools/compiletest/src/header.rs @@ -1,3 +1,4 @@ +use std::collections::HashSet; use std::env; use std::fs::File; use std::io::prelude::*; @@ -186,6 +187,17 @@ impl EarlyProps { if config.system_llvm && line.starts_with("no-system-llvm") { return true; } + if let Some(needed_components) = + config.parse_name_value_directive(line, "needs-llvm-components") + { + let components: HashSet<_> = config.llvm_components.split_whitespace().collect(); + if !needed_components + .split_whitespace() + .all(|needed_component| components.contains(needed_component)) + { + return true; + } + } if let Some(actual_version) = config.llvm_version { if let Some(rest) = line.strip_prefix("min-llvm-version:").map(str::trim) { let min_version = extract_llvm_version(rest).unwrap(); diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 9354cc16a9ae9..940e16720f6a9 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -178,27 +178,30 @@ pub fn make_diff(expected: &str, actual: &str, context_size: usize) -> Vec String { + use std::fmt::Write; + let mut output = String::new(); let diff_results = make_diff(expected, actual, context_size); for result in diff_results { let mut line_number = result.line_number; for line in result.lines { match line { DiffLine::Expected(e) => { - println!("-\t{}", e); + writeln!(output, "-\t{}", e).unwrap(); line_number += 1; } DiffLine::Context(c) => { - println!("{}\t{}", line_number, c); + writeln!(output, "{}\t{}", line_number, c).unwrap(); line_number += 1; } DiffLine::Resulting(r) => { - println!("+\t{}", r); + writeln!(output, "+\t{}", r).unwrap(); } } } - println!(); + writeln!(output, "").unwrap(); } + output } pub fn run(config: Config, testpaths: &TestPaths, revision: Option<&str>) { @@ -655,8 +658,12 @@ impl<'test> TestCx<'test> { ------------------------------------------\n\ {}\n\ ------------------------------------------\n\ - \n", - expected, actual + diff:\n\ + ------------------------------------------\n\ + {}\n", + expected, + actual, + write_diff(expected, actual, 3), )); } } @@ -3227,7 +3234,7 @@ impl<'test> TestCx<'test> { } let expected_string = fs::read_to_string(&expected_file).unwrap(); if dumped_string != expected_string { - print_diff(&expected_string, &dumped_string, 3); + print!("{}", write_diff(&expected_string, &dumped_string, 3)); panic!( "Actual MIR output differs from expected MIR output {}", expected_file.display() @@ -3452,7 +3459,7 @@ impl<'test> TestCx<'test> { println!("normalized {}:\n{}\n", kind, actual); } else { println!("diff of {}:\n", kind); - print_diff(expected, actual, 3); + print!("{}", write_diff(expected, actual, 3)); } }