Skip to content

Commit

Permalink
Update bootstrap compiler
Browse files Browse the repository at this point in the history
Also remove a number of `stage0` annotations and such
  • Loading branch information
alexcrichton committed Nov 30, 2017
1 parent 78fcf33 commit a850bb0
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 289 deletions.
114 changes: 57 additions & 57 deletions src/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/bootstrap/bin/rustc.rs
Expand Up @@ -175,7 +175,7 @@ fn main() {
if let Ok(s) = env::var("RUSTC_CODEGEN_UNITS") {
cmd.arg("-C").arg(format!("codegen-units={}", s));
}
if stage != "0" && env::var("RUSTC_THINLTO").is_ok() {
if env::var("RUSTC_THINLTO").is_ok() {
cmd.arg("-Ccodegen-units=16").arg("-Zthinlto");
}

Expand Down
16 changes: 4 additions & 12 deletions src/liballoc/boxed.rs
Expand Up @@ -300,10 +300,7 @@ impl<T: ?Sized> Box<T> {
issue = "27730")]
#[inline]
pub unsafe fn from_unique(u: Unique<T>) -> Self {
#[cfg(stage0)]
return mem::transmute(u);
#[cfg(not(stage0))]
return Box(u);
Box(u)
}

/// Consumes the `Box`, returning the wrapped raw pointer.
Expand Down Expand Up @@ -365,14 +362,9 @@ impl<T: ?Sized> Box<T> {
issue = "27730")]
#[inline]
pub fn into_unique(b: Box<T>) -> Unique<T> {
#[cfg(stage0)]
return unsafe { mem::transmute(b) };
#[cfg(not(stage0))]
return {
let unique = b.0;
mem::forget(b);
unique
};
let unique = b.0;
mem::forget(b);
unique
}

/// Consumes and leaks the `Box`, returning a mutable reference,
Expand Down
5 changes: 1 addition & 4 deletions src/liballoc/slice.rs
Expand Up @@ -1626,11 +1626,8 @@ impl<T> [T] {
}
}

