Skip to content

Commit ff2a7c8

Browse files
committed
Auto merge of #47644 - GuillaumeGomez:rollup, r=GuillaumeGomez
Rollup of 9 pull requests - Successful merges: #47247, #47334, #47512, #47582, #47595, #47625, #47632, #47633, #47637 - Failed merges:
2 parents 97520cc + dcbf0bf commit ff2a7c8

31 files changed

+1935
-188
lines changed

.mailmap

+3-2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ Boris Egorov <jightuse@gmail.com> <egorov@linux.com>
4141
Brandon Sanderson <singingboyo@gmail.com> Brandon Sanderson <singingboyo@hotmail.com>
4242
Brett Cannon <brett@python.org> Brett Cannon <brettcannon@users.noreply.github.com>
4343
Brian Anderson <banderson@mozilla.com> <andersrb@gmail.com>
44+
Brian Anderson <banderson@mozilla.com> <banderson@mozilla.org>
4445
Brian Dawn <brian.t.dawn@gmail.com>
4546
Brian Leibig <brian@brianleibig.com> Brian Leibig <brian.leibig@gmail.com>
4647
Carl-Anton Ingmarsson <mail@carlanton.se> <ca.ingmarsson@gmail.com>
47-
Carol (Nichols || Goulding) <carol.nichols@gmail.com>
48-
Carol (Nichols || Goulding) <cnichols@thinkthroughmath.com>
48+
Carol (Nichols || Goulding) <carol.nichols@gmail.com> <cnichols@thinkthroughmath.com>
49+
Carol (Nichols || Goulding) <carol.nichols@gmail.com> Carol Nichols <carol.nichols@gmail.com>
4950
Carol Willing <carolcode@willingconsulting.com>
5051
Chris C Cerami <chrisccerami@users.noreply.github.com> Chris C Cerami <chrisccerami@gmail.com>
5152
Chris Pressey <cpressey@gmail.com>

src/bootstrap/channel.rs

-5
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ use config::Config;
2626
// The version number
2727
pub const CFG_RELEASE_NUM: &str = "1.25.0";
2828

29-
// An optional number to put after the label, e.g. '.2' -> '-beta.2'
30-
// Be sure to make this starts with a dot to conform to semver pre-release
31-
// versions (section 9)
32-
pub const CFG_PRERELEASE_VERSION: &str = ".1";
33-
3429
pub struct GitInfo {
3530
inner: Option<Info>,
3631
}

src/bootstrap/dist.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1652,7 +1652,6 @@ fn add_env(build: &Build, cmd: &mut Command, target: Interned<String>) {
16521652
cmd.env("CFG_RELEASE_INFO", build.rust_version())
16531653
.env("CFG_RELEASE_NUM", channel::CFG_RELEASE_NUM)
16541654
.env("CFG_RELEASE", build.rust_release())
1655-
.env("CFG_PRERELEASE_VERSION", channel::CFG_PRERELEASE_VERSION)
16561655
.env("CFG_VER_MAJOR", parts.next().unwrap())
16571656
.env("CFG_VER_MINOR", parts.next().unwrap())
16581657
.env("CFG_VER_PATCH", parts.next().unwrap())

src/bootstrap/lib.rs

+51-2
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ extern crate toml;
134134
#[cfg(unix)]
135135
extern crate libc;
136136

137-
use std::cell::RefCell;
137+
use std::cell::{RefCell, Cell};
138138
use std::collections::{HashSet, HashMap};
139139
use std::env;
140140
use std::fs::{self, File};
@@ -250,6 +250,7 @@ pub struct Build {
250250
is_sudo: bool,
251251
ci_env: CiEnv,
252252
delayed_failures: RefCell<Vec<String>>,
253+
prerelease_version: Cell<Option<u32>>,
253254
}
254255

255256
#[derive(Debug)]
@@ -335,6 +336,7 @@ impl Build {
335336
is_sudo,
336337
ci_env: CiEnv::current(),
337338
delayed_failures: RefCell::new(Vec::new()),
339+
prerelease_version: Cell::new(None),
338340
}
339341
}
340342

