Skip to content

Commit

Permalink
Bless more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
compiler-errors committed Nov 5, 2022
1 parent d989156 commit ff8f84c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 15 deletions.
16 changes: 5 additions & 11 deletions src/test/codegen/avr/avr-func-addrspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ pub trait Sized { }
pub trait Copy { }
#[lang = "receiver"]
pub trait Receiver { }
#[lang = "tuple_trait"]
pub trait Tuple { }

pub struct Result<T, E> { _a: T, _b: E }

Expand All @@ -29,32 +31,24 @@ impl Copy for &usize {}
pub unsafe fn drop_in_place<T: ?Sized>(_: *mut T) {}

#[lang = "fn_once"]
pub trait FnOnce<Args> {
pub trait FnOnce<Args: Tuple> {
#[lang = "fn_once_output"]
type Output;

extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}

#[lang = "fn_mut"]
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;
}

#[lang = "fn"]
pub trait Fn<Args>: FnOnce<Args> {
pub trait Fn<Args: Tuple>: FnOnce<Args> {
/// Performs the call operation.
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
}

impl<'a, A, R> FnOnce<A> for &'a fn(A) -> R {
type Output = R;

extern "rust-call" fn call_once(self, args: A) -> R {
(*self)(args)
}
}

pub static mut STORAGE_FOO: fn(&usize, &mut u32) -> Result<(), ()> = arbitrary_black_box;
pub static mut STORAGE_BAR: u32 = 12;

Expand Down
4 changes: 2 additions & 2 deletions src/test/incremental/hashes/extern_mods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ extern "C" {
// Change calling convention ---------------------------------------------------
#[cfg(any(cfail1,cfail4))]
extern "C" {
pub fn change_calling_convention(c: i32);
pub fn change_calling_convention(c: (i32,));
}

#[cfg(not(any(cfail1,cfail4)))]
Expand All @@ -137,7 +137,7 @@ extern "C" {
#[rustc_clean(cfg = "cfail5", except = "hir_owner,hir_owner_nodes")]
#[rustc_clean(cfg = "cfail6")]
extern "rust-call" {
pub fn change_calling_convention(c: i32);
pub fn change_calling_convention(c: (i32,));
}

// Make function public --------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![feature(unsized_locals)]
#![feature(unboxed_closures)]
#![feature(tuple_trait)]

pub trait FnOnce<Args> {
pub trait FnOnce<Args: std::marker::Tuple> {
type Output;
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#![feature(unsized_locals)]
#![feature(unboxed_closures)]
#![feature(tuple_trait)]

pub trait FnOnce<Args> {
pub trait FnOnce<Args: std::marker::Tuple> {
type Output;
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
Expand Down

0 comments on commit ff8f84c

Please sign in to comment.