Skip to content

Commit 85c31af

Browse files
authored
Auto merge of #34541 - jseyfried:rollup, r=jseyfried
Rollup of 5 pull requests - Successful merges: #34105, #34305, #34512, ~~#34531,~~ #34547
2 parents c2b56fb + a8751e0 commit 85c31af

File tree

8 files changed

+46
-47
lines changed

8 files changed

+46
-47
lines changed

configure

+1-1
Original file line numberDiff line numberDiff line change
@@ -1726,7 +1726,7 @@ do
17261726
msg "configuring LLVM with:"
17271727
msg "$CMAKE_ARGS"
17281728

1729-
(cd $LLVM_BUILD_DIR && eval "$CFG_CMAKE" $CMAKE_ARGS)
1729+
(cd $LLVM_BUILD_DIR && eval "\"$CFG_CMAKE\"" $CMAKE_ARGS)
17301730
need_ok "LLVM cmake configure failed"
17311731
fi
17321732

src/libcollections/borrow.rs

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use core::clone::Clone;
1616
use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
1717
use core::convert::AsRef;
18+
use core::default::Default;
1819
use core::hash::{Hash, Hasher};
1920
use core::marker::Sized;
2021
use core::ops::Deref;
@@ -248,6 +249,16 @@ impl<'a, B: ?Sized> fmt::Display for Cow<'a, B>
248249
}
249250
}
250251

