Skip to content

Rollup of 19 pull requests #56531

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

Closed
wants to merge 64 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
ea5843c
fix intra-link resolution spans in block comments
euclio Nov 16, 2018
700c83b
Document `From` implementations
Jun 24, 2018
072bca3
Remove 'unsafe' comments
Jun 25, 2018
88a708d
Update comments
Jun 25, 2018
5c747eb
Update style of comments
Jul 26, 2018
e8dafba
Adjust doc comments
Nov 21, 2018
7933628
Remove trailing whitespace
Nov 21, 2018
c209ed8
Improve no result found sentence in doc search
GuillaumeGomez Nov 1, 2018
47b5e23
Introduce ptr::hash for references
dwijnand Nov 26, 2018
86d20f9
FIXME is the new TODO
dwijnand Nov 26, 2018
5558c07
Fix ptr::hex doc example
dwijnand Nov 26, 2018
7b429b0
Fix stability attribute for ptr::hash
dwijnand Nov 27, 2018
8125149
Pick a better variable name for ptr::hash
dwijnand Nov 27, 2018
afb4fbd
Add an assert_eq in ptr::hash's doc example
dwijnand Nov 27, 2018
4a7ffe2
Fix issue number
dwijnand Nov 27, 2018
9755410
Try to fix ptr::hash's doc example
dwijnand Nov 27, 2018
097b5db
Move feature enable in ptr::hash doc example
dwijnand Nov 27, 2018
dd717de
Add crate filtering
GuillaumeGomez Sep 30, 2018
8062c7a
Add test for crate filtering
GuillaumeGomez Sep 30, 2018
afe4107
Add arrow to the crate select box
GuillaumeGomez Nov 29, 2018
1560a75
Refer to the second borrow as the "second borrow".
wildarch Nov 30, 2018
d92287a
Fix some rustc doc links
matthewjasper Nov 30, 2018
4f5b8ea
Remove the `region_map` field from `BorrowSet`
matthewjasper Nov 30, 2018
6000c2e
Use visit_local to find 2PB activations
matthewjasper Nov 30, 2018
3b705a0
rustbuild: Fix issues with compiler docs
ollie27 Dec 2, 2018
23abd18
Fix invalid line number match
GuillaumeGomez Dec 2, 2018
380dd7d
Add rc::Weak.ptr_eq
Thomasdezeeuw Nov 15, 2018
d4b41fa
Add sync::Weak::ptr_eq
Thomasdezeeuw Nov 15, 2018
38e21f9
Fix link in Weak::new
Thomasdezeeuw Nov 23, 2018
1fb82b5
Handle existential types in dead code analysis
oli-obk Dec 3, 2018
651373c
data_structures: remove tuple_slice
ljedrz Dec 3, 2018
9c8802d
Explain raw identifer syntax
mark-i-m Dec 2, 2018
0b40be6
link to raw identifiers
mark-i-m Dec 2, 2018
3f253f5
Improve filter test
GuillaumeGomez Dec 3, 2018
65aa0a6
Remove redundant clone
sinkuu Nov 28, 2018
bc7c3dc
sort_by_cached_key -> sort_by
sinkuu Nov 30, 2018
6fab3f9
Make ptr::hash take a raw painter like ptr::eq
dwijnand Dec 4, 2018
ad76569
Fix ptr::hash, just hash the raw pointer
dwijnand Dec 4, 2018
450a8a6
Add extra comment slash
Dec 4, 2018
8c4129c
cleanup: remove static lifetimes from consts in libstd
ljedrz Dec 4, 2018
e41e85c
Fix line numbers display
GuillaumeGomez Dec 4, 2018
9012af6
Utilize `?` instead of `return None`.
frewsxcv Nov 21, 2018
56ace3e
Added a bare-bones eslint config (removing jslint)
JohnHeitmann Dec 4, 2018
5d7cf59
Added trailing newline
JohnHeitmann Dec 5, 2018
3512fb0
Avoid extra copy and syscall in std::env::current_exe
udoprog Dec 5, 2018
c18261b
Rollup merge of #51753 - gruberb:document-from-conversions-libstdpath…
GuillaumeGomez Dec 5, 2018
8221275
Rollup merge of #55563 - GuillaumeGomez:doc-search-sentence, r=QuietM…
GuillaumeGomez Dec 5, 2018
9f4e068
Rollup merge of #55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
GuillaumeGomez Dec 5, 2018
fe8c1c8
Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
GuillaumeGomez Dec 5, 2018
7f67a73
Rollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=Quiet…
GuillaumeGomez Dec 5, 2018
d6f80a2
Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=da…
GuillaumeGomez Dec 5, 2018
4b6011b
Rollup merge of #56388 - matthewjasper:more-lexical-mir-cleanup, r=ni…
GuillaumeGomez Dec 5, 2018
eb746a8
Rollup merge of #56424 - mark-i-m:explain-raw, r=Centril
GuillaumeGomez Dec 5, 2018
7beeb70
Rollup merge of #56452 - sinkuu:redundant_clone, r=nikic
GuillaumeGomez Dec 5, 2018
17f60bd
Rollup merge of #56456 - oli-obk:private_impl_trait, r=cramertj
GuillaumeGomez Dec 5, 2018
d804bdd
Rollup merge of #56466 - ljedrz:delete_tuple_slice, r=nikomatsakis
GuillaumeGomez Dec 5, 2018
12cb472
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=…
GuillaumeGomez Dec 5, 2018
ee1ad03
Rollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=ken…
GuillaumeGomez Dec 5, 2018
d4308cc
Rollup merge of #56498 - GuillaumeGomez:line-numbers, r=QuietMisdreavus
GuillaumeGomez Dec 5, 2018
1aecc3f
Rollup merge of #56523 - JohnHeitmann:es6, r=GuillaumeGomez
GuillaumeGomez Dec 5, 2018
c83f92f
Rollup merge of #56250 - dwijnand:ptr-hash, r=alexcrichton
kennytm Dec 5, 2018
096c434
Rollup merge of #56441 - ollie27:rustbuild_compiler_docs, r=alexcrichton
kennytm Dec 5, 2018
7021f15
Rollup merge of #56525 - udoprog:linux-current-exe, r=alexcrichton
kennytm Dec 5, 2018
f0fbfe2
Rollup merge of #56010 - euclio:intra-doc-spans, r=QuietMisdreavus
kennytm Dec 5, 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
17 changes: 11 additions & 6 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,6 @@ impl Step for Rustc {
return;
}

// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });

// Build rustc.
builder.ensure(compile::Rustc { compiler, target });

Expand All @@ -718,12 +715,16 @@ impl Step for Rustc {

// Find dependencies for top level crates.
let mut compiler_crates = HashSet::new();
for root_crate in &["rustc", "rustc_driver", "rustc_codegen_llvm"] {
for root_crate in &["rustc_driver", "rustc_codegen_llvm", "rustc_codegen_ssa"] {
let interned_root_crate = INTERNER.intern_str(root_crate);
find_compiler_crates(builder, &interned_root_crate, &mut compiler_crates);
}

for krate in &compiler_crates {
// Create all crate output directories first to make sure rustdoc uses
// relative links.
// FIXME: Cargo should probably do this itself.
t!(fs::create_dir_all(out_dir.join(krate)));
cargo.arg("-p").arg(krate);
}

Expand Down Expand Up @@ -797,8 +798,8 @@ impl Step for Rustdoc {
return;
}

// Build libstd docs so that we generate relative links.
builder.ensure(Std { stage, target });
// Build rustc docs so that we generate relative links.
builder.ensure(Rustc { stage, target });

// Build rustdoc.
builder.ensure(tool::Rustdoc { host: compiler.host });
Expand All @@ -822,6 +823,10 @@ impl Step for Rustdoc {
&[]
);

// Only include compiler crates, no dependencies of those, such as `libc`.
cargo.arg("--no-deps");
cargo.arg("-p").arg("rustdoc");

cargo.env("RUSTDOCFLAGS", "--document-private-items");
builder.run(&mut cargo);
}
Expand Down
49 changes: 48 additions & 1 deletion src/liballoc/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,9 @@ impl<T: ?Sized + Unsize<U>, U: ?Sized> DispatchFromDyn<Weak<U>> for Weak<T> {}

impl<T> Weak<T> {
/// Constructs a new `Weak<T>`, without allocating any memory.
/// Calling [`upgrade`][Weak::upgrade] on the return value always gives [`None`].
/// Calling [`upgrade`] on the return value always gives [`None`].
///
/// [`upgrade`]: #method.upgrade
/// [`None`]: ../../std/option/enum.Option.html
///
/// # Examples
Expand Down Expand Up @@ -1260,6 +1261,52 @@ impl<T: ?Sized> Weak<T> {
Some(unsafe { self.ptr.as_ref() })
}
}

/// Returns true if the two `Weak`s point to the same value (not just values
/// that compare as equal).
///
/// # Notes
///
/// Since this compares pointers it means that `Weak::new()` will equal each
/// other, even though they don't point to any value.
///
/// # Examples
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::rc::{Rc, Weak};
///
/// let first_rc = Rc::new(5);
/// let first = Rc::downgrade(&first_rc);
/// let second = Rc::downgrade(&first_rc);
///
/// assert!(Weak::ptr_eq(&first, &second));
///
/// let third_rc = Rc::new(5);
/// let third = Rc::downgrade(&third_rc);
///
/// assert!(!Weak::ptr_eq(&first, &third));
/// ```
///
/// Comparing `Weak::new`.
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::rc::{Rc, Weak};
///
/// let first = Weak::new();
/// let second = Weak::new();
/// assert!(Weak::ptr_eq(&first, &second));
///
/// let third_rc = Rc::new(());
/// let third = Rc::downgrade(&third_rc);
/// assert!(!Weak::ptr_eq(&first, &third));
/// ```
#[inline]
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
this.ptr.as_ptr() == other.ptr.as_ptr()
}
}

