diff --git a/compiler/rustc_builtin_macros/src/format_foreign.rs b/compiler/rustc_builtin_macros/src/format_foreign.rs index 13d5b42942ac7..e4c1f4b9dca73 100644 --- a/compiler/rustc_builtin_macros/src/format_foreign.rs +++ b/compiler/rustc_builtin_macros/src/format_foreign.rs @@ -62,6 +62,8 @@ pub(crate) mod printf { /// Precision of the conversion. precision: Option, /// Length modifier for the conversion. + // FIXME(#143487): is it okay that this field is never read? + #[cfg_attr(not(bootstrap), expect(dead_code))] length: Option<&'a str>, /// Type of parameter being converted. type_: &'a str, diff --git a/compiler/rustc_data_structures/src/sync/worker_local.rs b/compiler/rustc_data_structures/src/sync/worker_local.rs index d75af00985047..14b5e7c910176 100644 --- a/compiler/rustc_data_structures/src/sync/worker_local.rs +++ b/compiler/rustc_data_structures/src/sync/worker_local.rs @@ -12,7 +12,13 @@ use crate::sync::CacheAligned; /// A pointer to the `RegistryData` which uniquely identifies a registry. /// This identifier can be reused if the registry gets freed. #[derive(Clone, Copy, PartialEq)] -struct RegistryId(*const RegistryData); +struct RegistryId( + #[cfg_attr( + not(bootstrap), + expect(dead_code, reason = "This field is only used for equality comparisons") + )] + *const RegistryData, +); impl RegistryId { #[inline(always)] diff --git a/compiler/rustc_errors/src/json/tests.rs b/compiler/rustc_errors/src/json/tests.rs index 8cf81f467d84c..acac2700fc349 100644 --- a/compiler/rustc_errors/src/json/tests.rs +++ b/compiler/rustc_errors/src/json/tests.rs @@ -13,6 +13,7 @@ struct TestData { } #[derive(Deserialize, Debug, PartialEq, Eq)] +#[allow(dead_code, reason = "Fields are only used for equality comparisons")] struct SpanTestData { pub byte_start: u32, pub byte_end: u32, diff --git a/compiler/rustc_hir_typeck/src/loops.rs b/compiler/rustc_hir_typeck/src/loops.rs index 80eab578f1342..5ceba770e12b6 100644 --- a/compiler/rustc_hir_typeck/src/loops.rs +++ b/compiler/rustc_hir_typeck/src/loops.rs @@ -26,7 +26,10 @@ use crate::errors::{ enum Context { Normal, Fn, - Loop(hir::LoopSource), + Loop( + // FIXME(#143487): is it okay that this field is never read? + #[cfg_attr(not(bootstrap), expect(dead_code))] hir::LoopSource, + ), Closure(Span), Coroutine { coroutine_span: Span, @@ -34,7 +37,10 @@ enum Context { source: hir::CoroutineSource, }, UnlabeledBlock(Span), - UnlabeledIfBlock(Span), + UnlabeledIfBlock( + // FIXME(#143487): is it okay that this field is never read? + #[cfg_attr(not(bootstrap), expect(dead_code))] Span, + ), LabeledBlock, /// E.g. The labeled block inside `['_'; 'block: { break 'block 1 + 2; }]`. AnonConst, diff --git a/compiler/rustc_pattern_analysis/src/constructor.rs b/compiler/rustc_pattern_analysis/src/constructor.rs index 09685640e5022..57642358d9a76 100644 --- a/compiler/rustc_pattern_analysis/src/constructor.rs +++ b/compiler/rustc_pattern_analysis/src/constructor.rs @@ -657,7 +657,13 @@ impl Slice { /// A globally unique id to distinguish `Opaque` patterns. #[derive(Clone, Debug, PartialEq, Eq)] -pub struct OpaqueId(u32); +pub struct OpaqueId( + #[cfg_attr( + not(bootstrap), + expect(dead_code, reason = "This field is only used for equality comparisons") + )] + u32, +); impl OpaqueId { pub fn new() -> Self { diff --git a/compiler/rustc_thread_pool/tests/scoped_threadpool.rs b/compiler/rustc_thread_pool/tests/scoped_threadpool.rs index 295da650e8805..4d965c55d2905 100644 --- a/compiler/rustc_thread_pool/tests/scoped_threadpool.rs +++ b/compiler/rustc_thread_pool/tests/scoped_threadpool.rs @@ -4,7 +4,7 @@ use crossbeam_utils::thread; use rustc_thread_pool::ThreadPoolBuilder; #[derive(PartialEq, Eq, Debug)] -struct Local(i32); +struct Local(#[allow(dead_code, reason = "Only used for equality comparisons")] i32); scoped_tls::scoped_thread_local!(static LOCAL: Local); diff --git a/library/core/src/cmp.rs b/library/core/src/cmp.rs index b1ca3701fa5ae..323accf096287 100644 --- a/library/core/src/cmp.rs +++ b/library/core/src/cmp.rs @@ -247,6 +247,7 @@ use crate::ops::ControlFlow; append_const_msg )] #[rustc_diagnostic_item = "PartialEq"] +#[rustc_trivial_field_reads] #[const_trait] #[rustc_const_unstable(feature = "const_trait_impl", issue = "67792")] pub trait PartialEq: PointeeSized { diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs index 22a9cefff7b83..c0c1bc4499111 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/linux/aarch64.rs @@ -126,8 +126,8 @@ struct AtHwcap { f8fma: bool, f8dp4: bool, f8dp2: bool, - f8e4m3: bool, - f8e5m2: bool, + // f8e4m3: bool, + // f8e5m2: bool, smelutv2: bool, smef8f16: bool, smef8f32: bool, @@ -230,8 +230,8 @@ impl From for AtHwcap { f8fma: bit::test(auxv.hwcap2, 52), f8dp4: bit::test(auxv.hwcap2, 53), f8dp2: bit::test(auxv.hwcap2, 54), - f8e4m3: bit::test(auxv.hwcap2, 55), - f8e5m2: bit::test(auxv.hwcap2, 56), + // f8e4m3: bit::test(auxv.hwcap2, 55), + // f8e5m2: bit::test(auxv.hwcap2, 56), smelutv2: bit::test(auxv.hwcap2, 57), smef8f16: bit::test(auxv.hwcap2, 58), smef8f32: bit::test(auxv.hwcap2, 59), diff --git a/library/stdarch/crates/std_detect/src/detect/os/linux/s390x.rs b/library/stdarch/crates/std_detect/src/detect/os/linux/s390x.rs index 9b53f526d6198..84c2015f5cade 100644 --- a/library/stdarch/crates/std_detect/src/detect/os/linux/s390x.rs +++ b/library/stdarch/crates/std_detect/src/detect/os/linux/s390x.rs @@ -10,6 +10,8 @@ pub(crate) fn detect_features() -> cache::Initializer { cache(opt_hwcap, facilities) } +// FIXME(#143487): is it okay that the fields are never read? +#[expect(dead_code)] #[derive(Debug, Default, PartialEq)] struct AtHwcap { esan3: bool, diff --git a/src/tools/miri/tests/fail/enum-untagged-variant-invalid-encoding.rs b/src/tools/miri/tests/fail/enum-untagged-variant-invalid-encoding.rs index bd02e7f5fb44b..359d8bceb113d 100644 --- a/src/tools/miri/tests/fail/enum-untagged-variant-invalid-encoding.rs +++ b/src/tools/miri/tests/fail/enum-untagged-variant-invalid-encoding.rs @@ -7,6 +7,7 @@ use std::mem; // That means the untagged variants is in the niche variant range! // However, using the corresponding value (2+1 = 3) is not a valid encoding of this variant. #[derive(Copy, Clone, PartialEq)] +#[allow(dead_code)] enum Foo { Var1, Var2(bool), diff --git a/src/tools/miri/tests/pass/binops.rs b/src/tools/miri/tests/pass/binops.rs index 0aff7acb29d44..9896cf5c3d9f2 100644 --- a/src/tools/miri/tests/pass/binops.rs +++ b/src/tools/miri/tests/pass/binops.rs @@ -50,6 +50,7 @@ fn test_ptr() { } #[derive(PartialEq, Debug)] +#[allow(dead_code)] struct P { x: isize, y: isize, diff --git a/src/tools/miri/tests/pass/coercions.rs b/src/tools/miri/tests/pass/coercions.rs index db0d2ffd44bcf..b4e0820936bf6 100644 --- a/src/tools/miri/tests/pass/coercions.rs +++ b/src/tools/miri/tests/pass/coercions.rs @@ -1,4 +1,5 @@ #![feature(coerce_unsized, unsize)] +#![allow(dead_code)] use std::marker::Unsize; use std::ops::CoerceUnsized; diff --git a/src/tools/miri/tests/pass/deriving-associated-types.rs b/src/tools/miri/tests/pass/deriving-associated-types.rs index 4803792a97cee..8f2da3c881fa2 100644 --- a/src/tools/miri/tests/pass/deriving-associated-types.rs +++ b/src/tools/miri/tests/pass/deriving-associated-types.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + pub trait DeclaredTrait { type Type; } diff --git a/src/tools/miri/tests/pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs b/src/tools/miri/tests/pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs index 44441ed1d36c8..6400ce9ef4eac 100644 --- a/src/tools/miri/tests/pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs +++ b/src/tools/miri/tests/pass/tuple_like_enum_variant_constructor_struct_pointer_opt.rs @@ -1,3 +1,5 @@ +#![allow(dead_code)] + #[derive(Copy, Clone, PartialEq, Debug)] struct A<'a> { x: i32, diff --git a/src/tools/miri/tests/pass/tuple_like_struct_constructor.rs b/src/tools/miri/tests/pass/tuple_like_struct_constructor.rs index 05e8893de1787..31a987d7ef192 100644 --- a/src/tools/miri/tests/pass/tuple_like_struct_constructor.rs +++ b/src/tools/miri/tests/pass/tuple_like_struct_constructor.rs @@ -1,5 +1,6 @@ fn main() { #[derive(PartialEq, Eq, Debug)] + #[allow(dead_code)] struct A(i32); assert_eq!(Some(42).map(A), Some(A(42))); } diff --git a/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs b/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs index 271484da7b9a2..d8e83074692e6 100644 --- a/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs +++ b/src/tools/rust-analyzer/crates/hir-def/src/hir/format_args.rs @@ -160,9 +160,12 @@ pub enum FormatArgumentKind { // Only used in parse_args and report_invalid_references, // to indicate how a referred argument was used. -#[derive(Clone, Copy, Debug, PartialEq, Eq)] +#[derive(Clone, Copy, Debug)] enum PositionUsedAs { - Placeholder(Option), + Placeholder( + // FIXME(#143487): is it okay that the field is never read? + #[allow(dead_code)] Option, + ), Precision, Width, } diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs index c3ab5aff3dbab..021b86bf8f4d6 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/diagnostics/match_check.rs @@ -65,6 +65,8 @@ pub(crate) enum PatKind { /// `Foo(...)` or `Foo{...}` or `Foo`, where `Foo` is a variant name from an ADT with /// multiple variants. Variant { + // FIXME(#143487): is it okay that the field is never read? + #[allow(dead_code)] substs: Substitution, enum_variant: EnumVariantId, subpatterns: Vec, diff --git a/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs b/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs index 4e95eca3f9402..984d4e474eb72 100644 --- a/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs +++ b/src/tools/rust-analyzer/crates/hir-ty/src/infer/cast.rs @@ -362,7 +362,10 @@ enum PointerKind { // slice Length, OfAlias, - OfParam(PlaceholderIndex), + OfParam( + // FIXME(#143487): is it okay that the field is never read? + #[allow(dead_code)] PlaceholderIndex, + ), Error, } diff --git a/src/tools/rust-analyzer/crates/hir/src/lib.rs b/src/tools/rust-analyzer/crates/hir/src/lib.rs index 5c6f622e6c3e9..cdb67ba8568e1 100644 --- a/src/tools/rust-analyzer/crates/hir/src/lib.rs +++ b/src/tools/rust-analyzer/crates/hir/src/lib.rs @@ -4634,9 +4634,11 @@ impl Closure { } } -#[derive(Clone, Debug, PartialEq, Eq)] +#[derive(Clone, Debug)] pub struct ClosureCapture { owner: DefWithBodyId, + // FIXME(#143487): is it okay that the field is never read? + #[allow(dead_code)] closure: ClosureId, capture: hir_ty::CapturedItem, } diff --git a/src/tools/rust-analyzer/crates/ide-completion/src/context.rs b/src/tools/rust-analyzer/crates/ide-completion/src/context.rs index cfd7f80d40b30..8e7a67d80e67c 100644 --- a/src/tools/rust-analyzer/crates/ide-completion/src/context.rs +++ b/src/tools/rust-analyzer/crates/ide-completion/src/context.rs @@ -287,6 +287,7 @@ pub(crate) struct PatternContext { #[derive(Debug, Clone, PartialEq, Eq)] pub(crate) struct ParamContext { pub(crate) param_list: ast::ParamList, + #[allow(dead_code, reason = "Used for equality comparison")] pub(crate) param: ast::Param, pub(crate) kind: ParamKind, } diff --git a/src/tools/rust-analyzer/xtask/src/publish/notes.rs b/src/tools/rust-analyzer/xtask/src/publish/notes.rs index 93592d4986f8a..aafb0ff38e1be 100644 --- a/src/tools/rust-analyzer/xtask/src/publish/notes.rs +++ b/src/tools/rust-analyzer/xtask/src/publish/notes.rs @@ -421,9 +421,15 @@ impl Default for ListNesting { #[derive(Debug, PartialEq, Eq)] enum ListMarker { - Asterisk(usize), + Asterisk( + // FIXME(#143487): is it okay that the field is never read? + #[allow(dead_code)] usize, + ), Hyphen, - Dot(usize), + Dot( + // FIXME(#143487): is it okay that the field is never read? + #[allow(dead_code)] usize, + ), } impl ListMarker { diff --git a/tests/ui/abi/extern/extern-pass-FiveU16s.rs b/tests/ui/abi/extern/extern-pass-FiveU16s.rs index 5f1307beb28e6..ad3d1556cc611 100644 --- a/tests/ui/abi/extern/extern-pass-FiveU16s.rs +++ b/tests/ui/abi/extern/extern-pass-FiveU16s.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(improper_ctypes)] +#![allow(dead_code)] // Test a foreign function that accepts and returns a struct by value. diff --git a/tests/ui/abi/extern/extern-pass-TwoU16s.rs b/tests/ui/abi/extern/extern-pass-TwoU16s.rs index 8bde553050a40..8eb410be0cb55 100644 --- a/tests/ui/abi/extern/extern-pass-TwoU16s.rs +++ b/tests/ui/abi/extern/extern-pass-TwoU16s.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(improper_ctypes)] +#![allow(dead_code)] // Test a foreign function that accepts and returns a struct // by value. diff --git a/tests/ui/abi/extern/extern-pass-TwoU32s.rs b/tests/ui/abi/extern/extern-pass-TwoU32s.rs index fc90eb6945c7e..2132c6f220f14 100644 --- a/tests/ui/abi/extern/extern-pass-TwoU32s.rs +++ b/tests/ui/abi/extern/extern-pass-TwoU32s.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(improper_ctypes)] +#![allow(dead_code)] // Test a foreign function that accepts and returns a struct // by value. diff --git a/tests/ui/abi/extern/extern-pass-TwoU64s.rs b/tests/ui/abi/extern/extern-pass-TwoU64s.rs index 603de2e49ab2d..ad0f45132a9f0 100644 --- a/tests/ui/abi/extern/extern-pass-TwoU64s.rs +++ b/tests/ui/abi/extern/extern-pass-TwoU64s.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(improper_ctypes)] +#![allow(dead_code)] // Test a foreign function that accepts and returns a struct // by value. diff --git a/tests/ui/abi/extern/extern-pass-TwoU8s.rs b/tests/ui/abi/extern/extern-pass-TwoU8s.rs index a712d79a98dd2..0d4f80d313a09 100644 --- a/tests/ui/abi/extern/extern-pass-TwoU8s.rs +++ b/tests/ui/abi/extern/extern-pass-TwoU8s.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(improper_ctypes)] +#![allow(dead_code)] // Test a foreign function that accepts and returns a struct // by value. diff --git a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs index 2c78b794a8d74..ed42f65d2e33e 100644 --- a/tests/ui/abi/homogenous-floats-target-feature-mixup.rs +++ b/tests/ui/abi/homogenous-floats-target-feature-mixup.rs @@ -9,6 +9,7 @@ #![allow(overflowing_literals)] #![allow(unused_variables)] +#![allow(dead_code)] use std::process::{Command, ExitStatus}; use std::env; diff --git a/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs b/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs index ee155bd4105d1..e29e36e747f90 100644 --- a/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs +++ b/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters-by-ref-binding.rs @@ -3,6 +3,7 @@ //@ run-pass #![allow(unused_variables)] +#![allow(dead_code)] // Test that the drop order for parameters in a fn and async fn matches up. Also test that // parameters (used or unused) are not dropped until the async fn completes execution. diff --git a/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs b/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs index 6767e4baee879..0aa547b6c56d6 100644 --- a/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs +++ b/tests/ui/async-await/drop-order/drop-order-for-async-fn-parameters.rs @@ -6,6 +6,7 @@ //@[nomiropt]compile-flags: -Z mir-opt-level=0 #![allow(unused_variables)] +#![allow(dead_code)] // Test that the drop order for parameters in a fn and async fn matches up. Also test that // parameters (used or unused) are not dropped until the async fn completes execution. diff --git a/tests/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs b/tests/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs index 8b2131d07f785..140bc2f8b1573 100644 --- a/tests/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs +++ b/tests/ui/async-await/drop-order/drop-order-for-locals-when-cancelled.rs @@ -6,6 +6,7 @@ #![allow(unused_variables)] #![allow(unused_must_use)] #![allow(path_statements)] +#![allow(dead_code)] // Test that the drop order for locals in a fn and async fn matches up. extern crate arc_wake; diff --git a/tests/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs b/tests/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs index 8174f50cdce67..043ab8eef29d3 100644 --- a/tests/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs +++ b/tests/ui/async-await/drop-order/drop-order-for-temporary-in-tail-return-expr.rs @@ -6,6 +6,7 @@ //@[nomiropt]compile-flags: -Z mir-opt-level=0 #![allow(unused_variables)] +#![allow(dead_code)] // Test the drop order for parameters relative to local variables and // temporaries created in the tail return expression of the function diff --git a/tests/ui/async-await/drop-order/drop-order-when-cancelled.rs b/tests/ui/async-await/drop-order/drop-order-when-cancelled.rs index f8afa38a0fd09..a51b6f0f9b0b4 100644 --- a/tests/ui/async-await/drop-order/drop-order-when-cancelled.rs +++ b/tests/ui/async-await/drop-order/drop-order-when-cancelled.rs @@ -10,6 +10,7 @@ // This file is mostly copy-pasted from drop-order-for-async-fn-parameters.rs #![allow(unused_variables)] +#![allow(dead_code)] extern crate arc_wake; diff --git a/tests/ui/binding/match-larger-const.rs b/tests/ui/binding/match-larger-const.rs index 4d9e587fdce40..9ba97d23f0729 100644 --- a/tests/ui/binding/match-larger-const.rs +++ b/tests/ui/binding/match-larger-const.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(dead_code)] + #[derive(Eq, PartialEq)] pub struct Data([u8; 4]); diff --git a/tests/ui/binop/binops.rs b/tests/ui/binop/binops.rs index 7142190a45b9a..594dc03873005 100644 --- a/tests/ui/binop/binops.rs +++ b/tests/ui/binop/binops.rs @@ -1,6 +1,7 @@ //@ run-pass #![allow(non_camel_case_types)] +#![allow(dead_code)] // Binop corner cases fn test_nil() { diff --git a/tests/ui/codegen/mono-respects-abi-alignment.rs b/tests/ui/codegen/mono-respects-abi-alignment.rs index 045d82b761fdc..886674d2d2090 100644 --- a/tests/ui/codegen/mono-respects-abi-alignment.rs +++ b/tests/ui/codegen/mono-respects-abi-alignment.rs @@ -8,6 +8,7 @@ //! leading to incorrect method dispatch for `unwrap()`. //@ run-pass +#![allow(dead_code)] #[derive(Copy, Clone)] struct S { diff --git a/tests/ui/coercion/issue-39823.rs b/tests/ui/coercion/issue-39823.rs index 68554781761f5..41ebcc27d8c7d 100644 --- a/tests/ui/coercion/issue-39823.rs +++ b/tests/ui/coercion/issue-39823.rs @@ -1,5 +1,6 @@ //@ run-pass //@ aux-build:issue-39823.rs +#![allow(dead_code)] extern crate issue_39823; use issue_39823::{RemoteC, RemoteG}; diff --git a/tests/ui/coherence/coherence-where-clause.rs b/tests/ui/coherence/coherence-where-clause.rs index 84b35d20b7424..3e8252fd6fb7b 100644 --- a/tests/ui/coherence/coherence-where-clause.rs +++ b/tests/ui/coherence/coherence-where-clause.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] use std::fmt::Debug; trait MyTrait { diff --git a/tests/ui/consts/const_constructor/const_constructor_qpath.rs b/tests/ui/consts/const_constructor/const_constructor_qpath.rs index a0bf5e4eae8a6..eca68839bb380 100644 --- a/tests/ui/consts/const_constructor/const_constructor_qpath.rs +++ b/tests/ui/consts/const_constructor/const_constructor_qpath.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] trait ConstDefault { const DEFAULT: Self; diff --git a/tests/ui/consts/const_in_pattern/issue-62614.rs b/tests/ui/consts/const_in_pattern/issue-62614.rs index 92f76322fde13..d2e241cb475a3 100644 --- a/tests/ui/consts/const_in_pattern/issue-62614.rs +++ b/tests/ui/consts/const_in_pattern/issue-62614.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] struct Sum(u32, u32); diff --git a/tests/ui/consts/const_in_pattern/null-raw-ptr-issue-119270.rs b/tests/ui/consts/const_in_pattern/null-raw-ptr-issue-119270.rs index ae2d532be7b18..d6a65d6ceee93 100644 --- a/tests/ui/consts/const_in_pattern/null-raw-ptr-issue-119270.rs +++ b/tests/ui/consts/const_in_pattern/null-raw-ptr-issue-119270.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] struct NoDerive(#[allow(dead_code)] i32); #[derive(PartialEq)] diff --git a/tests/ui/consts/match-const-fn-structs.rs b/tests/ui/consts/match-const-fn-structs.rs index 49bb15977b857..fdcf1be353e60 100644 --- a/tests/ui/consts/match-const-fn-structs.rs +++ b/tests/ui/consts/match-const-fn-structs.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(unused_variables)] +#![allow(dead_code)] // https://github.com/rust-lang/rust/issues/46114 diff --git a/tests/ui/deriving/deriving-associated-types.rs b/tests/ui/deriving/deriving-associated-types.rs index 22dcd8d7cc035..4869cac099185 100644 --- a/tests/ui/deriving/deriving-associated-types.rs +++ b/tests/ui/deriving/deriving-associated-types.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(dead_code)] + pub trait DeclaredTrait { type Type; } diff --git a/tests/ui/deriving/deriving-via-extension-struct-tuple.rs b/tests/ui/deriving/deriving-via-extension-struct-tuple.rs index 3192b85a37be2..b67760079dba9 100644 --- a/tests/ui/deriving/deriving-via-extension-struct-tuple.rs +++ b/tests/ui/deriving/deriving-via-extension-struct-tuple.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] struct Foo(isize, isize, String); diff --git a/tests/ui/deriving/deriving-via-extension-struct.rs b/tests/ui/deriving/deriving-via-extension-struct.rs index 4a5c3453876a3..c3722cba1ad86 100644 --- a/tests/ui/deriving/deriving-via-extension-struct.rs +++ b/tests/ui/deriving/deriving-via-extension-struct.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(dead_code)] + #[derive(PartialEq, Debug)] struct Foo { x: isize, diff --git a/tests/ui/deriving/deriving-with-repr-packed.rs b/tests/ui/deriving/deriving-with-repr-packed.rs index 85eae60b2f4ec..7ed6343b822e3 100644 --- a/tests/ui/deriving/deriving-with-repr-packed.rs +++ b/tests/ui/deriving/deriving-with-repr-packed.rs @@ -1,6 +1,7 @@ //@ run-pass // check that derive on a packed struct does not call field // methods with a misaligned field. +#![allow(dead_code)] use std::mem; diff --git a/tests/ui/deriving/issue-15689-1.rs b/tests/ui/deriving/issue-15689-1.rs index c81c3359dfced..1a4970646ea2f 100644 --- a/tests/ui/deriving/issue-15689-1.rs +++ b/tests/ui/deriving/issue-15689-1.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] enum Test<'a> { diff --git a/tests/ui/deriving/issue-3935.rs b/tests/ui/deriving/issue-3935.rs index 64cb6597b1075..6a96e014dcc12 100644 --- a/tests/ui/deriving/issue-3935.rs +++ b/tests/ui/deriving/issue-3935.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #[derive(PartialEq)] struct Bike { diff --git a/tests/ui/enum-discriminant/issue-70509-partial_eq.rs b/tests/ui/enum-discriminant/issue-70509-partial_eq.rs index 5e71972c28086..4699b475c0569 100644 --- a/tests/ui/enum-discriminant/issue-70509-partial_eq.rs +++ b/tests/ui/enum-discriminant/issue-70509-partial_eq.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] #[repr(i128)] diff --git a/tests/ui/for-loop-while/while-prelude-drop.rs b/tests/ui/for-loop-while/while-prelude-drop.rs index 1fca90f019321..c913063471f86 100644 --- a/tests/ui/for-loop-while/while-prelude-drop.rs +++ b/tests/ui/for-loop-while/while-prelude-drop.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(non_camel_case_types)] +#![allow(dead_code)] #[derive(PartialEq)] enum t { a, b(String), } diff --git a/tests/ui/issues/issue-15763.rs b/tests/ui/issues/issue-15763.rs index 0ebadd80541f0..5552707a65c4c 100644 --- a/tests/ui/issues/issue-15763.rs +++ b/tests/ui/issues/issue-15763.rs @@ -1,5 +1,6 @@ //@ run-pass #![allow(unreachable_code)] +#![allow(dead_code)] #[derive(PartialEq, Debug)] struct Bar { diff --git a/tests/ui/issues/issue-21384.rs b/tests/ui/issues/issue-21384.rs index 7dc531e9c2bd1..b9f6b5920b278 100644 --- a/tests/ui/issues/issue-21384.rs +++ b/tests/ui/issues/issue-21384.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] use ::std::ops::RangeFull; diff --git a/tests/ui/issues/issue-29663.rs b/tests/ui/issues/issue-29663.rs index ed512f14f4ced..9bbb984553920 100644 --- a/tests/ui/issues/issue-29663.rs +++ b/tests/ui/issues/issue-29663.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #![allow(stable_features)] // write_volatile causes an LLVM assert with composite types diff --git a/tests/ui/lint/dead-code/partial-eq.rs b/tests/ui/lint/dead-code/partial-eq.rs new file mode 100644 index 0000000000000..21a2f8aa84a67 --- /dev/null +++ b/tests/ui/lint/dead-code/partial-eq.rs @@ -0,0 +1,20 @@ +#![deny(dead_code)] + +#[derive(PartialEq)] +struct MyStruct { + x: i32, + y: i32, //~ ERROR field `y` is never read +} + +struct MyStruct2 { + x: i32, + y: i32, //~ ERROR field `y` is never read +} + +pub fn main() { + let ms = MyStruct { x: 1, y: 2 }; + let _ = ms.x; + + let ms = MyStruct2 { x: 1, y: 2 }; + let _ = ms.x; +} diff --git a/tests/ui/lint/dead-code/partial-eq.stderr b/tests/ui/lint/dead-code/partial-eq.stderr new file mode 100644 index 0000000000000..b46d339eb24b6 --- /dev/null +++ b/tests/ui/lint/dead-code/partial-eq.stderr @@ -0,0 +1,27 @@ +error: field `y` is never read + --> $DIR/partial-eq.rs:6:5 + | +LL | struct MyStruct { + | -------- field in this struct +LL | x: i32, +LL | y: i32, + | ^ + | + = note: `MyStruct` has a derived impl for the trait `PartialEq`, but this is intentionally ignored during dead code analysis +note: the lint level is defined here + --> $DIR/partial-eq.rs:1:9 + | +LL | #![deny(dead_code)] + | ^^^^^^^^^ + +error: field `y` is never read + --> $DIR/partial-eq.rs:11:5 + | +LL | struct MyStruct2 { + | --------- field in this struct +LL | x: i32, +LL | y: i32, + | ^ + +error: aborting due to 2 previous errors + diff --git a/tests/ui/macros/assert-eq-macro-success.rs b/tests/ui/macros/assert-eq-macro-success.rs index 490cd9315b6e2..e94b1454f0d85 100644 --- a/tests/ui/macros/assert-eq-macro-success.rs +++ b/tests/ui/macros/assert-eq-macro-success.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] struct Point { x : isize } diff --git a/tests/ui/macros/assert-ne-macro-success.rs b/tests/ui/macros/assert-ne-macro-success.rs index 4078bb0700448..f28035e3c78a9 100644 --- a/tests/ui/macros/assert-ne-macro-success.rs +++ b/tests/ui/macros/assert-ne-macro-success.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] struct Point { x : isize } diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs index de7dbb9052edb..4f955292864d2 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-expr-kinds.rs @@ -4,6 +4,7 @@ //@ run-pass //@ needs-unwind Asserting on contents of error message +#![allow(dead_code)] #![allow(path_statements, unused_allocation)] #![feature(core_intrinsics, generic_assert)] diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs index 1600fd0af3f30..7e3889b8241b2 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/all-not-available-cases.rs @@ -4,6 +4,7 @@ //@ run-pass //@ needs-unwind Asserting on contents of error message +#![allow(dead_code)] #![feature(core_intrinsics, generic_assert)] extern crate common; diff --git a/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs b/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs index 254d59076e531..37ae23e060b32 100644 --- a/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs +++ b/tests/ui/macros/rfc-2011-nicer-assert-messages/feature-gate-generic_assert.rs @@ -5,6 +5,7 @@ //@ run-pass #![feature(core_intrinsics, generic_assert)] +#![allow(dead_code)] use std::fmt::{Debug, Formatter}; diff --git a/tests/ui/match/issue-42679.rs b/tests/ui/match/issue-42679.rs index d41ed43a65f17..349472c9ef36e 100644 --- a/tests/ui/match/issue-42679.rs +++ b/tests/ui/match/issue-42679.rs @@ -1,5 +1,6 @@ //@ run-pass #![feature(box_patterns)] +#![allow(dead_code)] #[derive(Debug, PartialEq)] enum Test { diff --git a/tests/ui/mir/issue-66851.rs b/tests/ui/mir/issue-66851.rs index cc92e75c6a80a..8bd9f4ac4a083 100644 --- a/tests/ui/mir/issue-66851.rs +++ b/tests/ui/mir/issue-66851.rs @@ -3,6 +3,7 @@ // //@ run-pass //@ compile-flags: -Zmir-opt-level=3 +#![allow(dead_code)] #[derive(Debug, PartialEq, Eq)] enum SpecialsRes { Res(u64) } diff --git a/tests/ui/mir/mir_adt_construction.rs b/tests/ui/mir/mir_adt_construction.rs index 87b471806af59..b1ef8c12858d7 100644 --- a/tests/ui/mir/mir_adt_construction.rs +++ b/tests/ui/mir/mir_adt_construction.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] use std::fmt; #[repr(C)] diff --git a/tests/ui/mir/mir_coercions.rs b/tests/ui/mir/mir_coercions.rs index 11230c3fbb7ee..e20deeabd1357 100644 --- a/tests/ui/mir/mir_coercions.rs +++ b/tests/ui/mir/mir_coercions.rs @@ -1,4 +1,5 @@ //@ run-pass +#![allow(dead_code)] #![feature(coerce_unsized, unsize)] use std::ops::CoerceUnsized; diff --git a/tests/ui/mir/mir_raw_fat_ptr.rs b/tests/ui/mir/mir_raw_fat_ptr.rs index 96c030b70e50f..cd64e5914a85c 100644 --- a/tests/ui/mir/mir_raw_fat_ptr.rs +++ b/tests/ui/mir/mir_raw_fat_ptr.rs @@ -8,7 +8,7 @@ use std::mem; #[derive(Debug, PartialEq, Eq)] struct ComparisonResults { - lt: bool, + lt: bool, //~ WARN: fields `lt`, `le`, `gt`, `ge`, `eq`, and `ne` are never read le: bool, gt: bool, ge: bool, diff --git a/tests/ui/mir/mir_raw_fat_ptr.stderr b/tests/ui/mir/mir_raw_fat_ptr.stderr index cd99d566654f9..d84a50c30895d 100644 --- a/tests/ui/mir/mir_raw_fat_ptr.stderr +++ b/tests/ui/mir/mir_raw_fat_ptr.stderr @@ -1,3 +1,24 @@ +warning: fields `lt`, `le`, `gt`, `ge`, `eq`, and `ne` are never read + --> $DIR/mir_raw_fat_ptr.rs:11:5 + | +LL | struct ComparisonResults { + | ----------------- fields in this struct +LL | lt: bool, + | ^^ +LL | le: bool, + | ^^ +LL | gt: bool, + | ^^ +LL | ge: bool, + | ^^ +LL | eq: bool, + | ^^ +LL | ne: bool + | ^^ + | + = note: `ComparisonResults` has derived impls for the traits `PartialEq` and `Debug`, but these are intentionally ignored during dead code analysis + = note: `#[warn(dead_code)]` on by default + warning: method `foo` is never used --> $DIR/mir_raw_fat_ptr.rs:100:16 | @@ -5,8 +26,6 @@ LL | trait Foo { fn foo(&self) -> usize; } | --- ^^^ | | | method in this trait - | - = note: `#[warn(dead_code)]` on by default -warning: 1 warning emitted +warning: 2 warnings emitted diff --git a/tests/ui/nll/rc-loop.rs b/tests/ui/nll/rc-loop.rs index f2c51b84394bd..a22ea050898de 100644 --- a/tests/ui/nll/rc-loop.rs +++ b/tests/ui/nll/rc-loop.rs @@ -5,6 +5,7 @@ // case, `x`) that you need in order to compute the next value for // `x`. The lexical checker makes this very painful. The NLL checker // does not. +#![allow(dead_code)] use std::rc::Rc; diff --git a/tests/ui/or-patterns/basic-switchint.rs b/tests/ui/or-patterns/basic-switchint.rs index e4efef597300c..12323a3979266 100644 --- a/tests/ui/or-patterns/basic-switchint.rs +++ b/tests/ui/or-patterns/basic-switchint.rs @@ -3,6 +3,8 @@ //@ run-pass +#![allow(dead_code)] + #[derive(Debug, PartialEq)] enum MatchArm { Arm(usize), diff --git a/tests/ui/or-patterns/box-patterns.rs b/tests/ui/or-patterns/box-patterns.rs index 6a3d048f8a6cc..49ca549ba9e3f 100644 --- a/tests/ui/or-patterns/box-patterns.rs +++ b/tests/ui/or-patterns/box-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #![feature(box_patterns)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/or-patterns/slice-patterns.rs b/tests/ui/or-patterns/slice-patterns.rs index 464d0b2ddda93..8ed112ba4e152 100644 --- a/tests/ui/or-patterns/slice-patterns.rs +++ b/tests/ui/or-patterns/slice-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #[derive(Debug, PartialEq)] enum MatchArm { Arm(usize), diff --git a/tests/ui/pattern/bindings-after-at/box-patterns.rs b/tests/ui/pattern/bindings-after-at/box-patterns.rs index 57110b0439a89..32b933aa28436 100644 --- a/tests/ui/pattern/bindings-after-at/box-patterns.rs +++ b/tests/ui/pattern/bindings-after-at/box-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #![feature(box_patterns)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs b/tests/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs index f6c285634c07f..20168894f9005 100644 --- a/tests/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs +++ b/tests/ui/pattern/bindings-after-at/or-patterns-box-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #![feature(box_patterns)] #[derive(Debug, PartialEq)] diff --git a/tests/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs b/tests/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs index 82e3f596e3efb..1a5173fd079b2 100644 --- a/tests/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs +++ b/tests/ui/pattern/bindings-after-at/or-patterns-slice-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #[derive(Debug, PartialEq)] enum MatchArm { diff --git a/tests/ui/pattern/bindings-after-at/or-patterns.rs b/tests/ui/pattern/bindings-after-at/or-patterns.rs index 360ba9d1ad2ea..f2a1cfab45704 100644 --- a/tests/ui/pattern/bindings-after-at/or-patterns.rs +++ b/tests/ui/pattern/bindings-after-at/or-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #[derive(Debug, PartialEq)] enum MatchArm { diff --git a/tests/ui/pattern/bindings-after-at/slice-patterns.rs b/tests/ui/pattern/bindings-after-at/slice-patterns.rs index aa03269b53fbe..8fd2b0a373afb 100644 --- a/tests/ui/pattern/bindings-after-at/slice-patterns.rs +++ b/tests/ui/pattern/bindings-after-at/slice-patterns.rs @@ -2,6 +2,7 @@ //@ run-pass +#![allow(dead_code)] #[derive(Debug, PartialEq)] enum MatchArm { diff --git a/tests/ui/proc-macro/derive-b.rs b/tests/ui/proc-macro/derive-b.rs index 68d341478f187..60afd8c9262bb 100644 --- a/tests/ui/proc-macro/derive-b.rs +++ b/tests/ui/proc-macro/derive-b.rs @@ -1,6 +1,8 @@ //@ run-pass //@ proc-macro: derive-b-rpass.rs +#![allow(dead_code)] + extern crate derive_b_rpass as derive_b; #[derive(Debug, PartialEq, derive_b::B, Eq, Copy, Clone)] diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/allow-use-behind-cousin-variant.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/allow-use-behind-cousin-variant.rs index 98bfda9bddb07..85092842da134 100644 --- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/allow-use-behind-cousin-variant.rs +++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/allow-use-behind-cousin-variant.rs @@ -8,6 +8,8 @@ //@ run-pass +#![allow(dead_code)] + struct Sum(u32, u32); impl PartialEq for Sum { diff --git a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/match-empty-array-allowed-without-eq-issue-62336.rs b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/match-empty-array-allowed-without-eq-issue-62336.rs index ad4e0d070da34..267c1b4aab749 100644 --- a/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/match-empty-array-allowed-without-eq-issue-62336.rs +++ b/tests/ui/rfcs/rfc-1445-restrict-constants-in-patterns/match-empty-array-allowed-without-eq-issue-62336.rs @@ -5,6 +5,7 @@ // See rust-lang/rust#62336. //@ run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] struct B(i32); diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs index 9f4e50679ffb7..63f0410b01221 100644 --- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs +++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.rs @@ -5,6 +5,7 @@ // as well as some compile time properties we expect. #![allow(dropping_copy_types)] +#![allow(dead_code)] #[derive(Copy, Clone, Debug)] struct Unit; diff --git a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr index 2c018ca875d40..739805b12ab53 100644 --- a/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr +++ b/tests/ui/rfcs/rfc-2361-dbg-macro/dbg-macro-expected-behavior.run.stderr @@ -1,28 +1,28 @@ -[$DIR/dbg-macro-expected-behavior.rs:22:19] Unit = Unit -[$DIR/dbg-macro-expected-behavior.rs:23:19] a = Unit -[$DIR/dbg-macro-expected-behavior.rs:29:24] Point { x: 42, y: 24 } = Point { +[$DIR/dbg-macro-expected-behavior.rs:23:19] Unit = Unit +[$DIR/dbg-macro-expected-behavior.rs:24:19] a = Unit +[$DIR/dbg-macro-expected-behavior.rs:30:24] Point { x: 42, y: 24 } = Point { x: 42, y: 24, } -[$DIR/dbg-macro-expected-behavior.rs:30:24] b = Point { +[$DIR/dbg-macro-expected-behavior.rs:31:24] b = Point { x: 42, y: 24, } -[$DIR/dbg-macro-expected-behavior.rs:38:17] -[$DIR/dbg-macro-expected-behavior.rs:42:27] &a = NoCopy( +[$DIR/dbg-macro-expected-behavior.rs:39:17] +[$DIR/dbg-macro-expected-behavior.rs:43:27] &a = NoCopy( 1337, ) -[$DIR/dbg-macro-expected-behavior.rs:42:22] dbg!(&a) = NoCopy( +[$DIR/dbg-macro-expected-behavior.rs:43:22] dbg!(&a) = NoCopy( 1337, ) -[$DIR/dbg-macro-expected-behavior.rs:47:18] f(&42) = 42 +[$DIR/dbg-macro-expected-behavior.rs:48:18] f(&42) = 42 before -[$DIR/dbg-macro-expected-behavior.rs:52:22] { foo += 1; eprintln!("before"); 7331 } = 7331 -[$DIR/dbg-macro-expected-behavior.rs:60:27] ("Yeah",) = ( +[$DIR/dbg-macro-expected-behavior.rs:53:22] { foo += 1; eprintln!("before"); 7331 } = 7331 +[$DIR/dbg-macro-expected-behavior.rs:61:27] ("Yeah",) = ( "Yeah", ) -[$DIR/dbg-macro-expected-behavior.rs:63:29] 1 = 1 -[$DIR/dbg-macro-expected-behavior.rs:63:29] 2 = 2 -[$DIR/dbg-macro-expected-behavior.rs:67:37] 1u8 = 1 -[$DIR/dbg-macro-expected-behavior.rs:67:37] 2u32 = 2 -[$DIR/dbg-macro-expected-behavior.rs:67:37] "Yeah" = "Yeah" +[$DIR/dbg-macro-expected-behavior.rs:64:29] 1 = 1 +[$DIR/dbg-macro-expected-behavior.rs:64:29] 2 = 2 +[$DIR/dbg-macro-expected-behavior.rs:68:37] 1u8 = 1 +[$DIR/dbg-macro-expected-behavior.rs:68:37] 2u32 = 2 +[$DIR/dbg-macro-expected-behavior.rs:68:37] "Yeah" = "Yeah" diff --git a/tests/ui/structs-enums/enum-non-c-like-repr-c-and-int.rs b/tests/ui/structs-enums/enum-non-c-like-repr-c-and-int.rs index 142d0ee32872e..2965d8be542ab 100644 --- a/tests/ui/structs-enums/enum-non-c-like-repr-c-and-int.rs +++ b/tests/ui/structs-enums/enum-non-c-like-repr-c-and-int.rs @@ -3,6 +3,7 @@ // should have the same layout, and manipulating the tag and payloads // independently. This verifies that `repr(some_int)` has a stable representation, // and that we don't miscompile these kinds of manipulations. +#![allow(dead_code)] use std::time::Duration; use std::mem; diff --git a/tests/ui/structs-enums/enum-non-c-like-repr-c.rs b/tests/ui/structs-enums/enum-non-c-like-repr-c.rs index 15c9784dbb9ad..879b07bda0c49 100644 --- a/tests/ui/structs-enums/enum-non-c-like-repr-c.rs +++ b/tests/ui/structs-enums/enum-non-c-like-repr-c.rs @@ -3,6 +3,7 @@ // should have the same layout, and manipulating the tag and payloads // independently. This verifies that `repr(some_int)` has a stable representation, // and that we don't miscompile these kinds of manipulations. +#![allow(dead_code)] use std::time::Duration; use std::mem; diff --git a/tests/ui/structs-enums/enum-non-c-like-repr-int.rs b/tests/ui/structs-enums/enum-non-c-like-repr-int.rs index 64338b2aba765..45fb13e503d31 100644 --- a/tests/ui/structs-enums/enum-non-c-like-repr-int.rs +++ b/tests/ui/structs-enums/enum-non-c-like-repr-int.rs @@ -3,6 +3,7 @@ // should have the same layout, and manipulating the tag and payloads // independently. This verifies that `repr(some_int)` has a stable representation, // and that we don't miscompile these kinds of manipulations. +#![allow(dead_code)] use std::time::Duration; use std::mem; diff --git a/tests/ui/structs-enums/struct-lit-functional-no-fields.rs b/tests/ui/structs-enums/struct-lit-functional-no-fields.rs index 0eb716da4f063..0548fe495445b 100644 --- a/tests/ui/structs-enums/struct-lit-functional-no-fields.rs +++ b/tests/ui/structs-enums/struct-lit-functional-no-fields.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(dead_code)] + #[derive(Debug,PartialEq,Clone)] struct Foo { bar: T, diff --git a/tests/ui/structs-enums/struct-partial-move-1.rs b/tests/ui/structs-enums/struct-partial-move-1.rs index 9494922b7d732..dcddfdff1f5ac 100644 --- a/tests/ui/structs-enums/struct-partial-move-1.rs +++ b/tests/ui/structs-enums/struct-partial-move-1.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(dead_code)] + #[derive(PartialEq, Debug)] pub struct Partial { x: T, y: T } diff --git a/tests/ui/structs-enums/tuple-struct-constructor-pointer.rs b/tests/ui/structs-enums/tuple-struct-constructor-pointer.rs index 18a59841e9fab..0d0bd74c89d07 100644 --- a/tests/ui/structs-enums/tuple-struct-constructor-pointer.rs +++ b/tests/ui/structs-enums/tuple-struct-constructor-pointer.rs @@ -1,4 +1,6 @@ //@ run-pass +#![allow(dead_code)] + #[derive(PartialEq, Debug)] struct Foo(isize); #[derive(PartialEq, Debug)] diff --git a/tests/ui/structs/struct-record-suggestion.fixed b/tests/ui/structs/struct-record-suggestion.fixed index 251123807041c..d8623f36cb4e1 100644 --- a/tests/ui/structs/struct-record-suggestion.fixed +++ b/tests/ui/structs/struct-record-suggestion.fixed @@ -1,4 +1,6 @@ //@ run-rustfix +#![allow(dead_code)] + #[derive(Debug, Default, Eq, PartialEq)] struct A { b: u32, diff --git a/tests/ui/structs/struct-record-suggestion.rs b/tests/ui/structs/struct-record-suggestion.rs index 9c4be68153a70..3407bf2ca1686 100644 --- a/tests/ui/structs/struct-record-suggestion.rs +++ b/tests/ui/structs/struct-record-suggestion.rs @@ -1,4 +1,6 @@ //@ run-rustfix +#![allow(dead_code)] + #[derive(Debug, Default, Eq, PartialEq)] struct A { b: u32, diff --git a/tests/ui/structs/struct-record-suggestion.stderr b/tests/ui/structs/struct-record-suggestion.stderr index 38274f8d9c0d5..e5d1991b0dba3 100644 --- a/tests/ui/structs/struct-record-suggestion.stderr +++ b/tests/ui/structs/struct-record-suggestion.stderr @@ -1,11 +1,11 @@ error[E0063]: missing fields `b` and `d` in initializer of `A` - --> $DIR/struct-record-suggestion.rs:10:13 + --> $DIR/struct-record-suggestion.rs:12:13 | LL | let q = A { c: 5..Default::default() }; | ^ missing `b` and `d` | note: this expression may have been misinterpreted as a `..` range expression - --> $DIR/struct-record-suggestion.rs:10:20 + --> $DIR/struct-record-suggestion.rs:12:20 | LL | let q = A { c: 5..Default::default() }; | ^^^^^^^^^^^^^^^^^^^^^ @@ -15,7 +15,7 @@ LL | let q = A { c: 5, ..Default::default() }; | + error[E0308]: mismatched types - --> $DIR/struct-record-suggestion.rs:23:20 + --> $DIR/struct-record-suggestion.rs:25:20 | LL | let q = B { b: 1..Default::default() }; | ^^^^^^^^^^^^^^^^^^^^^ expected `u32`, found `Range<{integer}>` @@ -23,7 +23,7 @@ LL | let q = B { b: 1..Default::default() }; = note: expected type `u32` found struct `std::ops::Range<{integer}>` note: this expression may have been misinterpreted as a `..` range expression - --> $DIR/struct-record-suggestion.rs:23:20 + --> $DIR/struct-record-suggestion.rs:25:20 | LL | let q = B { b: 1..Default::default() }; | ^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/ui/unboxed-closures/unboxed-closures-monomorphization.rs b/tests/ui/unboxed-closures/unboxed-closures-monomorphization.rs index 46fa8995c96b2..27b91d5d857ba 100644 --- a/tests/ui/unboxed-closures/unboxed-closures-monomorphization.rs +++ b/tests/ui/unboxed-closures/unboxed-closures-monomorphization.rs @@ -1,6 +1,7 @@ //@ run-pass // Test that unboxed closures in contexts with free type parameters // monomorphize correctly (issue #16791) +#![allow(dead_code)] fn main(){ fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> {