@@ -774,12 +776,59 @@ impl Build {
774776
fn release(&self, num: &str) -> String {
775777
match &self.config.channel[..] {
776778
"stable" => num.to_string(),
777-
"beta" => format!("{}-beta{}", num, channel::CFG_PRERELEASE_VERSION),
779+
"beta" => format!("{}-beta.{}", num, self.beta_prerelease_version()),
778780
"nightly" => format!("{}-nightly", num),
779781
_ => format!("{}-dev", num),
780782
}
781783
}
782784

785+
fn beta_prerelease_version(&self) -> u32 {
786+
if let Some(s) = self.prerelease_version.get() {
787+
return s
788+
}
789+
790+
let beta = output(
791+
Command::new("git")
792+
.arg("ls-remote")
793+
.arg("origin")
794+
.arg("beta")
795+
.current_dir(&self.src)
796+
);
797+
let beta = beta.trim().split_whitespace().next().unwrap();
798+
let master = output(
799+
Command::new("git")
800+
.arg("ls-remote")
801+
.arg("origin")
802+
.arg("master")
803+
.current_dir(&self.src)
804+
);
805+
let master = master.trim().split_whitespace().next().unwrap();
806+
807+
// Figure out where the current beta branch started.
808+
let base = output(
809+
Command::new("git")
810+
.arg("merge-base")
811+
.arg(beta)
812+
.arg(master)
813+
.current_dir(&self.src),
814+
);
815+
let base = base.trim();
816+
817+
// Next figure out how many merge commits happened since we branched off
818+
// beta. That's our beta number!
819+
let count = output(
820+
Command::new("git")
821+
.arg("rev-list")
822+
.arg("--count")
823+
.arg("--merges")
824+
.arg(format!("{}...HEAD", base))
825+
.current_dir(&self.src),
826+
);
827+
let n = count.trim().parse().unwrap();
828+
self.prerelease_version.set(Some(n));
829+
n
830+
}
831+
783832
/// Returns the value of `release` above for Rust itself.
784833
fn rust_release(&self) -> String {
785834
self.release(channel::CFG_RELEASE_NUM)

src/ci/init_repo.sh

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ fi
3636
rm -rf "$CACHE_DIR"
3737
mkdir "$CACHE_DIR"
3838

39+
# On the beta channel we'll be automatically calculating the prerelease version
40+
# via the git history, so unshallow our shallow clone from CI.
41+
if grep -q RUST_RELEASE_CHANNEL=beta src/ci/run.sh; then
42+
git fetch origin --unshallow beta master
43+
fi
44+
3945
travis_fold start update_cache
4046
travis_time_start
4147

src/liballoc/btree/set.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -658,26 +658,26 @@ impl<T: Ord> BTreeSet<T> {
658658
/// Basic usage:
659659
///
660660
/// ```
661-
/// use std::collections::BTreeMap;
661+
/// use std::collections::BTreeSet;
662662
///
663-
/// let mut a = BTreeMap::new();
664-
/// a.insert(1, "a");
665-
/// a.insert(2, "b");
666-
/// a.insert(3, "c");
667-
/// a.insert(17, "d");
668-
/// a.insert(41, "e");
663+
/// let mut a = BTreeSet::new();
664+
/// a.insert(1);
665+
/// a.insert(2);
666+
/// a.insert(3);
667+
/// a.insert(17);
668+
/// a.insert(41);
669669
///
670670
/// let b = a.split_off(&3);
671671
///
672672
/// assert_eq!(a.len(), 2);
673673
/// assert_eq!(b.len(), 3);
674674
///
675-
/// assert_eq!(a[&1], "a");
676-
/// assert_eq!(a[&2], "b");
675+
/// assert!(a.contains(&1));
676+
/// assert!(a.contains(&2));
677677
///
678-
/// assert_eq!(b[&3], "c");
679-
/// assert_eq!(b[&17], "d");
680-
/// assert_eq!(b[&41], "e");
678+
/// assert!(b.contains(&3));
679+
/// assert!(b.contains(&17));
680+
/// assert!(b.contains(&41));
681681
/// ```
682682
#[stable(feature = "btree_split_off", since = "1.11.0")]
683683
pub fn split_off<Q: ?Sized + Ord>(&mut self, key: &Q) -> Self where T: Borrow<Q> {

src/liballoc/slice.rs

+8
Original file line numberDiff line numberDiff line change
@@ -630,6 +630,8 @@ impl<T> [T] {
630630
/// assert_eq!(iter.next().unwrap(), &['m']);
631631
/// assert!(iter.next().is_none());
632632
/// ```
633+
///
634+
/// [`exact_chunks`]: #method.exact_chunks
633635
#[stable(feature = "rust1", since = "1.0.0")]
634636
#[inline]
635637
pub fn chunks(&self, chunk_size: usize) -> Chunks<T> {
@@ -660,6 +662,8 @@ impl<T> [T] {
660662
/// assert_eq!(iter.next().unwrap(), &['r', 'e']);
661663
/// assert!(iter.next().is_none());
662664
/// ```
665+
///
666+
/// [`chunks`]: #method.chunks
663667
#[unstable(feature = "exact_chunks", issue = "47115")]
664668
#[inline]
665669
pub fn exact_chunks(&self, chunk_size: usize) -> ExactChunks<T> {
@@ -692,6 +696,8 @@ impl<T> [T] {
692696
/// }
693697
/// assert_eq!(v, &[1, 1, 2, 2, 3]);
694698
/// ```
699+
///
700+
/// [`exact_chunks_mut`]: #method.exact_chunks_mut
695701
#[stable(feature = "rust1", since = "1.0.0")]
696702
#[inline]
697703
pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<T> {
@@ -728,6 +734,8 @@ impl<T> [T] {
728734
/// }
729735
/// assert_eq!(v, &[1, 1, 2, 2, 0]);
730736
/// ```
737+
///
738+
/// [`chunks_mut`]: #method.chunks_mut
731739
#[unstable(feature = "exact_chunks", issue = "47115")]
732740
#[inline]
733741
pub fn exact_chunks_mut(&mut self, chunk_size: usize) -> ExactChunksMut<T> {

src/liballoc/vec_deque.rs

+8-7
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ impl<T> VecDeque<T> {
906906
}
907907
}
908908

909-
/// Clears the buffer, removing all values.
909+
/// Clears the `VecDeque`, removing all values.
910910
///
911911
/// # Examples
912912
///
@@ -1624,18 +1624,18 @@ impl<T> VecDeque<T> {
16241624
return elem;
16251625
}
16261626

1627-
/// Splits the collection into two at the given index.
1627+
/// Splits the `VecDeque` into two at the given index.
16281628
///
1629-
/// Returns a newly allocated `Self`. `self` contains elements `[0, at)`,
1630-
/// and the returned `Self` contains elements `[at, len)`.
1629+
/// Returns a newly allocated `VecDeque`. `self` contains elements `[0, at)`,
1630+
/// and the returned `VecDeque` contains elements `[at, len)`.
16311631
///
16321632
/// Note that the capacity of `self` does not change.
16331633
///
16341634
/// Element at index 0 is the front of the queue.
16351635
///
16361636
/// # Panics
16371637
///
1638-
/// Panics if `at > len`
1638+
/// Panics if `at > len`.
16391639
///
16401640
/// # Examples
16411641
///
@@ -1815,7 +1815,8 @@ impl<T> VecDeque<T> {
18151815

18161816
impl<T: Clone> VecDeque<T> {
18171817
/// Modifies the `VecDeque` in-place so that `len()` is equal to new_len,
1818-
/// either by removing excess elements or by appending clones of `value` to the back.
1818+
/// either by removing excess elements from the back or by appending clones of `value`
1819+
/// to the back.
18191820
///
18201821
/// # Examples
18211822
///
@@ -2390,7 +2391,7 @@ impl<T> IntoIterator for VecDeque<T> {
23902391
type Item = T;
23912392
type IntoIter = IntoIter<T>;
23922393

2393-
/// Consumes the list into a front-to-back iterator yielding elements by
2394+
/// Consumes the `VecDeque` into a front-to-back iterator yielding elements by
23942395
/// value.
23952396
fn into_iter(self) -> IntoIter<T> {
23962397
IntoIter { inner: self }

src/librustc/hir/lowering.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -2046,7 +2046,8 @@ impl<'a> LoweringContext<'a> {
20462046
};
20472047

20482048
// Correctly resolve `self` imports
2049-
if path.segments.last().unwrap().identifier.name == keywords::SelfValue.name() {
2049+
if path.segments.len() > 1 &&
2050+
path.segments.last().unwrap().identifier.name == keywords::SelfValue.name() {
20502051
let _ = path.segments.pop();
20512052
if ident.name == keywords::SelfValue.name() {
20522053
*name = path.segments.last().unwrap().identifier.name;

src/librustc/hir/mod.rs

+63-1
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,14 @@ use util::nodemap::{NodeMap, FxHashSet};
3434
use syntax_pos::{Span, DUMMY_SP};
3535
use syntax::codemap::{self, Spanned};
3636
use syntax::abi::Abi;
37-
use syntax::ast::{Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
37+
use syntax::ast::{self, Ident, Name, NodeId, DUMMY_NODE_ID, AsmDialect};
3838
use syntax::ast::{Attribute, Lit, StrStyle, FloatTy, IntTy, UintTy, MetaItem};
3939
use syntax::ext::hygiene::SyntaxContext;
4040
use syntax::ptr::P;
4141
use syntax::symbol::{Symbol, keywords};
4242
use syntax::tokenstream::TokenStream;
4343
use syntax::util::ThinVec;
44+
use syntax::util::parser::ExprPrecedence;
4445
use ty::AdtKind;
4546

4647
use rustc_data_structures::indexed_vec;
@@ -958,6 +959,31 @@ impl BinOp_ {
958959
}
959960
}
960961

962+
impl Into<ast::BinOpKind> for BinOp_ {
963+
fn into(self) -> ast::BinOpKind {
964+
match self {
965+
BiAdd => ast::BinOpKind::Add,
966+
BiSub => ast::BinOpKind::Sub,
967+
BiMul => ast::BinOpKind::Mul,
968+
BiDiv => ast::BinOpKind::Div,
969+
BiRem => ast::BinOpKind::Rem,
970+
BiAnd => ast::BinOpKind::And,
971+
BiOr => ast::BinOpKind::Or,
972+
BiBitXor => ast::BinOpKind::BitXor,
973+
BiBitAnd => ast::BinOpKind::BitAnd,
974+
BiBitOr => ast::BinOpKind::BitOr,
975+
BiShl => ast::BinOpKind::Shl,
976+
BiShr => ast::BinOpKind::Shr,
977+
BiEq => ast::BinOpKind::Eq,
978+
BiLt => ast::BinOpKind::Lt,
979+
BiLe => ast::BinOpKind::Le,
980+
BiNe => ast::BinOpKind::Ne,
981+
BiGe => ast::BinOpKind::Ge,
982+
BiGt => ast::BinOpKind::Gt,
983+
}
984+
}
985+
}
986+
961987
pub type BinOp = Spanned<BinOp_>;
962988

963989
#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Debug, Copy)]
@@ -1166,6 +1192,42 @@ pub struct Expr {
11661192
pub hir_id: HirId,
11671193
}
11681194

1195+
impl Expr {
1196+
pub fn precedence(&self) -> ExprPrecedence {
1197+
match self.node {
1198+
ExprBox(_) => ExprPrecedence::Box,
1199+
ExprArray(_) => ExprPrecedence::Array,
1200+
ExprCall(..) => ExprPrecedence::Call,
1201+
ExprMethodCall(..) => ExprPrecedence::MethodCall,
1202+
ExprTup(_) => ExprPrecedence::Tup,
1203+
ExprBinary(op, ..) => ExprPrecedence::Binary(op.node.into()),
1204+
ExprUnary(..) => ExprPrecedence::Unary,
1205+
ExprLit(_) => ExprPrecedence::Lit,
1206+
ExprType(..) | ExprCast(..) => ExprPrecedence::Cast,
1207+
ExprIf(..) => ExprPrecedence::If,
1208+
ExprWhile(..) => ExprPrecedence::While,
1209+
ExprLoop(..) => ExprPrecedence::Loop,
1210+
ExprMatch(..) => ExprPrecedence::Match,
1211+
ExprClosure(..) => ExprPrecedence::Closure,
1212+
ExprBlock(..) => ExprPrecedence::Block,
1213+
ExprAssign(..) => ExprPrecedence::Assign,
1214+
ExprAssignOp(..) => ExprPrecedence::AssignOp,
1215+
ExprField(..) => ExprPrecedence::Field,
1216+
ExprTupField(..) => ExprPrecedence::TupField,
1217+
ExprIndex(..) => ExprPrecedence::Index,
1218+
ExprPath(..) => ExprPrecedence::Path,
1219+
ExprAddrOf(..) => ExprPrecedence::AddrOf,
1220+
ExprBreak(..) => ExprPrecedence::Break,
1221+
ExprAgain(..) => ExprPrecedence::Continue,
1222+
ExprRet(..) => ExprPrecedence::Ret,
1223+
ExprInlineAsm(..) => ExprPrecedence::InlineAsm,
1224+
ExprStruct(..) => ExprPrecedence::Struct,
1225+
ExprRepeat(..) => ExprPrecedence::Repeat,
1226+
ExprYield(..) => ExprPrecedence::Yield,
1227+
}
1228+
}
1229+
}
1230+
11691231
impl fmt::Debug for Expr {
11701232
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
11711233
write!(f, "expr({}: {})", self.id,

0 commit comments

Comments
 (0)