Merge commit '2bb3996244
' into sync_cg_clif-2022-12-14
This commit is contained in:
commit
949699931e
53 changed files with 1675 additions and 1012 deletions
24
compiler/rustc_codegen_cranelift/example/issue-72793.rs
Normal file
24
compiler/rustc_codegen_cranelift/example/issue-72793.rs
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Adapted from rustc ui test suite (ui/type-alias-impl-trait/issue-72793.rs)
|
||||
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
trait T { type Item; }
|
||||
|
||||
type Alias<'a> = impl T<Item = &'a ()>;
|
||||
|
||||
struct S;
|
||||
impl<'a> T for &'a S {
|
||||
type Item = &'a ();
|
||||
}
|
||||
|
||||
fn filter_positive<'a>() -> Alias<'a> {
|
||||
&S
|
||||
}
|
||||
|
||||
fn with_positive(fun: impl Fn(Alias<'_>)) {
|
||||
fun(filter_positive());
|
||||
}
|
||||
|
||||
fn main() {
|
||||
with_positive(|_| ());
|
||||
}
|
|
@ -19,6 +19,9 @@ pub trait Sized {}
|
|||
#[lang = "destruct"]
|
||||
pub trait Destruct {}
|
||||
|
||||
#[lang = "tuple_trait"]
|
||||
pub trait Tuple {}
|
||||
|
||||
#[lang = "unsize"]
|
||||
pub trait Unsize<T: ?Sized> {}
|
||||
|
||||
|
@ -443,7 +446,7 @@ pub struct PhantomData<T: ?Sized>;
|
|||
|
||||
#[lang = "fn_once"]
|
||||
#[rustc_paren_sugar]
|
||||
pub trait FnOnce<Args> {
|
||||
pub trait FnOnce<Args: Tuple> {
|
||||
#[lang = "fn_once_output"]
|
||||
type Output;
|
||||
|
||||
|
@ -452,7 +455,7 @@ pub trait FnOnce<Args> {
|
|||
|
||||
#[lang = "fn_mut"]
|
||||
#[rustc_paren_sugar]
|
||||
pub trait FnMut<Args>: FnOnce<Args> {
|
||||
pub trait FnMut<Args: Tuple>: FnOnce<Args> {
|
||||
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
|
||||
}
|
||||
|
||||
|
|
|
@ -171,8 +171,6 @@ fn main() {
|
|||
|
||||
assert_eq!(slice_ptr as usize % 4, 0);
|
||||
|
||||
//return;
|
||||
|
||||
unsafe {
|
||||
printf("Hello %s\n\0" as *const str as *const i8, "printf\0" as *const str as *const i8);
|
||||
|
||||
|
|
|
@ -164,6 +164,8 @@ unsafe fn test_simd() {
|
|||
let cmp_eq = _mm_cmpeq_epi8(y, y);
|
||||
let cmp_lt = _mm_cmplt_epi8(y, y);
|
||||
|
||||
let (zero0, zero1) = std::mem::transmute::<_, (u64, u64)>(x);
|
||||
assert_eq!((zero0, zero1), (0, 0));
|
||||
assert_eq!(std::mem::transmute::<_, [u16; 8]>(or), [7, 7, 7, 7, 7, 7, 7, 7]);
|
||||
assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_eq), [0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff]);
|
||||
assert_eq!(std::mem::transmute::<_, [u16; 8]>(cmp_lt), [0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue