Skip to content

Commit a64acaa

Browse files
committed
Merge remote-tracking branch 'upstream/master' into string-splice-stabilize
2 parents 196b142 + 5ee891c commit a64acaa

File tree

32 files changed

+577
-232
lines changed

32 files changed

+577
-232
lines changed

src/Cargo.lock

+185-164
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bootstrap/channel.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use Build;
2424
use config::Config;
2525

2626
// The version number
27-
pub const CFG_RELEASE_NUM: &str = "1.26.0";
27+
pub const CFG_RELEASE_NUM: &str = "1.27.0";
2828

2929
pub struct GitInfo {
3030
inner: Option<Info>,

src/liballoc/arc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use core::sync::atomic::Ordering::{Acquire, Relaxed, Release, SeqCst};
2121
use core::borrow;
2222
use core::fmt;
2323
use core::cmp::Ordering;
24+
use core::heap::{Alloc, Layout};
2425
use core::intrinsics::abort;
2526
use core::mem::{self, align_of_val, size_of_val, uninitialized};
2627
use core::ops::Deref;
@@ -31,7 +32,7 @@ use core::hash::{Hash, Hasher};
3132
use core::{isize, usize};
3233
use core::convert::From;
3334

34-
use heap::{Heap, Alloc, Layout, box_free};
35+
use heap::{Heap, box_free};
3536
use boxed::Box;
3637
use string::String;
3738
use vec::Vec;

src/liballoc/boxed.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@
5555
5656
#![stable(feature = "rust1", since = "1.0.0")]
5757

58-
use heap::{Heap, Layout, Alloc};
58+
use heap::Heap;
5959
use raw_vec::RawVec;
6060

6161
use core::any::Any;
6262
use core::borrow;
6363
use core::cmp::Ordering;
6464
use core::fmt;
6565
use core::hash::{Hash, Hasher};
66+
use core::heap::{Alloc, Layout};
6667
use core::iter::FusedIterator;
6768
use core::marker::{self, Unpin, Unsize};
6869
use core::mem::{self, Pin};

src/liballoc/btree/node.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@
4141
// - A node of length `n` has `n` keys, `n` values, and (in an internal node) `n + 1` edges.
4242
// This implies that even an empty internal node has at least one edge.
4343

44+
use core::heap::{Alloc, Layout};
4445
use core::marker::PhantomData;
4546
use core::mem;
4647
use core::ptr::{self, Unique, NonNull};
4748
use core::slice;
4849

4950
use boxed::Box;
50-
use heap::{Heap, Alloc, Layout};
51+
use heap::Heap;
5152

5253
const B: usize = 6;
5354
pub const MIN_LEN: usize = B - 1;

src/liballoc/raw_vec.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@
99
// except according to those terms.
1010

1111
use core::cmp;
12+
use core::heap::{Alloc, Layout};
1213
use core::mem;
1314
use core::ops::Drop;
1415
use core::ptr::{self, Unique};
1516
use core::slice;
16-
use heap::{Alloc, Layout, Heap};
17+
use heap::Heap;
1718
use super::boxed::Box;
1819
use super::allocator::CollectionAllocErr;
1920
use super::allocator::CollectionAllocErr::*;

src/liballoc/rc.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ use core::cell::Cell;
250250
use core::cmp::Ordering;
251251
use core::fmt;
252252
use core::hash::{Hash, Hasher};
253+
use core::heap::{Alloc, Layout};
253254
use core::intrinsics::abort;
254255
use core::marker;
255256
use core::marker::{Unsize, PhantomData};
@@ -259,7 +260,7 @@ use core::ops::CoerceUnsized;
259260
use core::ptr::{self, NonNull};
260261
use core::convert::From;
261262

262-
use heap::{Heap, Alloc, Layout, box_free};
263+
use heap::{Heap, box_free};
263264
use string::String;
264265
use vec::Vec;
265266

src/liballoc_jemalloc/lib.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
form or name",
1616
issue = "27783")]
1717
#![deny(warnings)]
18-
#![feature(alloc)]
1918
#![feature(alloc_system)]
2019
#![feature(libc)]
2120
#![feature(linkage)]
@@ -25,7 +24,6 @@
2524
#![cfg_attr(not(dummy_jemalloc), feature(allocator_api))]
2625
#![rustc_alloc_kind = "exe"]
2726

