about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-01-19 12:04:22 +0000
committerbors <bors@rust-lang.org>2021-01-19 12:04:22 +0000
commitf09fb488f70c5965ec4f64453a6e681fbfcff56c (patch)
treed31d1870ef32e0e3ee3ccb777ba9aa956a313591 /src/test
parent47121d6d884bb60dad47e345f52f2ad6aadecaaf (diff)
parentdcb74796c0a644bc78fdadbfb2b8df0d9e9d9359 (diff)
downloadrust-f09fb488f70c5965ec4f64453a6e681fbfcff56c.tar.gz
rust-f09fb488f70c5965ec4f64453a6e681fbfcff56c.zip
Auto merge of #81186 - GuillaumeGomez:rollup-y2d04g9, r=GuillaumeGomez
Rollup of 8 pull requests

Successful merges:

 - #80382 (Improve search result tab handling)
 - #81112 (Remove unused alloc::std::ops re-export.)
 - #81115 (BTreeMap: prefer bulk_steal functions over specialized ones)
 - #81147 (Fix structured suggestion for explicit `drop` call)
 - #81161 (Remove inline script tags)
 - #81164 (Fix typo in simplify.rs)
 - #81166 (remove some outdated comments regarding  debug assertions)
 - #81168 (Fixes #81109 - Typo in pointer::wrapping_sub)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'src/test')
-rw-r--r--src/test/ui/error-codes/E0040.fixed18
-rw-r--r--src/test/ui/error-codes/E0040.rs3
-rw-r--r--src/test/ui/error-codes/E0040.stderr10
-rw-r--r--src/test/ui/explicit/explicit-call-to-dtor.fixed16
-rw-r--r--src/test/ui/explicit/explicit-call-to-dtor.rs2
-rw-r--r--src/test/ui/explicit/explicit-call-to-dtor.stderr10
-rw-r--r--src/test/ui/explicit/explicit-call-to-supertrait-dtor.fixed26
-rw-r--r--src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs5
-rw-r--r--src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr10
-rw-r--r--src/test/ui/illegal-ufcs-drop.fixed10
-rw-r--r--src/test/ui/illegal-ufcs-drop.rs1
-rw-r--r--src/test/ui/illegal-ufcs-drop.stderr2
12 files changed, 96 insertions, 17 deletions
diff --git a/src/test/ui/error-codes/E0040.fixed b/src/test/ui/error-codes/E0040.fixed
new file mode 100644
index 00000000000..139dc8f9496
--- /dev/null
+++ b/src/test/ui/error-codes/E0040.fixed
@@ -0,0 +1,18 @@
+// run-rustfix
+struct Foo {
+    x: i32,
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("kaboom");
+    }
+}
+
+fn main() {
+    let mut x = Foo { x: -7 };
+    x.x = 0;
+    println!("{}", x.x);
+    drop(x);
+    //~^ ERROR E0040
+}
diff --git a/src/test/ui/error-codes/E0040.rs b/src/test/ui/error-codes/E0040.rs
index 113efae82c5..9ffc42d0c78 100644
--- a/src/test/ui/error-codes/E0040.rs
+++ b/src/test/ui/error-codes/E0040.rs
@@ -1,3 +1,4 @@
+// run-rustfix
 struct Foo {
     x: i32,
 }
@@ -10,6 +11,8 @@ impl Drop for Foo {
 
 fn main() {
     let mut x = Foo { x: -7 };
+    x.x = 0;
+    println!("{}", x.x);
     x.drop();
     //~^ ERROR E0040
 }
diff --git a/src/test/ui/error-codes/E0040.stderr b/src/test/ui/error-codes/E0040.stderr
index 69cf28b2970..9fcda1a9385 100644
--- a/src/test/ui/error-codes/E0040.stderr
+++ b/src/test/ui/error-codes/E0040.stderr
@@ -1,11 +1,11 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/E0040.rs:13:7
+  --> $DIR/E0040.rs:16:7
    |
 LL |     x.drop();
-   |       ^^^^
-   |       |
-   |       explicit destructor calls not allowed
-   |       help: consider using `drop` function: `drop(x)`
+   |     --^^^^--
+   |     | |
+   |     | explicit destructor calls not allowed
+   |     help: consider using `drop` function: `drop(x)`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/explicit/explicit-call-to-dtor.fixed b/src/test/ui/explicit/explicit-call-to-dtor.fixed
new file mode 100644
index 00000000000..91a4ca608da
--- /dev/null
+++ b/src/test/ui/explicit/explicit-call-to-dtor.fixed
@@ -0,0 +1,16 @@
+// run-rustfix
+struct Foo {
+    x: isize
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("kaboom");
+    }
+}
+
+fn main() {
+    let x = Foo { x: 3 };
+    println!("{}", x.x);
+    drop(x);   //~ ERROR explicit use of destructor method
+}
diff --git a/src/test/ui/explicit/explicit-call-to-dtor.rs b/src/test/ui/explicit/explicit-call-to-dtor.rs
index a6f9acc37a1..0656871eb1b 100644
--- a/src/test/ui/explicit/explicit-call-to-dtor.rs
+++ b/src/test/ui/explicit/explicit-call-to-dtor.rs
@@ -1,3 +1,4 @@
+// run-rustfix
 struct Foo {
     x: isize
 }
