diff --git a/src/librustc_typeck/coherence/mod.rs b/src/librustc_typeck/coherence/mod.rs index 9c8c9ba505612..859fbd974fedc 100644 --- a/src/librustc_typeck/coherence/mod.rs +++ b/src/librustc_typeck/coherence/mod.rs @@ -34,9 +34,7 @@ use CrateCtxt; use rustc::infer::{self, InferCtxt, TypeOrigin, new_infer_ctxt}; use std::cell::RefCell; use std::rc::Rc; -use syntax::ast; use syntax::codemap::Span; -use syntax::errors::DiagnosticBuilder; use util::nodemap::{DefIdMap, FnvHashMap}; use rustc::dep_graph::DepNode; use rustc::hir::map as hir_map; @@ -517,13 +515,6 @@ fn enforce_trait_manually_implementable(tcx: &TyCtxt, sp: Span, trait_def_id: De err.emit(); } -// Factored out into helper because the error cannot be defined in multiple locations. -pub fn report_duplicate_item<'tcx>(tcx: &TyCtxt<'tcx>, sp: Span, name: ast::Name) - -> DiagnosticBuilder<'tcx> -{ - struct_span_err!(tcx.sess, sp, E0201, "duplicate definitions with name `{}`:", name) -} - pub fn check_coherence(crate_context: &CrateCtxt) { let _task = crate_context.tcx.dep_graph.in_task(DepNode::Coherence); let infcx = new_infer_ctxt(crate_context.tcx, diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index e5e82ea7f5517..ffcf427715667 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -63,7 +63,6 @@ use lint; use hir::def::Def; use hir::def_id::DefId; use constrained_type_params as ctp; -use coherence; use middle::lang_items::SizedTraitLangItem; use middle::resolve_lifetime; use middle::const_val::ConstVal; @@ -80,13 +79,14 @@ use rscope::*; use rustc::dep_graph::DepNode; use rustc::hir::map as hir_map; use util::common::{ErrorReported, MemoizationMap}; -use util::nodemap::{FnvHashMap, FnvHashSet}; +use util::nodemap::FnvHashMap; use write_ty_to_tcx; use rustc_const_math::ConstInt; use std::cell::RefCell; use std::collections::HashSet; +use std::collections::hash_map::Entry::{Occupied, Vacant}; use std::rc::Rc; use syntax::abi; @@ -746,16 +746,27 @@ fn convert_item(ccx: &CrateCtxt, it: &hir::Item) { // Convert all the associated consts. // Also, check if there are any duplicate associated items - let mut seen_type_items = FnvHashSet(); - let mut seen_value_items = FnvHashSet(); + let mut seen_type_items = FnvHashMap(); + let mut seen_value_items = FnvHashMap(); for impl_item in impl_items { let seen_items = match impl_item.node { hir::ImplItemKind::Type(_) => &mut seen_type_items, _ => &mut seen_value_items, }; - if !seen_items.insert(impl_item.name) { - coherence::report_duplicate_item(tcx, impl_item.span, impl_item.name).emit(); + match seen_items.entry(impl_item.name) { + Occupied(entry) => { + let mut err = struct_span_err!(tcx.sess, impl_item.span, E0201, + "duplicate definitions with name `{}`:", + impl_item.name); + span_note!(&mut err, *entry.get(), + "previous definition of `{}` here", + impl_item.name); + err.emit(); + } + Vacant(entry) => { + entry.insert(impl_item.span); + } } if let hir::ImplItemKind::Const(ref ty, _) = impl_item.node { diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index fd57a452e0aba..e13b268878890 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -76,6 +76,7 @@ fn try_inline_def(cx: &DocContext, tcx: &TyCtxt, let inner = match def { Def::Trait(did) => { record_extern_fqn(cx, did, clean::TypeTrait); + ret.extend(build_impls(cx, tcx, did)); clean::TraitItem(build_external_trait(cx, tcx, did)) } Def::Fn(did) => { @@ -247,12 +248,10 @@ pub fn build_impls(cx: &DocContext, // Primarily, the impls will be used to populate the documentation for this // type being inlined, but impls can also be used when generating // documentation for primitives (no way to find those specifically). - if !cx.all_crate_impls.borrow_mut().contains_key(&did.krate) { - let mut impls = Vec::new(); + if cx.populated_crate_impls.borrow_mut().insert(did.krate) { for item in tcx.sess.cstore.crate_top_level_items(did.krate) { populate_impls(cx, tcx, item.def, &mut impls); } - cx.all_crate_impls.borrow_mut().insert(did.krate, impls); fn populate_impls(cx: &DocContext, tcx: &TyCtxt, def: cstore::DefLike, @@ -269,21 +268,7 @@ pub fn build_impls(cx: &DocContext, } } - let mut candidates = cx.all_crate_impls.borrow_mut(); - let candidates = candidates.get_mut(&did.krate).unwrap(); - for i in (0..candidates.len()).rev() { - let remove = match candidates[i].inner { - clean::ImplItem(ref i) => { - i.for_.def_id() == Some(did) || i.for_.primitive_type().is_some() - } - _ => continue, - }; - if remove { - impls.push(candidates.swap_remove(i)); - } - } - - return impls; + impls } pub fn build_impl(cx: &DocContext, diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index da792b363f0a5..23215fd9d478a 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -38,7 +38,7 @@ use rustc_trans::back::link; use rustc::middle::cstore::{self, CrateStore}; use rustc::middle::privacy::AccessLevels; use rustc::hir::def::Def; -use rustc::hir::def_id::{DefId, DefIndex}; +use rustc::hir::def_id::{DefId, DefIndex, CRATE_DEF_INDEX}; use rustc::ty::subst::{self, ParamSpace, VecPerParamSpace}; use rustc::ty; use rustc::middle::stability; @@ -2388,7 +2388,7 @@ impl Clean for doctree::ExternCrate { name: None, attrs: self.attrs.clean(cx), source: self.whence.clean(cx), - def_id: cx.map.local_def_id(0), + def_id: DefId { krate: self.cnum, index: CRATE_DEF_INDEX }, visibility: self.vis.clean(cx), stability: None, deprecation: None, diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 6d1e91a687e58..0b3a0c19dacc4 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -30,7 +30,7 @@ use syntax::feature_gate::UnstableFeatures; use syntax::parse::token; use std::cell::{RefCell, Cell}; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::rc::Rc; use visit_ast::RustdocVisitor; @@ -54,7 +54,7 @@ pub struct DocContext<'a, 'tcx: 'a> { pub map: &'a hir_map::Map<'tcx>, pub maybe_typed: MaybeTyped<'a, 'tcx>, pub input: Input, - pub all_crate_impls: RefCell>>, + pub populated_crate_impls: RefCell>, pub deref_trait_did: Cell>, // Note that external items for which `doc(hidden)` applies to are shown as // non-reachable while local items aren't. This is because we're reusing @@ -189,7 +189,7 @@ pub fn run_core(search_paths: SearchPaths, map: &tcx.map, maybe_typed: Typed(tcx), input: input, - all_crate_impls: RefCell::new(HashMap::new()), + populated_crate_impls: RefCell::new(HashSet::new()), deref_trait_did: Cell::new(None), access_levels: RefCell::new(access_levels), external_traits: RefCell::new(HashMap::new()), diff --git a/src/librustdoc/doctree.rs b/src/librustdoc/doctree.rs index 2db4b779eed98..408782a698a2a 100644 --- a/src/librustdoc/doctree.rs +++ b/src/librustdoc/doctree.rs @@ -232,6 +232,7 @@ pub struct Macro { pub struct ExternCrate { pub name: Name, + pub cnum: ast::CrateNum, pub path: Option, pub vis: hir::Visibility, pub attrs: hir::HirVec, diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index d4212bba59060..739da1b49d46c 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -57,6 +57,11 @@ pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]); pub struct CommaSep<'a, T: 'a>(pub &'a [T]); pub struct AbiSpace(pub Abi); +pub struct HRef<'a> { + pub did: DefId, + pub text: &'a str, +} + impl<'a> VisSpace<'a> { pub fn get(self) -> &'a Option { let VisSpace(v) = self; v @@ -291,17 +296,19 @@ impl fmt::Display for clean::Path { pub fn href(did: DefId) -> Option<(String, ItemType, Vec)> { let cache = cache(); + if !did.is_local() && !cache.access_levels.is_doc_reachable(did) { + return None + } + let loc = CURRENT_LOCATION_KEY.with(|l| l.borrow().clone()); let &(ref fqp, shortty) = match cache.paths.get(&did) { Some(p) => p, None => return None, }; + let mut url = if did.is_local() || cache.inlined.contains(&did) { repeat("../").take(loc.len()).collect::() } else { - if !cache.access_levels.is_doc_reachable(did) { - return None - } match cache.extern_locations[&did.krate] { (_, render::Remote(ref s)) => s.to_string(), (_, render::Local) => repeat("../").take(loc.len()).collect(), @@ -361,15 +368,7 @@ fn resolved_path(w: &mut fmt::Formatter, did: DefId, path: &clean::Path, } } } - - match href(did) { - Some((url, shortty, fqp)) => { - write!(w, "{}", - shortty, url, fqp.join("::"), last.name)?; - } - _ => write!(w, "{}", last.name)?, - } - write!(w, "{}", last.params)?; + write!(w, "{}{}", HRef::new(did, &last.name), last.params)?; Ok(()) } @@ -435,6 +434,24 @@ fn tybounds(w: &mut fmt::Formatter, } } +impl<'a> HRef<'a> { + pub fn new(did: DefId, text: &'a str) -> HRef<'a> { + HRef { did: did, text: text } + } +} + +impl<'a> fmt::Display for HRef<'a> { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match href(self.did) { + Some((url, shortty, fqp)) => { + write!(f, "{}", + shortty, url, fqp.join("::"), self.text) + } + _ => write!(f, "{}", self.text), + } + } +} + impl fmt::Display for clean::Type { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 824265bc3b303..a8f1fe7d46f90 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -1640,8 +1640,8 @@ fn plain_summary_line(s: Option<&str>) -> String { } fn document(w: &mut fmt::Formatter, cx: &Context, item: &clean::Item) -> fmt::Result { - if let Some(s) = short_stability(item, cx, true) { - write!(w, "
{}
", s)?; + for stability in short_stability(item, cx, true) { + write!(w, "
{}
", stability)?; } if let Some(s) = item.doc_value() { write!(w, "
{}
", Markdown(s))?; @@ -1739,16 +1739,19 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, match myitem.inner { clean::ExternCrateItem(ref name, ref src) => { + use html::format::HRef; + match *src { Some(ref src) => { write!(w, "{}extern crate {} as {};", VisSpace(&myitem.visibility), - src, + HRef::new(myitem.def_id, src), name)? } None => { write!(w, "{}extern crate {};", - VisSpace(&myitem.visibility), name)? + VisSpace(&myitem.visibility), + HRef::new(myitem.def_id, name))? } } write!(w, "")?; @@ -1761,8 +1764,15 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, _ => { if myitem.name.is_none() { continue } - let stab_docs = if let Some(s) = short_stability(myitem, cx, false) { - format!("[{}]", s) + + let stabilities = short_stability(myitem, cx, false); + + let stab_docs = if !stabilities.is_empty() { + stabilities.iter() + .map(|s| format!("[{}]", s)) + .collect::>() + .as_slice() + .join(" ") } else { String::new() }; @@ -1789,21 +1799,26 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context, write!(w, "") } -fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Option { - item.stability.as_ref().and_then(|stab| { +fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Vec { + let mut stability = vec![]; + + if let Some(stab) = item.stability.as_ref() { let reason = if show_reason && !stab.reason.is_empty() { format!(": {}", stab.reason) } else { String::new() }; - let text = if !stab.deprecated_since.is_empty() { + if !stab.deprecated_since.is_empty() { let since = if show_reason { format!(" since {}", Escape(&stab.deprecated_since)) } else { String::new() }; - format!("Deprecated{}{}", since, Markdown(&reason)) - } else if stab.level == stability::Unstable { + let text = format!("Deprecated{}{}", since, Markdown(&reason)); + stability.push(format!("{}", text)) + }; + + if stab.level == stability::Unstable { let unstable_extra = if show_reason { match (!stab.feature.is_empty(), &cx.shared.issue_tracker_base_url, stab.issue) { (true, &Some(ref tracker_url), Some(issue_no)) if issue_no > 0 => @@ -1819,29 +1834,26 @@ fn short_stability(item: &clean::Item, cx: &Context, show_reason: bool) -> Optio } else { String::new() }; - format!("Unstable{}{}", unstable_extra, Markdown(&reason)) + let text = format!("Unstable{}{}", unstable_extra, Markdown(&reason)); + stability.push(format!("{}", text)) + }; + } else if let Some(depr) = item.deprecation.as_ref() { + let note = if show_reason && !depr.note.is_empty() { + format!(": {}", depr.note) } else { - return None + String::new() + }; + let since = if show_reason && !depr.since.is_empty() { + format!(" since {}", Escape(&depr.since)) + } else { + String::new() }; - Some(format!("{}", - item.stability_class(), text)) - }).or_else(|| { - item.deprecation.as_ref().and_then(|depr| { - let note = if show_reason && !depr.note.is_empty() { - format!(": {}", depr.note) - } else { - String::new() - }; - let since = if show_reason && !depr.since.is_empty() { - format!(" since {}", Escape(&depr.since)) - } else { - String::new() - }; - let text = format!("Deprecated{}{}", since, Markdown(¬e)); - Some(format!("{}", text)) - }) - }) + let text = format!("Deprecated{}{}", since, Markdown(¬e)); + stability.push(format!("{}", text)) + } + + stability } struct Initializer<'a>(&'a str); @@ -2548,10 +2560,11 @@ fn render_impl(w: &mut fmt::Formatter, cx: &Context, i: &Impl, link: AssocItemLi if !is_static || render_static { let id = derive_id(format!("{}.{}", shortty, name)); write!(w, "

