Skip to content

Commit 54de911

Browse files
committed
rust-lang#10381: Warnings
1 parent 9768447 commit 54de911

10 files changed

+60
-52
lines changed

src/test/auxiliary/cross_crate_spans.rs

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// except according to those terms.
1010

1111
#![crate_type = "rlib"]
12+
13+
#![allow(unused_variables)]
1214
#![omit_gdb_pretty_printer_section]
1315

1416
// no-prefer-dynamic

src/test/debuginfo/constant-debug-locs.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
// compile-flags:-g
1515

16-
#![allow(unused_variables)]
17-
#![allow(dead_code)]
16+
#![allow(dead_code, unused_variables)]
1817
#![omit_gdb_pretty_printer_section]
1918
#![feature(std_misc, core)]
2019

src/test/debuginfo/constant-in-match-pattern.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313

1414
// compile-flags:-g
1515

16-
#![allow(unused_variables)]
17-
#![allow(dead_code)]
16+
#![allow(dead_code, unused_variables)]
1817
#![omit_gdb_pretty_printer_section]
1918

2019
// This test makes sure that the compiler doesn't crash when trying to assign

src/test/debuginfo/cross-crate-spans.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ extern crate cross_crate_spans;
2121

2222
// === GDB TESTS ===================================================================================
2323

24-
// gdb-command:break cross_crate_spans.rs:21
24+
// gdb-command:break cross_crate_spans.rs:23
2525
// gdb-command:run
2626

2727
// gdb-command:print result
@@ -44,7 +44,7 @@ extern crate cross_crate_spans;
4444

4545
// === LLDB TESTS ==================================================================================
4646

47-
// lldb-command:b cross_crate_spans.rs:21
47+
// lldb-command:b cross_crate_spans.rs:23
4848
// lldb-command:run
4949

5050
// lldb-command:print result

src/test/debuginfo/function-prologue-stepping-no-stack-check.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@
246246
// lldb-check:[...]$31 = 45
247247
// lldb-command:continue
248248

249-
#![allow(unused_variables)]
249+
#![allow(dead_code, unused_assignments, unused_variables)]
250250
#![omit_gdb_pretty_printer_section]
251251

252252
#[no_stack_check]

src/test/debuginfo/gdb-pretty-std.rs

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
// gdb-command: print none
3636
// gdb-check:$6 = None
3737

