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 20 pull requests #55912

Merged
merged 49 commits into from
Nov 14, 2018
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
1224e01
Format BtreeMap::range_mut example
kngwyu Nov 6, 2018
db3c69e
impl_stable_hash_for: support enums and tuple structs with generic pa…
RalfJung Nov 6, 2018
401cb6b
don't inline `pub use some_crate` unless directly asked to
QuietMisdreavus Nov 9, 2018
5e7b7f2
make PhantomData #[structural_match].
Centril Nov 10, 2018
852ff1f
add FromIterator<A> to Box<[A]>
lcnr Nov 10, 2018
3b3b60c
Avoid converting bytes to UTF-8 strings to print, just pass bytes to …
spastorino Nov 10, 2018
3030cbe
Remove short doc where it starts with a codeblock
GuillaumeGomez Oct 16, 2018
0edc9e8
Small fixes on code blocks in rustdoc
GuillaumeGomez Nov 10, 2018
20ef40a
Fix a typo in std::panic
dwijnand Nov 11, 2018
5030794
Merge branch 'master' of https://github.com/rust-lang/rust
lcnr Nov 11, 2018
ab55d9b
change attribute to stable
lcnr Nov 11, 2018
a62af85
Fix typos.
waywardmonkeys Nov 11, 2018
93b5112
Added comment for From trait implementation: boxed string slice to St…
denisvasilik Nov 10, 2018
f0bfbd3
Added comments for trait implementations.
denisvasilik Nov 11, 2018
dc0fd65
Whitespace cleanup according to Rust's style guidelines.
denisvasilik Nov 11, 2018
6f3add3
Minor style guide corrections.
denisvasilik Nov 11, 2018
04cc0d6
save-analysis: Don't panic for macro-generated use globs
Xanewok Nov 11, 2018
4fdae85
Reference count `crate_inherent_impls`s return value.
hugwijst Nov 12, 2018
c211238
Fix TLS errors when downloading stage0
dlrobertson Nov 12, 2018
c686299
Change `Lit::short_name` to `Lit::literal_name`.
nnethercote Nov 12, 2018
ace20b9
for uniformity, also move memory_deallocated to AllocationExtra
RalfJung Nov 12, 2018
075983c
global allocators: add a few comments
RalfJung Nov 12, 2018
3c88cfe
remove unused import
RalfJung Nov 12, 2018
4da9f10
Document optimizations enabled by FusedIterator
SimonSapin Nov 12, 2018
ab8a947
Move `static_assert!` into librustc_data_structures.
nnethercote Nov 8, 2018
49f482f
Move a `static_assert!` to a better spot.
nnethercote Nov 8, 2018
fb3dd9f
Add a static assertion about the size of `ast::Expr`.
nnethercote Nov 8, 2018
2bd4d5b
Move two `static_assert!`s to better spots.
nnethercote Nov 12, 2018
533d26f
Fix their/there grammar nit
KWierso Nov 13, 2018
e9bd1f2
Rollup merge of #55711 - kngwyu:btreemap-rangemut-doc, r=Mark-Simulacrum
kennytm Nov 13, 2018
a8bcf61
Rollup merge of #55754 - spastorino:fix-process-output-docs, r=alexcr…
kennytm Nov 13, 2018
d811f84
Rollup merge of #55804 - QuietMisdreavus:eager-crate-inline, r=pnkfelix
kennytm Nov 13, 2018
98bc7d6
Rollup merge of #55805 - nnethercote:mv-static_assert, r=Mark-Simulacrum
kennytm Nov 13, 2018
f73df10
Rollup merge of #55837 - Centril:spökdata-skall-vara-strukturellt-mat…
kennytm Nov 13, 2018
5b572fb
Rollup merge of #55840 - dlrobertson:fix_stage0_download, r=alexcrichton
kennytm Nov 13, 2018
196db96
Rollup merge of #55843 - Axary:master, r=sfackler
kennytm Nov 13, 2018
828dd17
Rollup merge of #55858 - GuillaumeGomez:fixes-rustdoc-codeblocks, r=Q…
kennytm Nov 13, 2018
910289c
Rollup merge of #55863 - dwijnand:patch-1, r=bluss
kennytm Nov 13, 2018
5ccc76f
Rollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiser
kennytm Nov 13, 2018
5134d9c
Rollup merge of #55874 - denisvasilik:docs, r=alexcrichton
kennytm Nov 13, 2018
a277435
Rollup merge of #55879 - Xanewok:dont-panic-with-globs, r=nrc
kennytm Nov 13, 2018
675c95c
Rollup merge of #55882 - hugwijst:rc_return_crate_inherent_impls, r=M…
kennytm Nov 13, 2018
c246a29
Rollup merge of #55888 - RalfJung:alloc-extra, r=oli-obk
kennytm Nov 13, 2018
99986a5
Rollup merge of #55889 - RalfJung:global-alloc, r=alexcrichton
kennytm Nov 13, 2018
4d76440
Rollup merge of #55896 - rust-lang:opt-fuse, r=shepmaster
kennytm Nov 13, 2018
64ea02a
Rollup merge of #55905 - nnethercote:short_name-to-literal_name, r=Ma…
kennytm Nov 13, 2018
8a13ae5
Rollup merge of #55908 - KWierso:patch-1, r=wesleywiser
kennytm Nov 13, 2018
2173681
Rollup merge of #55136 - GuillaumeGomez:short-doc, r=QuietMisdreavus
kennytm Nov 13, 2018
7921572
Rollup merge of #55722 - RalfJung:impl-stable-hash, r=varkor
kennytm Nov 13, 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
2 changes: 1 addition & 1 deletion src/README.md
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ This directory contains the source code of the rust project, including:

