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 6 pull requests #64535

Merged
merged 25 commits into from
Sep 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
b88bcf0
Update bundled OpenSSL to 1.1.1d
alexcrichton Sep 11, 2019
68b1a87
Various refactorings to clean up nll diagnostics
mark-i-m Sep 12, 2019
23db450
minor fixes
mark-i-m Sep 12, 2019
5b09358
update tests
mark-i-m Sep 12, 2019
2a774b1
address Centril's comments
mark-i-m Sep 14, 2019
04b1111
Name index variables consistently.
nnethercote Sep 16, 2019
43c0d2c
Redefine `NodeIndex` as a `newtype_index!`.
nnethercote Sep 16, 2019
1936e44
Factor out repeated `self.nodes[i]` expressions.
nnethercote Sep 16, 2019
3fda957
Remove out-of-date comments.
nnethercote Sep 16, 2019
ac061dc
Fix some out-of-date names of things in comments.
nnethercote Sep 16, 2019
6391ef4
Fix incorrect comment about contents of a `Node`.
nnethercote Sep 16, 2019
e2492b7
Add comments about `waiting_cache`.
nnethercote Sep 16, 2019
6e48053
Use iterators in `error_at` and `process_cycle`.
nnethercote Sep 16, 2019
f22bb2e
Use `retain` for `waiting_cache` in `apply_rewrites()`.
nnethercote Sep 16, 2019
201afa6
Minor comment tweaks.
nnethercote Sep 16, 2019
4ecd94e
Move `impl Node` just after `struct Node`.
nnethercote Sep 16, 2019
0a985f2
Tweak unsatisfied HRTB errors
estebank Sep 2, 2019
3a046ff
Elide lifetimes in `Pin<&(mut) Self>`
taiki-e Sep 16, 2019
076e0ce
Use shorthand syntax in the self parameter of methods of Pin
taiki-e Sep 16, 2019
3edc644
Rollup merge of #64085 - estebank:hrtb-errors, r=oli-obk
Centril Sep 17, 2019
aeb32f0
Rollup merge of #64380 - alexcrichton:update-openssl, r=Mark-Simulacrum
Centril Sep 17, 2019
69e93e8
Rollup merge of #64416 - mark-i-m:region-naming-ctx, r=estebank
Centril Sep 17, 2019
1e3b57e
Rollup merge of #64500 - nnethercote:ObligForest-fixups, r=nikomatsakis
Centril Sep 17, 2019
52fa593
Rollup merge of #64530 - taiki-e:docs-pin-lifetimes, r=Centril
Centril Sep 17, 2019
a1fd9ba
Rollup merge of #64531 - taiki-e:pin-self, r=Centril
Centril Sep 17, 2019
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
4 changes: 2 additions & 2 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2182,9 +2182,9 @@ checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"

