From 5ded8a89f353f35d07249d5e365f5381bba5e7ba Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Tue, 21 Apr 2015 21:53:07 -0700 Subject: [PATCH] #10381: Warnings --- src/test/auxiliary/cross_crate_spans.rs | 2 + src/test/debuginfo/constant-debug-locs.rs | 3 +- .../debuginfo/constant-in-match-pattern.rs | 3 +- src/test/debuginfo/cross-crate-spans.rs | 4 +- ...nction-prologue-stepping-no-stack-check.rs | 2 +- src/test/debuginfo/gdb-pretty-std.rs | 2 + ...gdb-pretty-struct-and-enums-pre-gdb-7-7.rs | 2 + .../debuginfo/gdb-pretty-struct-and-enums.rs | 2 + src/test/debuginfo/type-names.rs | 90 ++++++++++--------- src/test/debuginfo/vec-slices.rs | 2 +- 10 files changed, 60 insertions(+), 52 deletions(-) diff --git a/src/test/auxiliary/cross_crate_spans.rs b/src/test/auxiliary/cross_crate_spans.rs index 91a480ac86bdb..d9be03c094c49 100644 --- a/src/test/auxiliary/cross_crate_spans.rs +++ b/src/test/auxiliary/cross_crate_spans.rs @@ -9,6 +9,8 @@ // except according to those terms. #![crate_type = "rlib"] + +#![allow(unused_variables)] #![omit_gdb_pretty_printer_section] // no-prefer-dynamic diff --git a/src/test/debuginfo/constant-debug-locs.rs b/src/test/debuginfo/constant-debug-locs.rs index f150e84b9fdfe..3d0af686586bd 100644 --- a/src/test/debuginfo/constant-debug-locs.rs +++ b/src/test/debuginfo/constant-debug-locs.rs @@ -13,8 +13,7 @@ // compile-flags:-g -#![allow(unused_variables)] -#![allow(dead_code)] +#![allow(dead_code, unused_variables)] #![omit_gdb_pretty_printer_section] #![feature(std_misc, core)] diff --git a/src/test/debuginfo/constant-in-match-pattern.rs b/src/test/debuginfo/constant-in-match-pattern.rs index 487c69a85d6ac..58a1ba06b5452 100644 --- a/src/test/debuginfo/constant-in-match-pattern.rs +++ b/src/test/debuginfo/constant-in-match-pattern.rs @@ -13,8 +13,7 @@ // compile-flags:-g -#![allow(unused_variables)] -#![allow(dead_code)] +#![allow(dead_code, unused_variables)] #![omit_gdb_pretty_printer_section] // This test makes sure that the compiler doesn't crash when trying to assign diff --git a/src/test/debuginfo/cross-crate-spans.rs b/src/test/debuginfo/cross-crate-spans.rs index 85b4e9babebd2..09ab30cbec1a2 100644 --- a/src/test/debuginfo/cross-crate-spans.rs +++ b/src/test/debuginfo/cross-crate-spans.rs @@ -21,7 +21,7 @@ extern crate cross_crate_spans; // === GDB TESTS =================================================================================== -// gdb-command:break cross_crate_spans.rs:21 +// gdb-command:break cross_crate_spans.rs:23 // gdb-command:run // gdb-command:print result @@ -44,7 +44,7 @@ extern crate cross_crate_spans; // === LLDB TESTS ================================================================================== -// lldb-command:b cross_crate_spans.rs:21 +// lldb-command:b cross_crate_spans.rs:23 // lldb-command:run // lldb-command:print result diff --git a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs index 7e959a1e92012..d9cca5eb31517 100644 --- a/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs +++ b/src/test/debuginfo/function-prologue-stepping-no-stack-check.rs @@ -246,7 +246,7 @@ // lldb-check:[...]$31 = 45 // lldb-command:continue -#![allow(unused_variables)] +#![allow(dead_code, unused_assignments, unused_variables)] #![omit_gdb_pretty_printer_section] #[no_stack_check] diff --git a/src/test/debuginfo/gdb-pretty-std.rs b/src/test/debuginfo/gdb-pretty-std.rs index 1da9a06b0eea4..c42f7f19839fd 100644 --- a/src/test/debuginfo/gdb-pretty-std.rs +++ b/src/test/debuginfo/gdb-pretty-std.rs @@ -35,6 +35,8 @@ // gdb-command: print none // gdb-check:$6 = None +#![allow(unused_variables)] + fn main() { // &[] diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs index 0d8b42a9f7672..fa15e31450f8b 100644 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs @@ -37,6 +37,8 @@ // gdb-command: print c_style_enum3 // gdb-check:$5 = CStyleEnumVar3 +#![allow(dead_code, unused_variables)] + struct RegularStruct { the_first_field: isize, the_second_field: f64, diff --git a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs index 81af9c213a343..56a973fa59f66 100644 --- a/src/test/debuginfo/gdb-pretty-struct-and-enums.rs +++ b/src/test/debuginfo/gdb-pretty-struct-and-enums.rs @@ -76,6 +76,8 @@ // gdb-command: print none_check2 // gdb-check:$18 = None +#![allow(dead_code, unused_variables)] + use self::CStyleEnum::{CStyleEnumVar1, CStyleEnumVar2, CStyleEnumVar3}; use self::MixedEnum::{MixedEnumCStyleVar, MixedEnumTupleVar, MixedEnumStructVar}; use self::NestedEnum::{NestedVariant1, NestedVariant2}; diff --git a/src/test/debuginfo/type-names.rs b/src/test/debuginfo/type-names.rs index e7ee9e2ccf818..97b6bfacf80ee 100644 --- a/src/test/debuginfo/type-names.rs +++ b/src/test/debuginfo/type-names.rs @@ -21,7 +21,7 @@ // gdb-check:type = struct Struct1 // gdb-command:whatis generic_struct1 -// gdb-check:type = struct GenericStruct +// gdb-check:type = struct GenericStruct // gdb-command:whatis generic_struct2 // gdb-check:type = struct GenericStruct usize> @@ -41,7 +41,7 @@ // gdb-check:type = union Enum2 // gdb-command:whatis generic_enum_1 -// gdb-check:type = union Enum3 +// gdb-check:type = union Enum3 // gdb-command:whatis generic_enum_2 // gdb-check:type = union Enum3 @@ -49,10 +49,10 @@ // TUPLES // gdb-command:whatis tuple1 -// gdb-check:type = struct (u32, type_names::Struct1, type_names::Mod1::Mod2::Enum3) +// gdb-check:type = struct (u32, type_names::Struct1, type_names::mod1::mod2::Enum3) // gdb-command:whatis tuple2 -// gdb-check:type = struct ((type_names::Struct1, type_names::Mod1::Mod2::Struct3), type_names::Mod1::Enum2, char) +// gdb-check:type = struct ((type_names::Struct1, type_names::mod1::mod2::Struct3), type_names::mod1::Enum2, char) // BOX @@ -60,7 +60,7 @@ // gdb-check:type = struct (Box, i32) // gdb-command:whatis box2 -// gdb-check:type = struct (Box>, i32) +// gdb-check:type = struct (Box>, i32) // REFERENCES @@ -74,7 +74,7 @@ // gdb-check:type = struct (&mut type_names::Struct1, i32) // gdb-command:whatis mut_ref2 -// gdb-check:type = struct (&mut type_names::GenericStruct, i32) +// gdb-check:type = struct (&mut type_names::GenericStruct, i32) // RAW POINTERS @@ -85,7 +85,7 @@ // gdb-check:type = struct (*mut isize, isize) // gdb-command:whatis mut_ptr3 -// gdb-check:type = struct (*mut type_names::Mod1::Mod2::Enum3, isize) +// gdb-check:type = struct (*mut type_names::mod1::mod2::Enum3, isize) // gdb-command:whatis const_ptr1 // gdb-check:type = struct (*const type_names::Struct1, isize) @@ -94,7 +94,7 @@ // gdb-check:type = struct (*const isize, isize) // gdb-command:whatis const_ptr3 -// gdb-check:type = struct (*const type_names::Mod1::Mod2::Enum3, isize) +// gdb-check:type = struct (*const type_names::mod1::mod2::Enum3, isize) // VECTORS @@ -108,7 +108,7 @@ // gdb-check:type = struct &[usize] // gdb-command:whatis slice2 -// gdb-check:type = struct &[type_names::Mod1::Enum2] +// gdb-check:type = struct &[type_names::mod1::Enum2] // TRAITS @@ -122,18 +122,18 @@ // gdb-check:type = struct &mut Trait1 // gdb-command:whatis generic_box_trait -// gdb-check:type = struct Box> +// gdb-check:type = struct Box> // gdb-command:whatis generic_ref_trait // gdb-check:type = struct &Trait2 // gdb-command:whatis generic_mut_ref_trait -// gdb-check:type = struct &mut Trait2> +// gdb-check:type = struct &mut Trait2> // BARE FUNCTIONS // gdb-command:whatis rust_fn -// gdb-check:type = struct (fn(core::option::Option, core::option::Option<&type_names::Mod1::Struct2>), usize) +// gdb-check:type = struct (fn(core::option::Option, core::option::Option<&type_names::mod1::Struct2>), usize) // gdb-command:whatis extern_c_fn // gdb-check:type = struct (extern "C" fn(isize), usize) @@ -151,7 +151,7 @@ // gdb-check:type = struct (extern "C" fn() -> type_names::Struct1, usize) // gdb-command:whatis unsafe_fn_with_return_value -// gdb-check:type = struct (unsafe fn(type_names::GenericStruct) -> type_names::Mod1::Struct2, usize) +// gdb-check:type = struct (unsafe fn(type_names::GenericStruct) -> type_names::mod1::Struct2, usize) // gdb-command:whatis extern_stdcall_fn_with_return_value // gdb-check:type = struct (extern "stdcall" fn(Box) -> usize, usize) @@ -160,7 +160,7 @@ // gdb-check:type = struct (fn(isize) -> isize, usize) // gdb-command:whatis generic_function_struct3 -// gdb-check:type = struct (fn(type_names::Mod1::Mod2::Struct3) -> type_names::Mod1::Mod2::Struct3, usize) +// gdb-check:type = struct (fn(type_names::mod1::mod2::Struct3) -> type_names::mod1::mod2::Struct3, usize) // gdb-command:whatis variadic_function // gdb-check:type = struct (unsafe extern "C" fn(*const u8, ...) -> isize, usize) @@ -174,9 +174,10 @@ // gdb-check:type = struct (closure, usize) #![feature(box_syntax)] +#![allow(unused_variables)] #![omit_gdb_pretty_printer_section] -use self::Enum1::{Variant1_1, Variant1_2}; +use self::Enum1::{Variant1, Variant2}; use std::marker::PhantomData; use std::ptr; @@ -184,26 +185,26 @@ struct Struct1; struct GenericStruct(PhantomData<(T1,T2)>); enum Enum1 { - Variant1_1, - Variant1_2(isize) + Variant1, + Variant2(isize), } -mod Mod1 { - pub use self::Enum2::{Variant2_1, Variant2_2}; +mod mod1 { + pub use self::Enum2::{Variant1, Variant2}; pub struct Struct2; pub enum Enum2 { - Variant2_1, - Variant2_2(super::Struct1) + Variant1, + Variant2(super::Struct1), } - pub mod Mod2 { - pub use self::Enum3::{Variant3_1, Variant3_2}; + pub mod mod2 { + pub use self::Enum3::{Variant1, Variant2}; pub struct Struct3; pub enum Enum3 { - Variant3_1, - Variant3_2(T), + Variant1, + Variant2(T), } } } @@ -214,18 +215,19 @@ trait Trait2 { fn dummy(&self, _: T1, _:T2) { } } impl Trait1 for isize {} impl Trait2 for isize {} -fn rust_fn(_: Option, _: Option<&Mod1::Struct2>) {} +fn rust_fn(_: Option, _: Option<&mod1::Struct2>) {} extern "C" fn extern_c_fn(_: isize) {} unsafe fn unsafe_fn(_: Result) {} extern "stdcall" fn extern_stdcall_fn() {} fn rust_fn_with_return_value(_: f64) -> usize { 4 } extern "C" fn extern_c_fn_with_return_value() -> Struct1 { Struct1 } -unsafe fn unsafe_fn_with_return_value(_: GenericStruct) -> Mod1::Struct2 { Mod1::Struct2 } +unsafe fn unsafe_fn_with_return_value(_: GenericStruct) -> mod1::Struct2 { mod1::Struct2 } extern "stdcall" fn extern_stdcall_fn_with_return_value(_: Box) -> usize { 0 } fn generic_function(x: T) -> T { x } +#[allow(improper_ctypes)] extern { fn printf(_:*const u8, ...) -> isize; } @@ -241,45 +243,45 @@ fn main() { // Structs let simple_struct = Struct1; - let generic_struct1: GenericStruct = + let generic_struct1: GenericStruct = GenericStruct(PhantomData); let generic_struct2: GenericStruct usize> = GenericStruct(PhantomData); - let mod_struct = Mod1::Struct2; + let mod_struct = mod1::Struct2; // Enums - let simple_enum_1 = Variant1_1; - let simple_enum_2 = Variant1_2(0); - let simple_enum_3 = Mod1::Variant2_2(Struct1); + let simple_enum_1 = Variant1; + let simple_enum_2 = Variant2(0); + let simple_enum_3 = mod1::Variant2(Struct1); - let generic_enum_1: Mod1::Mod2::Enum3 = Mod1::Mod2::Variant3_1; - let generic_enum_2 = Mod1::Mod2::Variant3_2(Struct1); + let generic_enum_1: mod1::mod2::Enum3 = mod1::mod2::Variant1; + let generic_enum_2 = mod1::mod2::Variant2(Struct1); // Tuples - let tuple1 = (8u32, Struct1, Mod1::Mod2::Variant3_2(Mod1::Struct2)); - let tuple2 = ((Struct1, Mod1::Mod2::Struct3), Mod1::Variant2_1, 'x'); + let tuple1 = (8u32, Struct1, mod1::mod2::Variant2(mod1::Struct2)); + let tuple2 = ((Struct1, mod1::mod2::Struct3), mod1::Variant1, 'x'); // Box let box1 = (box 1f32, 0i32); - let box2 = (box Mod1::Mod2::Variant3_2(1f32), 0i32); + let box2 = (box mod1::mod2::Variant2(1f32), 0i32); // References let ref1 = (&Struct1, 0i32); let ref2 = (&GenericStruct::(PhantomData), 0i32); let mut mut_struct1 = Struct1; - let mut mut_generic_struct = GenericStruct::(PhantomData); + let mut mut_generic_struct = GenericStruct::(PhantomData); let mut_ref1 = (&mut mut_struct1, 0i32); let mut_ref2 = (&mut mut_generic_struct, 0i32); // Raw Pointers let mut_ptr1: (*mut Struct1, isize) = (ptr::null_mut(), 0); let mut_ptr2: (*mut isize, isize) = (ptr::null_mut(), 0); - let mut_ptr3: (*mut Mod1::Mod2::Enum3, isize) = (ptr::null_mut(), 0); + let mut_ptr3: (*mut mod1::mod2::Enum3, isize) = (ptr::null_mut(), 0); let const_ptr1: (*const Struct1, isize) = (ptr::null(), 0); let const_ptr2: (*const isize, isize) = (ptr::null(), 0); - let const_ptr3: (*const Mod1::Mod2::Enum3, isize) = (ptr::null(), 0); + let const_ptr3: (*const mod1::mod2::Enum3, isize) = (ptr::null(), 0); // Vectors let fixed_size_vec1 = ([Struct1, Struct1, Struct1], 0i16); @@ -287,7 +289,7 @@ fn main() { let vec1 = vec![0_usize, 2, 3]; let slice1 = &*vec1; - let vec2 = vec![Mod1::Variant2_2(Struct1)]; + let vec2 = vec![mod1::Variant2(Struct1)]; let slice2 = &*vec2; // Trait Objects @@ -296,12 +298,12 @@ fn main() { let mut mut_int1 = 0_isize; let mut_ref_trait = (&mut mut_int1) as &mut Trait1; - let generic_box_trait = (box 0_isize) as Box>; + let generic_box_trait = (box 0_isize) as Box>; let generic_ref_trait = (&0_isize) as &Trait2; let mut generic_mut_ref_trait_impl = 0_isize; let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl) as - &mut Trait2>; + &mut Trait2>; // Bare Functions let rust_fn = (rust_fn, 0_usize); @@ -315,7 +317,7 @@ fn main() { let extern_stdcall_fn_with_return_value = (extern_stdcall_fn_with_return_value, 0_usize); let generic_function_int = (generic_function::, 0_usize); - let generic_function_struct3 = (generic_function::, 0_usize); + let generic_function_struct3 = (generic_function::, 0_usize); let variadic_function = (printf, 0_usize); diff --git a/src/test/debuginfo/vec-slices.rs b/src/test/debuginfo/vec-slices.rs index b87a9250f4a7e..c806286deadaf 100644 --- a/src/test/debuginfo/vec-slices.rs +++ b/src/test/debuginfo/vec-slices.rs @@ -77,7 +77,7 @@ // lldb-command:print padded_struct // lldb-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }] -#![allow(unused_variables)] +#![allow(dead_code, unused_variables)] #![omit_gdb_pretty_printer_section] struct AStruct {