1
Fork 0

Adjust tests for new drop and forget lints

This commit is contained in:
Urgau 2023-03-29 22:18:20 +02:00
parent 3f81b6b8a2
commit 61ff2718f7
61 changed files with 145 additions and 64 deletions

View file

@ -1,3 +1,5 @@
#![allow(drop_ref)]
fn main() { fn main() {
let target = &mut 42; let target = &mut 42;
let target2 = target as *mut _; let target2 = target as *mut _;

View file

@ -1,5 +1,7 @@
//@error-pattern: memory is uninitialized at [0x4..0x10] //@error-pattern: memory is uninitialized at [0x4..0x10]
#![allow(drop_copy)]
use std::alloc::{alloc, dealloc, Layout}; use std::alloc::{alloc, dealloc, Layout};
use std::slice::from_raw_parts; use std::slice::from_raw_parts;

View file

@ -2,6 +2,8 @@
//@normalize-stderr-test: "a[0-9]+" -> "ALLOC" //@normalize-stderr-test: "a[0-9]+" -> "ALLOC"
#![feature(strict_provenance)] #![feature(strict_provenance)]
#![allow(drop_copy)]
// Test printing allocations that contain single-byte provenance. // Test printing allocations that contain single-byte provenance.
use std::alloc::{alloc, dealloc, Layout}; use std::alloc::{alloc, dealloc, Layout};

View file

@ -1,5 +1,8 @@
//@compile-flags: -Zmiri-retag-fields //@compile-flags: -Zmiri-retag-fields
// Checks that the test does not run forever (which relies on a fast path). // Checks that the test does not run forever (which relies on a fast path).
#![allow(drop_copy)]
fn main() { fn main() {
let array = [(); usize::MAX]; let array = [(); usize::MAX];
drop(array); // Pass the array to a function, retagging its fields drop(array); // Pass the array to a function, retagging its fields

View file

@ -3,6 +3,7 @@
#![feature(inherent_associated_types)] #![feature(inherent_associated_types)]
#![allow(incomplete_features)] #![allow(incomplete_features)]
#![allow(drop_copy)]
use std::convert::identity; use std::convert::identity;

View file

@ -4,7 +4,7 @@
async fn lotsa_lifetimes<'a, 'b, 'c>(a: &'a u32, b: &'b u32, c: &'c u32) -> (&'a u32, &'b u32) async fn lotsa_lifetimes<'a, 'b, 'c>(a: &'a u32, b: &'b u32, c: &'c u32) -> (&'a u32, &'b u32)
where 'b: 'a where 'b: 'a
{ {
drop((a, c)); let _ = (a, c);
(b, b) (b, b)
} }

View file

@ -1,6 +1,7 @@
// Check that closure captures for slice patterns are inferred correctly // Check that closure captures for slice patterns are inferred correctly
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(drop_ref)]
// run-pass // run-pass

View file

@ -1,6 +1,7 @@
// run-pass // run-pass
#![allow(unused_mut)] #![allow(unused_mut)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(drop_copy)]
// pretty-expanded FIXME #23616 // pretty-expanded FIXME #23616
struct A { a: isize, b: Box<isize> } struct A { a: isize, b: Box<isize> }

View file

@ -1,6 +1,8 @@
// run-pass // run-pass
// pretty-expanded FIXME #23616 // pretty-expanded FIXME #23616
#![allow(drop_copy)]
struct A { a: isize, b: Box<isize> } struct A { a: isize, b: Box<isize> }
fn field_copy_after_field_borrow() { fn field_copy_after_field_borrow() {

View file

@ -1,6 +1,7 @@
// run-pass // run-pass
#![warn(rust_2021_incompatible_closure_captures)] #![warn(rust_2021_incompatible_closure_captures)]
#![allow(drop_ref, drop_copy)]
fn main() { fn main() {
if let a = "" { if let a = "" {

View file

@ -1,5 +1,5 @@
warning: irrefutable `if let` pattern warning: irrefutable `if let` pattern
--> $DIR/issue-78720.rs:6:8 --> $DIR/issue-78720.rs:7:8
| |
LL | if let a = "" { LL | if let a = "" {
| ^^^^^^^^^^ | ^^^^^^^^^^

View file

@ -3,6 +3,7 @@
#![allow(unused)] #![allow(unused)]
#![allow(dead_code)] #![allow(dead_code)]
#![allow(drop_ref)]
struct Int(i32); struct Int(i32);
struct B<'a>(&'a i32); struct B<'a>(&'a i32);

View file

@ -1,6 +1,8 @@
// edition:2021 // edition:2021
// check-pass // check-pass
#![feature(rustc_attrs)] #![feature(rustc_attrs)]
#![allow(drop_ref)]
fn main() { fn main() {
let mut x = 1; let mut x = 1;

View file

@ -1,5 +1,7 @@
// check-pass // check-pass
#![allow(forget_copy)]
use std::mem::forget; use std::mem::forget;
const _: () = forget(0i32); const _: () = forget(0i32);

View file

@ -1,4 +1,7 @@
// check-pass // check-pass
#![allow(forget_copy)]
const _: () = core::mem::forget(Box::<u32>::default); const _: () = core::mem::forget(Box::<u32>::default);
const _: () = core::mem::forget(|| Box::<u32>::default()); const _: () = core::mem::forget(|| Box::<u32>::default());

View file

@ -1,6 +1,8 @@
// run-pass // run-pass
// pretty-expanded FIXME #23616 // pretty-expanded FIXME #23616
#![allow(drop_copy)]
fn main() { fn main() {
use ::std::mem; use ::std::mem;
mem::drop(2_usize); mem::drop(2_usize);

View file

@ -1,6 +1,8 @@
// run-pass // run-pass
// needs-unwind // needs-unwind
#![allow(drop_ref, drop_copy)]
static mut CHECK: usize = 0; static mut CHECK: usize = 0;
struct DropChecker(usize); struct DropChecker(usize);

View file

@ -1,4 +1,7 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)]
struct Foo { struct Foo {
x: isize x: isize
} }

View file

@ -1,4 +1,7 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)]
struct Foo { struct Foo {
x: isize x: isize
} }

View file

@ -1,5 +1,5 @@
error[E0040]: explicit use of destructor method error[E0040]: explicit use of destructor method
--> $DIR/explicit-call-to-supertrait-dtor.rs:19:14 --> $DIR/explicit-call-to-supertrait-dtor.rs:22:14
| |
LL | self.drop(); LL | self.drop();
| -----^^^^-- | -----^^^^--

View file

@ -13,5 +13,4 @@ fn non_unsafe_pin_new_unchecked<T>(pointer: &mut T) -> Pin<&mut T> {
fn main() { fn main() {
let mut self_referential = PhantomPinned; let mut self_referential = PhantomPinned;
let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential); let _: Pin<&mut PhantomPinned> = non_unsafe_pin_new_unchecked(&mut self_referential);
core::mem::forget(self_referential); // move and disable drop glue!
} }

View file

@ -4,6 +4,7 @@
//[nomiropt]compile-flags: -Z mir-opt-level=0 //[nomiropt]compile-flags: -Z mir-opt-level=0
#![feature(generators, generator_trait)] #![feature(generators, generator_trait)]
#![allow(drop_copy)]
use std::ops::Generator; use std::ops::Generator;
use std::pin::Pin; use std::pin::Pin;

View file

@ -1,5 +1,5 @@
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:31:25 --> $DIR/issue-57017.rs:32:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -15,7 +15,7 @@ LL | | );
| |
= help: the trait `Sync` is not implemented for `copy::unsync::Client` = help: the trait `Sync` is not implemented for `copy::unsync::Client`
note: generator is not `Send` as this value is used across a yield note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:29:28 --> $DIR/issue-57017.rs:30:28
| |
LL | let g = move || match drop(&$name::unsync::Client::default()) { LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&copy::unsync::Client` which is not `Send` | --------------------------------- has type `&copy::unsync::Client` which is not `Send`
@ -33,14 +33,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:51:19 --> $DIR/issue-57017.rs:52:19
| |
LL | fn assert_send<T: Send>(_thing: T) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:43:25 --> $DIR/issue-57017.rs:44:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -54,9 +54,9 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
| |
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `copy::unsend::Client` = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `copy::unsend::Client`
note: generator is not `Send` as this value is used across a yield note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:41:28 --> $DIR/issue-57017.rs:42:28
| |
LL | let g = move || match drop($name::unsend::Client::default()) { LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `copy::unsend::Client` which is not `Send` | -------------------------------- has type `copy::unsend::Client` which is not `Send`
@ -74,14 +74,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:51:19 --> $DIR/issue-57017.rs:52:19
| |
LL | fn assert_send<T: Send>(_thing: T) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:31:25 --> $DIR/issue-57017.rs:32:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -97,7 +97,7 @@ LL | | );
| |
= help: the trait `Sync` is not implemented for `derived_drop::unsync::Client` = help: the trait `Sync` is not implemented for `derived_drop::unsync::Client`
note: generator is not `Send` as this value is used across a yield note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:29:28 --> $DIR/issue-57017.rs:30:28
| |
LL | let g = move || match drop(&$name::unsync::Client::default()) { LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send` | --------------------------------- has type `&derived_drop::unsync::Client` which is not `Send`
@ -115,14 +115,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:51:19 --> $DIR/issue-57017.rs:52:19
| |
LL | fn assert_send<T: Send>(_thing: T) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:43:25 --> $DIR/issue-57017.rs:44:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -136,9 +136,9 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
| |
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client` = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `derived_drop::unsend::Client`
note: generator is not `Send` as this value is used across a yield note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:41:28 --> $DIR/issue-57017.rs:42:28
| |
LL | let g = move || match drop($name::unsend::Client::default()) { LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `derived_drop::unsend::Client` which is not `Send` | -------------------------------- has type `derived_drop::unsend::Client` which is not `Send`
@ -156,14 +156,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:51:19 --> $DIR/issue-57017.rs:52:19
| |
LL | fn assert_send<T: Send>(_thing: T) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:31:25 --> $DIR/issue-57017.rs:32:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -179,7 +179,7 @@ LL | | );
| |
= help: the trait `Sync` is not implemented for `significant_drop::unsync::Client` = help: the trait `Sync` is not implemented for `significant_drop::unsync::Client`
note: generator is not `Send` as this value is used across a yield note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:29:28 --> $DIR/issue-57017.rs:30:28
| |
LL | let g = move || match drop(&$name::unsync::Client::default()) { LL | let g = move || match drop(&$name::unsync::Client::default()) {
| --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send` | --------------------------------- has type `&significant_drop::unsync::Client` which is not `Send`
@ -197,14 +197,14 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:51:19 --> $DIR/issue-57017.rs:52:19
| |
LL | fn assert_send<T: Send>(_thing: T) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`
= note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info) = note: this error originates in the macro `type_combinations` (in Nightly builds, run with -Z macro-backtrace for more info)
error: generator cannot be sent between threads safely error: generator cannot be sent between threads safely
--> $DIR/issue-57017.rs:43:25 --> $DIR/issue-57017.rs:44:25
| |
LL | assert_send(g); LL | assert_send(g);
| ^ generator is not `Send` | ^ generator is not `Send`
@ -218,9 +218,9 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
| |
= help: within `[generator@$DIR/issue-57017.rs:40:21: 40:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client` = help: within `[generator@$DIR/issue-57017.rs:41:21: 41:28]`, the trait `Send` is not implemented for `significant_drop::unsend::Client`
note: generator is not `Send` as this value is used across a yield note: generator is not `Send` as this value is used across a yield
--> $DIR/issue-57017.rs:41:28 --> $DIR/issue-57017.rs:42:28
| |
LL | let g = move || match drop($name::unsend::Client::default()) { LL | let g = move || match drop($name::unsend::Client::default()) {
| -------------------------------- has type `significant_drop::unsend::Client` which is not `Send` | -------------------------------- has type `significant_drop::unsend::Client` which is not `Send`
@ -238,7 +238,7 @@ LL | | }
LL | | ); LL | | );
| |_____- in this macro invocation | |_____- in this macro invocation
note: required by a bound in `assert_send` note: required by a bound in `assert_send`
--> $DIR/issue-57017.rs:51:19 --> $DIR/issue-57017.rs:52:19
| |
LL | fn assert_send<T: Send>(_thing: T) {} LL | fn assert_send<T: Send>(_thing: T) {}
| ^^^^ required by this bound in `assert_send` | ^^^^ required by this bound in `assert_send`

View file

@ -5,6 +5,7 @@
// [drop_tracking_mir] build-pass // [drop_tracking_mir] build-pass
#![feature(generators, negative_impls)] #![feature(generators, negative_impls)]
#![allow(drop_ref, drop_copy)]
macro_rules! type_combinations { macro_rules! type_combinations {
( (

View file

@ -3,6 +3,7 @@
// run-pass // run-pass
#![feature(generators, generator_trait)] #![feature(generators, generator_trait)]
#![allow(drop_copy)]
use std::marker::{PhantomPinned, Unpin}; use std::marker::{PhantomPinned, Unpin};

View file

@ -1,4 +1,5 @@
#![feature(generators)] #![feature(generators)]
#![allow(drop_copy)]
// run-pass // run-pass

View file

@ -1,6 +1,7 @@
// check-pass // check-pass
#![feature(decl_macro)] #![feature(decl_macro)]
#![allow(drop_copy)]
macro mac() { macro mac() {
mod m { mod m {

View file

@ -1,4 +1,7 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)]
struct Foo; struct Foo;
impl Drop for Foo { impl Drop for Foo {

View file

@ -1,4 +1,7 @@
// run-rustfix // run-rustfix
#![allow(drop_ref)]
struct Foo; struct Foo;
impl Drop for Foo { impl Drop for Foo {

View file

@ -1,5 +1,5 @@
error[E0040]: explicit use of destructor method error[E0040]: explicit use of destructor method
--> $DIR/illegal-ufcs-drop.rs:9:5 --> $DIR/illegal-ufcs-drop.rs:12:5
| |
LL | Drop::drop(&mut Foo) LL | Drop::drop(&mut Foo)
| ^^^^^^^^^^ | ^^^^^^^^^^

View file

@ -1,7 +1,7 @@
#![warn(unused)] #![warn(unused)]
#![deny(unused_variables)] #![deny(unused_variables)]
#![deny(unused_assignments)] #![deny(unused_assignments)]
#![allow(dead_code, non_camel_case_types, trivial_numeric_casts)] #![allow(dead_code, non_camel_case_types, trivial_numeric_casts, drop_copy)]
use std::ops::AddAssign; use std::ops::AddAssign;

View file

@ -4,6 +4,7 @@
#![allow(unused_assignments)] #![allow(unused_assignments)]
#![allow(unused_variables)] #![allow(unused_variables)]
#![allow(stable_features)] #![allow(stable_features)]
#![allow(drop_copy)]
// Test parsing binary operators after macro invocations. // Test parsing binary operators after macro invocations.

View file

@ -3,6 +3,7 @@
// check-pass // check-pass
#![feature(never_type)] #![feature(never_type)]
#![allow(drop_copy)]
#![warn(unused)] #![warn(unused)]
fn main() { fn main() {

View file

@ -1,5 +1,5 @@
warning: unreachable statement warning: unreachable statement
--> $DIR/never-assign-dead-code.rs:10:5 --> $DIR/never-assign-dead-code.rs:11:5
| |
LL | let x: ! = panic!("aah"); LL | let x: ! = panic!("aah");
| ------------- any code following this expression is unreachable | ------------- any code following this expression is unreachable
@ -7,14 +7,14 @@ LL | drop(x);
| ^^^^^^^^ unreachable statement | ^^^^^^^^ unreachable statement
| |
note: the lint level is defined here note: the lint level is defined here
--> $DIR/never-assign-dead-code.rs:6:9 --> $DIR/never-assign-dead-code.rs:7:9
| |
LL | #![warn(unused)] LL | #![warn(unused)]
| ^^^^^^ | ^^^^^^
= note: `#[warn(unreachable_code)]` implied by `#[warn(unused)]` = note: `#[warn(unreachable_code)]` implied by `#[warn(unused)]`
warning: unreachable call warning: unreachable call
--> $DIR/never-assign-dead-code.rs:10:5 --> $DIR/never-assign-dead-code.rs:11:5
| |
LL | drop(x); LL | drop(x);
| ^^^^ - any code following this expression is unreachable | ^^^^ - any code following this expression is unreachable
@ -22,7 +22,7 @@ LL | drop(x);
| unreachable call | unreachable call
warning: unused variable: `x` warning: unused variable: `x`
--> $DIR/never-assign-dead-code.rs:9:9 --> $DIR/never-assign-dead-code.rs:10:9
| |
LL | let x: ! = panic!("aah"); LL | let x: ! = panic!("aah");
| ^ help: if this is intentional, prefix it with an underscore: `_x` | ^ help: if this is intentional, prefix it with an underscore: `_x`

View file

@ -5,6 +5,8 @@
// check-pass // check-pass
// compile-flags:-Zno-leak-check // compile-flags:-Zno-leak-check
#![allow(drop_copy)]
fn make_it() -> for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 { fn make_it() -> for<'a, 'b> fn(&'a u32, &'b u32) -> &'a u32 {
panic!() panic!()
} }

View file

@ -3,6 +3,8 @@
// //
// check-pass // check-pass
#![allow(drop_ref)]
trait MyTrait<'a> { trait MyTrait<'a> {
type Output; type Output;
} }

View file

@ -3,6 +3,8 @@
// check-pass // check-pass
#![allow(irrefutable_let_patterns)] #![allow(irrefutable_let_patterns)]
#![allow(drop_copy)]
#![allow(drop_ref)]
fn main() { fn main() {
// A regression test for a mistake we made at one point: // A regression test for a mistake we made at one point:

View file

@ -2,6 +2,9 @@
// Test `@` patterns combined with `box` patterns. // Test `@` patterns combined with `box` patterns.
#![allow(drop_ref)]
#![allow(drop_copy)]
#![feature(box_patterns)] #![feature(box_patterns)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]

View file

@ -2,6 +2,8 @@
// Test `Copy` bindings in the rhs of `@` patterns. // Test `Copy` bindings in the rhs of `@` patterns.
#![allow(drop_copy)]
#[derive(Copy, Clone)] #[derive(Copy, Clone)]
struct C; struct C;

View file

@ -1,5 +1,7 @@
// check-pass // check-pass
#![allow(drop_ref)]
fn main() {} fn main() {}
struct U; struct U;

View file

@ -1,5 +1,7 @@
// check-pass // check-pass
#![allow(drop_ref)]
fn main() { fn main() {
struct U; struct U;
fn accept_fn_once(_: impl FnOnce()) {} fn accept_fn_once(_: impl FnOnce()) {}

View file

@ -3,6 +3,8 @@
// build-pass // build-pass
// ignore-pass // ignore-pass
#![allow(drop_copy)]
async fn wait() {} async fn wait() {}
pub async fn test(arg: [u8; 8192]) { pub async fn test(arg: [u8; 8192]) {

View file

@ -1,4 +1,4 @@
print-type-size type: `[async fn body@$DIR/async.rs:8:36: 11:2]`: 16386 bytes, alignment: 1 bytes print-type-size type: `[async fn body@$DIR/async.rs:10:36: 13:2]`: 16386 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 8192 bytes print-type-size variant `Unresumed`: 8192 bytes
print-type-size upvar `.arg`: 8192 bytes print-type-size upvar `.arg`: 8192 bytes
@ -16,14 +16,14 @@ print-type-size type: `std::mem::MaybeUninit<[u8; 8192]>`: 8192 bytes, alignment
print-type-size variant `MaybeUninit`: 8192 bytes print-type-size variant `MaybeUninit`: 8192 bytes
print-type-size field `.uninit`: 0 bytes print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 8192 bytes print-type-size field `.value`: 8192 bytes
print-type-size type: `[async fn body@$DIR/async.rs:6:17: 6:19]`: 1 bytes, alignment: 1 bytes print-type-size type: `[async fn body@$DIR/async.rs:8:17: 8:19]`: 1 bytes, alignment: 1 bytes
print-type-size discriminant: 1 bytes print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Returned`: 0 bytes print-type-size variant `Returned`: 0 bytes
print-type-size variant `Panicked`: 0 bytes print-type-size variant `Panicked`: 0 bytes
print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes print-type-size type: `std::mem::ManuallyDrop<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
print-type-size field `.value`: 1 bytes print-type-size field `.value`: 1 bytes
print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:6:17: 6:19]>`: 1 bytes, alignment: 1 bytes print-type-size type: `std::mem::MaybeUninit<[async fn body@$DIR/async.rs:8:17: 8:19]>`: 1 bytes, alignment: 1 bytes
print-type-size variant `MaybeUninit`: 1 bytes print-type-size variant `MaybeUninit`: 1 bytes
print-type-size field `.uninit`: 0 bytes print-type-size field `.uninit`: 0 bytes
print-type-size field `.value`: 1 bytes print-type-size field `.value`: 1 bytes

View file

@ -6,6 +6,7 @@
// Avoid emitting panic handlers, like the rest of these tests... // Avoid emitting panic handlers, like the rest of these tests...
#![feature(generators)] #![feature(generators)]
#![allow(drop_copy)]
pub fn foo() { pub fn foo() {
let a = || { let a = || {

View file

@ -1,4 +1,4 @@
print-type-size type: `[generator@$DIR/generator_discr_placement.rs:11:13: 11:15]`: 8 bytes, alignment: 4 bytes print-type-size type: `[generator@$DIR/generator_discr_placement.rs:12:13: 12:15]`: 8 bytes, alignment: 4 bytes
print-type-size discriminant: 1 bytes print-type-size discriminant: 1 bytes
print-type-size variant `Unresumed`: 0 bytes print-type-size variant `Unresumed`: 0 bytes
print-type-size variant `Suspend0`: 7 bytes print-type-size variant `Suspend0`: 7 bytes

View file

@ -55,11 +55,11 @@ where
} }
pub fn x<T: Copy>(a: Array<T>) { pub fn x<T: Copy>(a: Array<T>) {
// drop just avoids a must_use warning // _ just avoids a must_use warning
drop((0..1).filter(|_| true)); let _ = (0..1).filter(|_| true);
let y = a.index_axis(); let y = a.index_axis();
a.axis_iter().for_each(|_| { a.axis_iter().for_each(|_| {
drop(y); let _ = y;
}); });
} }

View file

@ -3,6 +3,8 @@
// check-pass // check-pass
#![allow(drop_copy)]
use std::marker::PhantomData; use std::marker::PhantomData;
fn apply<T, F: FnOnce(T)>(_: T, _: F) {} fn apply<T, F: FnOnce(T)>(_: T, _: F) {}

View file

@ -3,6 +3,8 @@
// check-pass // check-pass
#![allow(drop_ref)]
// aux-build:monovariants.rs // aux-build:monovariants.rs
extern crate monovariants; extern crate monovariants;

View file

@ -4,6 +4,8 @@
// Tests ensuring that `dbg!(expr)` has the expected run-time behavior. // Tests ensuring that `dbg!(expr)` has the expected run-time behavior.
// as well as some compile time properties we expect. // as well as some compile time properties we expect.
#![allow(drop_copy)]
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
struct Unit; struct Unit;

View file

@ -1,28 +1,28 @@
[$DIR/dbg-macro-expected-behavior.rs:20] Unit = Unit [$DIR/dbg-macro-expected-behavior.rs:22] Unit = Unit
[$DIR/dbg-macro-expected-behavior.rs:21] a = Unit [$DIR/dbg-macro-expected-behavior.rs:23] a = Unit
[$DIR/dbg-macro-expected-behavior.rs:27] Point { x: 42, y: 24 } = Point { [$DIR/dbg-macro-expected-behavior.rs:29] Point { x: 42, y: 24 } = Point {
x: 42, x: 42,
y: 24, y: 24,
} }
[$DIR/dbg-macro-expected-behavior.rs:28] b = Point { [$DIR/dbg-macro-expected-behavior.rs:30] b = Point {
x: 42, x: 42,
y: 24, y: 24,
} }
[$DIR/dbg-macro-expected-behavior.rs:36] [$DIR/dbg-macro-expected-behavior.rs:38]
[$DIR/dbg-macro-expected-behavior.rs:40] &a = NoCopy( [$DIR/dbg-macro-expected-behavior.rs:42] &a = NoCopy(
1337, 1337,
) )
[$DIR/dbg-macro-expected-behavior.rs:40] dbg!(& a) = NoCopy( [$DIR/dbg-macro-expected-behavior.rs:42] dbg!(& a) = NoCopy(
1337, 1337,
) )
[$DIR/dbg-macro-expected-behavior.rs:45] f(&42) = 42 [$DIR/dbg-macro-expected-behavior.rs:47] f(&42) = 42
before before
[$DIR/dbg-macro-expected-behavior.rs:50] { foo += 1; eprintln!("before"); 7331 } = 7331 [$DIR/dbg-macro-expected-behavior.rs:52] { foo += 1; eprintln!("before"); 7331 } = 7331
[$DIR/dbg-macro-expected-behavior.rs:58] ("Yeah",) = ( [$DIR/dbg-macro-expected-behavior.rs:60] ("Yeah",) = (
"Yeah", "Yeah",
) )
[$DIR/dbg-macro-expected-behavior.rs:61] 1 = 1 [$DIR/dbg-macro-expected-behavior.rs:63] 1 = 1
[$DIR/dbg-macro-expected-behavior.rs:61] 2 = 2 [$DIR/dbg-macro-expected-behavior.rs:63] 2 = 2
[$DIR/dbg-macro-expected-behavior.rs:65] 1u8 = 1 [$DIR/dbg-macro-expected-behavior.rs:67] 1u8 = 1
[$DIR/dbg-macro-expected-behavior.rs:65] 2u32 = 2 [$DIR/dbg-macro-expected-behavior.rs:67] 2u32 = 2
[$DIR/dbg-macro-expected-behavior.rs:65] "Yeah" = "Yeah" [$DIR/dbg-macro-expected-behavior.rs:67] "Yeah" = "Yeah"

View file

@ -5,6 +5,7 @@
// compile-flags:--extern remove_extern_crate // compile-flags:--extern remove_extern_crate
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![allow(drop_copy)]
//~ WARNING unused extern crate //~ WARNING unused extern crate
// Shouldn't suggest changing to `use`, as `another_name` // Shouldn't suggest changing to `use`, as `another_name`

View file

@ -5,6 +5,7 @@
// compile-flags:--extern remove_extern_crate // compile-flags:--extern remove_extern_crate
#![warn(rust_2018_idioms)] #![warn(rust_2018_idioms)]
#![allow(drop_copy)]
extern crate core; //~ WARNING unused extern crate extern crate core; //~ WARNING unused extern crate
// Shouldn't suggest changing to `use`, as `another_name` // Shouldn't suggest changing to `use`, as `another_name`

View file

@ -1,5 +1,5 @@
warning: unused extern crate warning: unused extern crate
--> $DIR/remove-extern-crate.rs:9:1 --> $DIR/remove-extern-crate.rs:10:1
| |
LL | extern crate core; LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ help: remove it | ^^^^^^^^^^^^^^^^^^ help: remove it
@ -12,7 +12,7 @@ LL | #![warn(rust_2018_idioms)]
= note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]` = note: `#[warn(unused_extern_crates)]` implied by `#[warn(rust_2018_idioms)]`
warning: `extern crate` is not idiomatic in the new edition warning: `extern crate` is not idiomatic in the new edition
--> $DIR/remove-extern-crate.rs:33:5 --> $DIR/remove-extern-crate.rs:34:5
| |
LL | extern crate core; LL | extern crate core;
| ^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^
@ -23,7 +23,7 @@ LL | use core;
| ~~~ | ~~~
warning: `extern crate` is not idiomatic in the new edition warning: `extern crate` is not idiomatic in the new edition
--> $DIR/remove-extern-crate.rs:43:5 --> $DIR/remove-extern-crate.rs:44:5
| |
LL | pub extern crate core; LL | pub extern crate core;
| ^^^^^^^^^^^^^^^^^^^^^^ | ^^^^^^^^^^^^^^^^^^^^^^

View file

@ -12,6 +12,8 @@
// //
// In regular builds, the bad cast was UB, like "Invalid LLVMRustVisibility value!" // In regular builds, the bad cast was UB, like "Invalid LLVMRustVisibility value!"
#![allow(drop_copy)]
pub mod before { pub mod before {
#[no_mangle] #[no_mangle]
pub static GLOBAL1: [u8; 1] = [1]; pub static GLOBAL1: [u8; 1] = [1];

View file

@ -1,5 +1,8 @@
// run-pass // run-pass
#![allow(dead_code)] #![allow(dead_code)]
#![allow(drop_copy)]
// "guessing" in trait selection can affect `copy_or_move`. Check that this // "guessing" in trait selection can affect `copy_or_move`. Check that this
// is correctly handled. I am not sure what is the "correct" behaviour, // is correctly handled. I am not sure what is the "correct" behaviour,
// but we should at least not ICE. // but we should at least not ICE.

View file

@ -6,6 +6,8 @@
// check-pass // check-pass
#![allow(drop_copy)]
trait A { trait A {
type B; type B;
} }

View file

@ -1,5 +1,5 @@
error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely error[E0277]: `impl Future<Output = ()>` cannot be sent between threads safely
--> $DIR/auto-with-drop_tracking_mir.rs:24:13 --> $DIR/auto-with-drop_tracking_mir.rs:25:13
| |
LL | is_send(foo()); LL | is_send(foo());
| ------- ^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely | ------- ^^^^^ `impl Future<Output = ()>` cannot be sent between threads safely
@ -8,7 +8,7 @@ LL | is_send(foo());
| |
= help: the trait `Send` is not implemented for `impl Future<Output = ()>` = help: the trait `Send` is not implemented for `impl Future<Output = ()>`
note: required by a bound in `is_send` note: required by a bound in `is_send`
--> $DIR/auto-with-drop_tracking_mir.rs:23:24 --> $DIR/auto-with-drop_tracking_mir.rs:24:24
| |
LL | fn is_send(_: impl Send) {} LL | fn is_send(_: impl Send) {}
| ^^^^ required by this bound in `is_send` | ^^^^ required by this bound in `is_send`

View file

@ -14,6 +14,7 @@ async fn foo() {
#[cfg(fail)] #[cfg(fail)]
let x = &NotSync; let x = &NotSync;
bar().await; bar().await;
#[allow(drop_ref)]
drop(x); drop(x);
} }

View file

@ -18,5 +18,5 @@ fn main() {
let w = Wrapper(x); let w = Wrapper(x);
needs_foo(w); needs_foo(w);
x = 1; x = 1;
drop(x); let _ = x;
} }

View file

@ -1,6 +1,8 @@
// check-pass // check-pass
// Check tautalogically false `Copy` bounds // Check tautalogically false `Copy` bounds
#![feature(trivial_bounds)] #![feature(trivial_bounds)]
#![allow(drop_ref, drop_copy)]
fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds fn copy_string(t: String) -> String where String: Copy { //~ WARNING trivial_bounds
is_copy(&t); is_copy(&t);

View file

@ -1,5 +1,5 @@
warning: trait bound String: Copy does not depend on any type or lifetime parameters warning: trait bound String: Copy does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent-copy.rs:5:51 --> $DIR/trivial-bounds-inconsistent-copy.rs:7:51
| |
LL | fn copy_string(t: String) -> String where String: Copy { LL | fn copy_string(t: String) -> String where String: Copy {
| ^^^^ | ^^^^
@ -7,19 +7,19 @@ LL | fn copy_string(t: String) -> String where String: Copy {
= note: `#[warn(trivial_bounds)]` on by default = note: `#[warn(trivial_bounds)]` on by default
warning: trait bound String: Copy does not depend on any type or lifetime parameters warning: trait bound String: Copy does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent-copy.rs:12:56 --> $DIR/trivial-bounds-inconsistent-copy.rs:14:56
| |
LL | fn copy_out_string(t: &String) -> String where String: Copy { LL | fn copy_out_string(t: &String) -> String where String: Copy {
| ^^^^ | ^^^^
warning: trait bound String: Copy does not depend on any type or lifetime parameters warning: trait bound String: Copy does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent-copy.rs:16:55 --> $DIR/trivial-bounds-inconsistent-copy.rs:18:55
| |
LL | fn copy_string_with_param<T>(x: String) where String: Copy { LL | fn copy_string_with_param<T>(x: String) where String: Copy {
| ^^^^ | ^^^^
warning: trait bound for<'b> &'b mut i32: Copy does not depend on any type or lifetime parameters warning: trait bound for<'b> &'b mut i32: Copy does not depend on any type or lifetime parameters
--> $DIR/trivial-bounds-inconsistent-copy.rs:22:76 --> $DIR/trivial-bounds-inconsistent-copy.rs:24:76
| |
LL | fn copy_mut<'a>(t: &&'a mut i32) -> &'a mut i32 where for<'b> &'b mut i32: Copy { LL | fn copy_mut<'a>(t: &&'a mut i32) -> &'a mut i32 where for<'b> &'b mut i32: Copy {
| ^^^^ | ^^^^