Skip to content

Commit 61ff271

Browse files
committed
Adjust tests for new drop and forget lints
1 parent 3f81b6b commit 61ff271

File tree

61 files changed

+145
-64
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+145
-64
lines changed

src/tools/miri/tests/fail/stacked_borrows/illegal_write2.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(drop_ref)]
2+
13
fn main() {
24
let target = &mut 42;
35
let target2 = target as *mut _;

src/tools/miri/tests/fail/uninit_buffer.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
//@error-pattern: memory is uninitialized at [0x4..0x10]
22

3+
#![allow(drop_copy)]
4+
35
use std::alloc::{alloc, dealloc, Layout};
46
use std::slice::from_raw_parts;
57

src/tools/miri/tests/fail/uninit_buffer_with_provenance.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
//@normalize-stderr-test: "a[0-9]+" -> "ALLOC"
33
#![feature(strict_provenance)]
44

5+
#![allow(drop_copy)]
6+
57
// Test printing allocations that contain single-byte provenance.
68

79
use std::alloc::{alloc, dealloc, Layout};

src/tools/miri/tests/pass/stacked-borrows/zst-field-retagging-terminates.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//@compile-flags: -Zmiri-retag-fields
22
// Checks that the test does not run forever (which relies on a fast path).
3+
4+
#![allow(drop_copy)]
5+
36
fn main() {
47
let array = [(); usize::MAX];
58
drop(array); // Pass the array to a function, retagging its fields

tests/ui/associated-inherent-types/inference.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#![feature(inherent_associated_types)]
55
#![allow(incomplete_features)]
6+
#![allow(drop_copy)]
67

78
use std::convert::identity;
89

tests/ui/async-await/multiple-lifetimes/partial-relation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
async fn lotsa_lifetimes<'a, 'b, 'c>(a: &'a u32, b: &'b u32, c: &'c u32) -> (&'a u32, &'b u32)
55
where 'b: 'a
66
{
7-
drop((a, c));
7+
let _ = (a, c);
88
(b, b)
99
}
1010

tests/ui/borrowck/borrowck-closures-slice-patterns-ok.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Check that closure captures for slice patterns are inferred correctly
22

33
#![allow(unused_variables)]
4+
#![allow(drop_ref)]
45

56
// run-pass
67

tests/ui/borrowck/borrowck-field-sensitivity-rpass.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22
#![allow(unused_mut)]
33
#![allow(unused_variables)]
4+
#![allow(drop_copy)]
45
// pretty-expanded FIXME #23616
56

67
struct A { a: isize, b: Box<isize> }

tests/ui/borrowck/borrowck-use-mut-borrow-rpass.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// run-pass
22
// pretty-expanded FIXME #23616
33

4+
#![allow(drop_copy)]
5+
46
struct A { a: isize, b: Box<isize> }
57

68
fn field_copy_after_field_borrow() {

tests/ui/closures/2229_closure_analysis/migrations/issue-78720.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// run-pass
22

33
#![warn(rust_2021_incompatible_closure_captures)]
4+
#![allow(drop_ref, drop_copy)]
45

56
fn main() {
67
if let a = "" {

tests/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
warning: irrefutable `if let` pattern
2-
--> $DIR/issue-78720.rs:6:8
2+
--> $DIR/issue-78720.rs:7:8
33
|
44
LL | if let a = "" {
55
| ^^^^^^^^^^

tests/ui/closures/2229_closure_analysis/optimization/edge_case_run_pass.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#![allow(unused)]
55
#![allow(dead_code)]
6+
#![allow(drop_ref)]
67

78
struct Int(i32);
89
struct B<'a>(&'a i32);

tests/ui/closures/2229_closure_analysis/run_pass/drop_then_use_fake_reads.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// edition:2021
22
// check-pass
3+
34
#![feature(rustc_attrs)]
5+
#![allow(drop_ref)]
46

57
fn main() {
68
let mut x = 1;

tests/ui/consts/const_forget.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// check-pass
22

3+
#![allow(forget_copy)]
4+
35
use std::mem::forget;
46

57
const _: () = forget(0i32);

tests/ui/consts/issue-104155.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// check-pass
2+
3+
#![allow(forget_copy)]
4+
25
const _: () = core::mem::forget(Box::<u32>::default);
36
const _: () = core::mem::forget(|| Box::<u32>::default());
47

tests/ui/crate-leading-sep.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// run-pass
22
// pretty-expanded FIXME #23616
33

4+
#![allow(drop_copy)]
5+
46
fn main() {
57
use ::std::mem;
68
mem::drop(2_usize);

tests/ui/drop/repeat-drop.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// run-pass
22
// needs-unwind
33

4+
#![allow(drop_ref, drop_copy)]
5+
46
static mut CHECK: usize = 0;
57

68
struct DropChecker(usize);

tests/ui/explicit/explicit-call-to-supertrait-dtor.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// run-rustfix
2+
3+
#![allow(drop_ref)]
4+
25
struct Foo {
36
x: isize
47
}

tests/ui/explicit/explicit-call-to-supertrait-dtor.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// run-rustfix
2+
3+
#![allow(drop_ref)]
4+
25
struct Foo {
36
x: isize
47
}

tests/ui/explicit/explicit-call-to-supertrait-dtor.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0040]: explicit use of destructor method
2-
--> $DIR/explicit-call-to-supertrait-dtor.rs:19:14
2+
--> $DIR/explicit-call-to-supertrait-dtor.rs:22:14
33
|
44
LL | self.drop();
55
| -----^^^^--

tests/ui/feature-gates/feature-gate-unsafe_pin_internals.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ fn non_unsafe_pin_new_unchecked<T>(pointer: &mut T) -> Pin<&mut T> {
1313
fn main() {
1414
let mut self_referential = PhantomPinned;
1515
let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential);
16-
core::mem::forget(self_referential); // move and disable drop glue!
1716
}

tests/ui/generator/drop-env.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//[nomiropt]compile-flags: -Z mir-opt-level=0
55

66
#![feature(generators, generator_trait)]
7+
#![allow(drop_copy)]
78

89
use std::ops::Generator;
910
use std::pin::Pin;

tests/ui/generator/issue-57017.no_drop_tracking.stderr

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: generator cannot be sent between threads safely
2-
--> $DIR/issue-57017.rs:31:25
2+
--> $DIR/issue-57017.rs:32:25
33
|
44
LL | assert_send(g);
55
| ^ generator is not `Send`
@@ -15,7 +15,7 @@ LL | | );
1515
|
1616
= help: the trait `Sync` is not implemented for `copy::unsync::Client`
1717
note: generator is not `Send` as this value is used across a yield
18-
--> $DIR/issue-57017.rs:29:28
18+
--> $DIR/issue-57017.rs:30:28
1919
|
2020
LL | let g = move || match drop(&$name::unsync::Client::default()) {
2121
| --------------------------------- has type `&copy::unsync::Client` which is not `Send`
@@ -33,14 +33,14 @@ LL | | }
3333
LL | | );
3434
| |_____- in this macro invocation
3535
note: required by a bound in `assert_send`
36-
--> $DIR/issue-57017.rs:51:19
36+
--> $DIR/issue-57017.rs:52:19
3737
|
3838
LL | fn assert_send<T: Send>(_thing: T) {}
3939
| ^^^^ required by this bound in `assert_send`
4040
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
4141

4242
error: generator cannot be sent between threads safely
43-
--> $DIR/issue-57017.rs:43:25
43+
--> $DIR/issue-57017.rs:44:25
4444
|
4545
LL | assert_send(g);
4646
| ^ generator is not `Send`
@@ -54,9 +54,9 @@ LL | | }
5454
LL | | );
5555
| |_____- in this macro invocation
5656
|
57-
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
57+
= help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
5858
note: generator is not `Send` as this value is used across a yield
59-
--> $DIR/issue-57017.rs:41:28
59+
--> $DIR/issue-57017.rs:42:28
6060
|
6161
LL | let g = move || match drop($name::unsend::Client::default()) {
6262
| -------------------------------- has type `copy::unsend::Client` which is not `Send`
@@ -74,14 +74,14 @@ LL | | }
7474
LL | | );
7575
| |_____- in this macro invocation
7676
note: required by a bound in `assert_send`
77-
--> $DIR/issue-57017.rs:51:19
77+
--> $DIR/issue-57017.rs:52:19
7878
|
7979
LL | fn assert_send<T: Send>(_thing: T) {}
8080
| ^^^^ required by this bound in `assert_send`
8181
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
8282

