From 35c261aea0d891d31b3fda83da653cb1e385681f Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Mon, 30 Mar 2015 17:52:00 -0400 Subject: [PATCH] Add `#[fundamental]` annotations into libcore so that `Sized` and the `Fn` traits are considered fundamental, along with `Box` (though that is mostly for show; the real type is `~T` in the compiler). --- src/liballoc/boxed.rs | 1 + src/liballoc/lib.rs | 2 ++ src/libcore/lib.rs | 2 ++ src/libcore/marker.rs | 1 + src/libcore/ops.rs | 3 +++ 5 files changed, 9 insertions(+) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 550b25ac3a7..adfe0f461be 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -86,6 +86,7 @@ pub static HEAP: () = (); /// See the [module-level documentation](../../std/boxed/index.html) for more. #[lang = "owned_box"] #[stable(feature = "rust1", since = "1.0.0")] +#[fundamental] pub struct Box(Unique); impl Box { diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index b92dfa9117e..a8be63d6373 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -71,6 +71,8 @@ #![feature(no_std)] #![no_std] #![feature(allocator)] +#![feature(custom_attribute)] +#![feature(fundamental)] #![feature(lang_items, unsafe_destructor)] #![feature(box_syntax)] #![feature(optin_builtin_traits)] diff --git a/src/libcore/lib.rs b/src/libcore/lib.rs index 5e8b7fba1f1..3a9af50fefb 100644 --- a/src/libcore/lib.rs +++ b/src/libcore/lib.rs @@ -70,8 +70,10 @@ #![feature(unboxed_closures)] #![feature(rustc_attrs)] #![feature(optin_builtin_traits)] +#![feature(fundamental)] #![feature(concat_idents)] #![feature(reflect)] +#![feature(custom_attribute)] #[macro_use] mod macros; diff --git a/src/libcore/marker.rs b/src/libcore/marker.rs index f755c912fcd..97bde9fc96e 100644 --- a/src/libcore/marker.rs +++ b/src/libcore/marker.rs @@ -49,6 +49,7 @@ impl !Send for Managed { } #[stable(feature = "rust1", since = "1.0.0")] #[lang="sized"] #[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"] +#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable pub trait Sized : MarkerTrait { // Empty. } diff --git a/src/libcore/ops.rs b/src/libcore/ops.rs index 862eb16d0bf..399aec9afd4 100644 --- a/src/libcore/ops.rs +++ b/src/libcore/ops.rs @@ -1117,6 +1117,7 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T { #[lang="fn"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] +#[fundamental] // so that regex can rely that `&str: !FnMut` pub trait Fn : FnMut { /// This is called when the call operator is used. extern "rust-call" fn call(&self, args: Args) -> Self::Output; @@ -1126,6 +1127,7 @@ pub trait Fn : FnMut { #[lang="fn_mut"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] +#[fundamental] // so that regex can rely that `&str: !FnMut` pub trait FnMut : FnOnce { /// This is called when the call operator is used. extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output; @@ -1135,6 +1137,7 @@ pub trait FnMut : FnOnce { #[lang="fn_once"] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_paren_sugar] +#[fundamental] // so that regex can rely that `&str: !FnMut` pub trait FnOnce { /// The returned type after the call operator is used. type Output;