Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve suggestions for broken intra-doc links #75756

Merged
merged 25 commits into from
Sep 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
3797f29
[WIP] give better errors for broken intra doc links
jyn514 Aug 20, 2020
f45e7b5
Update .stderr
jyn514 Aug 21, 2020
4ace4e7
Use fewer `.to_string()`s
jyn514 Aug 21, 2020
fcb2199
Report if the thing exists in another namespace
jyn514 Aug 21, 2020
42bed03
Pass on the DefId so rustdoc can name it in suggestions
jyn514 Aug 21, 2020
f4e6ebd
Fix tests and improve error message if `::` isn't found
jyn514 Aug 21, 2020
002d3a9
Don't give misleading errors for `f::A`, where f is in the value name…
jyn514 Aug 21, 2020
7b8d0be
Remove some TODOs
jyn514 Aug 21, 2020
e2d69f2
Make errors more concise and helpful
jyn514 Aug 21, 2020
19d1002
Fix failures to resolve primitives
jyn514 Aug 21, 2020
ebc8cb4
Turn NoParentItem from a panic into an ICE
jyn514 Aug 21, 2020
6875220
Use rustc_resolve's descr() instead of rewriting it
jyn514 Aug 21, 2020
418f608
Give a better error message when linking to a macro with the wrong di…
jyn514 Aug 21, 2020
2ca6f11
Fix rebase conflicts
jyn514 Aug 22, 2020
bb9d157
Address my own review comments
jyn514 Aug 25, 2020
f2826d9
Show the first path segment which failed to resolve.
jyn514 Aug 25, 2020
d67eb1f
Don't suggest \[ \] if there's a :: in the path
jyn514 Aug 28, 2020
ee683ef
Say 'prefix with `kind@`' instead of 'prefix with the item kind'
jyn514 Aug 28, 2020
efdc3fa
Give a much better error message when an item has a macro disambiguator
jyn514 Aug 28, 2020
8318a18
x.py bless
jyn514 Aug 29, 2020
cd72d90
Find the first segment that failed to resolve for _any_ namespace
jyn514 Sep 1, 2020
c213c68
box ResolutionFailures on the heap
jyn514 Sep 11, 2020
57250ef
Use `span_label` instead of `note`
jyn514 Sep 11, 2020
b2a5a7a
Remove unnecessary clone
jyn514 Sep 11, 2020
5ea3eaf
Name the current module
jyn514 Sep 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions compiler/rustc_hir/src/def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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> {
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
Loading