Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #40840

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
9768ef5
rustc: add a TyLayout helper for type-related layout queries.
eddyb Feb 28, 2017
03ce886
rustc_trans: avoid sizing_type_of everywhere possible.
eddyb Mar 2, 2017
b957df0
rustc: add some abstractions to ty::layout for a more concise API.
eddyb Mar 10, 2017
6ac00de
rustc_trans: use ty::layout for ABI computation instead of LLVM types.
eddyb Mar 10, 2017
c2b44a3
rustbuild: Update bootstrap compiler
alexcrichton Mar 14, 2017
b470354
Update cargo submodule
alexcrichton Mar 23, 2017
50c4222
Move `syntax::ext::hygiene` to `syntax_pos::hygiene`.
jseyfried Mar 16, 2017
074a3c4
Remove code in `syntax::codemap`.
jseyfried Mar 16, 2017
da3ad47
Merge `ExpnId` and `SyntaxContext`.
jseyfried Mar 17, 2017
8c49446
Refactor how spans are combined in the parser.
jseyfried Mar 15, 2017
8b92255
Don't stutter in operator descriptions #29365
theotherphil Mar 25, 2017
33a6a07
FromStr implementation example
donniebishop Mar 25, 2017
64cd0be
Remove trailing whitespace
donniebishop Mar 25, 2017
fb5e63f
Change `try!` to `?`
donniebishop Mar 25, 2017
9ae3735
Rollup merge of #40524 - alexcrichton:update-bootstrap, r=brson
frewsxcv Mar 26, 2017
e351a87
Rollup merge of #40597 - jseyfried:improve_span_expn_info, r=nrc
frewsxcv Mar 26, 2017
846f504
Rollup merge of #40658 - eddyb:lay-more-out, r=arielb1
frewsxcv Mar 26, 2017
c56bfed
Rollup merge of #40778 - alexcrichton:update-cargo, r=alexcrichton
frewsxcv Mar 26, 2017
24b40a6
Rollup merge of #40818 - theotherphil:master, r=steveklabnik
frewsxcv Mar 26, 2017
2d01cfb
Rollup merge of #40824 - donniebishop:fromstr_docexample, r=steveklabnik
frewsxcv Mar 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,8 @@ class RustBuild(object):
def download_stage0(self):
cache_dst = os.path.join(self.build_dir, "cache")
rustc_cache = os.path.join(cache_dst, self.stage0_rustc_date())
cargo_cache = os.path.join(cache_dst, self.stage0_cargo_rev())
if not os.path.exists(rustc_cache):
os.makedirs(rustc_cache)
if not os.path.exists(cargo_cache):
os.makedirs(cargo_cache)

if self.rustc().startswith(self.bin_root()) and \
(not os.path.exists(self.rustc()) or self.rustc_out_of_date()):
Expand Down Expand Up @@ -195,15 +192,15 @@ def download_stage0(self):
if self.cargo().startswith(self.bin_root()) and \
(not os.path.exists(self.cargo()) or self.cargo_out_of_date()):
self.print_what_it_means_to_bootstrap()
filename = "cargo-nightly-{}.tar.gz".format(self.build)
url = "https://s3.amazonaws.com/rust-lang-ci/cargo-builds/" + self.stage0_cargo_rev()
tarball = os.path.join(cargo_cache, filename)
filename = "cargo-{}-{}.tar.gz".format(channel, self.build)
url = "https://static.rust-lang.org/dist/" + self.stage0_rustc_date()
tarball = os.path.join(rustc_cache, filename)
if not os.path.exists(tarball):
get("{}/{}".format(url, filename), tarball, verbose=self.verbose)
unpack(tarball, self.bin_root(), match="cargo", verbose=self.verbose)
self.fix_executable(self.bin_root() + "/bin/cargo")
with open(self.cargo_stamp(), 'w') as f:
f.write(self.stage0_cargo_rev())
f.write(self.stage0_rustc_date())

def fix_executable(self, fname):
# If we're on NixOS we need to change the path to the dynamic loader
Expand Down Expand Up @@ -258,9 +255,6 @@ def fix_executable(self, fname):
print("warning: failed to call patchelf: %s" % e)
return

def stage0_cargo_rev(self):
return self._cargo_rev

def stage0_rustc_date(self):
return self._rustc_date

Expand All @@ -283,7 +277,7 @@ def cargo_out_of_date(self):
if not os.path.exists(self.cargo_stamp()) or self.clean:
return True
with open(self.cargo_stamp(), 'r') as f:
return self.stage0_cargo_rev() != f.read()
return self.stage0_rustc_date() != f.read()

def bin_root(self):
return os.path.join(self.build_dir, self.build, "stage0")
Expand Down Expand Up @@ -578,7 +572,6 @@ def bootstrap():

data = stage0_data(rb.rust_root)
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
rb._cargo_rev = data['cargo']

# Fetch/build the bootstrap
rb.build = rb.build_triple()
Expand Down
2 changes: 1 addition & 1 deletion src/bootstrap/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use build_helper::output;
use Build;

// The version number
pub const CFG_RELEASE_NUM: &'static str = "1.17.0";
pub const CFG_RELEASE_NUM: &'static str = "1.18.0";

