Skip to content

Commit 2527125

Browse files
committed
resolve: Bind primitive types to items in libcore
1 parent 1049986 commit 2527125

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+169
-87
lines changed

src/libcollections/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
#![feature(pattern)]
4747
#![feature(placement_in)]
4848
#![feature(placement_new_protocol)]
49+
#![cfg_attr(not(stage0), feature(primitive_type))]
4950
#![feature(shared)]
5051
#![feature(slice_patterns)]
5152
#![feature(staged_api)]
@@ -56,7 +57,6 @@
5657
#![feature(unique)]
5758
#![feature(unsafe_no_drop_flag)]
5859
#![cfg_attr(test, feature(rand, test))]
59-
6060
#![no_std]
6161

6262
extern crate rustc_unicode;
@@ -99,6 +99,7 @@ pub mod fmt;
9999
pub mod linked_list;
100100
pub mod range;
101101
pub mod slice;
102+
#[cfg_attr(not(stage0), primitive_type)]
102103
pub mod str;
103104
pub mod string;
104105
pub mod vec;

src/libcore/fmt/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use num::flt2dec;
2121
use ops::Deref;
2222
use result;
2323
use slice;
24-
use str;
2524

2625
#[unstable(feature = "fmt_flags_align", issue = "27726")]
2726
/// Possible alignments returned by `Formatter::align`

src/libcore/fmt/num.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use prelude::v1::*;
1919
use fmt;
2020
use num::Zero;
2121
use ops::{Div, Rem, Sub};
22-
use str;
2322
use slice;
2423
use ptr;
2524
use mem;

src/libcore/lib.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
#![deny(missing_docs)]
5959
#![deny(missing_debug_implementations)]
6060
#![cfg_attr(not(stage0), deny(warnings))]
61+
// This is a temporary way to use libcore's prelude in libcore
62+
#![cfg_attr(not(stage0), feature(primitive_type, local_prelude))]
63+
#![cfg_attr(not(stage0), local_prelude)]
6164

6265
#![feature(allow_internal_unstable)]
6366
#![feature(associated_type_defaults)]
@@ -93,19 +96,43 @@ mod int_macros;
9396
#[macro_use]
9497
mod uint_macros;
9598

99+
/// The boolean type.
100+
#[cfg(not(stage0))]
101+
#[stable(feature = "core_primitive_types", since = "1.9.0")]
102+
#[allow(non_camel_case_types)]
103+
#[primitive_type]
104+
pub type bool = bool;
105+
106+
/// The boolean type.
107+
#[cfg(stage0)]
108+
#[stable(feature = "core_primitive_types", since = "1.9.0")]
109+
pub mod bool {}
110+
111+
#[cfg_attr(not(stage0), primitive_type)]
96112
#[path = "num/isize.rs"] pub mod isize;
113+
#[cfg_attr(not(stage0), primitive_type)]
97114
#[path = "num/i8.rs"] pub mod i8;
115+
#[cfg_attr(not(stage0), primitive_type)]
98116
#[path = "num/i16.rs"] pub mod i16;
117+
#[cfg_attr(not(stage0), primitive_type)]
99118
#[path = "num/i32.rs"] pub mod i32;
119+
#[cfg_attr(not(stage0), primitive_type)]
100120
#[path = "num/i64.rs"] pub mod i64;
101121

122+
#[cfg_attr(not(stage0), primitive_type)]
102123
#[path = "num/usize.rs"] pub mod usize;
124+
#[cfg_attr(not(stage0), primitive_type)]
103125
#[path = "num/u8.rs"] pub mod u8;
126+
#[cfg_attr(not(stage0), primitive_type)]
104127
#[path = "num/u16.rs"] pub mod u16;
128+
#[cfg_attr(not(stage0), primitive_type)]
105129
#[path = "num/u32.rs"] pub mod u32;
130+
#[cfg_attr(not(stage0), primitive_type)]
106131
#[path = "num/u64.rs"] pub mod u64;
107132

133+
#[cfg_attr(not(stage0), primitive_type)]
108134
#[path = "num/f32.rs"] pub mod f32;
135+
#[cfg_attr(not(stage0), primitive_type)]
109136
#[path = "num/f64.rs"] pub mod f64;
110137

111138
#[macro_use]
@@ -138,6 +165,7 @@ pub mod any;
138165
pub mod array;
139166
pub mod sync;
140167
pub mod cell;
168+
#[cfg_attr(not(stage0), primitive_type)]
141169
pub mod char;
142170
pub mod panicking;
143171
pub mod iter;
@@ -146,6 +174,7 @@ pub mod raw;
146174
pub mod result;
147175

148176
pub mod slice;
177+
#[cfg_attr(not(stage0), primitive_type)]
149178
pub mod str;
150179
pub mod hash;
151180
pub mod fmt;

src/libcore/num/dec2flt/rawfp.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
//! take the universally-correct slow path (Algorithm M) for very small and very large numbers.
2929
//! That algorithm needs only next_float() which does handle subnormals and zeros.
3030
use prelude::v1::*;
31-
use u32;
3231
use cmp::Ordering::{Less, Equal, Greater};
3332
use ops::{Mul, Div, Neg};
3433
use fmt::{Debug, LowerExp};

src/libcore/num/flt2dec/decoder.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
1313
use prelude::v1::*;
1414

15-
use {f32, f64};
1615
use num::{Float, FpCategory};
1716

1817
/// Decoded unsigned finite value, such that:

src/libcore/num/flt2dec/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ functions.
131131
issue = "0")]
132132

133133
use prelude::v1::*;
134-
use i16;
135134
pub use self::decoder::{decode, DecodableFloat, FullDecoded, Decoded};
136135

137136
pub mod estimator;

src/libcore/prelude/v1.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
//! same manner as the standard library's prelude.
1616
1717
#![stable(feature = "core_prelude", since = "1.4.0")]
18+
#![cfg_attr(not(stage0), no_implicit_prelude)]
1819

1920
// Reexported core operators
2021
#[stable(feature = "core_prelude", since = "1.4.0")]
@@ -51,3 +52,7 @@
5152
#[doc(no_inline)] pub use str::StrExt;
5253
#[stable(feature = "core_prelude", since = "1.4.0")]
5354
#[doc(no_inline)] pub use char::CharExt;
55+
56+
#[stable(feature = "core_primitive_types", since = "1.9.0")]
57+
#[doc(no_inline)] pub use {u8, u16, u32, u64, usize, i8, i16, i32, i64, isize,
58+
f32, f64, bool, char, str};

src/libcore/str/pattern.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use prelude::v1::*;
2121

2222
use cmp;
2323
use fmt;
24-
use usize;
2524

2625
// Pattern
2726

src/libcoretest/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#![feature(libc)]
2929
#![feature(nonzero)]
3030
#![feature(peekable_is_empty)]
31+
#![feature(primitive_type)]
3132
#![feature(ptr_as_ref)]
3233
#![feature(rand)]
3334
#![feature(raw)]

0 commit comments

Comments
 (0)