[[package]]
name = "openssl-src"
version = "111.3.0+1.1.1c"
version = "111.6.0+1.1.1d"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "53ed5f31d294bdf5f7a4ba0a206c2754b0f60e9a63b7e3076babc5317873c797"
checksum = "b9c2da1de8a7a3f860919c01540b03a6db16de042405a8a07a5e9d0b4b825d9c"
dependencies = [
"cc",
]
Expand Down
4 changes: 2 additions & 2 deletions src/libcore/option.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ impl<T> Option<T> {
/// [`Pin`]: ../pin/struct.Pin.html
#[inline]
#[stable(feature = "pin", since = "1.33.0")]
pub fn as_pin_ref<'a>(self: Pin<&'a Option<T>>) -> Option<Pin<&'a T>> {
pub fn as_pin_ref(self: Pin<&Self>) -> Option<Pin<&T>> {
unsafe {
Pin::get_ref(self).as_ref().map(|x| Pin::new_unchecked(x))
}
Expand All @@ -306,7 +306,7 @@ impl<T> Option<T> {
/// [`Pin`]: ../pin/struct.Pin.html
#[inline]
#[stable(feature = "pin", since = "1.33.0")]
pub fn as_pin_mut<'a>(self: Pin<&'a mut Option<T>>) -> Option<Pin<&'a mut T>> {
pub fn as_pin_mut(self: Pin<&mut Self>) -> Option<Pin<&mut T>> {
unsafe {
Pin::get_unchecked_mut(self).as_mut().map(|x| Pin::new_unchecked(x))
}
Expand Down
22 changes: 11 additions & 11 deletions src/libcore/pin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
//! # type Field = i32;
//! # struct Struct { field: Field }
//! impl Struct {
//! fn pin_get_field<'a>(self: Pin<&'a mut Self>) -> &'a mut Field {
//! fn pin_get_field(self: Pin<&mut Self>) -> &mut Field {
//! // This is okay because `field` is never considered pinned.
//! unsafe { &mut self.get_unchecked_mut().field }
//! }
Expand All @@ -257,7 +257,7 @@
//! # type Field = i32;
//! # struct Struct { field: Field }
//! impl Struct {
//! fn pin_get_field<'a>(self: Pin<&'a mut Self>) -> Pin<&'a mut Field> {
//! fn pin_get_field(self: Pin<&mut Self>) -> Pin<&mut Field> {
//! // This is okay because `field` is pinned when `self` is.
//! unsafe { self.map_unchecked_mut(|s| &mut s.field) }
//! }
Expand Down Expand Up @@ -549,7 +549,7 @@ impl<P: Deref> Pin<P> {
/// ruled out by the contract of `Pin::new_unchecked`.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn as_ref(self: &Pin<P>) -> Pin<&P::Target> {
pub fn as_ref(&self) -> Pin<&P::Target> {
unsafe { Pin::new_unchecked(&*self.pointer) }
}

Expand Down Expand Up @@ -586,7 +586,7 @@ impl<P: DerefMut> Pin<P> {
/// ruled out by the contract of `Pin::new_unchecked`.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn as_mut(self: &mut Pin<P>) -> Pin<&mut P::Target> {
pub fn as_mut(&mut self) -> Pin<&mut P::Target> {
unsafe { Pin::new_unchecked(&mut *self.pointer) }
}

Expand All @@ -596,7 +596,7 @@ impl<P: DerefMut> Pin<P> {
/// run before being overwritten, so no pinning guarantee is violated.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn set(self: &mut Pin<P>, value: P::Target)
pub fn set(&mut self, value: P::Target)
where
P::Target: Sized,
{
Expand All @@ -621,7 +621,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
///
/// [`pin` module]: ../../std/pin/index.html#projections-and-structural-pinning
#[stable(feature = "pin", since = "1.33.0")]
pub unsafe fn map_unchecked<U, F>(self: Pin<&'a T>, func: F) -> Pin<&'a U> where
pub unsafe fn map_unchecked<U, F>(self, func: F) -> Pin<&'a U> where
F: FnOnce(&T) -> &U,
{
let pointer = &*self.pointer;
Expand All @@ -648,7 +648,7 @@ impl<'a, T: ?Sized> Pin<&'a T> {
/// ["pinning projections"]: ../../std/pin/index.html#projections-and-structural-pinning
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn get_ref(self: Pin<&'a T>) -> &'a T {
pub fn get_ref(self) -> &'a T {
self.pointer
}
}
Expand All @@ -657,7 +657,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// Converts this `Pin<&mut T>` into a `Pin<&T>` with the same lifetime.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn into_ref(self: Pin<&'a mut T>) -> Pin<&'a T> {
pub fn into_ref(self) -> Pin<&'a T> {
Pin { pointer: self.pointer }
}

Expand All @@ -672,7 +672,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// with the same lifetime as the original `Pin`.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub fn get_mut(self: Pin<&'a mut T>) -> &'a mut T
pub fn get_mut(self) -> &'a mut T
where T: Unpin,
{
self.pointer
Expand All @@ -690,7 +690,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
/// instead.
#[stable(feature = "pin", since = "1.33.0")]
#[inline(always)]
pub unsafe fn get_unchecked_mut(self: Pin<&'a mut T>) -> &'a mut T {
pub unsafe fn get_unchecked_mut(self) -> &'a mut T {
self.pointer
}

Expand All @@ -710,7 +710,7 @@ impl<'a, T: ?Sized> Pin<&'a mut T> {
///
/// [`pin` module]: ../../std/pin/index.html#projections-and-structural-pinning
#[stable(feature = "pin", since = "1.33.0")]
pub unsafe fn map_unchecked_mut<U, F>(self: Pin<&'a mut T>, func: F) -> Pin<&'a mut U> where
pub unsafe fn map_unchecked_mut<U, F>(self, func: F) -> Pin<&'a mut U> where
F: FnOnce(&mut T) -> &mut U,
{
let pointer = Pin::get_unchecked_mut(self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,23 +192,28 @@ impl NiceRegionError<'me, 'tcx> {
vid, sub_placeholder, sup_placeholder, trait_def_id, expected_substs, actual_substs
);

let mut err = self.tcx().sess.struct_span_err(
cause.span(self.tcx()),
&format!(
"implementation of `{}` is not general enough",
self.tcx().def_path_str(trait_def_id),
),
let span = cause.span(self.tcx());
let msg = format!(
"implementation of `{}` is not general enough",
self.tcx().def_path_str(trait_def_id),
);
let mut err = self.tcx().sess.struct_span_err(span, &msg);
err.span_label(
self.tcx().def_span(trait_def_id),
format!("trait `{}` defined here", self.tcx().def_path_str(trait_def_id)),
);

match cause.code {
ObligationCauseCode::ItemObligation(def_id) => {
err.note(&format!(
"Due to a where-clause on `{}`,",
self.tcx().def_path_str(def_id),
));
}
_ => (),
}
let leading_ellipsis = if let ObligationCauseCode::ItemObligation(def_id) = cause.code {
err.span_label(span, "doesn't satisfy where-clause");
err.span_label(
self.tcx().def_span(def_id),
&format!("due to a where-clause on `{}`...", self.tcx().def_path_str(def_id)),
);
true
} else {
err.span_label(span, &msg);
false
};

let expected_trait_ref = self.infcx.resolve_vars_if_possible(&ty::TraitRef {
def_id: trait_def_id,
Expand Down Expand Up @@ -295,6 +300,7 @@ impl NiceRegionError<'me, 'tcx> {
expected_has_vid,
actual_has_vid,
any_self_ty_has_vid,
leading_ellipsis,
);

err
Expand All @@ -318,6 +324,7 @@ impl NiceRegionError<'me, 'tcx> {
expected_has_vid: Option<usize>,
actual_has_vid: Option<usize>,
any_self_ty_has_vid: bool,
leading_ellipsis: bool,
) {
// HACK(eddyb) maybe move this in a more central location.
#[derive(Copy, Clone)]
Expand Down Expand Up @@ -392,13 +399,15 @@ impl NiceRegionError<'me, 'tcx> {

let mut note = if passive_voice {
format!(
"`{}` would have to be implemented for the type `{}`",
"{}`{}` would have to be implemented for the type `{}`",
if leading_ellipsis { "..." } else { "" },
expected_trait_ref,
expected_trait_ref.map(|tr| tr.self_ty()),
)
} else {
format!(
"`{}` must implement `{}`",
"{}`{}` must implement `{}`",
if leading_ellipsis { "..." } else { "" },
expected_trait_ref.map(|tr| tr.self_ty()),
expected_trait_ref,
)
Expand All @@ -407,20 +416,20 @@ impl NiceRegionError<'me, 'tcx> {
match (has_sub, has_sup) {
(Some(n1), Some(n2)) => {
let _ = write!(note,
", for any two lifetimes `'{}` and `'{}`",
", for any two lifetimes `'{}` and `'{}`...",
std::cmp::min(n1, n2),
std::cmp::max(n1, n2),
);
}
(Some(n), _) | (_, Some(n)) => {
let _ = write!(note,
", for any lifetime `'{}`",
", for any lifetime `'{}`...",
n,
);
}
(None, None) => if let Some(n) = expected_has_vid {
let _ = write!(note,
", for some specific lifetime `'{}`",
", for some specific lifetime `'{}`...",
n,
);
},
Expand All @@ -439,13 +448,13 @@ impl NiceRegionError<'me, 'tcx> {

let mut note = if passive_voice {
format!(
"but `{}` is actually implemented for the type `{}`",
"...but `{}` is actually implemented for the type `{}`",
actual_trait_ref,
actual_trait_ref.map(|tr| tr.self_ty()),
)
} else {
format!(
"but `{}` actually implements `{}`",
"...but `{}` actually implements `{}`",
actual_trait_ref.map(|tr| tr.self_ty()),
actual_trait_ref,
)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_data_structures/indexed_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ macro_rules! newtype_index {

#[inline]
$v const unsafe fn from_u32_unchecked(value: u32) -> Self {
unsafe { $type { private: value } }
$type { private: value }
}

/// Extracts the value of this index as an integer.
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_data_structures/obligation_forest/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ impl<'a, O: ForestObligation + 'a> dot::GraphWalk<'a> for &'a ObligationForest<O
.flat_map(|i| {
let node = &self.nodes[i];

node.parent.iter().map(|p| p.get())
.chain(node.dependents.iter().map(|p| p.get()))
.map(move |p| (p, i))
node.parent.iter()
.chain(node.dependents.iter())
.map(move |p| (p.index(), i))
})
.collect()
}
Expand Down
Loading