Skip to content

Commit 35c261a

Browse files
committed
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).
1 parent 03d3ba7 commit 35c261a

File tree

5 files changed

+9
-0
lines changed

5 files changed

+9
-0
lines changed

src/liballoc/boxed.rs

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ pub static HEAP: () = ();
8686
/// See the [module-level documentation](../../std/boxed/index.html) for more.
8787
#[lang = "owned_box"]
8888
#[stable(feature = "rust1", since = "1.0.0")]
89+
#[fundamental]
8990
pub struct Box<T>(Unique<T>);
9091

9192
impl<T> Box<T> {

src/liballoc/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@
7171
#![feature(no_std)]
7272
#![no_std]
7373
#![feature(allocator)]
74+
#![feature(custom_attribute)]
75+
#![feature(fundamental)]
7476
#![feature(lang_items, unsafe_destructor)]
7577
#![feature(box_syntax)]
7678
#![feature(optin_builtin_traits)]

src/libcore/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,10 @@
7070
#![feature(unboxed_closures)]
7171
#![feature(rustc_attrs)]
7272
#![feature(optin_builtin_traits)]
73+
#![feature(fundamental)]
7374
#![feature(concat_idents)]
7475
#![feature(reflect)]
76+
#![feature(custom_attribute)]
7577

7678
#[macro_use]
7779
mod macros;

src/libcore/marker.rs

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl !Send for Managed { }
4949
#[stable(feature = "rust1", since = "1.0.0")]
5050
#[lang="sized"]
5151
#[rustc_on_unimplemented = "`{Self}` does not have a constant size known at compile-time"]
52+
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
5253
pub trait Sized : MarkerTrait {
5354
// Empty.
5455
}

src/libcore/ops.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1117,6 +1117,7 @@ impl<'a, T: ?Sized> DerefMut for &'a mut T {
11171117
#[lang="fn"]
11181118
#[stable(feature = "rust1", since = "1.0.0")]
11191119
#[rustc_paren_sugar]
1120+
#[fundamental] // so that regex can rely that `&str: !FnMut`
11201121
pub trait Fn<Args> : FnMut<Args> {
11211122
/// This is called when the call operator is used.
11221123
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
@@ -1126,6 +1127,7 @@ pub trait Fn<Args> : FnMut<Args> {
11261127
#[lang="fn_mut"]
11271128
#[stable(feature = "rust1", since = "1.0.0")]
11281129
#[rustc_paren_sugar]
1130+
#[fundamental] // so that regex can rely that `&str: !FnMut`
11291131
pub trait FnMut<Args> : FnOnce<Args> {
11301132
/// This is called when the call operator is used.
11311133
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
@@ -1135,6 +1137,7 @@ pub trait FnMut<Args> : FnOnce<Args> {
11351137
#[lang="fn_once"]
11361138
#[stable(feature = "rust1", since = "1.0.0")]
11371139
#[rustc_paren_sugar]
1140+
#[fundamental] // so that regex can rely that `&str: !FnMut`
11381141
pub trait FnOnce<Args> {
11391142
/// The returned type after the call operator is used.
11401143
type Output;

0 commit comments

Comments
 (0)