From cc181040348966789413387d4f99fc81673f60c7 Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Sun, 5 Jun 2016 23:50:18 +0100 Subject: [PATCH 1/4] rustdoc: Remove Derived Implementations title As far as I know whether a trait was derived or not does not change the public API so there is no need to include this information in the docs. This title currently just adds an extra divide in the list of trait implementations which I don't think needs to be there. --- src/librustdoc/clean/inline.rs | 1 - src/librustdoc/clean/mod.rs | 6 ------ src/librustdoc/html/render.rs | 17 +---------------- 3 files changed, 1 insertion(+), 23 deletions(-) diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index f5d54123f37..fbd9ba9d302 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -425,7 +425,6 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext, ret.push(clean::Item { inner: clean::ImplItem(clean::Impl { unsafety: hir::Unsafety::Normal, // FIXME: this should be decoded - derived: clean::detect_derived(&attrs), provided_trait_methods: provided, trait_: trait_, for_: for_, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 0f3c62aca2a..1a08fc6bde4 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -2239,14 +2239,9 @@ pub struct Impl { pub trait_: Option, pub for_: Type, pub items: Vec, - pub derived: bool, pub polarity: Option, } -fn detect_derived(attrs: &[M]) -> bool { - attr::contains_name(attrs, "automatically_derived") -} - impl Clean> for doctree::Impl { fn clean(&self, cx: &DocContext) -> Vec { let mut ret = Vec::new(); @@ -2283,7 +2278,6 @@ impl Clean> for doctree::Impl { trait_: trait_, for_: self.for_.clean(cx), items: items, - derived: detect_derived(&self.attrs), polarity: Some(self.polarity.clean(cx)), }), }); diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 396f71173f8..1fa40a0cead 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -399,7 +399,6 @@ fn init_ids() -> HashMap { "methods", "deref-methods", "implementations", - "derived_implementations" ].into_iter().map(|id| (String::from(*id), 1)).collect() } @@ -2501,25 +2500,11 @@ fn render_assoc_items(w: &mut fmt::Formatter, } write!(w, "

Trait \ Implementations

")?; - let (derived, manual): (Vec<_>, Vec<&Impl>) = traits.iter().partition(|i| { - i.inner_impl().derived - }); - for i in &manual { + for i in &traits { 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())?; } - if !derived.is_empty() { - write!(w, "

\ - Derived Implementations \ -

")?; - 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(()) } From 703d7b519e69daf03e34edcd1af2957e393414b5 Mon Sep 17 00:00:00 2001 From: Aaronepower Date: Thu, 16 Jun 2016 14:44:56 +0100 Subject: [PATCH 2/4] Added Default trait for Cow --- src/libcollections/borrow.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/libcollections/borrow.rs b/src/libcollections/borrow.rs index 6ca0db68a88..37dbeb4eae1 100644 --- a/src/libcollections/borrow.rs +++ b/src/libcollections/borrow.rs @@ -15,6 +15,7 @@ use core::clone::Clone; use core::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd}; use core::convert::AsRef; +use core::default::Default; use core::hash::{Hash, Hasher}; use core::marker::Sized; 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, + ::Owned: Default +{ + fn default() -> Cow<'a, B> { + Owned(::Owned::default()) + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl<'a, B: ?Sized> Hash for Cow<'a, B> where B: Hash + ToOwned { #[inline] From 37f0f676829159b47e4f5357768c22c6576b47ad Mon Sep 17 00:00:00 2001 From: CensoredUsername Date: Mon, 27 Jun 2016 23:39:51 +0200 Subject: [PATCH 3/4] Support CMake installations in paths containing spaces --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index beaac755757..e1319828e3f 100755 --- a/configure +++ b/configure @@ -1725,7 +1725,7 @@ do msg "configuring LLVM with:" 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" fi From 3c29fc5f6cd69b1299cf5482a6bc991ba6b86a0f Mon Sep 17 00:00:00 2001 From: Seo Sanghyeon Date: Wed, 29 Jun 2016 21:53:01 +0900 Subject: [PATCH 4/4] Fix pretty-printing of lifetime bound --- src/libsyntax/print/pprust.rs | 39 ++++++++++++++------------------ src/test/pretty/lifetime.rs | 15 ++++++++++++ src/test/pretty/where-clauses.rs | 2 +- 3 files changed, 33 insertions(+), 23 deletions(-) create mode 100644 src/test/pretty/lifetime.rs diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index b56cec72a95..94b71661bc2 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -1338,7 +1338,7 @@ impl<'a> State<'a> { if comma { try!(self.word_space(",")) } - try!(self.print_lifetime_def(lifetime_def)); + try!(self.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds)); comma = true; } try!(word(&mut self.s, ">")); @@ -2749,16 +2749,20 @@ impl<'a> State<'a> { self.print_name(lifetime.name) } - pub fn print_lifetime_def(&mut self, - lifetime: &ast::LifetimeDef) - -> io::Result<()> + pub fn print_lifetime_bounds(&mut self, + lifetime: &ast::Lifetime, + bounds: &[ast::Lifetime]) + -> io::Result<()> { - try!(self.print_lifetime(&lifetime.lifetime)); - let mut sep = ":"; - for v in &lifetime.bounds { - try!(word(&mut self.s, sep)); - try!(self.print_lifetime(v)); - sep = "+"; + try!(self.print_lifetime(lifetime)); + if !bounds.is_empty() { + try!(word(&mut self.s, ": ")); + for (i, bound) in bounds.iter().enumerate() { + if i != 0 { + try!(word(&mut self.s, " + ")); + } + try!(self.print_lifetime(bound)); + } } Ok(()) } @@ -2781,8 +2785,8 @@ impl<'a> State<'a> { try!(self.commasep(Inconsistent, &ints[..], |s, &idx| { if idx < generics.lifetimes.len() { - let lifetime = &generics.lifetimes[idx]; - s.print_lifetime_def(lifetime) + let lifetime_def = &generics.lifetimes[idx]; + s.print_lifetime_bounds(&lifetime_def.lifetime, &lifetime_def.bounds) } else { let idx = idx - generics.lifetimes.len(); let param = &generics.ty_params[idx]; @@ -2833,16 +2837,7 @@ impl<'a> State<'a> { ast::WherePredicate::RegionPredicate(ast::WhereRegionPredicate{ref lifetime, ref bounds, ..}) => { - try!(self.print_lifetime(lifetime)); - 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, ":")); - } - } + try!(self.print_lifetime_bounds(lifetime, bounds)); } ast::WherePredicate::EqPredicate(ast::WhereEqPredicate{ref path, ref ty, ..}) => { try!(self.print_path(path, false, 0)); diff --git a/src/test/pretty/lifetime.rs b/src/test/pretty/lifetime.rs new file mode 100644 index 00000000000..2cc7153b7f5 --- /dev/null +++ b/src/test/pretty/lifetime.rs @@ -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 or the MIT license +// , 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() { } diff --git a/src/test/pretty/where-clauses.rs b/src/test/pretty/where-clauses.rs index cca7707509f..388064a8be8 100644 --- a/src/test/pretty/where-clauses.rs +++ b/src/test/pretty/where-clauses.rs @@ -10,6 +10,6 @@ // 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() { }