diff options
| author | Matthias Krüger <476013+matthiaskrgr@users.noreply.github.com> | 2025-04-04 08:02:09 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-04 08:02:09 +0200 |
| commit | 0a9eae161b1aa6097a0f02b6ad8dea48ae534e30 (patch) | |
| tree | 8264a55affa9c6b2ac95a3df54f8200bd11051f6 /tests | |
| parent | 0c4ac89760894dea1db9e76c26abfd1c68b57e27 (diff) | |
| parent | a14e8f687c2f274548a20e01231b706d3c88790c (diff) | |
| download | rust-0a9eae161b1aa6097a0f02b6ad8dea48ae534e30.tar.gz rust-0a9eae161b1aa6097a0f02b6ad8dea48ae534e30.zip | |
Rollup merge of #139349 - meithecatte:destructor-constness, r=compiler-errors
adt_destructor: sanity-check returned item Fixes #139278
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ui/drop/nonsense-drop-impl-issue-139278.rs | 10 | ||||
| -rw-r--r-- | tests/ui/drop/nonsense-drop-impl-issue-139278.stderr | 18 |
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/ui/drop/nonsense-drop-impl-issue-139278.rs b/tests/ui/drop/nonsense-drop-impl-issue-139278.rs new file mode 100644 index 00000000000..86f4e4d8607 --- /dev/null +++ b/tests/ui/drop/nonsense-drop-impl-issue-139278.rs @@ -0,0 +1,10 @@ +//@ check-fail +struct Foo; + +impl Drop for Foo { //~ ERROR: not all trait items implemented + const SPLOK: u32 = 0; //~ ERROR: not a member of trait +} + +const X: Foo = Foo; + +fn main() {} diff --git a/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr b/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr new file mode 100644 index 00000000000..825e883fa6d --- /dev/null +++ b/tests/ui/drop/nonsense-drop-impl-issue-139278.stderr @@ -0,0 +1,18 @@ +error[E0438]: const `SPLOK` is not a member of trait `Drop` + --> $DIR/nonsense-drop-impl-issue-139278.rs:5:5 + | +LL | const SPLOK: u32 = 0; + | ^^^^^^^^^^^^^^^^^^^^^ not a member of trait `Drop` + +error[E0046]: not all trait items implemented, missing: `drop` + --> $DIR/nonsense-drop-impl-issue-139278.rs:4:1 + | +LL | impl Drop for Foo { + | ^^^^^^^^^^^^^^^^^ missing `drop` in implementation + | + = help: implement the missing item: `fn drop(&mut self) { todo!() }` + +error: aborting due to 2 previous errors + +Some errors have detailed explanations: E0046, E0438. +For more information about an error, try `rustc --explain E0046`. |
