[WIP] give better errors for broken intra doc links

This commit is contained in:
Joshua Nelson 2020-08-20 11:41:18 -04:00
parent 7d289aeade
commit 3797f29aad
10 changed files with 475 additions and 93 deletions

View file

@ -6,6 +6,7 @@ use rustc_ast::NodeId;
use rustc_macros::HashStable_Generic;
use rustc_span::hygiene::MacroKind;
use std::array::IntoIter;
use std::fmt::Debug;
/// Encodes if a `DefKind::Ctor` is the constructor of an enum variant or a struct.
@ -291,6 +292,14 @@ impl<T> PerNS<T> {
pub fn map<U, F: FnMut(T) -> U>(self, mut f: F) -> PerNS<U> {
PerNS { value_ns: f(self.value_ns), type_ns: f(self.type_ns), macro_ns: f(self.macro_ns) }
}
pub fn into_iter(self) -> IntoIter<T, 3> {
IntoIter::new([self.value_ns, self.type_ns, self.macro_ns])
}
pub fn iter(&self) -> IntoIter<&T, 3> {
IntoIter::new([&self.value_ns, &self.type_ns, &self.macro_ns])
}
}
impl<T> ::std::ops::Index<Namespace> for PerNS<T> {

View file

@ -2,6 +2,7 @@
//!
//! [rustc dev guide]: https://rustc-dev-guide.rust-lang.org/hir.html
#![feature(array_value_iter)]
#![feature(crate_visibility_modifier)]
#![feature(const_fn)] // For the unsizing cast on `&[]`
#![feature(const_panic)]