8383
error: generator cannot be sent between threads safely
84-
--> $DIR/issue-57017.rs:31:25
84+
--> $DIR/issue-57017.rs:32:25
8585
|
8686
LL | assert_send(g);
8787
| ^ generator is not `Send`
@@ -97,7 +97,7 @@ LL | | );
9797
|
9898
= help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
9999
note: generator is not `Send` as this value is used across a yield
100-
--> $DIR/issue-57017.rs:29:28
100+
--> $DIR/issue-57017.rs:30:28
101101
|
102102
LL | let g = move || match drop(&$name::unsync::Client::default()) {
103103
| --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
@@ -115,14 +115,14 @@ LL | | }
115115
LL | | );
116116
| |_____- in this macro invocation
117117
note: required by a bound in `assert_send`
118-
--> $DIR/issue-57017.rs:51:19
118+
--> $DIR/issue-57017.rs:52:19
119119
|
120120
LL | fn assert_send<T: Send>(_thing: T) {}
121121
| ^^^^ required by this bound in `assert_send`
122122
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
123123

124124
error: generator cannot be sent between threads safely
125-
--> $DIR/issue-57017.rs:43:25
125+
--> $DIR/issue-57017.rs:44:25
126126
|
127127
LL | assert_send(g);
128128
| ^ generator is not `Send`
@@ -136,9 +136,9 @@ LL | | }
136136
LL | | );
137137
| |_____- in this macro invocation
138138
|
139-
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
139+
= help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
140140
note: generator is not `Send` as this value is used across a yield
141-
--> $DIR/issue-57017.rs:41:28
141+
--> $DIR/issue-57017.rs:42:28
142142
|
143143
LL | let g = move || match drop($name::unsend::Client::default()) {
144144
| -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
@@ -156,14 +156,14 @@ LL | | }
156156
LL | | );
157157
| |_____- in this macro invocation
158158
note: required by a bound in `assert_send`
159-
--> $DIR/issue-57017.rs:51:19
159+
--> $DIR/issue-57017.rs:52:19
160160
|
161161
LL | fn assert_send<T: Send>(_thing: T) {}
162162
| ^^^^ required by this bound in `assert_send`
163163
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
164164