// An optional number to put after the label, e.g. '.2' -> '-beta.2'
// Be sure to make this starts with a dot to conform to semver pre-release
Expand Down
44 changes: 22 additions & 22 deletions src/libcore/ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ pub trait Drop {
fn drop(&mut self);
}

/// The `Add` trait is used to specify the functionality of `+`.
/// The addition operator `+`.
///
/// # Examples
///
Expand Down Expand Up @@ -269,7 +269,7 @@ macro_rules! add_impl {

add_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `Sub` trait is used to specify the functionality of `-`.
/// The subtraction operator `-`.
///
/// # Examples
///
Expand Down Expand Up @@ -342,7 +342,7 @@ macro_rules! sub_impl {

sub_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `Mul` trait is used to specify the functionality of `*`.
/// The multiplication operator `*`.
///
/// # Examples
///
Expand Down Expand Up @@ -464,7 +464,7 @@ macro_rules! mul_impl {

mul_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `Div` trait is used to specify the functionality of `/`.
/// The division operator `/`.
///
/// # Examples
///
Expand Down Expand Up @@ -609,7 +609,7 @@ macro_rules! div_impl_float {

div_impl_float! { f32 f64 }

/// The `Rem` trait is used to specify the functionality of `%`.
/// The remainder operator `%`.
///
/// # Examples
///
Expand Down Expand Up @@ -689,7 +689,7 @@ macro_rules! rem_impl_float {

rem_impl_float! { f32 f64 }

/// The `Neg` trait is used to specify the functionality of unary `-`.
/// The unary negation operator `-`.
///
/// # Examples
///
Expand Down Expand Up @@ -768,7 +768,7 @@ macro_rules! neg_impl_unsigned {
// neg_impl_unsigned! { usize u8 u16 u32 u64 }
neg_impl_numeric! { isize i8 i16 i32 i64 i128 f32 f64 }

/// The `Not` trait is used to specify the functionality of unary `!`.
/// The unary logical negation operator `!`.
///
/// # Examples
///
Expand Down Expand Up @@ -826,7 +826,7 @@ macro_rules! not_impl {

not_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `BitAnd` trait is used to specify the functionality of `&`.
/// The bitwise AND operator `&`.
///
/// # Examples
///
Expand Down Expand Up @@ -909,7 +909,7 @@ macro_rules! bitand_impl {

bitand_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `BitOr` trait is used to specify the functionality of `|`.
/// The bitwise OR operator `|`.
///
/// # Examples
///
Expand Down Expand Up @@ -992,7 +992,7 @@ macro_rules! bitor_impl {

bitor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `BitXor` trait is used to specify the functionality of `^`.
/// The bitwise XOR operator `^`.
///
/// # Examples
///
Expand Down Expand Up @@ -1078,7 +1078,7 @@ macro_rules! bitxor_impl {

bitxor_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `Shl` trait is used to specify the functionality of `<<`.
/// The left shift operator `<<`.
///
/// # Examples
///
Expand Down Expand Up @@ -1181,7 +1181,7 @@ macro_rules! shl_impl_all {

shl_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 isize i128 }

/// The `Shr` trait is used to specify the functionality of `>>`.
/// The right shift operator `>>`.
///
/// # Examples
///
Expand Down Expand Up @@ -1284,7 +1284,7 @@ macro_rules! shr_impl_all {

shr_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }

/// The `AddAssign` trait is used to specify the functionality of `+=`.
/// The addition assignment operator `+=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1340,7 +1340,7 @@ macro_rules! add_assign_impl {

add_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `SubAssign` trait is used to specify the functionality of `-=`.
/// The subtraction assignment operator `-=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1396,7 +1396,7 @@ macro_rules! sub_assign_impl {

sub_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `MulAssign` trait is used to specify the functionality of `*=`.
/// The multiplication assignment operator `*=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1441,7 +1441,7 @@ macro_rules! mul_assign_impl {

mul_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `DivAssign` trait is used to specify the functionality of `/=`.
/// The division assignment operator `/=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1485,7 +1485,7 @@ macro_rules! div_assign_impl {

div_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `RemAssign` trait is used to specify the functionality of `%=`.
/// The remainder assignment operator `%=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1529,7 +1529,7 @@ macro_rules! rem_assign_impl {

rem_assign_impl! { usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64 }

/// The `BitAndAssign` trait is used to specify the functionality of `&=`.
/// The bitwise AND assignment operator `&=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1615,7 +1615,7 @@ macro_rules! bitand_assign_impl {

bitand_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `BitOrAssign` trait is used to specify the functionality of `|=`.
/// The bitwise OR assignment operator `|=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1659,7 +1659,7 @@ macro_rules! bitor_assign_impl {

bitor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `BitXorAssign` trait is used to specify the functionality of `^=`.
/// The bitwise XOR assignment operator `^=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1703,7 +1703,7 @@ macro_rules! bitxor_assign_impl {

bitxor_assign_impl! { bool usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 }

/// The `ShlAssign` trait is used to specify the functionality of `<<=`.
/// The left shift assignment operator `<<=`.
///
/// # Examples
///
Expand Down Expand Up @@ -1768,7 +1768,7 @@ macro_rules! shl_assign_impl_all {

shl_assign_impl_all! { u8 u16 u32 u64 u128 usize i8 i16 i32 i64 i128 isize }

/// The `ShrAssign` trait is used to specify the functionality of `>>=`.
/// The right shift assignment operator `>>=`.
///
/// # Examples
///
Expand Down
33 changes: 33 additions & 0 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,39 @@ pub mod pattern;
/// [`from_str`]: #tymethod.from_str
/// [`str`]: ../../std/primitive.str.html
/// [`parse`]: ../../std/primitive.str.html#method.parse
///
/// # Examples
///
/// Basic implementation of `FromStr` on an example `Point` type:
///
/// ```
/// use std::str::FromStr;
/// use std::num::ParseIntError;
///
/// #[derive(Debug, PartialEq)]
/// struct Point {
/// x: i32,
/// y: i32
/// }
///
/// impl FromStr for Point {
/// type Err = ParseIntError;
///
/// fn from_str(s: &str) -> Result<Self, Self::Err> {
/// let coords: Vec<&str> = s.trim_matches(|p| p == '(' || p == ')' )
/// .split(",")
/// .collect();
///
/// let x_fromstr = coords[0].parse::<i32>()?;
/// let y_fromstr = coords[1].parse::<i32>()?;
///
/// Ok(Point { x: x_fromstr, y: y_fromstr })
/// }
/// }
///
/// let p = Point::from_str("(1,2)");
/// assert_eq!(p.unwrap(), Point{ x: 1, y: 2} )
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub trait FromStr: Sized {
/// The associated error which can be returned from parsing.
Expand Down
7 changes: 5 additions & 2 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ use std::mem;
use syntax::attr;
use syntax::ast::*;
use syntax::errors;
use syntax::ext::hygiene::{Mark, SyntaxContext};
use syntax::ptr::P;
use syntax::codemap::{self, respan, Spanned};
use syntax::std_inject;
Expand Down Expand Up @@ -392,14 +393,16 @@ impl<'a> LoweringContext<'a> {
}

fn allow_internal_unstable(&self, reason: &'static str, mut span: Span) -> Span {
span.expn_id = self.sess.codemap().record_expansion(codemap::ExpnInfo {
let mark = Mark::fresh();
mark.set_expn_info(codemap::ExpnInfo {
call_site: span,
callee: codemap::NameAndSpan {
format: codemap::CompilerDesugaring(Symbol::intern(reason)),
span: Some(span),
allow_internal_unstable: true,
},
});
span.ctxt = SyntaxContext::empty().apply_mark(mark);
span
}

Expand Down Expand Up @@ -1998,7 +2001,7 @@ impl<'a> LoweringContext<'a> {
volatile: asm.volatile,
alignstack: asm.alignstack,
dialect: asm.dialect,
expn_id: asm.expn_id,
ctxt: asm.ctxt,
};
let outputs =
asm.outputs.iter().map(|out| self.lower_expr(&out.expr)).collect();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/hir/map/def_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl<'a> DefCollector<'a> {
fn visit_macro_invoc(&mut self, id: NodeId, const_expr: bool) {
if let Some(ref mut visit) = self.visit_macro_invoc {
visit(MacroInvocationData {
mark: Mark::from_placeholder_id(id),
mark: id.placeholder_to_mark(),
const_expr: const_expr,
def_index: self.parent_def.unwrap(),
})
Expand Down
5 changes: 3 additions & 2 deletions src/librustc/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ use hir::def::Def;
use hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX};
use util::nodemap::{NodeMap, FxHashSet};

use syntax_pos::{Span, ExpnId, DUMMY_SP};
use syntax_pos::{Span, DUMMY_SP};
use syntax::codemap::{self, Spanned};
use syntax::abi::Abi;
use syntax::ast::{Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
use syntax::ext::hygiene::SyntaxContext;
use syntax::ptr::P;
use syntax::symbol::{Symbol, keywords};
use syntax::tokenstream::TokenStream;
Expand Down Expand Up @@ -1367,7 +1368,7 @@ pub struct InlineAsm {
pub volatile: bool,
pub alignstack: bool,
pub dialect: AsmDialect,
pub expn_id: ExpnId,
pub ctxt: SyntaxContext,
}

/// represents an argument in a function header
Expand Down
4 changes: 0 additions & 4 deletions src/librustc/ich/caching_codemap_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ impl<'tcx> CachingCodemapView<'tcx> {
}
}

pub fn codemap(&self) -> &'tcx CodeMap {
self.codemap
}

pub fn byte_pos_to_line_and_col(&mut self,
pos: BytePos)
-> Option<(Rc<FileMap>, usize, BytePos)> {
Expand Down
1 change: 0 additions & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#![feature(conservative_impl_trait)]
#![feature(const_fn)]
#![feature(core_intrinsics)]
#![cfg_attr(stage0,feature(field_init_shorthand))]
#![feature(i128_type)]
#![feature(libc)]
#![feature(loop_break_value)]
Expand Down
Loading