diff --git a/src/test/ui/existential_type.rs b/src/test/ui/existential_types/existential_type-pass.rs similarity index 100% rename from src/test/ui/existential_type.rs rename to src/test/ui/existential_types/existential_type-pass.rs diff --git a/src/test/ui/existential_types/issue-53678-generator-and-const-fn.rs b/src/test/ui/existential_types/issue-53678-generator-and-const-fn.rs new file mode 100644 index 0000000000000..d964f2b74ff69 --- /dev/null +++ b/src/test/ui/existential_types/issue-53678-generator-and-const-fn.rs @@ -0,0 +1,19 @@ +// check-pass + +#![feature(const_fn, generators, generator_trait, existential_type)] + +use std::ops::Generator; + +existential type GenOnce: Generator; + +const fn const_generator(yielding: Y, returning: R) -> GenOnce { + move || { + yield yielding; + + return returning; + } +} + +const FOO: GenOnce = const_generator(10, 100); + +fn main() {} diff --git a/src/test/ui/existential-type/issue-58887.rs b/src/test/ui/existential_types/issue-58887.rs similarity index 100% rename from src/test/ui/existential-type/issue-58887.rs rename to src/test/ui/existential_types/issue-58887.rs diff --git a/src/test/ui/existential-type/issue-58887.stderr b/src/test/ui/existential_types/issue-58887.stderr similarity index 100% rename from src/test/ui/existential-type/issue-58887.stderr rename to src/test/ui/existential_types/issue-58887.stderr diff --git a/src/test/ui/existential-type/issue-60371.rs b/src/test/ui/existential_types/issue-60371.rs similarity index 100% rename from src/test/ui/existential-type/issue-60371.rs rename to src/test/ui/existential_types/issue-60371.rs diff --git a/src/test/ui/existential-type/issue-60371.stderr b/src/test/ui/existential_types/issue-60371.stderr similarity index 100% rename from src/test/ui/existential-type/issue-60371.stderr rename to src/test/ui/existential_types/issue-60371.stderr diff --git a/src/test/ui/existential_types/issue-60407.rs b/src/test/ui/existential_types/issue-60407.rs new file mode 100644 index 0000000000000..52162c491b5c8 --- /dev/null +++ b/src/test/ui/existential_types/issue-60407.rs @@ -0,0 +1,15 @@ +// check-pass + +#![feature(existential_type)] + +existential type Debuggable: core::fmt::Debug; + +static mut TEST: Option = None; + +fn main() { + unsafe { TEST = Some(foo()) } +} + +fn foo() -> Debuggable { + 0u32 +} diff --git a/src/test/ui/existential_types/issue-60564.rs b/src/test/ui/existential_types/issue-60564.rs new file mode 100644 index 0000000000000..cb3914ddd1deb --- /dev/null +++ b/src/test/ui/existential_types/issue-60564.rs @@ -0,0 +1,26 @@ +#![feature(existential_type)] + +trait IterBits { + type BitsIter: Iterator; + fn iter_bits(self, n: u8) -> Self::BitsIter; +} + +existential type IterBitsIter: std::iter::Iterator; +//~^ ERROR could not find defining uses + +impl IterBits for T +where + T: std::ops::Shr + + std::ops::BitAnd + + std::convert::From + + std::convert::TryInto, + E: std::fmt::Debug, +{ + type BitsIter = IterBitsIter; + fn iter_bits(self, n: u8) -> Self::BitsIter { + //~^ ERROR type parameter `E` is part of concrete type but not used + (0u8..n) + .rev() + .map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) + } +} diff --git a/src/test/ui/existential_types/issue-60564.stderr b/src/test/ui/existential_types/issue-60564.stderr new file mode 100644 index 0000000000000..d8480b521570a --- /dev/null +++ b/src/test/ui/existential_types/issue-60564.stderr @@ -0,0 +1,25 @@ +error[E0601]: `main` function not found in crate `issue_60564` + | + = note: consider adding a `main` function to `$DIR/issue-60564.rs` + +error: type parameter `E` is part of concrete type but not used in parameter list for existential type + --> $DIR/issue-60564.rs:20:49 + | +LL | fn iter_bits(self, n: u8) -> Self::BitsIter { + | _________________________________________________^ +LL | | +LL | | (0u8..n) +LL | | .rev() +LL | | .map(move |shift| ((self >> T::from(shift)) & T::from(1)).try_into().unwrap()) +LL | | } + | |_____^ + +error: could not find defining uses + --> $DIR/issue-60564.rs:8:1 + | +LL | existential type IterBitsIter: std::iter::Iterator; + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0601`.