28-
extern crate alloc;
2927
extern crate alloc_system;
3028
extern crate libc;
3129

@@ -35,7 +33,7 @@ pub use contents::*;
3533
mod contents {
3634
use core::ptr;
3735

38-
use alloc::heap::{Alloc, AllocErr, Layout};
36+
use core::heap::{Alloc, AllocErr, Layout};
3937
use alloc_system::System;
4038
use libc::{c_int, c_void, size_t};
4139

src/liballoc_system/lib.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
issue = "32838")]
1818
#![feature(global_allocator)]
1919
#![feature(allocator_api)]
20-
#![feature(alloc)]
2120
#![feature(core_intrinsics)]
2221
#![feature(staged_api)]
2322
#![feature(rustc_attrs)]
@@ -43,9 +42,7 @@ const MIN_ALIGN: usize = 8;
4342
#[allow(dead_code)]
4443
const MIN_ALIGN: usize = 16;
4544

46-
extern crate alloc;
47-
48-
use self::alloc::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
45+
use core::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
4946

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

126123
use MIN_ALIGN;
127124
use System;
128-
use alloc::heap::{Alloc, AllocErr, Layout};
125+
use core::heap::{Alloc, AllocErr, Layout};
129126

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

280277
use MIN_ALIGN;
281278
use System;
282-
use alloc::heap::{Alloc, AllocErr, Layout, CannotReallocInPlace};
279+
use core::heap::{Alloc, AllocErr, Layout, CannotReallocInPlace};
283280