#[stable(feature = "rc_weak", since = "1.4.0")]
Expand Down
47 changes: 47 additions & 0 deletions src/liballoc/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,53 @@ impl<T: ?Sized> Weak<T> {
Some(unsafe { self.ptr.as_ref() })
}
}

/// Returns true if the two `Weak`s point to the same value (not just values
/// that compare as equal).
///
/// # Notes
///
/// Since this compares pointers it means that `Weak::new()` will equal each
/// other, even though they don't point to any value.
///
///
/// # Examples
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::sync::{Arc, Weak};
///
/// let first_rc = Arc::new(5);
/// let first = Arc::downgrade(&first_rc);
/// let second = Arc::downgrade(&first_rc);
///
/// assert!(Weak::ptr_eq(&first, &second));
///
/// let third_rc = Arc::new(5);
/// let third = Arc::downgrade(&third_rc);
///
/// assert!(!Weak::ptr_eq(&first, &third));
/// ```
///
/// Comparing `Weak::new`.
///
/// ```
/// #![feature(weak_ptr_eq)]
/// use std::sync::{Arc, Weak};
///
/// let first = Weak::new();
/// let second = Weak::new();
/// assert!(Weak::ptr_eq(&first, &second));
///
/// let third_rc = Arc::new(());
/// let third = Arc::downgrade(&third_rc);
/// assert!(!Weak::ptr_eq(&first, &third));
/// ```
#[inline]
#[unstable(feature = "weak_ptr_eq", issue = "55981")]
pub fn ptr_eq(this: &Self, other: &Self) -> bool {
this.ptr.as_ptr() == other.ptr.as_ptr()
}
}