38+
#![allow(unused_variables)]
39+
3840
fn main() {
3941

4042
// &[]

src/test/debuginfo/gdb-pretty-struct-and-enums-pre-gdb-7-7.rs

+2
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
// gdb-command: print c_style_enum3
3838
// gdb-check:$5 = CStyleEnumVar3
3939

40+
#![allow(dead_code, unused_variables)]
41+
4042
struct RegularStruct {
4143
the_first_field: isize,
4244
the_second_field: f64,

src/test/debuginfo/gdb-pretty-struct-and-enums.rs

+2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
// gdb-command: print none_check2
7777
// gdb-check:$18 = None
7878

79+
#![allow(dead_code, unused_variables)]
80+
7981
use self::CStyleEnum::{CStyleEnumVar1, CStyleEnumVar2, CStyleEnumVar3};
8082
use self::MixedEnum::{MixedEnumCStyleVar, MixedEnumTupleVar, MixedEnumStructVar};
8183
use self::NestedEnum::{NestedVariant1, NestedVariant2};

src/test/debuginfo/type-names.rs

+46-44
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// gdb-check:type = struct Struct1
2222

2323
// gdb-command:whatis generic_struct1
24-
// gdb-check:type = struct GenericStruct<type_names::Mod1::Struct2, type_names::Mod1::Mod2::Struct3>
24+
// gdb-check:type = struct GenericStruct<type_names::mod1::Struct2, type_names::mod1::mod2::Struct3>
2525

2626
// gdb-command:whatis generic_struct2
2727
// gdb-check:type = struct GenericStruct<type_names::Struct1, extern "fastcall" fn(isize) -> usize>
@@ -41,26 +41,26 @@
4141
// gdb-check:type = union Enum2
4242

4343
// gdb-command:whatis generic_enum_1
44-
// gdb-check:type = union Enum3<type_names::Mod1::Struct2>
44+
// gdb-check:type = union Enum3<type_names::mod1::Struct2>
4545

4646
// gdb-command:whatis generic_enum_2
4747
// gdb-check:type = union Enum3<type_names::Struct1>
4848

4949

5050
// TUPLES
5151
// gdb-command:whatis tuple1
52-
// gdb-check:type = struct (u32, type_names::Struct1, type_names::Mod1::Mod2::Enum3<type_names::Mod1::Struct2>)
52+
// gdb-check:type = struct (u32, type_names::Struct1, type_names::mod1::mod2::Enum3<type_names::mod1::Struct2>)
5353

5454
// gdb-command:whatis tuple2
55-
// gdb-check:type = struct ((type_names::Struct1, type_names::Mod1::Mod2::Struct3), type_names::Mod1::Enum2, char)
55+
// gdb-check:type = struct ((type_names::Struct1, type_names::mod1::mod2::Struct3), type_names::mod1::Enum2, char)
5656

5757

5858
// BOX
5959
// gdb-command:whatis box1
6060
// gdb-check:type = struct (Box<f32>, i32)
6161

6262
// gdb-command:whatis box2
63-
// gdb-check:type = struct (Box<type_names::Mod1::Mod2::Enum3<f32>>, i32)
63+
// gdb-check:type = struct (Box<type_names::mod1::mod2::Enum3<f32>>, i32)
6464

6565

6666
// REFERENCES
@@ -74,7 +74,7 @@
7474
// gdb-check:type = struct (&mut type_names::Struct1, i32)
7575

7676
// gdb-command:whatis mut_ref2
77-
// gdb-check:type = struct (&mut type_names::GenericStruct<type_names::Mod1::Enum2, f64>, i32)
77+
// gdb-check:type = struct (&mut type_names::GenericStruct<type_names::mod1::Enum2, f64>, i32)
7878

7979

8080
// RAW POINTERS
@@ -85,7 +85,7 @@
8585
// gdb-check:type = struct (*mut isize, isize)
8686

8787
// gdb-command:whatis mut_ptr3
88-
// gdb-check:type = struct (*mut type_names::Mod1::Mod2::Enum3<type_names::Struct1>, isize)
88+
// gdb-check:type = struct (*mut type_names::mod1::mod2::Enum3<type_names::Struct1>, isize)
8989

9090
// gdb-command:whatis const_ptr1
9191
// gdb-check:type = struct (*const type_names::Struct1, isize)
@@ -94,7 +94,7 @@
9494
// gdb-check:type = struct (*const isize, isize)
9595

9696
// gdb-command:whatis const_ptr3
97-
// gdb-check:type = struct (*const type_names::Mod1::Mod2::Enum3<type_names::Struct1>, isize)
97+
// gdb-check:type = struct (*const type_names::mod1::mod2::Enum3<type_names::Struct1>, isize)
9898

9999

100100
// VECTORS
@@ -108,7 +108,7 @@
108108
// gdb-check:type = struct &[usize]
109109

110110
// gdb-command:whatis slice2
111-
// gdb-check:type = struct &[type_names::Mod1::Enum2]
111+
// gdb-check:type = struct &[type_names::mod1::Enum2]
112112

113113

114114
// TRAITS
@@ -122,18 +122,18 @@
122122
// gdb-check:type = struct &mut Trait1
123123

124124
// gdb-command:whatis generic_box_trait
125-
// gdb-check:type = struct Box<Trait2<i32, type_names::Mod1::Struct2>>
125+
// gdb-check:type = struct Box<Trait2<i32, type_names::mod1::Struct2>>
126126

127127
// gdb-command:whatis generic_ref_trait
128128
// gdb-check:type = struct &Trait2<type_names::Struct1, type_names::Struct1>
129129

130130
// gdb-command:whatis generic_mut_ref_trait
131-
// gdb-check:type = struct &mut Trait2<type_names::Mod1::Mod2::Struct3, type_names::GenericStruct<usize, isize>>
131+
// gdb-check:type = struct &mut Trait2<type_names::mod1::mod2::Struct3, type_names::GenericStruct<usize, isize>>
132132

133133

134134
// BARE FUNCTIONS
135135
// gdb-command:whatis rust_fn
136-
// gdb-check:type = struct (fn(core::option::Option<isize>, core::option::Option<&type_names::Mod1::Struct2>), usize)
136+
// gdb-check:type = struct (fn(core::option::Option<isize>, core::option::Option<&type_names::mod1::Struct2>), usize)
137137

138138
// gdb-command:whatis extern_c_fn
139139
// gdb-check:type = struct (extern "C" fn(isize), usize)
@@ -151,7 +151,7 @@
151151
// gdb-check:type = struct (extern "C" fn() -> type_names::Struct1, usize)
152152

153153
// gdb-command:whatis unsafe_fn_with_return_value
154-
// gdb-check:type = struct (unsafe fn(type_names::GenericStruct<u16, u8>) -> type_names::Mod1::Struct2, usize)
154+
// gdb-check:type = struct (unsafe fn(type_names::GenericStruct<u16, u8>) -> type_names::mod1::Struct2, usize)
155155

156156
// gdb-command:whatis extern_stdcall_fn_with_return_value
157157
// gdb-check:type = struct (extern "stdcall" fn(Box<isize>) -> usize, usize)
@@ -160,7 +160,7 @@
160160
// gdb-check:type = struct (fn(isize) -> isize, usize)
161161

162162
// gdb-command:whatis generic_function_struct3
163-
// gdb-check:type = struct (fn(type_names::Mod1::Mod2::Struct3) -> type_names::Mod1::Mod2::Struct3, usize)
163+
// gdb-check:type = struct (fn(type_names::mod1::mod2::Struct3) -> type_names::mod1::mod2::Struct3, usize)
164164

165165
// gdb-command:whatis variadic_function
166166
// gdb-check:type = struct (unsafe extern "C" fn(*const u8, ...) -> isize, usize)
@@ -174,36 +174,37 @@
174174
// gdb-check:type = struct (closure, usize)
175175

176176
#![feature(box_syntax)]
177+
#![allow(unused_variables)]
177178
#![omit_gdb_pretty_printer_section]
178179

179-
use self::Enum1::{Variant1_1, Variant1_2};
180+
use self::Enum1::{Variant1, Variant2};
180181
use std::marker::PhantomData;
181182
use std::ptr;
182183

183184
struct Struct1;
184185
struct GenericStruct<T1, T2>(PhantomData<(T1,T2)>);
185186

186187
enum Enum1 {
187-
Variant1_1,
188-
Variant1_2(isize)
188+
Variant1,
189+
Variant2(isize),
189190
}
190191

191-
mod Mod1 {
192-
pub use self::Enum2::{Variant2_1, Variant2_2};
192+
mod mod1 {
193+
pub use self::Enum2::{Variant1, Variant2};
193194
pub struct Struct2;
194195

195196
pub enum Enum2 {
196-
Variant2_1,
197-
Variant2_2(super::Struct1)
197+
Variant1,
198+
Variant2(super::Struct1),
198199
}
199200

200-
pub mod Mod2 {
201-
pub use self::Enum3::{Variant3_1, Variant3_2};
201+
pub mod mod2 {
202+
pub use self::Enum3::{Variant1, Variant2};
202203
pub struct Struct3;
203204

204205
pub enum Enum3<T> {
205-
Variant3_1,
206-
Variant3_2(T),
206+
Variant1,
207+
Variant2(T),
207208
}
208209
}
209210
}
@@ -214,18 +215,19 @@ trait Trait2<T1, T2> { fn dummy(&self, _: T1, _:T2) { } }
214215
impl Trait1 for isize {}
215216
impl<T1, T2> Trait2<T1, T2> for isize {}
216217

217-
fn rust_fn(_: Option<isize>, _: Option<&Mod1::Struct2>) {}
218+
fn rust_fn(_: Option<isize>, _: Option<&mod1::Struct2>) {}
218219
extern "C" fn extern_c_fn(_: isize) {}
219220
unsafe fn unsafe_fn(_: Result<char, f64>) {}
220221
extern "stdcall" fn extern_stdcall_fn() {}
221222

222223
fn rust_fn_with_return_value(_: f64) -> usize { 4 }
223224
extern "C" fn extern_c_fn_with_return_value() -> Struct1 { Struct1 }
224-
unsafe fn unsafe_fn_with_return_value(_: GenericStruct<u16, u8>) -> Mod1::Struct2 { Mod1::Struct2 }
225+
unsafe fn unsafe_fn_with_return_value(_: GenericStruct<u16, u8>) -> mod1::Struct2 { mod1::Struct2 }
225226
extern "stdcall" fn extern_stdcall_fn_with_return_value(_: Box<isize>) -> usize { 0 }
226227

227228
fn generic_function<T>(x: T) -> T { x }
228229

230+
#[allow(improper_ctypes)]
229231
extern {
230232
fn printf(_:*const u8, ...) -> isize;
231233
}
@@ -241,53 +243,53 @@ fn main() {
241243

242244
// Structs
243245
let simple_struct = Struct1;
244-
let generic_struct1: GenericStruct<Mod1::Struct2, Mod1::Mod2::Struct3> =
246+
let generic_struct1: GenericStruct<mod1::Struct2, mod1::mod2::Struct3> =
245247
GenericStruct(PhantomData);
246248
let generic_struct2: GenericStruct<Struct1, extern "fastcall" fn(isize) -> usize> =
247249
GenericStruct(PhantomData);
248-
let mod_struct = Mod1::Struct2;
250+
let mod_struct = mod1::Struct2;
249251

250252
// Enums
251-
let simple_enum_1 = Variant1_1;
252-
let simple_enum_2 = Variant1_2(0);
253-
let simple_enum_3 = Mod1::Variant2_2(Struct1);
253+
let simple_enum_1 = Variant1;
254+
let simple_enum_2 = Variant2(0);
255+
let simple_enum_3 = mod1::Variant2(Struct1);
254256

255-
let generic_enum_1: Mod1::Mod2::Enum3<Mod1::Struct2> = Mod1::Mod2::Variant3_1;
256-
let generic_enum_2 = Mod1::Mod2::Variant3_2(Struct1);
257+
let generic_enum_1: mod1::mod2::Enum3<mod1::Struct2> = mod1::mod2::Variant1;
258+
let generic_enum_2 = mod1::mod2::Variant2(Struct1);
257259

258260
// Tuples
259-
let tuple1 = (8u32, Struct1, Mod1::Mod2::Variant3_2(Mod1::Struct2));
260-
let tuple2 = ((Struct1, Mod1::Mod2::Struct3), Mod1::Variant2_1, 'x');
261+
let tuple1 = (8u32, Struct1, mod1::mod2::Variant2(mod1::Struct2));
262+
let tuple2 = ((Struct1, mod1::mod2::Struct3), mod1::Variant1, 'x');
261263

262264
// Box
263265
let box1 = (box 1f32, 0i32);
264-
let box2 = (box Mod1::Mod2::Variant3_2(1f32), 0i32);
266+
let box2 = (box mod1::mod2::Variant2(1f32), 0i32);
265267

266268
// References
267269
let ref1 = (&Struct1, 0i32);
268270
let ref2 = (&GenericStruct::<char, Struct1>(PhantomData), 0i32);
269271

270272
let mut mut_struct1 = Struct1;
271-
let mut mut_generic_struct = GenericStruct::<Mod1::Enum2, f64>(PhantomData);
273+
let mut mut_generic_struct = GenericStruct::<mod1::Enum2, f64>(PhantomData);
272274
let mut_ref1 = (&mut mut_struct1, 0i32);
273275
let mut_ref2 = (&mut mut_generic_struct, 0i32);
274276

275277
// Raw Pointers
276278
let mut_ptr1: (*mut Struct1, isize) = (ptr::null_mut(), 0);
277279
let mut_ptr2: (*mut isize, isize) = (ptr::null_mut(), 0);
278-
let mut_ptr3: (*mut Mod1::Mod2::Enum3<Struct1>, isize) = (ptr::null_mut(), 0);
280+
let mut_ptr3: (*mut mod1::mod2::Enum3<Struct1>, isize) = (ptr::null_mut(), 0);
279281

280282
let const_ptr1: (*const Struct1, isize) = (ptr::null(), 0);
281283
let const_ptr2: (*const isize, isize) = (ptr::null(), 0);
282-
let const_ptr3: (*const Mod1::Mod2::Enum3<Struct1>, isize) = (ptr::null(), 0);
284+
let const_ptr3: (*const mod1::mod2::Enum3<Struct1>, isize) = (ptr::null(), 0);
283285

284286
// Vectors
285287
let fixed_size_vec1 = ([Struct1, Struct1, Struct1], 0i16);
286288
let fixed_size_vec2 = ([0_usize, 1, 2], 0i16);
287289

288290
let vec1 = vec![0_usize, 2, 3];
289291
let slice1 = &*vec1;
290-
let vec2 = vec![Mod1::Variant2_2(Struct1)];
292+
let vec2 = vec![mod1::Variant2(Struct1)];
291293
let slice2 = &*vec2;
292294

293295
// Trait Objects
@@ -296,12 +298,12 @@ fn main() {
296298
let mut mut_int1 = 0_isize;
297299
let mut_ref_trait = (&mut mut_int1) as &mut Trait1;
298300

299-
let generic_box_trait = (box 0_isize) as Box<Trait2<i32, Mod1::Struct2>>;
301+
let generic_box_trait = (box 0_isize) as Box<Trait2<i32, mod1::Struct2>>;
300302
let generic_ref_trait = (&0_isize) as &Trait2<Struct1, Struct1>;
301303

302304
let mut generic_mut_ref_trait_impl = 0_isize;
303305
let generic_mut_ref_trait = (&mut generic_mut_ref_trait_impl) as
304-
&mut Trait2<Mod1::Mod2::Struct3, GenericStruct<usize, isize>>;
306+
&mut Trait2<mod1::mod2::Struct3, GenericStruct<usize, isize>>;
305307

306308
// Bare Functions
307309
let rust_fn = (rust_fn, 0_usize);
@@ -315,7 +317,7 @@ fn main() {
315317
let extern_stdcall_fn_with_return_value = (extern_stdcall_fn_with_return_value, 0_usize);
316318

317319
let generic_function_int = (generic_function::<isize>, 0_usize);
318-
let generic_function_struct3 = (generic_function::<Mod1::Mod2::Struct3>, 0_usize);
320+
let generic_function_struct3 = (generic_function::<mod1::mod2::Struct3>, 0_usize);
319321

320322
let variadic_function = (printf, 0_usize);
321323

src/test/debuginfo/vec-slices.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
// lldb-command:print padded_struct
7878
// lldb-check:[...]$5 = &[AStruct { x: 10, y: 11, z: 12 }, AStruct { x: 13, y: 14, z: 15 }]
7979

80-
#![allow(unused_variables)]
80+
#![allow(dead_code, unused_variables)]
8181
#![omit_gdb_pretty_printer_section]
8282

8383
struct AStruct {

0 commit comments

Comments
 (0)