252+
#[stable(feature = "default", since = "1.11.0")]
253+
impl<'a, B: ?Sized> Default for Cow<'a, B>
254+
where B: ToOwned,
255+
<B as ToOwned>::Owned: Default
256+
{
257+
fn default() -> Cow<'a, B> {
258+
Owned(<B as ToOwned>::Owned::default())
259+
}
260+
}
261+
251262
#[stable(feature = "rust1", since = "1.0.0")]
252263
impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned {
253264
#[inline]

src/librustdoc/clean/inline.rs

-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,6 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext,
432432
ret.push(clean::Item {
433433
inner: clean::ImplItem(clean::Impl {
434434
unsafety: hir::Unsafety::Normal, // FIXME: this should be decoded
435-
derived: clean::detect_derived(&attrs),
436435
provided_trait_methods: provided,
437436
trait_: trait_,
438437
for_: for_,

src/librustdoc/clean/mod.rs

-6
Original file line numberDiff line numberDiff line change
@@ -2239,14 +2239,9 @@ pub struct Impl {
22392239
pub trait_: Option<Type>,
22402240
pub for_: Type,
22412241
pub items: Vec<Item>,
2242-
pub derived: bool,
22432242
pub polarity: Option<ImplPolarity>,
22442243
}
22452244

2246-
fn detect_derived<M: AttrMetaMethods>(attrs: &[M]) -> bool {
2247-
attr::contains_name(attrs, "automatically_derived")
2248-
}
2249-
22502245
impl Clean<Vec<Item>> for doctree::Impl {
22512246
fn clean(&self, cx: &DocContext) -> Vec<Item> {
22522247
let mut ret = Vec::new();
@@ -2283,7 +2278,6 @@ impl Clean<Vec<Item>> for doctree::Impl {
22832278
trait_: trait_,
22842279
for_: self.for_.clean(cx),
22852280
items: items,
2286-
derived: detect_derived(&self.attrs),
22872281
polarity: Some(self.polarity.clean(cx)),
22882282
}),
22892283
});

src/librustdoc/html/render.rs

+1-16
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,6 @@ fn init_ids() -> HashMap<String, usize> {
399399
"methods",
400400
"deref-methods",
401401
"implementations",
402-
"derived_implementations"
403402
].into_iter().map(|id| (String::from(*id), 1)).collect()
404403
}
405404

@@ -2527,25 +2526,11 @@ fn render_assoc_items(w: &mut fmt::Formatter,
25272526
}
25282527
write!(w, "<h2 id='implementations'>Trait \
25292528
Implementations</h2>")?;
2530-
let (derived, manual): (Vec<_>, Vec<&Impl>) = traits.iter().partition(|i| {
2531-
i.inner_impl().derived
2532-
});
2533-
for i in &manual {
2529+
for i in &traits {
25342530
let did = i.trait_did().unwrap();
25352531
let assoc_link = AssocItemLink::GotoSource(did, &i.inner_impl().provided_trait_methods);
25362532
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
25372533
}
2538-
if !derived.is_empty() {
2539-
write!(w, "<h3 id='derived_implementations'>\
2540-
Derived Implementations \
2541-
</h3>")?;
2542-
for i in &derived {
2543-
let did = i.trait_did().unwrap();
2544-
let assoc_link = AssocItemLink::GotoSource(did,
2545-
&i.inner_impl().provided_trait_methods);
2546-
render_impl(w, cx, i, assoc_link, true, containing_item.stable_since())?;
2547-
}
2548-
}
25492534
}
25502535
Ok(())
25512536
}

src/libsyntax/print/pprust.rs

+17-22
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ impl<'a> State<'a> {
13381338
if comma {
13391339
try!(self.word_space(","))
13401340
}
1341-
try!(self.print_lifetime_def(lifetime_def));
1341+
try!(self.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds));
13421342
comma = true;
13431343
}
13441344
try!(word(&mut self.s, ">"));
@@ -2749,16 +2749,20 @@ impl<'a> State<'a> {
27492749
self.print_name(lifetime.name)
27502750
}
27512751

2752-
pub fn print_lifetime_def(&mut self,
2753-
lifetime: &ast::LifetimeDef)
2754-
-> io::Result<()>
2752+
pub fn print_lifetime_bounds(&mut self,
2753+
lifetime: &ast::Lifetime,
2754+
bounds: &[ast::Lifetime])
2755+
-> io::Result<()>
27552756
{
2756-
try!(self.print_lifetime(&lifetime.lifetime));
2757-
let mut sep = ":";
2758-
for v in &lifetime.bounds {
2759-
try!(word(&mut self.s, sep));
2760-
try!(self.print_lifetime(v));
2761-
sep = "+";
2757+
try!(self.print_lifetime(lifetime));
2758+
if !bounds.is_empty() {
2759+
try!(word(&mut self.s, ": "));
2760+
for (i, bound) in bounds.iter().enumerate() {
2761+
if i != 0 {
2762+
try!(word(&mut self.s, " + "));
2763+
}
2764+
try!(self.print_lifetime(bound));
2765+
}
27622766
}
27632767
Ok(())
27642768
}
@@ -2781,8 +2785,8 @@ impl<'a> State<'a> {
27812785

27822786
try!(self.commasep(Inconsistent, &ints[..], |s, &idx| {
27832787
if idx < generics.lifetimes.len() {
2784-
let lifetime = &generics.lifetimes[idx];
2785-
s.print_lifetime_def(lifetime)
2788+
let lifetime_def = &generics.lifetimes[idx];
2789+
s.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds)
27862790
} else {
27872791
let idx = idx - generics.lifetimes.len();
27882792
let param = &generics.ty_params[idx];
@@ -2833,16 +2837,7 @@ impl<'a> State<'a> {
28332837
ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime,
28342838
ref bounds,
28352839
..}) => {
2836-
try!(self.print_lifetime(lifetime));
2837-
try!(word(&mut self.s, ":"));
2838-
2839-
for (i, bound) in bounds.iter().enumerate() {
2840-
try!(self.print_lifetime(bound));
2841-
2842-
if i != 0 {
2843-
try!(word(&mut self.s, ":"));
2844-
}
2845-
}
2840+
try!(self.print_lifetime_bounds(lifetime, bounds));
28462841
}
28472842
ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => {
28482843
try!(self.print_path(path, false, 0));

src/test/pretty/lifetime.rs

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
// pp-exact
12+
13+
fn f1<'a, 'b, 'c>(_x: &'a u32, _y: &'b u32, _z: &'c u32) where 'c: 'a + 'b { }
14+
15+
fn main() { }

src/test/pretty/where-clauses.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@
1010

1111
// pp-exact
1212

13-
fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a:'b, T: Eq { 0 }
13+
fn f<'a, 'b, T>(t: T) -> isize where T: 'a, 'a: 'b, T: Eq { 0 }
1414

1515
fn main() { }

0 commit comments

Comments
 (0)