Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into string-splice-sta…
Browse files Browse the repository at this point in the history
…bilize
  • Loading branch information
tmccombs committed Apr 3, 2018
2 parents 196b142 + 5ee891c commit a64acaa
Show file tree
Hide file tree
Showing 32 changed files with 577 additions and 232 deletions.
349 changes: 185 additions & 164 deletions src/Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use Build;
use config::Config;

// The version number
pub const CFG_RELEASE_NUM: &str = "1.26.0";
pub const CFG_RELEASE_NUM: &str = "1.27.0";

pub struct GitInfo {
inner: Option<Info>,
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
use core::borrow;
use core::fmt;
use core::cmp::Ordering;
use core::heap::{Alloc, Layout};
use core::intrinsics::abort;
use core::mem::{self, align_of_val, size_of_val, uninitialized};
use core::ops::Deref;
Expand All @@ -31,7 +32,7 @@ use core::hash::{Hash, Hasher};
use core::{isize, usize};
use core::convert::From;

use heap::{Heap, Alloc, Layout, box_free};
use heap::{Heap, box_free};
use boxed::Box;
use string::String;
use vec::Vec;
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@
#![stable(feature = "rust1", since = "1.0.0")]

use heap::{Heap, Layout, Alloc};
use heap::Heap;
use raw_vec::RawVec;

use core::any::Any;
use core::borrow;
use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hash, Hasher};
use core::heap::{Alloc, Layout};
use core::iter::FusedIterator;
use core::marker::{self, Unpin, Unsize};
use core::mem::{self, Pin};
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@
// - A node of length `n` has `n` keys, `n` values, and (in an internal node) `n + 1` edges.
// This implies that even an empty internal node has at least one edge.

use core::heap::{Alloc, Layout};
use core::marker::PhantomData;
use core::mem;
use core::ptr::{self, Unique, NonNull};
use core::slice;

use boxed::Box;
use heap::{Heap, Alloc, Layout};
use heap::Heap;

const B: usize = 6;
pub const MIN_LEN: usize = B - 1;
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
// except according to those terms.

use core::cmp;
use core::heap::{Alloc, Layout};
use core::mem;
use core::ops::Drop;
use core::ptr::{self, Unique};
use core::slice;
use heap::{Alloc, Layout, Heap};
use heap::Heap;
use super::boxed::Box;
use super::allocator::CollectionAllocErr;
use super::allocator::CollectionAllocErr::*;
Expand Down
3 changes: 2 additions & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ use core::cell::Cell;
use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hash, Hasher};
use core::heap::{Alloc, Layout};
use core::intrinsics::abort;
use core::marker;
use core::marker::{Unsize, PhantomData};
Expand All @@ -259,7 +260,7 @@ use core::ops::CoerceUnsized;
use core::ptr::{self, NonNull};
use core::convert::From;

use heap::{Heap, Alloc, Layout, box_free};
use heap::{Heap, box_free};
use string::String;
use vec::Vec;

Expand Down
4 changes: 1 addition & 3 deletions src/liballoc_jemalloc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
form or name",
issue = "27783")]
#![deny(warnings)]
#![feature(alloc)]
#![feature(alloc_system)]
#![feature(libc)]
#![feature(linkage)]
Expand All @@ -25,7 +24,6 @@
#![cfg_attr(not(dummy_jemalloc), feature(allocator_api))]
#![rustc_alloc_kind = "exe"]

extern crate alloc;
extern crate alloc_system;
extern crate libc;

Expand All @@ -35,7 +33,7 @@ pub use contents::*;
mod contents {
use core::ptr;

use alloc::heap::{Alloc, AllocErr, Layout};
use core::heap::{Alloc, AllocErr, Layout};
use alloc_system::System;
use libc::{c_int, c_void, size_t};

Expand Down
11 changes: 4 additions & 7 deletions src/liballoc_system/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
issue = "32838")]
#![feature(global_allocator)]
#![feature(allocator_api)]
#![feature(alloc)]
#![feature(core_intrinsics)]
#![feature(staged_api)]
#![feature(rustc_attrs)]
Expand All @@ -43,9 +42,7 @@ const MIN_ALIGN: usize = 8;
#[allow(dead_code)]
const MIN_ALIGN: usize = 16;

extern crate alloc;

use self::alloc::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
use core::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};