// FIXME(LukasKalbertodt): the `not(stage0)` constraint can be removed in the
// future once the stage0 compiler is new enough to know about the `slice_u8`
// lang item.
#[lang = "slice_u8"]
#[cfg(all(not(stage0), not(test)))]
#[cfg(not(test))]
impl [u8] {
/// Checks if all bytes in this slice are within the ASCII range.
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
Expand Down
5 changes: 0 additions & 5 deletions src/liballoc/str.rs
Expand Up @@ -2110,7 +2110,6 @@ impl str {
/// [`to_uppercase`]: #method.to_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[inline]
#[cfg(not(stage0))]
pub fn to_ascii_uppercase(&self) -> String {
let mut bytes = self.as_bytes().to_vec();
bytes.make_ascii_uppercase();
Expand Down Expand Up @@ -2141,7 +2140,6 @@ impl str {
/// [`to_lowercase`]: #method.to_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[inline]
#[cfg(not(stage0))]
pub fn to_ascii_lowercase(&self) -> String {
let mut bytes = self.as_bytes().to_vec();
bytes.make_ascii_lowercase();
Expand All @@ -2163,7 +2161,6 @@ impl str {
/// ```
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[inline]
#[cfg(not(stage0))]
pub fn eq_ignore_ascii_case(&self, other: &str) -> bool {
self.as_bytes().eq_ignore_ascii_case(other.as_bytes())
}
Expand All @@ -2178,7 +2175,6 @@ impl str {
///
/// [`to_ascii_uppercase`]: #method.to_ascii_uppercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[cfg(not(stage0))]
pub fn make_ascii_uppercase(&mut self) {
let me = unsafe { self.as_bytes_mut() };
me.make_ascii_uppercase()
Expand All @@ -2194,7 +2190,6 @@ impl str {
///
/// [`to_ascii_lowercase`]: #method.to_ascii_lowercase
#[stable(feature = "ascii_methods_on_intrinsics", since = "1.21.0")]
#[cfg(not(stage0))]
pub fn make_ascii_lowercase(&mut self) {
let me = unsafe { self.as_bytes_mut() };
me.make_ascii_lowercase()
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/lib.rs
Expand Up @@ -90,7 +90,7 @@
#![feature(unboxed_closures)]
#![feature(untagged_unions)]
#![feature(unwind_attributes)]
#![cfg_attr(not(stage0), feature(doc_spotlight))]
#![feature(doc_spotlight)]

#[prelude_import]
#[allow(unused)]
Expand Down
1 change: 0 additions & 1 deletion src/libcore/marker.rs
Expand Up @@ -39,7 +39,6 @@ use hash::Hasher;
/// [arc]: ../../std/sync/struct.Arc.html
/// [ub]: ../../reference/behavior-considered-undefined.html
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(stage0, lang = "send")]
#[rustc_on_unimplemented = "`{Self}` cannot be sent between threads safely"]
pub unsafe trait Send {
// empty.
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/lint/mod.rs
Expand Up @@ -38,8 +38,6 @@ use hir::def_id::{CrateNum, LOCAL_CRATE};
use hir::intravisit::{self, FnKind};
use hir;
use session::Session;
#[cfg(stage0)]
use std::ascii::AsciiExt;
use std::hash;
use syntax::ast;
use syntax::codemap::MultiSpan;
Expand Down
2 changes: 0 additions & 2 deletions src/librustdoc/clean/cfg.rs
Expand Up @@ -15,8 +15,6 @@
use std::mem;
use std::fmt::{self, Write};
use std::ops;
#[cfg(stage0)]
use std::ascii::AsciiExt;

use syntax::symbol::Symbol;
use syntax::ast::{MetaItem, MetaItemKind, NestedMetaItem, NestedMetaItemKind, LitKind};
Expand Down
2 changes: 0 additions & 2 deletions src/librustdoc/html/render.rs
Expand Up @@ -34,8 +34,6 @@
//! both occur before the crate is rendered.
pub use self::ExternalLocation::*;

#[cfg(stage0)]
use std::ascii::AsciiExt;
use std::borrow::Cow;
use std::cell::RefCell;
use std::cmp::Ordering;
Expand Down
200 changes: 0 additions & 200 deletions src/libstd/ascii.rs
Expand Up @@ -298,198 +298,6 @@ pub trait AsciiExt {
fn is_ascii_control(&self) -> bool { unimplemented!(); }
}

// FIXME(LukasKalbertodt): this impl block can be removed in the future. This is
// possible once the stage0 compiler is new enough to contain the inherent
// ascii methods for `[str]`. See FIXME comment further down.
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
impl AsciiExt for str {
type Owned = String;

#[inline]
fn is_ascii(&self) -> bool {
self.bytes().all(|b| b.is_ascii())
}

#[inline]
fn to_ascii_uppercase(&self) -> String {
let mut bytes = self.as_bytes().to_vec();
bytes.make_ascii_uppercase();
// make_ascii_uppercase() preserves the UTF-8 invariant.
unsafe { String::from_utf8_unchecked(bytes) }
}

#[inline]
fn to_ascii_lowercase(&self) -> String {
let mut bytes = self.as_bytes().to_vec();
bytes.make_ascii_lowercase();
// make_ascii_uppercase() preserves the UTF-8 invariant.
unsafe { String::from_utf8_unchecked(bytes) }
}

#[inline]
fn eq_ignore_ascii_case(&self, other: &str) -> bool {
self.as_bytes().eq_ignore_ascii_case(other.as_bytes())
}

fn make_ascii_uppercase(&mut self) {
let me = unsafe { self.as_bytes_mut() };
me.make_ascii_uppercase()
}

fn make_ascii_lowercase(&mut self) {
let me = unsafe { self.as_bytes_mut() };
me.make_ascii_lowercase()
}

#[inline]
fn is_ascii_alphabetic(&self) -> bool {
self.bytes().all(|b| b.is_ascii_alphabetic())
}

#[inline]
fn is_ascii_uppercase(&self) -> bool {
self.bytes().all(|b| b.is_ascii_uppercase())
}

#[inline]
fn is_ascii_lowercase(&self) -> bool {
self.bytes().all(|b| b.is_ascii_lowercase())
}

#[inline]
fn is_ascii_alphanumeric(&self) -> bool {
self.bytes().all(|b| b.is_ascii_alphanumeric())
}

#[inline]
fn is_ascii_digit(&self) -> bool {
self.bytes().all(|b| b.is_ascii_digit())
}

#[inline]
fn is_ascii_hexdigit(&self) -> bool {
self.bytes().all(|b| b.is_ascii_hexdigit())
}

#[inline]
fn is_ascii_punctuation(&self) -> bool {
self.bytes().all(|b| b.is_ascii_punctuation())
}

#[inline]
fn is_ascii_graphic(&self) -> bool {
self.bytes().all(|b| b.is_ascii_graphic())
}

#[inline]
fn is_ascii_whitespace(&self) -> bool {
self.bytes().all(|b| b.is_ascii_whitespace())
}

#[inline]
fn is_ascii_control(&self) -> bool {
self.bytes().all(|b| b.is_ascii_control())
}
}

// FIXME(LukasKalbertodt): this impl block can be removed in the future. This is
// possible once the stage0 compiler is new enough to contain the inherent
// ascii methods for `[u8]`. See FIXME comment further down.
#[cfg(stage0)]
#[stable(feature = "rust1", since = "1.0.0")]
impl AsciiExt for [u8] {
type Owned = Vec<u8>;
#[inline]
fn is_ascii(&self) -> bool {
self.iter().all(|b| b.is_ascii())
}

#[inline]
fn to_ascii_uppercase(&self) -> Vec<u8> {
let mut me = self.to_vec();
me.make_ascii_uppercase();
return me
}

#[inline]
fn to_ascii_lowercase(&self) -> Vec<u8> {
let mut me = self.to_vec();
me.make_ascii_lowercase();
return me
}

#[inline]
fn eq_ignore_ascii_case(&self, other: &[u8]) -> bool {
self.len() == other.len() &&
self.iter().zip(other).all(|(a, b)| {
a.eq_ignore_ascii_case(b)
})
}

fn make_ascii_uppercase(&mut self) {
for byte in self {
byte.make_ascii_uppercase();
}
}

fn make_ascii_lowercase(&mut self) {
for byte in self {
byte.make_ascii_lowercase();
}
}

#[inline]
fn is_ascii_alphabetic(&self) -> bool {
self.iter().all(|b| b.is_ascii_alphabetic())
}

#[inline]
fn is_ascii_uppercase(&self) -> bool {
self.iter().all(|b| b.is_ascii_uppercase())
}

#[inline]
fn is_ascii_lowercase(&self) -> bool {
self.iter().all(|b| b.is_ascii_lowercase())
}

#[inline]
fn is_ascii_alphanumeric(&self) -> bool {
self.iter().all(|b| b.is_ascii_alphanumeric())
}

#[inline]
fn is_ascii_digit(&self) -> bool {
self.iter().all(|b| b.is_ascii_digit())
}

#[inline]
fn is_ascii_hexdigit(&self) -> bool {
self.iter().all(|b| b.is_ascii_hexdigit())
}

#[inline]
fn is_ascii_punctuation(&self) -> bool {
self.iter().all(|b| b.is_ascii_punctuation())
}

#[inline]
fn is_ascii_graphic(&self) -> bool {
self.iter().all(|b| b.is_ascii_graphic())
}

#[inline]
fn is_ascii_whitespace(&self) -> bool {
self.iter().all(|b| b.is_ascii_whitespace())
}

#[inline]
fn is_ascii_control(&self) -> bool {
self.iter().all(|b| b.is_ascii_control())
}
}

macro_rules! delegating_ascii_methods {
() => {
#[inline]
Expand Down Expand Up @@ -562,10 +370,6 @@ impl AsciiExt for char {
delegating_ascii_ctype_methods!();
}

// FIXME(LukasKalbertodt): the macro invocation should replace the impl block
// for `[u8]` above. But this is not possible until the stage0 compiler is new
// enough to contain the inherent ascii methods for `[u8]`.
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl AsciiExt for [u8] {
type Owned = Vec<u8>;
Expand Down Expand Up @@ -623,10 +427,6 @@ impl AsciiExt for [u8] {
}
}

// FIXME(LukasKalbertodt): the macro invocation should replace the impl block
// for `str` above. But this is not possible until the stage0 compiler is new
// enough to contain the inherent ascii methods for `str`.
#[cfg(not(stage0))]
#[stable(feature = "rust1", since = "1.0.0")]
impl AsciiExt for str {
type Owned = String;
Expand Down
2 changes: 1 addition & 1 deletion src/stage0.txt
Expand Up @@ -12,7 +12,7 @@
# source tarball for a stable release you'll likely see `1.x.0` for rustc and
# `0.x.0` for Cargo where they were released on `date`.

date: 2017-10-20
date: 2017-11-21
rustc: beta
cargo: beta

Expand Down

0 comments on commit a850bb0

Please sign in to comment.