Rollup merge of #72572 - JohnTitor:add-tests, r=matthewjasper
Add some regression tests Closes #68532 Closes #70121 Closes #71042 CC #56445 r? @matthewjasper since they (except for #71042) are related to #72362.
This commit is contained in:
commit
89cb4d75a1
5 changed files with 79 additions and 0 deletions
26
src/test/ui/impl-trait/issue-56445.rs
Normal file
26
src/test/ui/impl-trait/issue-56445.rs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Regression test for https://github.com/rust-lang/rust/issues/56445#issuecomment-629426939
|
||||
// check-pass
|
||||
|
||||
#![crate_type = "lib"]
|
||||
|
||||
use std::marker::PhantomData;
|
||||
|
||||
pub struct S<'a>
|
||||
{
|
||||
pub m1: PhantomData<&'a u8>,
|
||||
pub m2: [u8; S::size()],
|
||||
}
|
||||
|
||||
impl<'a> S<'a>
|
||||
{
|
||||
pub const fn size() -> usize { 1 }
|
||||
|
||||
pub fn new() -> Self
|
||||
{
|
||||
Self
|
||||
{
|
||||
m1: PhantomData,
|
||||
m2: [0; Self::size()],
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/test/ui/impl-trait/issue-68532.rs
Normal file
13
src/test/ui/impl-trait/issue-68532.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
// check-pass
|
||||
|
||||
pub struct A<'a>(&'a ());
|
||||
|
||||
impl<'a> A<'a> {
|
||||
const N: usize = 68;
|
||||
|
||||
pub fn foo(&self) {
|
||||
let _b = [0; Self::N];
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
#![feature(impl_trait_in_bindings)]
|
||||
#![allow(incomplete_features)]
|
||||
|
||||
fn main() {
|
||||
const C: impl Copy = 0;
|
||||
match C {
|
||||
C | _ => {} //~ ERROR: opaque types cannot be used in patterns
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
error: opaque types cannot be used in patterns
|
||||
--> $DIR/issue-71042-opaquely-typed-constant-used-in-pattern.rs:7:9
|
||||
|
|
||||
LL | C | _ => {}
|
||||
| ^
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
23
src/test/ui/type-alias-impl-trait/issue-70121.rs
Normal file
23
src/test/ui/type-alias-impl-trait/issue-70121.rs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// check-pass
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
pub type Successors<'a> = impl Iterator<Item = &'a ()>;
|
||||
|
||||
pub fn f<'a>() -> Successors<'a> {
|
||||
None.into_iter()
|
||||
}
|
||||
|
||||
pub trait Tr {
|
||||
type Item;
|
||||
}
|
||||
|
||||
impl<'a> Tr for &'a () {
|
||||
type Item = Successors<'a>;
|
||||
}
|
||||
|
||||
pub fn kazusa<'a>() -> <&'a () as Tr>::Item {
|
||||
None.into_iter()
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue