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 15 pull requests #56521

Closed
wants to merge 46 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
51fdc2b
Add example of using the indexing operator to HashMap docs
fhartwig Oct 30, 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
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
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
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
4bddb76
Add example of using the indexing operator to BTreeMap docs
frewsxcv Dec 4, 2018
06722f9
Rollup merge of #51753 - gruberb:document-from-conversions-libstdpath…
GuillaumeGomez Dec 4, 2018
a380bee
Rollup merge of #55519 - fhartwig:hashmap-index-example, r=frewsxcv
GuillaumeGomez Dec 4, 2018
e5a8699
Rollup merge of #55563 - GuillaumeGomez:doc-search-sentence, r=QuietM…
GuillaumeGomez Dec 4, 2018
68c209c
Rollup merge of #55987 - Thomasdezeeuw:weak-ptr_eq, r=sfackler
GuillaumeGomez Dec 4, 2018
b96a12a
Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
GuillaumeGomez Dec 4, 2018
7eda308
Rollup merge of #56332 - GuillaumeGomez:specifi-crate-search, r=Quiet…
GuillaumeGomez Dec 4, 2018
42ad3ab
Rollup merge of #56372 - wildarch:issue-55314-second-borrow-ref, r=da…
GuillaumeGomez Dec 4, 2018
ea256e1
Rollup merge of #56388 - matthewjasper:more-lexical-mir-cleanup, r=ni…
GuillaumeGomez Dec 4, 2018
82a30d4
Rollup merge of #56424 - mark-i-m:explain-raw, r=Centril
GuillaumeGomez Dec 4, 2018
4dc8d0c
Rollup merge of #56452 - sinkuu:redundant_clone, r=nikic
GuillaumeGomez Dec 4, 2018
dcb57d5
Rollup merge of #56456 - oli-obk:private_impl_trait, r=cramertj
GuillaumeGomez Dec 4, 2018
56f77d1
Rollup merge of #56466 - ljedrz:delete_tuple_slice, r=nikomatsakis
GuillaumeGomez Dec 4, 2018
70c167e
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=…
GuillaumeGomez Dec 4, 2018
426643d
Rollup merge of #56497 - ljedrz:cleanup_libstd_const_lifetimes, r=ken…
GuillaumeGomez Dec 4, 2018
be0217c
Rollup merge of #56498 - GuillaumeGomez:line-numbers, r=QuietMisdreavus
GuillaumeGomez Dec 4, 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 src/liballoc/collections/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ use self::Entry::*;
/// }
/// }
///
/// // Look up the value for a key (will panic if the key is not found).
/// println!("Review for Jane: {}", book_reviews["Pride and Prejudice"]);
///
/// // iterate over everything.
/// for (movie, review) in &movie_reviews {
/// println!("{}: \"{}\"", movie, review);
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
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