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 19 pull requests #56381

Merged
merged 55 commits into from
Nov 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
6674db4
Reuse the `P` in `InvocationCollector::fold_{,opt_}expr`.
nnethercote Nov 20, 2018
464c9da
serialize: preallocate VecDeque in Decodable::decode
ljedrz Nov 21, 2018
591607d
String: add a FIXME to from_utf16
ljedrz Nov 21, 2018
057e6d3
Add TryFrom<&[T]> for [T; $N] where T: Copy
SimonSapin Nov 25, 2018
769d711
add test for issue #21335
euclio Nov 14, 2018
d4a6e73
Use sort_by_cached_key when key the function is not trivial/free
ljedrz Nov 9, 2018
6c80f7c
Fix whitespace in `pp.rs`.
nnethercote Nov 28, 2018
deb9195
Remove `huge_word` and `zero_word`.
nnethercote Nov 28, 2018
787959c
Use `Cow` in `Token::String`.
nnethercote Nov 29, 2018
64cd645
Split up `pretty_print` and `print`.
nnethercote Nov 29, 2018
71f643e
Remove not used option
yui-knk Nov 28, 2018
2a91bba
Rename conversion util; remove duplicate util in librustc_codegen_llvm.
frewsxcv Nov 29, 2018
e955dbc
Use raw_entry for more efficient interning
Zoxc May 17, 2018
0124341
Only consider stem when extension is exe.
davidtwco Nov 29, 2018
3b2cfc5
Handle inference variables in `nll_relate` and use it for chalk
scalexm Nov 6, 2018
0169dc3
Implement `ResolventOps`
scalexm Nov 9, 2018
b2b82f7
Implement `AggregateOps`
scalexm Nov 15, 2018
c805e81
Fix doc comments
scalexm Nov 29, 2018
1fce415
Correctly generalize inference variables in `nll_relate`
scalexm Nov 29, 2018
4cce4ff
Add inline attributes and add unit to CommonTypes
Zoxc Nov 29, 2018
fdef384
Add libstd and libcore Cargo features "panic_immediate_abort"
vi Nov 29, 2018
225140e
Optimize local linkchecker program
alexcrichton Nov 29, 2018
d3f9788
panic_immediate_abort: Fix issues from review
vi Nov 29, 2018
f18a8c6
Fix exceeding line width limit
vi Nov 29, 2018
a0fec94
Fix panic with outlives in existential type
dlrobertson Nov 30, 2018
c144dc0
Fix ICE with feature self_struct_ctor
estebank Nov 25, 2018
027bf8b
Use opt_def_id instead of having special branch
estebank Nov 25, 2018
5f19cdc
Changed test for issue 56202 to compile-pass.
alexreg Nov 30, 2018
946ea14
Inline things
Zoxc Nov 29, 2018
9b847f0
Fix const_fn ICE with non-const function pointer
phansch Nov 30, 2018
247ab49
Pacify tidy
phansch Nov 30, 2018
4c34404
update nomicon
steveklabnik Nov 30, 2018
934871a
Add the edition guide to doc.rust-lang.org
steveklabnik Nov 30, 2018
d49a8d5
Removed feature gate.
alexreg Nov 30, 2018
24717fd
Updated ui tests.
alexreg Nov 30, 2018
a824897
Moved feature-gate tests to correct dir.
alexreg Nov 30, 2018
b8198da
Rollup merge of #55821 - ljedrz:cached_key_sorts, r=michaelwoerister
kennytm Nov 30, 2018
e40f37e
Rollup merge of #56014 - euclio:issue-21335, r=nagisa
kennytm Nov 30, 2018
c3950c8
Rollup merge of #56131 - ljedrz:assorted, r=RalfJung
kennytm Nov 30, 2018
f7c407e
Rollup merge of #56216 - SimonSapin:array-tryfrom-slice, r=withoutboats
kennytm Nov 30, 2018
ce00a8d
Rollup merge of #56268 - nnethercote:fold_opt_expr-recycle, r=petroch…
kennytm Nov 30, 2018
bdb901c
Rollup merge of #56336 - nnethercote:clean-up-pp, r=nikomatsakis
kennytm Nov 30, 2018
78c598a
Rollup merge of #56339 - yui-knk:remove_mir_stats_flag, r=alexcrichton
kennytm Nov 30, 2018
540f4cf
Rollup merge of #56341 - frewsxcv:frewsxcv-util-cstr, r=Mark-Simulacrum
kennytm Nov 30, 2018
cb9add6
Rollup merge of #56349 - davidtwco:issue-55396-inference-extension, r…
kennytm Nov 30, 2018
45aaaa7
Rollup merge of #56355 - Zoxc:inline-things, r=michaelwoerister
kennytm Nov 30, 2018
ddc7ef2
Rollup merge of #56360 - alexcrichton:linkchecker-omg, r=pietroalbini
kennytm Nov 30, 2018
42bac05
Rollup merge of #56364 - dlrobertson:fix_55903, r=oli-obk
kennytm Nov 30, 2018
fb2b2f5
Rollup merge of #56367 - alexreg:move-feature-gate-tests-1, r=Centril
kennytm Nov 30, 2018
8641b8d
Rollup merge of #56373 - steveklabnik:update-books, r=Mark-Simulacrum
kennytm Nov 30, 2018
440bda4
Rollup merge of #56365 - alexreg:stabilise-self_struct_ctor, r=Centril
kennytm Nov 30, 2018
2584d92
Rollup merge of #55011 - vi:panic_immediate_abort, r=alexcrichton
kennytm Nov 30, 2018
ecfe721
Rollup merge of #56324 - Zoxc:int-ext, r=nikomatsakis
kennytm Nov 30, 2018
f3be931
Rollup merge of #56337 - phansch:fix_const_ice, r=oli-obk
kennytm Nov 30, 2018
a6c4771
Rollup merge of #56214 - scalexm:unification, r=nikomatsakis
kennytm Nov 30, 2018
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,6 @@
[submodule "src/doc/rustc-guide"]
path = src/doc/rustc-guide
url = https://github.com/rust-lang/rustc-guide.git
[submodule "src/doc/edition-guide"]
path = src/doc/edition-guide
url = https://github.com/rust-lang-nursery/edition-guide
1 change: 1 addition & 0 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ macro_rules! book {
book!(
Nomicon, "src/doc/nomicon", "nomicon";
Reference, "src/doc/reference", "reference";
EditionGuide, "src/doc/edition-guide", "edition-guide";
RustdocBook, "src/doc/rustdoc", "rustdoc";
RustcBook, "src/doc/rustc", "rustc";
RustByExample, "src/doc/rust-by-example", "rust-by-example";
Expand Down
1 change: 1 addition & 0 deletions src/doc/edition-guide
Submodule edition-guide added at ad8958
2 changes: 1 addition & 1 deletion src/doc/nomicon
33 changes: 0 additions & 33 deletions src/doc/unstable-book/src/language-features/self-struct-ctor.md

This file was deleted.

2 changes: 2 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,8 @@ impl String {
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn from_utf16(v: &[u16]) -> Result<String, FromUtf16Error> {
// This isn't done via collect::<Result<_, _>>() for performance reasons.
// FIXME: the function can be simplified again when #48994 is closed.
let mut ret = String::with_capacity(v.len());
for c in decode_utf16(v.iter().cloned()) {
if let Ok(c) = c {
Expand Down
2 changes: 2 additions & 0 deletions src/libarena/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,7 @@ pub struct DroplessArena {
unsafe impl Send for DroplessArena {}

impl Default for DroplessArena {
#[inline]
fn default() -> DroplessArena {
DroplessArena {
ptr: Cell::new(0 as *mut u8),
Expand All @@ -319,6 +320,7 @@ impl DroplessArena {
false
}

#[inline]
fn align(&self, align: usize) {
let final_address = ((self.ptr.get() as usize) + align - 1) & !(align - 1);
self.ptr.set(final_address as *mut u8);
Expand Down
4 changes: 4 additions & 0 deletions src/libcore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ path = "../libcore/benches/lib.rs"

[dev-dependencies]
rand = "0.5"

[features]
# Make panics and failed asserts immediately abort without formatting any message
panic_immediate_abort = []
9 changes: 9 additions & 0 deletions src/libcore/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ macro_rules! array_impls {
}
}

#[unstable(feature = "try_from", issue = "33417")]
impl<'a, T> TryFrom<&'a [T]> for [T; $N] where T: Copy {
type Error = TryFromSliceError;

fn try_from(slice: &[T]) -> Result<[T; $N], TryFromSliceError> {
<&Self>::try_from(slice).map(|r| *r)
}
}

#[unstable(feature = "try_from", issue = "33417")]
impl<'a, T> TryFrom<&'a [T]> for &'a [T; $N] {
type Error = TryFromSliceError;
Expand Down
79 changes: 79 additions & 0 deletions src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1989,6 +1989,19 @@ big endian.
```
let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand All @@ -2008,6 +2021,19 @@ little endian.
```
let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -2037,6 +2063,19 @@ let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"bi
", $le_bytes, "
});
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -3614,6 +3653,7 @@ assert_eq!(3", stringify!($SelfT), ".checked_next_power_of_two(), Some(4));
assert_eq!(", stringify!($SelfT), "::max_value().checked_next_power_of_two(), None);",
$EndFeature, "
```"),
#[inline]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn checked_next_power_of_two(self) -> Option<Self> {
self.one_less_than_next_power_of_two().checked_add(1)
Expand Down Expand Up @@ -3719,6 +3759,19 @@ big endian.
```
let value = ", stringify!($SelfT), "::from_be_bytes(", $be_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand All @@ -3738,6 +3791,19 @@ little endian.
```
let value = ", stringify!($SelfT), "::from_le_bytes(", $le_bytes, ");
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down Expand Up @@ -3767,6 +3833,19 @@ let value = ", stringify!($SelfT), "::from_ne_bytes(if cfg!(target_endian = \"bi
", $le_bytes, "
});
assert_eq!(value, ", $swap_op, ");
```

When starting from a slice rather than an array, fallible conversion APIs can be used:

```
#![feature(try_from)]
use std::convert::TryInto;

fn read_be_", stringify!($SelfT), "(input: &mut &[u8]) -> ", stringify!($SelfT), " {
let (int_bytes, rest) = input.split_at(std::mem::size_of::<", stringify!($SelfT), ">());
*input = rest;
", stringify!($SelfT), "::from_be_bytes(int_bytes.try_into().unwrap())
}
```"),
#[stable(feature = "int_to_from_bytes", since = "1.32.0")]
#[rustc_const_unstable(feature = "const_int_conversion")]
Expand Down
24 changes: 21 additions & 3 deletions src/libcore/panicking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,16 @@
use fmt;
use panic::{Location, PanicInfo};

#[cold] #[inline(never)] // this is the slow path, always
#[cold]
// never inline unless panic_immediate_abort to avoid code
// bloat at the call sites as much as possible
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
#[lang = "panic"]
pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
if cfg!(feature = "panic_immediate_abort") {
unsafe { super::intrinsics::abort() }
}

// Use Arguments::new_v1 instead of format_args!("{}", expr) to potentially
// reduce size overhead. The format_args! macro uses str's Display trait to
// write expr, which calls Formatter::pad, which must accommodate string
Expand All @@ -52,16 +59,27 @@ pub fn panic(expr_file_line_col: &(&'static str, &'static str, u32, u32)) -> ! {
panic_fmt(fmt::Arguments::new_v1(&[expr], &[]), &(file, line, col))
}

#[cold] #[inline(never)]
#[cold]
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
#[lang = "panic_bounds_check"]
fn panic_bounds_check(file_line_col: &(&'static str, u32, u32),
index: usize, len: usize) -> ! {
if cfg!(feature = "panic_immediate_abort") {
unsafe { super::intrinsics::abort() }
}

panic_fmt(format_args!("index out of bounds: the len is {} but the index is {}",
len, index), file_line_col)
}

#[cold] #[inline(never)]
#[cold]
#[cfg_attr(not(feature="panic_immediate_abort"),inline(never))]
#[cfg_attr( feature="panic_immediate_abort" ,inline)]
pub fn panic_fmt(fmt: fmt::Arguments, file_line_col: &(&'static str, u32, u32)) -> ! {
if cfg!(feature = "panic_immediate_abort") {
unsafe { super::intrinsics::abort() }
}

// NOTE This function never crosses the FFI boundary; it's a Rust-to-Rust call
#[allow(improper_ctypes)] // PanicInfo contains a trait object which is not FFI safe
extern "Rust" {
Expand Down
16 changes: 0 additions & 16 deletions src/librustc/hir/lowering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ use syntax::ast;
use syntax::ast::*;
use syntax::errors;
use syntax::ext::hygiene::{Mark, SyntaxContext};
use syntax::feature_gate::{emit_feature_err, GateIssue};
use syntax::print::pprust;
use syntax::ptr::P;
use syntax::source_map::{self, respan, CompilerDesugaringKind, Spanned};
Expand Down Expand Up @@ -3628,7 +3627,6 @@ impl<'a> LoweringContext<'a> {
ParamMode::Optional,
ImplTraitContext::disallowed(),
);
self.check_self_struct_ctor_feature(&qpath);
hir::PatKind::TupleStruct(
qpath,
pats.iter().map(|x| self.lower_pat(x)).collect(),
Expand All @@ -3643,7 +3641,6 @@ impl<'a> LoweringContext<'a> {
ParamMode::Optional,
ImplTraitContext::disallowed(),
);
self.check_self_struct_ctor_feature(&qpath);
hir::PatKind::Path(qpath)
}
PatKind::Struct(ref path, ref fields, etc) => {
Expand Down Expand Up @@ -4039,7 +4036,6 @@ impl<'a> LoweringContext<'a> {
ParamMode::Optional,
ImplTraitContext::disallowed(),
);
self.check_self_struct_ctor_feature(&qpath);
hir::ExprKind::Path(qpath)
}
ExprKind::Break(opt_label, ref opt_expr) => {
Expand Down Expand Up @@ -5102,18 +5098,6 @@ impl<'a> LoweringContext<'a> {
ThinVec::new()));
P(self.expr_call(e.span, from_err, hir_vec![e]))
}

fn check_self_struct_ctor_feature(&self, qp: &hir::QPath) {
if let hir::QPath::Resolved(_, ref p) = qp {
if p.segments.len() == 1 &&
p.segments[0].ident.name == keywords::SelfType.name() &&
!self.sess.features_untracked().self_struct_ctor {
emit_feature_err(&self.sess.parse_sess, "self_struct_ctor",
p.span, GateIssue::Language,
"`Self` struct constructors are unstable");
}
}
}
}

fn body_ids(bodies: &BTreeMap<hir::BodyId, hir::Body>) -> Vec<hir::BodyId> {
Expand Down
Loading