#[stable(feature = "arc_weak", since = "1.4.0")]
Expand Down
4 changes: 4 additions & 0 deletions src/libcore/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,10 @@ macro_rules! debug_assert_ne {
/// with converting downstream errors.
///
/// The `?` operator was added to replace `try!` and should be used instead.
/// Furthermore, `try` is a reserved word in Rust 2018, so if you must use
/// it, you will need to use the [raw-identifier syntax][ris]: `r#try`.
///
/// [ris]: https://doc.rust-lang.org/nightly/rust-by-example/compatibility/raw_identifiers.html
///
/// `try!` matches the given [`Result`]. In case of the `Ok` variant, the
/// expression has the value of the wrapped value.
Expand Down
30 changes: 30 additions & 0 deletions src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2516,6 +2516,36 @@ pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool {
a == b
}

/// Hash the raw pointer address behind a reference, rather than the value
/// it points to.
///
/// # Examples
///
/// ```
/// #![feature(ptr_hash)]
/// use std::collections::hash_map::DefaultHasher;
/// use std::hash::{Hash, Hasher};
/// use std::ptr;
///
/// let five = 5;
/// let five_ref = &five;
///
/// let mut hasher = DefaultHasher::new();
/// ptr::hash(five_ref, &mut hasher);
/// let actual = hasher.finish();
///
/// let mut hasher = DefaultHasher::new();
/// (five_ref as *const i32).hash(&mut hasher);
/// let expected = hasher.finish();
///
/// assert_eq!(actual, expected);
/// ```
#[unstable(feature = "ptr_hash", reason = "newly added", issue = "56286")]
pub fn hash<T, S: hash::Hasher>(hashee: *const T, into: &mut S) {
use hash::Hash;
hashee.hash(into);
}

// Impls for function pointers
macro_rules! fnptr_impls_safety_abi {
($FnTy: ty, $($Arg: ident),*) => {
Expand Down
7 changes: 3 additions & 4 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,10 +536,9 @@ fn next_code_point_reverse<'a, I>(bytes: &mut I) -> Option<u32>
where I: DoubleEndedIterator<Item = &'a u8>,
{
// Decode UTF-8
let w = match bytes.next_back() {
None => return None,
Some(&next_byte) if next_byte < 128 => return Some(next_byte as u32),
Some(&back_byte) => back_byte,
let w = match *bytes.next_back()? {
next_byte if next_byte < 128 => return Some(next_byte as u32),
back_byte => back_byte,
};

// Multibyte case follows
Expand Down
1 change: 1 addition & 0 deletions src/librustc/middle/dead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
hir::ItemKind::Fn(..)
| hir::ItemKind::Ty(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Existential(..)
| hir::ItemKind::Const(..) => {
intravisit::walk_item(self, &item);
}
Expand Down
5 changes: 1 addition & 4 deletions src/librustc/middle/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,7 @@ impl<'tcx> ScopeTree {
return Some(scope.item_local_id());
}

match self.opt_encl_scope(scope) {
None => return None,
Some(parent) => scope = parent,
}
scope = self.opt_encl_scope(scope)?;
}
}

Expand Down
11 changes: 5 additions & 6 deletions src/librustc/session/search_paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,13 @@ impl<'a> Iterator for Iter<'a> {

fn next(&mut self) -> Option<(&'a Path, PathKind)> {
loop {
match self.iter.next() {
Some(&(kind, ref p)) if self.kind == PathKind::All ||
kind == PathKind::All ||
kind == self.kind => {
match *self.iter.next()? {
(kind, ref p) if self.kind == PathKind::All ||
kind == PathKind::All ||
kind == self.kind => {
return Some((p, kind))
}
Some(..) => {}
None => return None,
_ => {}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_borrowck/borrowck/check_loans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
let new_loan_str = &new_loan.kind.to_user_str();
self.bccx.cannot_reborrow_already_uniquely_borrowed(
new_loan.span, "closure", &nl, &new_loan_msg, new_loan_str,
old_loan.span, &old_loan_msg, previous_end_span, Origin::Ast)
old_loan.span, &old_loan_msg, previous_end_span, "", Origin::Ast)
}
(..) =>
self.bccx.cannot_reborrow_already_borrowed(
Expand Down
1 change: 0 additions & 1 deletion src/librustc_data_structures/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ pub mod sync;
pub mod tiny_list;
pub mod thin_vec;
pub mod transitive_relation;
pub mod tuple_slice;
pub use ena::unify;
pub mod vec_linked_list;
pub mod work_queue;
Expand Down
70 changes: 0 additions & 70 deletions src/librustc_data_structures/tuple_slice.rs

This file was deleted.

8 changes: 2 additions & 6 deletions src/librustc_incremental/persist/work_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
return None
}

let saved_files: Option<Vec<_>> =
let saved_files =
files.iter()
.map(|&(kind, ref path)| {
let extension = match kind {
Expand All @@ -51,11 +51,7 @@ pub fn copy_cgu_workproducts_to_incr_comp_cache_dir(
}
}
})
.collect();
let saved_files = match saved_files {
None => return None,
Some(v) => v,
};
.collect::<Option<Vec<_>>>()?;

let work_product = WorkProduct {
cgu_name: cgu_name.to_string(),
Expand Down
Loading