", id, shortty)?; - render_stability_since_raw(w, item.stable_since(), outer_version)?; write!(w, "")?; render_assoc_item(w, item, link.anchor(&id))?; - write!(w, "

\n")?; + write!(w, "
")?; + render_stability_since_raw(w, item.stable_since(), outer_version)?; + write!(w, "\n")?; } } clean::TypedefItem(ref tydef, _) => { diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 1d1e78926f120..a368b4197a395 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -981,7 +981,7 @@ $(".method").each(function() { if ($(this).next().is(".docblock") || ($(this).next().is(".stability") && $(this).next().next().is(".docblock"))) { - $(this).children().first().after(toggle.clone()); + $(this).children().last().after(toggle.clone()); } }); diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index 487aac1806ea7..81fd1128afac8 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -9,7 +9,7 @@ // except according to those terms. use std::cell::{RefCell, Cell}; -use std::collections::HashMap; +use std::collections::{HashMap, HashSet}; use std::env; use std::ffi::OsString; use std::io::prelude::*; @@ -111,7 +111,7 @@ pub fn run(input: &str, maybe_typed: core::NotTyped(&sess), input: input, external_traits: RefCell::new(HashMap::new()), - all_crate_impls: RefCell::new(HashMap::new()), + populated_crate_impls: RefCell::new(HashSet::new()), deref_trait_did: Cell::new(None), access_levels: Default::default(), renderinfo: Default::default(), diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 2bce8f4c2a127..d9ea82acbea35 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -316,7 +316,10 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let name = renamed.unwrap_or(item.name); match item.node { hir::ItemExternCrate(ref p) => { + let cstore = &self.cx.sess().cstore; om.extern_crates.push(ExternCrate { + cnum: cstore.extern_mod_stmt_cnum(item.id) + .unwrap_or(ast::CrateNum::max_value()), name: name, path: p.map(|x|x.to_string()), vis: item.vis.clone(), diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index f56f4c306f90a..f6d89f7c1dc89 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -44,6 +44,7 @@ impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> { pub fn visit_lib(&mut self, cnum: ast::CrateNum) { let did = DefId { krate: cnum, index: CRATE_DEF_INDEX }; + self.update(did, Some(AccessLevel::Public)); self.visit_mod(did); } diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs index a7738e3170049..5ab0d5a0877b7 100644 --- a/src/libstd/net/tcp.rs +++ b/src/libstd/net/tcp.rs @@ -86,6 +86,8 @@ impl TcpStream { /// `addr` is an address of the remote host. Anything which implements /// `ToSocketAddrs` trait can be supplied for the address; see this trait /// documentation for concrete examples. + /// In case `ToSocketAddrs::to_socket_addrs()` returns more than one entry, + /// then the first valid and reachable address is used. #[stable(feature = "rust1", since = "1.0.0")] pub fn connect(addr: A) -> io::Result { super::each_addr(addr, net_imp::TcpStream::connect).map(TcpStream) diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs index 4683c7061c3c8..9d0279deb1bcb 100644 --- a/src/libstd/net/udp.rs +++ b/src/libstd/net/udp.rs @@ -324,7 +324,7 @@ impl UdpSocket { self.0.recv(buf) } - /// Moves this TCP stream into or out of nonblocking mode. + /// Moves this UDP socket into or out of nonblocking mode. /// /// On Unix this corresponds to calling fcntl, and on Windows this /// corresponds to calling ioctlsocket. diff --git a/src/test/auxiliary/issue-33113.rs b/src/test/auxiliary/issue-33113.rs new file mode 100644 index 0000000000000..c476dda269029 --- /dev/null +++ b/src/test/auxiliary/issue-33113.rs @@ -0,0 +1,17 @@ +// 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. + +#![crate_name="bar"] + +pub trait Bar {} +pub struct Foo; + +impl<'a> Bar for &'a char {} +impl Bar for Foo {} diff --git a/src/test/auxiliary/rustdoc-hidden.rs b/src/test/auxiliary/rustdoc-hidden.rs new file mode 100644 index 0000000000000..aae3eb84fb5dd --- /dev/null +++ b/src/test/auxiliary/rustdoc-hidden.rs @@ -0,0 +1,14 @@ +// 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. + +#[doc(hidden)] +pub struct Foo; + +pub struct Bar; diff --git a/src/test/auxiliary/rustdoc-trait-object-impl.rs b/src/test/auxiliary/rustdoc-trait-object-impl.rs new file mode 100644 index 0000000000000..317262f417512 --- /dev/null +++ b/src/test/auxiliary/rustdoc-trait-object-impl.rs @@ -0,0 +1,24 @@ +// 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. + +use std::fmt; + +pub trait Bar {} + +impl<'a> Bar + 'a { + pub fn bar(&self) -> usize { 42 } +} + +impl<'a> fmt::Debug for Bar + 'a { + fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result { + Ok(()) + } +} + diff --git a/src/test/compile-fail/impl-duplicate-methods.rs b/src/test/compile-fail/impl-duplicate-methods.rs index 148958ae12897..981eddc9dd96b 100644 --- a/src/test/compile-fail/impl-duplicate-methods.rs +++ b/src/test/compile-fail/impl-duplicate-methods.rs @@ -9,9 +9,10 @@ // except according to those terms. struct Foo; + impl Foo { - fn orange(&self){} - fn orange(&self){} //~ ERROR duplicate definitions + fn orange(&self) {} //~ NOTE previous definition of `orange` here + fn orange(&self) {} //~ ERROR duplicate definitions with name `orange` } fn main() {} diff --git a/src/test/rustdoc/inline_cross/inline_hidden.rs b/src/test/rustdoc/inline_cross/inline_hidden.rs new file mode 100644 index 0000000000000..c59b5afd1c483 --- /dev/null +++ b/src/test/rustdoc/inline_cross/inline_hidden.rs @@ -0,0 +1,22 @@ +// 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. + +// aux-build:rustdoc-hidden.rs +// build-aux-docs +// ignore-cross-compile + +extern crate rustdoc_hidden; + +#[doc(no_inline)] +pub use rustdoc_hidden::Foo; + +// @has inline_hidden/fn.foo.html +// @!has - '//a/@title' 'Foo' +pub fn foo(_: Foo) {} diff --git a/src/test/rustdoc/inline_cross/issue-32881.rs b/src/test/rustdoc/inline_cross/issue-32881.rs new file mode 100644 index 0000000000000..948061bdcbed5 --- /dev/null +++ b/src/test/rustdoc/inline_cross/issue-32881.rs @@ -0,0 +1,22 @@ +// 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. + +// aux-build:rustdoc-trait-object-impl.rs +// build-aux-docs +// ignore-cross-compile + +extern crate rustdoc_trait_object_impl; + +// @has issue_32881/trait.Bar.html +// @has - '//code' "impl<'a> Bar" +// @has - '//code' "impl<'a> Debug for Bar" + +pub use rustdoc_trait_object_impl::Bar; + diff --git a/src/test/rustdoc/inline_cross/issue-33113.rs b/src/test/rustdoc/inline_cross/issue-33113.rs new file mode 100644 index 0000000000000..9ae8fefe730ef --- /dev/null +++ b/src/test/rustdoc/inline_cross/issue-33113.rs @@ -0,0 +1,20 @@ +// 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. + +// aux-build:issue-33113.rs +// build-aux-docs +// ignore-cross-compile + +extern crate bar; + +// @has issue_33113/trait.Bar.html +// @has - '//code' "for &'a char" +// @has - '//code' "for Foo" +pub use bar::Bar; diff --git a/src/test/rustdoc/issue-32374.rs b/src/test/rustdoc/issue-32374.rs new file mode 100644 index 0000000000000..cdb4094ffe051 --- /dev/null +++ b/src/test/rustdoc/issue-32374.rs @@ -0,0 +1,25 @@ +// 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. + +#![feature(staged_api)] +#![doc(issue_tracker_base_url = "http://issue_url/")] + +#![unstable(feature="test", issue = "32374")] + +// @has issue_32374/index.html '//*[@class="docblock short"]' \ +// '[Deprecated] [Unstable]' + +// @has issue_32374/struct.T.html '//*[@class="stab deprecated"]' \ +// 'Deprecated since 1.0.0: text' +// @has - 'test' +// @has - '#32374' +#[rustc_deprecated(since = "1.0.0", reason = "text")] +#[unstable(feature = "test", issue = "32374")] +pub struct T; diff --git a/src/test/rustdoc/issue-33178-1.rs b/src/test/rustdoc/issue-33178-1.rs new file mode 100644 index 0000000000000..a368d6b68b9aa --- /dev/null +++ b/src/test/rustdoc/issue-33178-1.rs @@ -0,0 +1,20 @@ +// 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. + +// aux-build:empty.rs +// aux-build:variant-struct.rs +// ignore-cross-compile + +// @has issue_33178_1/index.html +// @!has - //a/@title empty +pub extern crate empty; + +// @!has - //a/@title variant_struct +pub extern crate variant_struct as foo; diff --git a/src/test/rustdoc/issue-33178.rs b/src/test/rustdoc/issue-33178.rs new file mode 100644 index 0000000000000..2ecb7d9ec44f3 --- /dev/null +++ b/src/test/rustdoc/issue-33178.rs @@ -0,0 +1,23 @@ +// 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. + +// aux-build:empty.rs +// aux-build:variant-struct.rs +// build-aux-docs +// ignore-cross-compile + +// @has issue_33178/index.html +// @has - //a/@title empty +// @has - //a/@href ../empty/index.html +pub extern crate empty; + +// @has - //a/@title variant_struct +// @has - //a/@href ../variant_struct/index.html +pub extern crate variant_struct as foo;