Skip to content

Commit

Permalink
Auto merge of #30883 - Manishearth:rollup, r=Manishearth
Browse files Browse the repository at this point in the history
- Successful merges: #30626, #30662, #30770, #30801, #30818, #30823, #30828, #30835, #30837, #30839, #30845, #30848, #30850, #30851, #30863
- Failed merges:
  • Loading branch information
bors committed Jan 14, 2016
2 parents e1f550e + 1246f43 commit 5b3a75f
Show file tree
Hide file tree
Showing 34 changed files with 833 additions and 351 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Read ["Installing Rust"] from [The Book].
1. Make sure you have installed the dependencies:

* `g++` 4.7 or `clang++` 3.x
* `python` 2.6 or later (but not 3.x)
* `python` 2.7 or later (but not 3.x)
* GNU `make` 3.81 or later
* `curl`
* `git`
Expand Down
2 changes: 1 addition & 1 deletion mk/crates.mk
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ DEPS_rustc_lint := rustc log syntax
DEPS_rustc_llvm := native:rustllvm libc std rustc_bitflags
DEPS_rustc_metadata := rustc rustc_front syntax rbml
DEPS_rustc_mir := rustc rustc_front syntax
DEPS_rustc_resolve := rustc rustc_front log syntax
DEPS_rustc_resolve := arena rustc rustc_front log syntax
DEPS_rustc_platform_intrinsics := rustc rustc_llvm
DEPS_rustc_plugin := rustc rustc_metadata syntax
DEPS_rustc_privacy := rustc rustc_front log syntax
Expand Down
14 changes: 3 additions & 11 deletions src/liballoc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
#![feature(unsize)]
#![feature(drop_in_place)]
#![feature(fn_traits)]
#![feature(const_fn)]

#![feature(needs_allocator)]

Expand Down Expand Up @@ -134,15 +135,6 @@ mod boxed_test;
pub mod arc;
pub mod rc;
pub mod raw_vec;
pub mod oom;

/// Common out-of-memory routine
#[cold]
#[inline(never)]
#[unstable(feature = "oom", reason = "not a scrutinized interface",
issue = "27700")]
pub fn oom() -> ! {
// FIXME(#14674): This really needs to do something other than just abort
// here, but any printing done must be *guaranteed* to not
// allocate.
unsafe { core::intrinsics::abort() }
}
pub use oom::oom;
42 changes: 42 additions & 0 deletions src/liballoc/oom.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Copyright 2014-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use core::sync::atomic::{AtomicPtr, Ordering};
use core::mem;
use core::intrinsics;

static OOM_HANDLER: AtomicPtr<()> = AtomicPtr::new(default_oom_handler as *mut ());

fn default_oom_handler() -> ! {
// The default handler can't do much more since we can't assume the presence
// of libc or any way of printing an error message.
unsafe { intrinsics::abort() }
}

/// Common out-of-memory routine
#[cold]
#[inline(never)]
#[unstable(feature = "oom", reason = "not a scrutinized interface",
issue = "27700")]
pub fn oom() -> ! {
let value = OOM_HANDLER.load(Ordering::SeqCst);
let handler: fn() -> ! = unsafe { mem::transmute(value) };
handler();
}

/// Set a custom handler for out-of-memory conditions
///
/// To avoid recursive OOM failures, it is critical that the OOM handler does
/// not allocate any memory itself.
#[unstable(feature = "oom", reason = "not a scrutinized interface",
issue = "27700")]
pub fn set_oom_handler(handler: fn() -> !) {
OOM_HANDLER.store(handler as *mut (), Ordering::SeqCst);
}
36 changes: 36 additions & 0 deletions src/libcollections/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,42 @@
//!
//! [`String`]: struct.String.html
//! [`ToString`]: trait.ToString.html
//!
//! # Examples
//!
//! There are multiple ways to create a new `String` from a string literal:
//!
//! ```rust
//! let s = "Hello".to_string();
//!
//! let s = String::from("world");
//! let s: String = "also this".into();
//! ```
//!
//! You can create a new `String` from an existing one by concatenating with
//! `+`:
//!
//! ```rust
//! let s = "Hello".to_string();
//!
//! let message = s + " world!";
//! ```
//!
//! If you have a vector of valid UTF-8 bytes, you can make a `String` out of
//! it. You can do the reverse too.
//!
//! ```rust
//! let sparkle_heart = vec![240, 159, 146, 150];
//!
//! // We know these bytes are valid, so we'll use `unwrap()`.
//! let sparkle_heart = String::from_utf8(sparkle_heart).unwrap();
//!
//! assert_eq!("💖", sparkle_heart);
//!
//! let bytes = sparkle_heart.into_bytes();
//!
//! assert_eq!(bytes, [240, 159, 146, 150]);
//! ```

