summaryrefslogtreecommitdiffstats
path: root/src/test/ui/traits/vtable
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /src/test/ui/traits/vtable
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/traits/vtable')
-rw-r--r--src/test/ui/traits/vtable/issue-91807.rs17
-rw-r--r--src/test/ui/traits/vtable/issue-97381.rs30
-rw-r--r--src/test/ui/traits/vtable/issue-97381.stderr15
-rw-r--r--src/test/ui/traits/vtable/vtable-diamond.rs44
-rw-r--r--src/test/ui/traits/vtable/vtable-diamond.stderr29
-rw-r--r--src/test/ui/traits/vtable/vtable-multi-level.rs143
-rw-r--r--src/test/ui/traits/vtable/vtable-multi-level.stderr203
-rw-r--r--src/test/ui/traits/vtable/vtable-multiple.rs33
-rw-r--r--src/test/ui/traits/vtable/vtable-multiple.stderr27
-rw-r--r--src/test/ui/traits/vtable/vtable-non-object-safe.rs18
-rw-r--r--src/test/ui/traits/vtable/vtable-non-object-safe.stderr16
-rw-r--r--src/test/ui/traits/vtable/vtable-vacant.rs31
-rw-r--r--src/test/ui/traits/vtable/vtable-vacant.stderr16
13 files changed, 0 insertions, 622 deletions
diff --git a/src/test/ui/traits/vtable/issue-91807.rs b/src/test/ui/traits/vtable/issue-91807.rs
deleted file mode 100644
index f435ff09d..000000000
--- a/src/test/ui/traits/vtable/issue-91807.rs
+++ /dev/null
@@ -1,17 +0,0 @@
-// check-pass
-// incremental
-
-struct Struct<T>(T);
-
-impl<T> std::ops::Deref for Struct<T> {
- type Target = dyn Fn(T);
- fn deref(&self) -> &Self::Target {
- unimplemented!()
- }
-}
-
-fn main() {
- let f = Struct(Default::default());
- f(0);
- f(0);
-}
diff --git a/src/test/ui/traits/vtable/issue-97381.rs b/src/test/ui/traits/vtable/issue-97381.rs
deleted file mode 100644
index 393cf91ef..000000000
--- a/src/test/ui/traits/vtable/issue-97381.rs
+++ /dev/null
@@ -1,30 +0,0 @@
-use std::ops::Deref;
-trait MyTrait: Deref<Target = u32> {}
-struct MyStruct(u32);
-impl MyTrait for MyStruct {}
-impl Deref for MyStruct {
- type Target = u32;
-
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
-fn get_concrete_value(i: u32) -> MyStruct {
- MyStruct(i)
-}
-fn get_boxed_value(i: u32) -> Box<dyn MyTrait> {
- Box::new(get_concrete_value(i))
-}
-fn main() {
- let v = [1, 2, 3]
- .iter()
- .map(|i| get_boxed_value(*i))
- .collect::<Vec<_>>();
-
- let el = &v[0];
-
- for _ in v {
- //~^ ERROR cannot move out of `v` because it is borrowed
- println!("{}", ***el > 0);
- }
-}
diff --git a/src/test/ui/traits/vtable/issue-97381.stderr b/src/test/ui/traits/vtable/issue-97381.stderr
deleted file mode 100644
index c4f8294e2..000000000
--- a/src/test/ui/traits/vtable/issue-97381.stderr
+++ /dev/null
@@ -1,15 +0,0 @@
-error[E0505]: cannot move out of `v` because it is borrowed
- --> $DIR/issue-97381.rs:26:14
- |
-LL | let el = &v[0];
- | - borrow of `v` occurs here
-LL |
-LL | for _ in v {
- | ^ move out of `v` occurs here
-LL |
-LL | println!("{}", ***el > 0);
- | ---- borrow later used here
-
-error: aborting due to previous error
-
-For more information about this error, try `rustc --explain E0505`.
diff --git a/src/test/ui/traits/vtable/vtable-diamond.rs b/src/test/ui/traits/vtable/vtable-diamond.rs
deleted file mode 100644
index dc3c17ac3..000000000
--- a/src/test/ui/traits/vtable/vtable-diamond.rs
+++ /dev/null
@@ -1,44 +0,0 @@
-// build-fail
-#![feature(rustc_attrs)]
-
-#[rustc_dump_vtable]
-trait A {
- fn foo_a(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait B: A {
- fn foo_b(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait C: A {
- //~^ error vtable
- fn foo_c(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait D: B + C {
- //~^ error vtable
- fn foo_d(&self) {}
-}
-
-struct S;
-
-impl A for S {}
-impl B for S {}
-impl C for S {}
-impl D for S {}
-
-fn foo(d: &dyn D) {
- d.foo_d();
-}
-
-fn bar(d: &dyn C) {
- d.foo_c();
-}
-
-fn main() {
- foo(&S);
- bar(&S);
-}
diff --git a/src/test/ui/traits/vtable/vtable-diamond.stderr b/src/test/ui/traits/vtable/vtable-diamond.stderr
deleted file mode 100644
index f3718c5d8..000000000
--- a/src/test/ui/traits/vtable/vtable-diamond.stderr
+++ /dev/null
@@ -1,29 +0,0 @@
-error: vtable entries for `<S as D>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a),
- Method(<S as B>::foo_b),
- Method(<S as C>::foo_c),
- TraitVPtr(<S as C>),
- Method(<S as D>::foo_d),
- ]
- --> $DIR/vtable-diamond.rs:21:1
- |
-LL | trait D: B + C {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as C>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a),
- Method(<S as C>::foo_c),
- ]
- --> $DIR/vtable-diamond.rs:15:1
- |
-LL | trait C: A {
- | ^^^^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/traits/vtable/vtable-multi-level.rs b/src/test/ui/traits/vtable/vtable-multi-level.rs
deleted file mode 100644
index ebd55bcf3..000000000
--- a/src/test/ui/traits/vtable/vtable-multi-level.rs
+++ /dev/null
@@ -1,143 +0,0 @@
-// build-fail
-#![feature(rustc_attrs)]
-
-// O --> G --> C --> A
-// \ \ \-> B
-// | |-> F --> D
-// | \-> E
-// |-> N --> J --> H
-// \ \-> I
-// |-> M --> K
-// \-> L
-
-#[rustc_dump_vtable]
-trait A {
- //~^ error vtable
- fn foo_a(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait B {
- //~^ error vtable
- fn foo_b(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait C: A + B {
- //~^ error vtable
- fn foo_c(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait D {
- //~^ error vtable
- fn foo_d(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait E {
- //~^ error vtable
- fn foo_e(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait F: D + E {
- //~^ error vtable
- fn foo_f(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait G: C + F {
- fn foo_g(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait H {
- //~^ error vtable
- fn foo_h(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait I {
- //~^ error vtable
- fn foo_i(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait J: H + I {
- //~^ error vtable
- fn foo_j(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait K {
- //~^ error vtable
- fn foo_k(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait L {
- //~^ error vtable
- fn foo_l(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait M: K + L {
- //~^ error vtable
- fn foo_m(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait N: J + M {
- //~^ error vtable
- fn foo_n(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait O: G + N {
- //~^ error vtable
- fn foo_o(&self) {}
-}
-
-struct S;
-
-impl A for S {}
-impl B for S {}
-impl C for S {}
-impl D for S {}
-impl E for S {}
-impl F for S {}
-impl G for S {}
-impl H for S {}
-impl I for S {}
-impl J for S {}
-impl K for S {}
-impl L for S {}
-impl M for S {}
-impl N for S {}
-impl O for S {}
-
-macro_rules! monomorphize_vtable {
- ($trait:ident) => {{
- fn foo(_ : &dyn $trait) {}
- foo(&S);
- }}
-}
-
-fn main() {
- monomorphize_vtable!(O);
-
- monomorphize_vtable!(A);
- monomorphize_vtable!(B);
- monomorphize_vtable!(C);
- monomorphize_vtable!(D);
- monomorphize_vtable!(E);
- monomorphize_vtable!(F);
- monomorphize_vtable!(H);
- monomorphize_vtable!(I);
- monomorphize_vtable!(J);
- monomorphize_vtable!(K);
- monomorphize_vtable!(L);
- monomorphize_vtable!(M);
- monomorphize_vtable!(N);
-}
diff --git a/src/test/ui/traits/vtable/vtable-multi-level.stderr b/src/test/ui/traits/vtable/vtable-multi-level.stderr
deleted file mode 100644
index c4389e23f..000000000
--- a/src/test/ui/traits/vtable/vtable-multi-level.stderr
+++ /dev/null
@@ -1,203 +0,0 @@
-error: vtable entries for `<S as O>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a),
- Method(<S as B>::foo_b),
- TraitVPtr(<S as B>),
- Method(<S as C>::foo_c),
- Method(<S as D>::foo_d),
- TraitVPtr(<S as D>),
- Method(<S as E>::foo_e),
- TraitVPtr(<S as E>),
- Method(<S as F>::foo_f),
- TraitVPtr(<S as F>),
- Method(<S as G>::foo_g),
- Method(<S as H>::foo_h),
- TraitVPtr(<S as H>),
- Method(<S as I>::foo_i),
- TraitVPtr(<S as I>),
- Method(<S as J>::foo_j),
- TraitVPtr(<S as J>),
- Method(<S as K>::foo_k),
- TraitVPtr(<S as K>),
- Method(<S as L>::foo_l),
- TraitVPtr(<S as L>),
- Method(<S as M>::foo_m),
- TraitVPtr(<S as M>),
- Method(<S as N>::foo_n),
- TraitVPtr(<S as N>),
- Method(<S as O>::foo_o),
- ]
- --> $DIR/vtable-multi-level.rs:97:1
- |
-LL | trait O: G + N {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as A>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a),
- ]
- --> $DIR/vtable-multi-level.rs:14:1
- |
-LL | trait A {
- | ^^^^^^^
-
-error: vtable entries for `<S as B>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as B>::foo_b),
- ]
- --> $DIR/vtable-multi-level.rs:20:1
- |
-LL | trait B {
- | ^^^^^^^
-
-error: vtable entries for `<S as C>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a),
- Method(<S as B>::foo_b),
- TraitVPtr(<S as B>),
- Method(<S as C>::foo_c),
- ]
- --> $DIR/vtable-multi-level.rs:26:1
- |
-LL | trait C: A + B {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as D>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as D>::foo_d),
- ]
- --> $DIR/vtable-multi-level.rs:32:1
- |
-LL | trait D {
- | ^^^^^^^
-
-error: vtable entries for `<S as E>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as E>::foo_e),
- ]
- --> $DIR/vtable-multi-level.rs:38:1
- |
-LL | trait E {
- | ^^^^^^^
-
-error: vtable entries for `<S as F>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as D>::foo_d),
- Method(<S as E>::foo_e),
- TraitVPtr(<S as E>),
- Method(<S as F>::foo_f),
- ]
- --> $DIR/vtable-multi-level.rs:44:1
- |
-LL | trait F: D + E {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as H>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as H>::foo_h),
- ]
- --> $DIR/vtable-multi-level.rs:55:1
- |
-LL | trait H {
- | ^^^^^^^
-
-error: vtable entries for `<S as I>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as I>::foo_i),
- ]
- --> $DIR/vtable-multi-level.rs:61:1
- |
-LL | trait I {
- | ^^^^^^^
-
-error: vtable entries for `<S as J>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as H>::foo_h),
- Method(<S as I>::foo_i),
- TraitVPtr(<S as I>),
- Method(<S as J>::foo_j),
- ]
- --> $DIR/vtable-multi-level.rs:67:1
- |
-LL | trait J: H + I {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as K>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as K>::foo_k),
- ]
- --> $DIR/vtable-multi-level.rs:73:1
- |
-LL | trait K {
- | ^^^^^^^
-
-error: vtable entries for `<S as L>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as L>::foo_l),
- ]
- --> $DIR/vtable-multi-level.rs:79:1
- |
-LL | trait L {
- | ^^^^^^^
-
-error: vtable entries for `<S as M>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as K>::foo_k),
- Method(<S as L>::foo_l),
- TraitVPtr(<S as L>),
- Method(<S as M>::foo_m),
- ]
- --> $DIR/vtable-multi-level.rs:85:1
- |
-LL | trait M: K + L {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as N>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as H>::foo_h),
- Method(<S as I>::foo_i),
- TraitVPtr(<S as I>),
- Method(<S as J>::foo_j),
- Method(<S as K>::foo_k),
- TraitVPtr(<S as K>),
- Method(<S as L>::foo_l),
- TraitVPtr(<S as L>),
- Method(<S as M>::foo_m),
- TraitVPtr(<S as M>),
- Method(<S as N>::foo_n),
- ]
- --> $DIR/vtable-multi-level.rs:91:1
- |
-LL | trait N: J + M {
- | ^^^^^^^^^^^^^^
-
-error: aborting due to 14 previous errors
-
diff --git a/src/test/ui/traits/vtable/vtable-multiple.rs b/src/test/ui/traits/vtable/vtable-multiple.rs
deleted file mode 100644
index 7a0111c5e..000000000
--- a/src/test/ui/traits/vtable/vtable-multiple.rs
+++ /dev/null
@@ -1,33 +0,0 @@
-// build-fail
-#![feature(rustc_attrs)]
-
-#[rustc_dump_vtable]
-trait A {
- fn foo_a(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait B {
- //~^ error vtable
- fn foo_b(&self) {}
-}
-
-#[rustc_dump_vtable]
-trait C: A + B {
- //~^ error vtable
- fn foo_c(&self) {}
-}
-
-struct S;
-
-impl A for S {}
-impl B for S {}
-impl C for S {}
-
-fn foo(c: &dyn C) {}
-fn bar(c: &dyn B) {}
-
-fn main() {
- foo(&S);
- bar(&S);
-}
diff --git a/src/test/ui/traits/vtable/vtable-multiple.stderr b/src/test/ui/traits/vtable/vtable-multiple.stderr
deleted file mode 100644
index 0dcd84433..000000000
--- a/src/test/ui/traits/vtable/vtable-multiple.stderr
+++ /dev/null
@@ -1,27 +0,0 @@
-error: vtable entries for `<S as C>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a),
- Method(<S as B>::foo_b),
- TraitVPtr(<S as B>),
- Method(<S as C>::foo_c),
- ]
- --> $DIR/vtable-multiple.rs:16:1
- |
-LL | trait C: A + B {
- | ^^^^^^^^^^^^^^
-
-error: vtable entries for `<S as B>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as B>::foo_b),
- ]
- --> $DIR/vtable-multiple.rs:10:1
- |
-LL | trait B {
- | ^^^^^^^
-
-error: aborting due to 2 previous errors
-
diff --git a/src/test/ui/traits/vtable/vtable-non-object-safe.rs b/src/test/ui/traits/vtable/vtable-non-object-safe.rs
deleted file mode 100644
index 7661bb574..000000000
--- a/src/test/ui/traits/vtable/vtable-non-object-safe.rs
+++ /dev/null
@@ -1,18 +0,0 @@
-// build-fail
-#![feature(rustc_attrs)]
-
-// Ensure that non-object-safe methods in Iterator does not generate
-// vtable entries.
-
-#[rustc_dump_vtable]
-trait A: Iterator {}
-//~^ error vtable
-
-impl<T> A for T where T: Iterator {}
-
-fn foo(_a: &mut dyn A<Item=u8>) {
-}
-
-fn main() {
- foo(&mut vec![0, 1, 2, 3].into_iter());
-}
diff --git a/src/test/ui/traits/vtable/vtable-non-object-safe.stderr b/src/test/ui/traits/vtable/vtable-non-object-safe.stderr
deleted file mode 100644
index 9345c2711..000000000
--- a/src/test/ui/traits/vtable/vtable-non-object-safe.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: vtable entries for `<std::vec::IntoIter<u8> as A>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<std::vec::IntoIter<u8> as Iterator>::next),
- Method(<std::vec::IntoIter<u8> as Iterator>::size_hint),
- Method(<std::vec::IntoIter<u8> as Iterator>::advance_by),
- Method(<std::vec::IntoIter<u8> as Iterator>::nth),
- ]
- --> $DIR/vtable-non-object-safe.rs:8:1
- |
-LL | trait A: Iterator {}
- | ^^^^^^^^^^^^^^^^^
-
-error: aborting due to previous error
-
diff --git a/src/test/ui/traits/vtable/vtable-vacant.rs b/src/test/ui/traits/vtable/vtable-vacant.rs
deleted file mode 100644
index a64796358..000000000
--- a/src/test/ui/traits/vtable/vtable-vacant.rs
+++ /dev/null
@@ -1,31 +0,0 @@
-// build-fail
-#![feature(rustc_attrs)]
-#![feature(negative_impls)]
-#![allow(where_clauses_object_safety)]
-
-// B --> A
-
-#[rustc_dump_vtable]
-trait A {
- fn foo_a1(&self) {}
- fn foo_a2(&self) where Self: Send {}
-}
-
-#[rustc_dump_vtable]
-trait B: A {
- //~^ error vtable
- fn foo_b1(&self) {}
- fn foo_b2(&self) where Self: Send {}
-}
-
-struct S;
-impl !Send for S {}
-
-impl A for S {}
-impl B for S {}
-
-fn foo(_: &dyn B) {}
-
-fn main() {
- foo(&S);
-}
diff --git a/src/test/ui/traits/vtable/vtable-vacant.stderr b/src/test/ui/traits/vtable/vtable-vacant.stderr
deleted file mode 100644
index 5346a7027..000000000
--- a/src/test/ui/traits/vtable/vtable-vacant.stderr
+++ /dev/null
@@ -1,16 +0,0 @@
-error: vtable entries for `<S as B>`: [
- MetadataDropInPlace,
- MetadataSize,
- MetadataAlign,
- Method(<S as A>::foo_a1),
- Vacant,
- Method(<S as B>::foo_b1),
- Vacant,
- ]
- --> $DIR/vtable-vacant.rs:15:1
- |
-LL | trait B: A {
- | ^^^^^^^^^^
-
-error: aborting due to previous error
-