@@ -10,5 +11,6 @@ impl Drop for Foo {
 
 fn main() {
     let x = Foo { x: 3 };
+    println!("{}", x.x);
     x.drop();   //~ ERROR explicit use of destructor method
 }
diff --git a/src/test/ui/explicit/explicit-call-to-dtor.stderr b/src/test/ui/explicit/explicit-call-to-dtor.stderr
index 5ebe4ee4b90..f3c9bf6cccd 100644
--- a/src/test/ui/explicit/explicit-call-to-dtor.stderr
+++ b/src/test/ui/explicit/explicit-call-to-dtor.stderr
@@ -1,11 +1,11 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/explicit-call-to-dtor.rs:13:7
+  --> $DIR/explicit-call-to-dtor.rs:15:7
    |
 LL |     x.drop();
-   |       ^^^^
-   |       |
-   |       explicit destructor calls not allowed
-   |       help: consider using `drop` function: `drop(x)`
+   |     --^^^^--
+   |     | |
+   |     | explicit destructor calls not allowed
+   |     help: consider using `drop` function: `drop(x)`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.fixed b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.fixed
new file mode 100644
index 00000000000..47c4c9f67b6
--- /dev/null
+++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.fixed
@@ -0,0 +1,26 @@
+// run-rustfix
+struct Foo {
+    x: isize
+}
+
+#[allow(drop_bounds)]
+trait Bar: Drop {
+    fn blah(&self);
+}
+
+impl Drop for Foo {
+    fn drop(&mut self) {
+        println!("kaboom");
+    }
+}
+
+impl Bar for Foo {
+    fn blah(&self) {
+        drop(self);    //~ ERROR explicit use of destructor method
+    }
+}
+
+fn main() {
+    let x = Foo { x: 3 };
+    println!("{}", x.x);
+}
diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs
index ff56b9a8ae4..c698de50c75 100644
--- a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs
+++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.rs
@@ -1,8 +1,10 @@
+// run-rustfix
 struct Foo {
     x: isize
 }
 
-trait Bar : Drop {
+#[allow(drop_bounds)]
+trait Bar: Drop {
     fn blah(&self);
 }
 
@@ -20,4 +22,5 @@ impl Bar for Foo {
 
 fn main() {
     let x = Foo { x: 3 };
+    println!("{}", x.x);
 }
diff --git a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr
index cd3fb3119a5..7f5106eb57e 100644
--- a/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr
+++ b/src/test/ui/explicit/explicit-call-to-supertrait-dtor.stderr
@@ -1,11 +1,11 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/explicit-call-to-supertrait-dtor.rs:17:14
+  --> $DIR/explicit-call-to-supertrait-dtor.rs:19:14
    |
 LL |         self.drop();
-   |              ^^^^
-   |              |
-   |              explicit destructor calls not allowed
-   |              help: consider using `drop` function: `drop(self)`
+   |         -----^^^^--
+   |         |    |
+   |         |    explicit destructor calls not allowed
+   |         help: consider using `drop` function: `drop(self)`
 
 error: aborting due to previous error
 
diff --git a/src/test/ui/illegal-ufcs-drop.fixed b/src/test/ui/illegal-ufcs-drop.fixed
new file mode 100644
index 00000000000..d73b391be06
--- /dev/null
+++ b/src/test/ui/illegal-ufcs-drop.fixed
@@ -0,0 +1,10 @@
+// run-rustfix
+struct Foo;
+
+impl Drop for Foo {
+    fn drop(&mut self) {}
+}
+
+fn main() {
+    drop(&mut Foo) //~ ERROR explicit use of destructor method
+}
diff --git a/src/test/ui/illegal-ufcs-drop.rs b/src/test/ui/illegal-ufcs-drop.rs
index 5c072663eda..11411f55494 100644
--- a/src/test/ui/illegal-ufcs-drop.rs
+++ b/src/test/ui/illegal-ufcs-drop.rs
@@ -1,3 +1,4 @@
+// run-rustfix
 struct Foo;
 
 impl Drop for Foo {
diff --git a/src/test/ui/illegal-ufcs-drop.stderr b/src/test/ui/illegal-ufcs-drop.stderr
index 57c99739afd..91f47d5e456 100644
--- a/src/test/ui/illegal-ufcs-drop.stderr
+++ b/src/test/ui/illegal-ufcs-drop.stderr
@@ -1,5 +1,5 @@
 error[E0040]: explicit use of destructor method
-  --> $DIR/illegal-ufcs-drop.rs:8:5
+  --> $DIR/illegal-ufcs-drop.rs:9:5
    |
 LL |     Drop::drop(&mut Foo)
    |     ^^^^^^^^^^