For more information on how various parts of the compiler work, see the [rustc guide].

Their is also useful content in the following READMEs, which are gradually being moved over to the guide:
There is also useful content in the following READMEs, which are gradually being moved over to the guide:
- https://github.com/rust-lang/rust/tree/master/src/librustc/ty/query
- https://github.com/rust-lang/rust/tree/master/src/librustc/dep_graph
- https://github.com/rust-lang/rust/blob/master/src/librustc/infer/region_constraints
4 changes: 2 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
@@ -79,8 +79,8 @@ def _download(path, url, probably_big, verbose, exception):
# see http://serverfault.com/questions/301128/how-to-download
if sys.platform == 'win32':
run(["PowerShell.exe", "/nologo", "-Command",
"(New-Object System.Net.WebClient)"
".DownloadFile('{}', '{}')".format(url, path)],
"[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;",
"(New-Object System.Net.WebClient).DownloadFile('{}', '{}')".format(url, path)],
verbose=verbose,
exception=exception)
else:
2 changes: 1 addition & 1 deletion src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
@@ -203,7 +203,7 @@ impl Step for StdLink {

/// Link all libstd rlibs/dylibs into the sysroot location.
///
/// Links those artifacts generated by `compiler` to a the `stage` compiler's
/// Links those artifacts generated by `compiler` to the `stage` compiler's
/// sysroot for the specified `host` and `target`.
///
/// Note that this assumes that `compiler` has already generated the libstd
3 changes: 3 additions & 0 deletions src/doc/rustdoc/src/the-doc-attribute.md
Original file line number Diff line number Diff line change
@@ -186,6 +186,9 @@ mod bar {

Now we'll have a `Re-exports` line, and `Bar` will not link to anywhere.

One special case: In Rust 2018 and later, if you `pub use` one of your dependencies, `rustdoc` will
not eagerly inline it as a module unless you add `#[doc(inline)}`.

## `#[doc(hidden)]`

Any item annotated with `#[doc(hidden)]` will not appear in the documentation, unless
2 changes: 1 addition & 1 deletion src/etc/lldb_batchmode.py
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@
# containing LLDB commands (one command per line), this script will execute the commands one after
# the other.
# LLDB also has the -s and -S commandline options which also execute a list of commands from a text
# file. However, this command are execute `immediately`: a the command of a `run` or `continue`
# file. However, this command are execute `immediately`: the command of a `run` or `continue`
# command will be executed immediately after the `run` or `continue`, without waiting for the next
# breakpoint to be hit. This a command sequence like the following will not yield reliable results:
#
4 changes: 4 additions & 0 deletions src/liballoc/alloc.rs
Original file line number Diff line number Diff line change
@@ -21,6 +21,10 @@ use core::usize;
pub use core::alloc::*;

extern "Rust" {
// These are the magic symbols to call the global allocator. rustc generates
// them from the `#[global_allocator]` attribute if there is one, or uses the
// default implementations in libstd (`__rdl_alloc` etc in `src/libstd/alloc.rs`)
// otherwise.
#[allocator]
#[rustc_allocator_nounwind]
fn __rust_alloc(size: usize, align: usize) -> *mut u8;
10 changes: 9 additions & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
@@ -73,14 +73,15 @@ use core::convert::From;
use core::fmt;
use core::future::Future;
use core::hash::{Hash, Hasher};
use core::iter::FusedIterator;
use core::iter::{Iterator, FromIterator, FusedIterator};
use core::marker::{Unpin, Unsize};
use core::mem;
use core::pin::Pin;
use core::ops::{CoerceUnsized, DispatchFromDyn, Deref, DerefMut, Generator, GeneratorState};
use core::ptr::{self, NonNull, Unique};
use core::task::{LocalWaker, Poll};

use vec::Vec;
use raw_vec::RawVec;
use str::from_boxed_utf8_unchecked;

@@ -699,6 +700,13 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> CoerceUnsized<Box<U>> for Box<T> {}
#[unstable(feature = "dispatch_from_dyn", issue = "0")]
impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Box<U>> for Box<T> {}

#[stable(feature = "boxed_slice_from_iter", since = "1.32.0")]
impl<A> FromIterator<A> for Box<[A]> {
fn from_iter<T: IntoIterator<Item = A>>(iter: T) -> Self {
iter.into_iter().collect::<Vec<_>>().into_boxed_slice()
}
}

#[stable(feature = "box_slice_clone", since = "1.3.0")]
impl<T: Clone> Clone for Box<[T]> {
fn clone(&self) -> Self {
8 changes: 8 additions & 0 deletions src/liballoc/boxed_test.rs
Original file line number Diff line number Diff line change
@@ -140,3 +140,11 @@ fn str_slice() {
let boxed: Box<str> = Box::from(s);
assert_eq!(&*boxed, s)
}

#[test]
fn boxed_slice_from_iter() {
let iter = 0..100;
let boxed: Box<[u32]> = iter.collect();
assert_eq!(boxed.len(), 100);
assert_eq!(boxed[7], 7);
}
7 changes: 4 additions & 3 deletions src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
@@ -853,9 +853,10 @@ impl<K: Ord, V> BTreeMap<K, V> {
/// ```
/// use std::collections::BTreeMap;
///
/// let mut map: BTreeMap<&str, i32> = ["Alice", "Bob", "Carol", "Cheryl"].iter()
/// .map(|&s| (s, 0))
/// .collect();
/// let mut map: BTreeMap<&str, i32> = ["Alice", "Bob", "Carol", "Cheryl"]
/// .iter()
/// .map(|&s| (s, 0))
/// .collect();
/// for (_, balance) in map.range_mut("B".."Cheryl") {
/// *balance += 100;
/// }
41 changes: 41 additions & 0 deletions src/liballoc/string.rs
Original file line number Diff line number Diff line change
@@ -2206,13 +2206,40 @@ impl<'a> From<&'a str> for String {
#[cfg(not(test))]
#[stable(feature = "string_from_box", since = "1.18.0")]
impl From<Box<str>> for String {
/// Converts the given boxed `str` slice to a `String`.
/// It is notable that the `str` slice is owned.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let s1: String = String::from("hello world");
/// let s2: Box<str> = s1.into_boxed_str();
/// let s3: String = String::from(s2);
///
/// assert_eq!("hello world", s3)
/// ```
fn from(s: Box<str>) -> String {
s.into_string()
}
}

#[stable(feature = "box_from_str", since = "1.20.0")]
impl From<String> for Box<str> {
/// Converts the given `String` to a boxed `str` slice that is owned.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let s1: String = String::from("hello world");
/// let s2: Box<str> = Box::from(s1);
/// let s3: String = String::from(s2);
///
/// assert_eq!("hello world", s3)
/// ```
fn from(s: String) -> Box<str> {
s.into_boxed_str()
}
@@ -2272,6 +2299,20 @@ impl<'a> FromIterator<String> for Cow<'a, str> {

#[stable(feature = "from_string_for_vec_u8", since = "1.14.0")]
impl From<String> for Vec<u8> {
/// Converts the given `String` to a vector `Vec` that holds values of type `u8`.
///
/// # Examples
///
/// Basic usage:
///
/// ```
/// let s1 = String::from("hello world");
/// let v1 = Vec::from(s1);
///
/// for b in v1 {
/// println!("{}", b);
/// }
/// ```
fn from(string: String) -> Vec<u8> {
string.into_bytes()
}
2 changes: 1 addition & 1 deletion src/libcore/iter/traits.rs
Original file line number Diff line number Diff line change
@@ -960,7 +960,7 @@ impl<T, U, E> Product<Result<U, E>> for Result<T, E>
///
/// Calling next on a fused iterator that has returned `None` once is guaranteed
/// to return [`None`] again. This trait should be implemented by all iterators
/// that behave this way because it allows for some significant optimizations.
/// that behave this way because it allows optimizing [`Iterator::fuse`].
///
/// Note: In general, you should not use `FusedIterator` in generic bounds if
/// you need a fused iterator. Instead, you should just call [`Iterator::fuse`]
1 change: 1 addition & 0 deletions src/libcore/lib.rs
Original file line number Diff line number Diff line change
@@ -128,6 +128,7 @@
#![feature(const_transmute)]
#![feature(reverse_bits)]
#![feature(non_exhaustive)]
#![feature(structural_match)]

#[prelude_import]
#[allow(unused)]
1 change: 1 addition & 0 deletions src/libcore/marker.rs
Original file line number Diff line number Diff line change
@@ -578,6 +578,7 @@ macro_rules! impls{
///
/// [drop check]: ../../nomicon/dropck.html
#[lang = "phantom_data"]
#[structural_match]
#[stable(feature = "rust1", since = "1.0.0")]
pub struct PhantomData<T:?Sized>;

2 changes: 1 addition & 1 deletion src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
@@ -1896,7 +1896,7 @@ mod traits {
#[inline]
fn index_mut(self, slice: &mut str) -> &mut Self::Output {
// is_char_boundary checks that the index is in [0, .len()]
// canot reuse `get` as above, because of NLL trouble
// cannot reuse `get` as above, because of NLL trouble
if self.start <= self.end &&
slice.is_char_boundary(self.start) &&
slice.is_char_boundary(self.end) {
71 changes: 17 additions & 54 deletions src/librustc/ich/impls_mir.rs
Original file line number Diff line number Diff line change
@@ -37,68 +37,31 @@ impl_stable_hash_for!(struct mir::BasicBlockData<'tcx> { statements, terminator,
impl_stable_hash_for!(struct mir::UnsafetyViolation { source_info, description, details, kind });
impl_stable_hash_for!(struct mir::UnsafetyCheckResult { violations, unsafe_blocks });

impl<'a> HashStable<StableHashingContext<'a>>
for mir::BorrowKind {
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher);

match *self {
mir::BorrowKind::Shared |
mir::BorrowKind::Shallow |
mir::BorrowKind::Unique => {}
mir::BorrowKind::Mut { allow_two_phase_borrow } => {
allow_two_phase_borrow.hash_stable(hcx, hasher);
}
}
}
}


impl<'a> HashStable<StableHashingContext<'a>>
for mir::UnsafetyViolationKind {
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {

mem::discriminant(self).hash_stable(hcx, hasher);

match *self {
mir::UnsafetyViolationKind::General => {}
mir::UnsafetyViolationKind::MinConstFn => {}
mir::UnsafetyViolationKind::ExternStatic(lint_node_id) |
mir::UnsafetyViolationKind::BorrowPacked(lint_node_id) => {
lint_node_id.hash_stable(hcx, hasher);
}
impl_stable_hash_for!(enum mir::BorrowKind {
Shared,
Shallow,
Unique,
Mut { allow_two_phase_borrow },
});

}
}
}
impl_stable_hash_for!(enum mir::UnsafetyViolationKind {
General,
MinConstFn,
ExternStatic(lint_node_id),
BorrowPacked(lint_node_id),
});

impl_stable_hash_for!(struct mir::Terminator<'tcx> {
kind,
source_info
});

impl<'a, 'gcx, T> HashStable<StableHashingContext<'a>> for mir::ClearCrossCrate<T>
where T: HashStable<StableHashingContext<'a>>
{
#[inline]
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
mem::discriminant(self).hash_stable(hcx, hasher);
match *self {
mir::ClearCrossCrate::Clear => {}
mir::ClearCrossCrate::Set(ref value) => {
value.hash_stable(hcx, hasher);
}
}
impl_stable_hash_for!(
impl<T> for enum mir::ClearCrossCrate<T> [ mir::ClearCrossCrate ] {
Clear,
Set(value),
}
}
);

impl<'a> HashStable<StableHashingContext<'a>> for mir::Local {
#[inline]
Loading