|
1 | 1 | //@ check-pass
|
2 |
| -//@ revisions: host |
3 | 2 | //@ revisions: i686
|
4 | 3 | //@[i686] compile-flags: --target i686-unknown-linux-gnu
|
5 | 4 | //@[i686] needs-llvm-components: x86
|
|
58 | 57 | //@ revisions: nvptx64
|
59 | 58 | //@[nvptx64] compile-flags: --target nvptx64-nvidia-cuda
|
60 | 59 | //@[nvptx64] needs-llvm-components: nvptx
|
61 |
| -#![feature(rustc_attrs, unsized_fn_params, transparent_unions)] |
62 |
| -#![cfg_attr(not(host), feature(no_core, lang_items), no_std, no_core)] |
| 60 | +#![feature(no_core, rustc_attrs, lang_items)] |
| 61 | +#![feature(unsized_fn_params, transparent_unions)] |
| 62 | +#![no_std] |
| 63 | +#![no_core] |
63 | 64 | #![allow(unused, improper_ctypes_definitions, internal_features)]
|
64 | 65 |
|
65 | 66 | // FIXME: some targets are broken in various ways.
|
66 | 67 | // Hence there are `cfg` throughout this test to disable parts of it on those targets.
|
67 | 68 | // sparc64: https://github.com/rust-lang/rust/issues/115336
|
68 | 69 | // mips64: https://github.com/rust-lang/rust/issues/115404
|
69 | 70 |
|
70 |
| -#[cfg(host)] |
71 |
| -use std::{ |
72 |
| - any::Any, marker::PhantomData, mem::ManuallyDrop, num::NonZero, ptr::NonNull, rc::Rc, sync::Arc, |
73 |
| -}; |
| 71 | +//@ use-minicore |
| 72 | +extern crate minicore; |
| 73 | +use minicore::*; |
74 | 74 |
|
75 |
| -/// To work cross-target this test must be no_core. |
76 |
| -/// This little prelude supplies what we need. |
77 |
| -#[cfg(not(host))] |
| 75 | +/// To work cross-target this test must be no_core. This little prelude supplies what we need. |
| 76 | +/// |
| 77 | +/// Note that `minicore` provides a very minimal subset of `core` items (not yet complete). This |
| 78 | +/// prelude contains `alloc` and non-`core` (but in `std`) items that minicore does not stub out. |
78 | 79 | mod prelude {
|
79 |
| - #[lang = "sized"] |
80 |
| - pub trait Sized {} |
81 |
| - |
82 |
| - #[lang = "receiver"] |
83 |
| - pub trait Receiver {} |
84 |
| - impl<T: ?Sized> Receiver for &T {} |
85 |
| - impl<T: ?Sized> Receiver for &mut T {} |
86 |
| - |
87 |
| - #[lang = "copy"] |
88 |
| - pub trait Copy: Sized {} |
89 |
| - impl Copy for i32 {} |
90 |
| - impl Copy for f32 {} |
91 |
| - impl<T: ?Sized> Copy for &T {} |
92 |
| - impl<T: ?Sized> Copy for *const T {} |
93 |
| - impl<T: ?Sized> Copy for *mut T {} |
| 80 | + use minicore::*; |
94 | 81 |
|
95 | 82 | #[lang = "clone"]
|
96 | 83 | pub trait Clone: Sized {
|
97 | 84 | fn clone(&self) -> Self;
|
98 | 85 | }
|
99 | 86 |
|
100 |
| - #[lang = "phantom_data"] |
101 |
| - pub struct PhantomData<T: ?Sized>; |
102 |
| - impl<T: ?Sized> Copy for PhantomData<T> {} |
103 |
| - |
104 |
| - #[lang = "unsafe_cell"] |
105 |
| - #[repr(transparent)] |
106 |
| - pub struct UnsafeCell<T: ?Sized> { |
107 |
| - value: T, |
108 |
| - } |
109 |
| - |
110 |
| - pub trait Any: 'static {} |
111 |
| - |
112 |
| - pub enum Option<T> { |
113 |
| - None, |
114 |
| - Some(T), |
115 |
| - } |
116 |
| - impl<T: Copy> Copy for Option<T> {} |
117 |
| - |
118 |
| - pub enum Result<T, E> { |
119 |
| - Ok(T), |
120 |
| - Err(E), |
121 |
| - } |
122 |
| - impl<T: Copy, E: Copy> Copy for Result<T, E> {} |
123 |
| - |
124 |
| - #[lang = "manually_drop"] |
125 |
| - #[repr(transparent)] |
126 |
| - pub struct ManuallyDrop<T: ?Sized> { |
127 |
| - value: T, |
128 |
| - } |
129 |
| - impl<T: Copy + ?Sized> Copy for ManuallyDrop<T> {} |
130 |
| - |
131 | 87 | #[repr(transparent)]
|
132 | 88 | #[rustc_layout_scalar_valid_range_start(1)]
|
133 | 89 | #[rustc_nonnull_optimization_guaranteed]
|
@@ -185,7 +141,6 @@ mod prelude {
|
185 | 141 | alloc: A,
|
186 | 142 | }
|
187 | 143 | }
|
188 |
| -#[cfg(not(host))] |
189 | 144 | use prelude::*;
|
190 | 145 |
|
191 | 146 | macro_rules! test_abi_compatible {
|
|
0 commit comments