mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 23:12:02 +00:00
Auto merge of #34541 - jseyfried:rollup, r=jseyfried
Rollup of 5 pull requests - Successful merges: #34105, #34305, #34512, ~~#34531,~~ #34547
This commit is contained in:
commit
85c31af981
2
configure
vendored
2
configure
vendored
@ -1726,7 +1726,7 @@ do
|
|||||||
msg "configuring LLVM with:"
|
msg "configuring LLVM with:"
|
||||||
msg "$CMAKE_ARGS"
|
msg "$CMAKE_ARGS"
|
||||||
|
|
||||||
(cd $LLVM_BUILD_DIR && eval "$CFG_CMAKE" $CMAKE_ARGS)
|
(cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS)
|
||||||
need_ok "LLVM cmake configure failed"
|
need_ok "LLVM cmake configure failed"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
use core::clone::Clone;
|
use core::clone::Clone;
|
||||||
use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
|
use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
|
||||||
use core::convert::AsRef;
|
use core::convert::AsRef;
|
||||||
|
use core::default::Default;
|
||||||
use core::hash::{Hash, Hasher};
|
use core::hash::{Hash, Hasher};
|
||||||
use core::marker::Sized;
|
use core::marker::Sized;
|
||||||
use core::ops::Deref;
|
use core::ops::Deref;
|
||||||
@ -248,6 +249,16 @@ impl<'a, B: ?Sized> fmt::Display for Cow<'a, B>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[stable(feature = "default", since = "1.11.0")]
|
||||||
|
impl<'a, B: ?Sized> Default for Cow<'a, B>
|
||||||
|
where B: ToOwned,
|
||||||
|
<B as ToOwned>::Owned: Default
|
||||||
|
{
|
||||||
|
fn default() -> Cow<'a, B> {
|
||||||
|
Owned(<B as ToOwned>::Owned::default())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
|
impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
|
||||||
#[inline]
|
#[inline]
|
||||||
|
@ -432,7 +432,6 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext,
|
|||||||
ret.push(clean::Item {
|
ret.push(clean::Item {
|
||||||
inner: clean::ImplItem(clean::Impl {
|
inner: clean::ImplItem(clean::Impl {
|
||||||
unsafety: hir::Unsafety::Normal, // FIXME: this should be decoded
|
unsafety: hir::Unsafety::Normal, // FIXME: this should be decoded
|
||||||
derived: clean::detect_derived(&attrs),
|
|
||||||
provided_trait_methods: provided,
|
provided_trait_methods: provided,
|
||||||
trait_: trait_,
|
trait_: trait_,
|
||||||
for_: for_,
|
for_: for_,
|
||||||
|
@ -2239,14 +2239,9 @@ pub struct Impl {
|
|||||||
pub trait_: Option<Type>,
|
pub trait_: Option<Type>,
|
||||||
pub for_: Type,
|
pub for_: Type,
|
||||||
pub items: Vec<Item>,
|
pub items: Vec<Item>,
|
||||||
pub derived: bool,
|
|
||||||
pub polarity: Option<ImplPolarity>,
|
pub polarity: Option<ImplPolarity>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn detect_derived<M: AttrMetaMethods>(attrs: &[M]) -> bool {
|
|
||||||
attr::contains_name(attrs, "automatically_derived")
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Clean<Vec<Item>> for doctree::Impl {
|
impl Clean<Vec<Item>> for doctree::Impl {
|
||||||
fn clean(&self, cx: &DocContext) -> Vec<Item> {
|
fn clean(&self, cx: &DocContext) -> Vec<Item> {
|
||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
@ -2283,7 +2278,6 @@ impl Clean<Vec<Item>> for doctree::Impl {
|
|||||||
trait_: trait_,
|
trait_: trait_,
|
||||||
for_: self.for_.clean(cx),
|
for_: self.for_.clean(cx),
|
||||||
items: items,
|
items: items,
|
||||||
derived: detect_derived(&self.attrs),
|
|
||||||
polarity: Some(self.polarity.clean(cx)),
|
polarity: Some(self.polarity.clean(cx)),
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
@ -399,7 +399,6 @@ fn init_ids() -> HashMap<String, usize> {
|
|||||||
"methods",
|
"methods",
|
||||||
"deref-methods",
|
"deref-methods",
|
||||||
"implementations",
|
"implementations",
|
||||||
"derived_implementations"
|
|
||||||
].into_iter().map(|id| (String::from(*id), 1)).collect()
|
].into_iter().map(|id| (String::from(*id), 1)).collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2527,25 +2526,11 @@ fn render_assoc_items(w: &mut fmt::Formatter,
|
|||||||
}
|
}
|
||||||
write!(w, "<h2 id='implementations'>Trait \
|
write!(w, "<h2 id='implementations'>Trait \
|
||||||
Implementations</h2>")?;
|
Implementations</h2>")?;
|
||||||
let (derived, manual): (Vec<_>, Vec<&Impl>) = traits.iter().partition(|i| {
|
for i in &traits {
|
||||||
i.inner_impl().derived
|
|
||||||
});
|
|
||||||
for i in &manual {
|
|
||||||
let did = i.trait_did().unwrap();
|
let did = i.trait_did().unwrap();
|
||||||
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
|
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
|
||||||
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
|
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
|
||||||
}
|
}
|
||||||
if !derived.is_empty() {
|
|
||||||
write!(w, "<h3 id='derived_implementations'>\
|
|
||||||
Derived Implementations \
|
|
||||||
</h3>")?;
|
|
||||||
for i in &derived {
|
|
||||||
let did = i.trait_did().unwrap();
|
|
||||||
let assoc_link = AssocItemLink::GotoSource(did,
|
|
||||||
&i.inner_impl().provided_trait_methods);
|
|
||||||
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -1338,7 +1338,7 @@ impl<'a> State<'a> {
|
|||||||
if comma {
|
if comma {
|
||||||
try!(self.word_space(","))
|
try!(self.word_space(","))
|
||||||
}
|
}
|
||||||
try!(self.print_lifetime_def(lifetime_def));
|
try!(self.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds));
|
||||||
comma = true;
|
comma = true;
|
||||||
}
|
}
|
||||||
try!(word(&mut self.s, ">"));
|
try!(word(&mut self.s, ">"));
|
||||||
@ -2749,16 +2749,20 @@ impl<'a> State<'a> {
|
|||||||
self.print_name(lifetime.name)
|
self.print_name(lifetime.name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn print_lifetime_def(&mut self,
|
pub fn print_lifetime_bounds(&mut self,
|
||||||
lifetime: &ast::LifetimeDef)
|
lifetime: &ast::Lifetime,
|
||||||
-> io::Result<()>
|
bounds: &[ast::Lifetime])
|
||||||
|
-> io::Result<()>
|
||||||
{
|
{
|
||||||
try!(self.print_lifetime(&lifetime.lifetime));
|
try!(self.print_lifetime(lifetime));
|
||||||
let mut sep = ":";
|
if !bounds.is_empty() {
|
||||||
for v in &lifetime.bounds {
|
try!(word(&mut self.s, ": "));
|
||||||
try!(word(&mut self.s, sep));
|
for (i, bound) in bounds.iter().enumerate() {
|
||||||
try!(self.print_lifetime(v));
|
if i != 0 {
|
||||||
sep = "+";
|
try!(word(&mut self.s, " + "));
|
||||||
|
}
|
||||||
|
try!(self.print_lifetime(bound));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@ -2781,8 +2785,8 @@ impl<'a> State<'a> {
|
|||||||
|
|
||||||
try!(self.commasep(Inconsistent, &ints[..], |s, &idx| {
|
try!(self.commasep(Inconsistent, &ints[..], |s, &idx| {
|
||||||
if idx < generics.lifetimes.len() {
|
if idx < generics.lifetimes.len() {
|
||||||
let lifetime = &generics.lifetimes[idx];
|
let lifetime_def = &generics.lifetimes[idx];
|
||||||
s.print_lifetime_def(lifetime)
|
s.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds)
|
||||||
} else {
|
} else {
|
||||||
let idx = idx - generics.lifetimes.len();
|
let idx = idx - generics.lifetimes.len();
|
||||||
let param = &generics.ty_params[idx];
|
let param = &generics.ty_params[idx];
|
||||||
@ -2833,16 +2837,7 @@ impl<'a> State<'a> {
|
|||||||
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
|
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
|
||||||
ref bounds,
|
ref bounds,
|
||||||
..}) => {
|
..}) => {
|
||||||
try!(self.print_lifetime(lifetime));
|
try!(self.print_lifetime_bounds(lifetime, bounds));
|
||||||
try!(word(&mut self.s, ":"));
|
|
||||||
|
|
||||||
for (i, bound) in bounds.iter().enumerate() {
|
|
||||||
try!(self.print_lifetime(bound));
|
|
||||||
|
|
||||||
if i != 0 {
|
|
||||||
try!(word(&mut self.s, ":"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
|
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
|
||||||
try!(self.print_path(path, false, 0));
|
try!(self.print_path(path, false, 0));
|
||||||
|
15
src/test/pretty/lifetime.rs
Normal file
15
src/test/pretty/lifetime.rs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
|
||||||
|
// file at the top-level directory of this distribution and at
|
||||||
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
||||||
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
||||||
|
// option. This file may not be copied, modified, or distributed
|
||||||
|
// except according to those terms.
|
||||||
|
|
||||||
|
// pp-exact
|
||||||
|
|
||||||
|
fn f1<'a, 'b, 'c>(_x: &'a u32, _y: &'b u32, _z: &'c u32) where 'c: 'a + 'b { }
|
||||||
|
|
||||||
|
fn main() { }
|
@ -10,6 +10,6 @@
|
|||||||
|
|
||||||
// pp-exact
|
// pp-exact
|
||||||
|
|
||||||
fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a:'b, T: Eq { 0 }
|
fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a: 'b, T: Eq { 0 }
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
Loading…
Reference in New Issue
Block a user