9329: internal: add Copy to minicore r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
bors[bot] 2021-06-18 19:11:13 +00:00 committed by GitHub
commit c2f15270ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 464 additions and 306 deletions

View File

@ -3014,8 +3014,8 @@ fn foo() {
file_id: FileId(
1,
),
full_range: 248..430,
focus_range: 287..293,
full_range: 250..432,
focus_range: 289..295,
name: "Future",
kind: Trait,
description: "pub trait Future",

File diff suppressed because it is too large Load Diff

View File

@ -23,6 +23,8 @@
//! iterator: option
//! iterators: iterator
//! default: sized
//! clone: sized
//! copy: clone
//! from: sized
//! eq: sized
//! ord: eq, option
@ -40,6 +42,38 @@ pub trait Sized {}
#[lang = "unsize"]
pub trait Unsize<T: ?Sized> {}
// endregion:unsize
// region:copy
#[lang = "copy"]
pub trait Copy: Clone {}
// region:derive
#[rustc_builtin_macro]
pub macro Copy($item:item) {}
// endregion:derive
mod copy_impls {
use super::Copy;
macro_rules! impl_copy {
($($t:ty)*) => {
$(
impl Copy for $t {}
)*
}
}
impl_copy! {
usize u8 u16 u32 u64 u128
isize i8 i16 i32 i64 i128
f32 f64
bool char
}
impl<T: ?Sized> Copy for *const T {}
impl<T: ?Sized> Copy for *mut T {}
impl<T: ?Sized> Copy for &T {}
}
// endregion:copy
}
// region:default
@ -50,6 +84,19 @@ pub trait Default: Sized {
}
// endregion:default
// region:clone
pub mod clone {
#[lang = "clone"]
pub trait Clone: Sized {
fn clone(&self) -> Self;
}
// region:derive
#[rustc_builtin_macro]
pub macro Clone($item:item) {}
// endregion:derive
}
// endregion:clone
// region:from
pub mod convert {
pub trait From<T>: Sized {
@ -114,9 +161,11 @@ pub trait DerefMut: Deref {
}
// endregion:deref_mut
}
pub use self::deref::Deref;
pub use self::deref::DerefMut; //:deref_mut
// endregion:deref
pub use self::deref::{
Deref,
DerefMut, // :deref_mut
};
// endregion:deref
// region:range
mod range {
@ -402,12 +451,14 @@ pub(crate) mod builtin {
pub mod prelude {
pub mod v1 {
pub use crate::{
clone::Clone, // :clone
cmp::{Eq, PartialEq}, // :eq
cmp::{Ord, PartialOrd}, // :ord
convert::{From, Into}, // :from
default::Default, // :default
iter::{IntoIterator, Iterator}, // :iterator
macros::builtin::derive, // :derive
marker::Copy, // :copy
marker::Sized, // :sized
ops::{Fn, FnMut, FnOnce}, // :fn
option::Option::{self, None, Some}, // :option