#![stable(feature = "rust1", since = "1.0.0")]

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1569,7 +1569,7 @@ impl Debug for () {
}
}
#[stable(feature = "rust1", since = "1.0.0")]
impl<T> Debug for PhantomData<T> {
impl<T: ?Sized> Debug for PhantomData<T> {
fn fmt(&self, f: &mut Formatter) -> Result {
f.pad("PhantomData")
}
Expand Down
6 changes: 2 additions & 4 deletions src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ pub struct Options {
pub prints: Vec<PrintRequest>,
pub cg: CodegenOptions,
pub color: ColorConfig,
pub show_span: Option<String>,
pub externs: HashMap<String, Vec<String>>,
pub crate_name: Option<String>,
/// An optional name to use as the crate for std during std injection,
Expand Down Expand Up @@ -243,7 +242,6 @@ pub fn basic_options() -> Options {
prints: Vec::new(),
cg: basic_codegen_options(),
color: ColorConfig::Auto,
show_span: None,
externs: HashMap::new(),
crate_name: None,
alt_std_name: None,
Expand Down Expand Up @@ -634,6 +632,8 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
"don't clear the resolution tables after analysis"),
keep_ast: bool = (false, parse_bool,
"keep the AST after lowering it to HIR"),
show_span: Option<String> = (None, parse_opt_string,
"show spans for compiler debugging (expr|pat|ty)"),
}

pub fn default_lib_output() -> CrateType {
Expand Down Expand Up @@ -882,7 +882,6 @@ pub fn rustc_optgroups() -> Vec<RustcOptGroup> {
`hir` (the HIR), `hir,identified`, or
`hir,typed` (HIR with types for each node).",
"TYPE"),
opt::opt_u("", "show-span", "Show spans for compiler debugging", "expr|pat|ty"),
]);
opts
}
Expand Down Expand Up @@ -1123,7 +1122,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
prints: prints,
cg: cg,
color: color,
show_span: None,
externs: externs,
crate_name: crate_name,
alt_std_name: None,
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ pub fn phase_1_parse_input(sess: &Session, cfg: ast::CrateConfig, input: &Input)
println!("Pre-expansion node count: {}", count_nodes(&krate));
}

if let Some(ref s) = sess.opts.show_span {
if let Some(ref s) = sess.opts.debugging_opts.show_span {
syntax::show_span::run(sess.diagnostic(), s, &krate);
}

Expand Down
7 changes: 2 additions & 5 deletions src/librustc_driver/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,9 @@ pub fn run_compiler<'a>(args: &[String], callbacks: &mut CompilerCalls<'a>) {
};

let cstore = Rc::new(CStore::new(token::get_ident_interner()));
let mut sess = build_session(sopts, input_file_path, descriptions,
let sess = build_session(sopts, input_file_path, descriptions,
cstore.clone());
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
if sess.unstable_options() {
sess.opts.show_span = matches.opt_str("show-span");
}
let mut cfg = config::build_configuration(&sess);
target_features::add_configuration(&mut cfg, &sess);

Expand Down Expand Up @@ -387,7 +384,7 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
fn build_controller(&mut self, sess: &Session) -> CompileController<'a> {
let mut control = CompileController::basic();

if sess.opts.parse_only || sess.opts.show_span.is_some() ||
if sess.opts.parse_only || sess.opts.debugging_opts.show_span.is_some() ||
sess.opts.debugging_opts.ast_json_noexpand {
control.after_parse.stop = Compilation::Stop;
}
Expand Down
Loading

0 comments on commit 5b3a75f

Please sign in to comment.