284281
type LPVOID = *mut u8;
285282
type HANDLE = LPVOID;
@@ -491,7 +488,7 @@ mod platform {
491488
mod platform {
492489
extern crate dlmalloc;
493490

494-
use alloc::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
491+
use core::heap::{Alloc, AllocErr, Layout, Excess, CannotReallocInPlace};
495492
use System;
496493
use self::dlmalloc::GlobalDlmalloc;
497494

src/libcore/ops/drop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
pub trait Drop {
9696
/// Executes the destructor for this type.
9797
///
98-
/// This method is called implilcitly when the value goes out of scope,
98+
/// This method is called implicitly when the value goes out of scope,
9999
/// and cannot be called explicitly (this is compiler error [E0040]).
100100
/// However, the [`std::mem::drop`] function in the prelude can be
101101
/// used to call the argument's `Drop` implementation.

src/libstd/collections/hash/map.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
use self::Entry::*;
1212
use self::VacantEntryState::*;
1313

14-
use alloc::heap::{Heap, Alloc};
14+
use alloc::heap::Heap;
1515
use alloc::allocator::CollectionAllocErr;
1616
use cell::Cell;
17+
use core::heap::Alloc;
1718
use borrow::Borrow;
1819
use cmp::max;
1920
use fmt::{self, Debug};

src/libstd/collections/hash/table.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
use alloc::heap::{Heap, Alloc, Layout};
11+
use alloc::heap::Heap;
12+
use core::heap::{Alloc, Layout};
1213

1314
use cmp;
1415
use hash::{BuildHasher, Hash, Hasher};

src/libstd/process.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -1420,14 +1420,13 @@ pub fn abort() -> ! {
14201420
/// Basic usage:
14211421
///
14221422
/// ```no_run
1423-
/// #![feature(getpid)]
14241423
/// use std::process;
14251424
///
14261425
/// println!("My pid is {}", process::id());
14271426
/// ```
14281427
///
14291428
///
1430-
#[unstable(feature = "getpid", issue = "44971", reason = "recently added")]
1429+
#[stable(feature = "getpid", since = "1.27.0")]
14311430
pub fn id() -> u32 {
14321431
::sys::os::getpid()
14331432
}

src/libsyntax/ast.rs

+7
Original file line numberDiff line numberDiff line change
@@ -837,6 +837,13 @@ impl Stmt {
837837
_ => false,
838838
}
839839
}
840+
841+
pub fn is_expr(&self) -> bool {
842+
match self.node {
843+
StmtKind::Expr(_) => true,
844+
_ => false,
845+
}
846+
}
840847
}
841848

842849
impl fmt::Debug for Stmt {

src/libsyntax/config.rs

+17-10
Original file line numberDiff line numberDiff line change
@@ -149,17 +149,24 @@ impl<'a> StripUnconfigured<'a> {
149149
fn visit_expr_attrs(&mut self, attrs: &[ast::Attribute]) {
150150
// flag the offending attributes
151151
for attr in attrs.iter() {
152-
if !self.features.map(|features| features.stmt_expr_attributes).unwrap_or(true) {
153-
let mut err = feature_err(self.sess,
154-
"stmt_expr_attributes",
155-
attr.span,
156-
GateIssue::Language,
157-
EXPLAIN_STMT_ATTR_SYNTAX);
158-
if attr.is_sugared_doc {
159-
err.help("`///` is for documentation comments. For a plain comment, use `//`.");
160-
}
161-
err.emit();
152+
self.maybe_emit_expr_attr_err(attr);
153+
}
154+
}
155+
156+
/// If attributes are not allowed on expressions, emit an error for `attr`
157+
pub fn maybe_emit_expr_attr_err(&self, attr: &ast::Attribute) {
158+
if !self.features.map(|features| features.stmt_expr_attributes).unwrap_or(true) {
159+
let mut err = feature_err(self.sess,
160+
"stmt_expr_attributes",
161+
attr.span,
162+
GateIssue::Language,
163+
EXPLAIN_STMT_ATTR_SYNTAX);
164+
165+
if attr.is_sugared_doc {
166+
err.help("`///` is for documentation comments. For a plain comment, use `//`.");
162167
}
168+
169+
err.emit();
163170
}
164171
}
165172

src/libsyntax/edition.rs

+7
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,13 @@ impl Edition {
5555
Edition::Edition2018 => "edition_2018",
5656
}
5757
}
58+
59+
pub fn feature_name(&self) -> &'static str {
60+
match *self {
61+
Edition::Edition2015 => "rust_2015_preview",
62+
Edition::Edition2018 => "rust_2018_preview",
63+
}
64+
}
5865
}
5966

6067
impl FromStr for Edition {

src/libsyntax/ext/base.rs

+8
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub enum Annotatable {
3838
Item(P<ast::Item>),
3939
TraitItem(P<ast::TraitItem>),
4040
ImplItem(P<ast::ImplItem>),
41+
Stmt(P<ast::Stmt>),
42+
Expr(P<ast::Expr>),
4143
}
4244

4345
impl HasAttrs for Annotatable {
@@ -46,6 +48,8 @@ impl HasAttrs for Annotatable {
4648
Annotatable::Item(ref item) => &item.attrs,
4749
Annotatable::TraitItem(ref trait_item) => &trait_item.attrs,
4850
Annotatable::ImplItem(ref impl_item) => &impl_item.attrs,
51+
Annotatable::Stmt(ref stmt) => stmt.attrs(),
52+
Annotatable::Expr(ref expr) => &expr.attrs,
4953
}
5054
}
5155

@@ -54,6 +58,8 @@ impl HasAttrs for Annotatable {
5458
Annotatable::Item(item) => Annotatable::Item(item.map_attrs(f)),
5559
Annotatable::TraitItem(trait_item) => Annotatable::TraitItem(trait_item.map_attrs(f)),
5660
Annotatable::ImplItem(impl_item) => Annotatable::ImplItem(impl_item.map_attrs(f)),
61+
Annotatable::Stmt(stmt) => Annotatable::Stmt(stmt.map_attrs(f)),
62+
Annotatable::Expr(expr) => Annotatable::Expr(expr.map_attrs(f)),
5763
}
5864
}
5965
}
@@ -64,6 +70,8 @@ impl Annotatable {
6470
Annotatable::Item(ref item) => item.span,
6571
Annotatable::TraitItem(ref trait_item) => trait_item.span,
6672
Annotatable::ImplItem(ref impl_item) => impl_item.span,
73+
Annotatable::Stmt(ref stmt) => stmt.span,
74+
Annotatable::Expr(ref expr) => expr.span,
6775
}
6876
}
6977

0 commit comments

Comments
 (0)