#[unstable(feature = "allocator_api", issue = "32838")]
pub struct System;
Expand Down Expand Up @@ -125,7 +122,7 @@ mod platform {

use MIN_ALIGN;
use System;
use alloc::heap::{Alloc, AllocErr, Layout};
use core::heap::{Alloc, AllocErr, Layout};

#[unstable(feature = "allocator_api", issue = "32838")]
unsafe impl<'a> Alloc for &'a System {
Expand Down Expand Up @@ -279,7 +276,7 @@ mod platform {

use MIN_ALIGN;
use System;
use alloc::heap::{Alloc, AllocErr, Layout, CannotReallocInPlace};
use core::heap::{Alloc, AllocErr, Layout, CannotReallocInPlace};

type LPVOID = *mut u8;
type HANDLE = LPVOID;
Expand Down Expand Up @@ -491,7 +488,7 @@ mod platform {
mod platform {
extern crate dlmalloc;

use alloc::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
use core::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
use System;
use self::dlmalloc::GlobalDlmalloc;

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/ops/drop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
pub trait Drop {
/// Executes the destructor for this type.
///
/// This method is called implilcitly when the value goes out of scope,
/// This method is called implicitly when the value goes out of scope,
/// and cannot be called explicitly (this is compiler error [E0040]).
/// However, the [`std::mem::drop`] function in the prelude can be
/// used to call the argument's `Drop` implementation.
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/collections/hash/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
use self::Entry::*;
use self::VacantEntryState::*;

use alloc::heap::{Heap, Alloc};
use alloc::heap::Heap;
use alloc::allocator::CollectionAllocErr;
use cell::Cell;
use core::heap::Alloc;
use borrow::Borrow;
use cmp::max;
use fmt::{self, Debug};
Expand Down
3 changes: 2 additions & 1 deletion src/libstd/collections/hash/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

use alloc::heap::{Heap, Alloc, Layout};
use alloc::heap::Heap;
use core::heap::{Alloc, Layout};

use cmp;
use hash::{BuildHasher, Hash, Hasher};
Expand Down
3 changes: 1 addition & 2 deletions src/libstd/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1420,14 +1420,13 @@ pub fn abort() -> ! {
/// Basic usage:
///
/// ```no_run
/// #![feature(getpid)]
/// use std::process;
///
/// println!("My pid is {}", process::id());
/// ```
///
///
#[unstable(feature = "getpid", issue = "44971", reason = "recently added")]
#[stable(feature = "getpid", since = "1.27.0")]
pub fn id() -> u32 {
::sys::os::getpid()
}
Expand Down
7 changes: 7 additions & 0 deletions src/libsyntax/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,13 @@ impl Stmt {
_ => false,
}
}

pub fn is_expr(&self) -> bool {
match self.node {
StmtKind::Expr(_) => true,
_ => false,
}
}
}

impl fmt::Debug for Stmt {
Expand Down
27 changes: 17 additions & 10 deletions src/libsyntax/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,17 +149,24 @@ impl<'a> StripUnconfigured<'a> {
fn visit_expr_attrs(&mut self, attrs: &[ast::Attribute]) {
// flag the offending attributes
for attr in attrs.iter() {
if !self.features.map(|features| features.stmt_expr_attributes).unwrap_or(true) {
let mut err = feature_err(self.sess,
"stmt_expr_attributes",
attr.span,
GateIssue::Language,
EXPLAIN_STMT_ATTR_SYNTAX);
if attr.is_sugared_doc {
err.help("`///` is for documentation comments. For a plain comment, use `//`.");
}
err.emit();
self.maybe_emit_expr_attr_err(attr);
}
}

/// If attributes are not allowed on expressions, emit an error for `attr`
pub fn maybe_emit_expr_attr_err(&self, attr: &ast::Attribute) {
if !self.features.map(|features| features.stmt_expr_attributes).unwrap_or(true) {
let mut err = feature_err(self.sess,
"stmt_expr_attributes",
attr.span,
GateIssue::Language,
EXPLAIN_STMT_ATTR_SYNTAX);

if attr.is_sugared_doc {
err.help("`///` is for documentation comments. For a plain comment, use `//`.");
}

err.emit();
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/libsyntax/edition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,13 @@ impl Edition {
Edition::Edition2018 => "edition_2018",
}
}

pub fn feature_name(&self) -> &'static str {
match *self {
Edition::Edition2015 => "rust_2015_preview",
Edition::Edition2018 => "rust_2018_preview",
}
}
}

impl FromStr for Edition {
Expand Down
8 changes: 8 additions & 0 deletions src/libsyntax/ext/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ pub enum Annotatable {
Item(P<ast::Item>),
TraitItem(P<ast::TraitItem>),
ImplItem(P<ast::ImplItem>),
Stmt(P<ast::Stmt>),
Expr(P<ast::Expr>),
}

impl HasAttrs for Annotatable {
Expand All @@ -46,6 +48,8 @@ impl HasAttrs for Annotatable {
Annotatable::Item(ref item) => &item.attrs,
Annotatable::TraitItem(ref trait_item) => &trait_item.attrs,
Annotatable::ImplItem(ref impl_item) => &impl_item.attrs,
Annotatable::Stmt(ref stmt) => stmt.attrs(),
Annotatable::Expr(ref expr) => &expr.attrs,
}
}

Expand All @@ -54,6 +58,8 @@ impl HasAttrs for Annotatable {
Annotatable::Item(item) => Annotatable::Item(item.map_attrs(f)),
Annotatable::TraitItem(trait_item) => Annotatable::TraitItem(trait_item.map_attrs(f)),
Annotatable::ImplItem(impl_item) => Annotatable::ImplItem(impl_item.map_attrs(f)),
Annotatable::Stmt(stmt) => Annotatable::Stmt(stmt.map_attrs(f)),
Annotatable::Expr(expr) => Annotatable::Expr(expr.map_attrs(f)),
}
}
}
Expand All @@ -64,6 +70,8 @@ impl Annotatable {
Annotatable::Item(ref item) => item.span,
Annotatable::TraitItem(ref trait_item) => trait_item.span,
Annotatable::ImplItem(ref impl_item) => impl_item.span,
Annotatable::Stmt(ref stmt) => stmt.span,
Annotatable::Expr(ref expr) => expr.span,
}
}

Expand Down
Loading

0 comments on commit a64acaa

Please sign in to comment.