165165
error: generator cannot be sent between threads safely
166-
--> $DIR/issue-57017.rs:31:25
166+
--> $DIR/issue-57017.rs:32:25
167167
|
168168
LL | assert_send(g);
169169
| ^ generator is not `Send`
@@ -179,7 +179,7 @@ LL | | );
179179
|
180180
= help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
181181
note: generator is not `Send` as this value is used across a yield
182-
--> $DIR/issue-57017.rs:29:28
182+
--> $DIR/issue-57017.rs:30:28
183183
|
184184
LL | let g = move || match drop(&$name::unsync::Client::default()) {
185185
| --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
@@ -197,14 +197,14 @@ LL | | }
197197
LL | | );
198198
| |_____- in this macro invocation
199199
note: required by a bound in `assert_send`
200-
--> $DIR/issue-57017.rs:51:19
200+
--> $DIR/issue-57017.rs:52:19
201201
|
202202
LL | fn assert_send<T: Send>(_thing: T) {}
203203
| ^^^^ required by this bound in `assert_send`
204204
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
205205

206206
error: generator cannot be sent between threads safely
207-
--> $DIR/issue-57017.rs:43:25
207+
--> $DIR/issue-57017.rs:44:25
208208
|
209209
LL | assert_send(g);
210210
| ^ generator is not `Send`
@@ -218,9 +218,9 @@ LL | | }
218218
LL | | );
219219
| |_____- in this macro invocation
220220
|
221-
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
221+
= help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
222222
note: generator is not `Send` as this value is used across a yield
223-
--> $DIR/issue-57017.rs:41:28
223+
--> $DIR/issue-57017.rs:42:28
224224
|
225225
LL | let g = move || match drop($name::unsend::Client::default()) {
226226
| -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
@@ -238,7 +238,7 @@ LL | | }
238238
LL | | );
239239
| |_____- in this macro invocation
240240
note: required by a bound in `assert_send`
241-
--> $DIR/issue-57017.rs:51:19
241+
--> $DIR/issue-57017.rs:52:19
242242
|
243243
LL | fn assert_send<T: Send>(_thing: T) {}
244244
| ^^^^ required by this bound in `assert_send`

tests/ui/generator/issue-57017.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// [drop_tracking_mir] build-pass
66

77
#![feature(generators, negative_impls)]
8+
#![allow(drop_ref, drop_copy)]
89

910
macro_rules! type_combinations {
1011
(

tests/ui/generator/non-static-is-unpin.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// run-pass
44

55
#![feature(generators, generator_trait)]
6+
#![allow(drop_copy)]
67

78
use std::marker::{PhantomPinned, Unpin};
89

tests/ui/generator/resume-arg-size.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![feature(generators)]
2+
#![allow(drop_copy)]
23

34
// run-pass
45

tests/ui/hygiene/stdlib-prelude-from-opaque-late.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// check-pass
22

33
#![feature(decl_macro)]
4+
#![allow(drop_copy)]
45

56
macro mac() {
67
mod m {

tests/ui/illegal-ufcs-drop.fixed

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// run-rustfix
2+
3+
#![allow(drop_ref)]
4+
25
struct Foo;
36

47
impl Drop for Foo {

tests/ui/illegal-ufcs-drop.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
// run-rustfix
2+
3+
#![allow(drop_ref)]
4+
25
struct Foo;
36

47
impl Drop for Foo {

tests/ui/illegal-ufcs-drop.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0040]: explicit use of destructor method
2-
--> $DIR/illegal-ufcs-drop.rs:9:5
2+
--> $DIR/illegal-ufcs-drop.rs:12:5
33
|
44
LL | Drop::drop(&mut Foo)
55
| ^^^^^^^^^^

0 commit comments

Comments
 (0)