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

Rollup of 11 pull requests #76621

Closed
wants to merge 65 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
688f447
Stabilize future readiness fns
yoshuawuyts Jul 14, 2020
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
b869aa5
Add saturating methods for `Duration`
marmeladema Aug 30, 2020
75e471a
Add MaybeUninit::drop.
m-ou-se Sep 8, 2020
caef832
Fix doc comment on MaybeUninit::drop.
m-ou-se Sep 8, 2020
656a17b
Rename MaybeUninit::drop to assume_init_drop.
m-ou-se Sep 9, 2020
a14efd1
Rename MaybeUninit::read to assume_init_read.
m-ou-se Sep 9, 2020
a94b2cb
Add safety docs about T's invariants in MaybeUninit::assume_init_drop.
m-ou-se Sep 9, 2020
43c7a9b
Fix broken doc links in MaybeUninit.
m-ou-se Sep 9, 2020
f7b6ace
Use IOV_MAX and UIO_MAXIOV constants in limit vectored I/O
Thomasdezeeuw Sep 10, 2020
7c3e1ff
Update libc in Cargo.lock
Thomasdezeeuw Sep 10, 2020
283d4c4
Ignore `|` and `+` tokens during proc-macro pretty-print check
Aaron1011 Sep 10, 2020
15aa6f3
add debug-logging to config.toml
guswynn Sep 10, 2020
fb8d070
Add ui test for 74672 and 76571
tesuji Sep 11, 2020
c3d048a
Ignore rustc_private items from std docs
tesuji Sep 10, 2020
439b766
replacing sub's that can wrap by saturating_sub's
ad-anssi Sep 11, 2020
1854f8b
Warn for #[unstable] on trait impls when it has no effect.
m-ou-se Sep 9, 2020
e5c645f
Turn useless #[unstable] attributes into errors.
m-ou-se Sep 10, 2020
f6fbf66
Mark RefUnwindSafe impls for stable atomic types as stable.
m-ou-se Sep 10, 2020
cf8e5d1
Mark Error impl for LayoutErr as stable.
m-ou-se Sep 10, 2020
89fb34f
Turn unstable trait impl error into a lint, so it can be disabled.
m-ou-se Sep 10, 2020
471fb62
Allow unstable From impl for [Raw]Waker.
m-ou-se Sep 10, 2020
1c1bfba
Add test for unstable trait impl lint.
m-ou-se Sep 10, 2020
f9059a4
add non-regression test for issue #76597
ad-anssi Sep 11, 2020
62068a5
repairing broken error message and rustfix application for the new test
ad-anssi Sep 11, 2020
56f5c7f
comments + add max_level_info so false works with debug_assertions on
guswynn Sep 11, 2020
0be66d7
just max_level_info
guswynn Sep 11, 2020
c394624
Ignore unnecessary unsafe warnings
Thomasdezeeuw Sep 11, 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
14cc177
Improve `ineffective_unstable_trait_impl` error message.
m-ou-se Sep 11, 2020
5e126c9
better diag when const ranges are used in patterns
guswynn Sep 1, 2020
e7f5a4d
Rollup merge of #74328 - yoshuawuyts:stabilize-future-readiness-fns, …
Dylan-DPC Sep 12, 2020
b0b016c
Rollup merge of #75756 - jyn514:diagnostic-suggestions, r=estebank
Dylan-DPC Sep 12, 2020
42c1bde
Rollup merge of #76114 - marmeladema:duration-saturating-ops, r=shepm…
Dylan-DPC Sep 12, 2020
5185c39
Rollup merge of #76222 - guswynn:const_diag, r=estebank
Dylan-DPC Sep 12, 2020
b6bdb2c
Rollup merge of #76484 - fusion-engineering-forks:maybe-uninit-drop, …
Dylan-DPC Sep 12, 2020
a493e97
Rollup merge of #76538 - fusion-engineering-forks:check-useless-unsta…
Dylan-DPC Sep 12, 2020
39a4aec
Rollup merge of #76561 - Thomasdezeeuw:iov-constant-limits, r=Amanieu
Dylan-DPC Sep 12, 2020
e8689d3
Rollup merge of #76571 - lzutao:rustdoc-private-traits, r=jyn514
Dylan-DPC Sep 12, 2020
bd3b10e
Rollup merge of #76585 - Aaron1011:ignore-vert-plus, r=petrochenkov
Dylan-DPC Sep 12, 2020
db0d8e0
Rollup merge of #76588 - guswynn:debug_logging, r=jyn514,Mark-Simulacrum
Dylan-DPC Sep 12, 2020
d234dac
Rollup merge of #76598 - ad-anssi:diagnostic_errors_fix, r=estebank
Dylan-DPC Sep 12, 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
65 changes: 42 additions & 23 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
@@ -81,6 +81,7 @@ enum ResolutionFailure<'a> {
}

impl ResolutionFailure<'a> {
// A partial or full resolution
fn res(&self) -> Option<Res> {
use ResolutionFailure::*;
match self {
@@ -93,6 +94,14 @@ impl ResolutionFailure<'a> {
NotInScope(_) | NoParentItem | Dummy => None,
}
}

// This resolved fully (not just partially) but is erroneous for some other reason
fn full_res(&self) -> Option<Res> {
match self {
Self::WrongNamespace(res, _) => Some(*res),
_ => None,
}
}
}

enum AnchorFailure {
@@ -128,6 +137,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
) -> Result<(Res, Option<String>), ErrorKind<'path>> {
let cx = self.cx;

debug!("looking for enum variant {}", path_str);
let mut split = path_str.rsplitn(3, "::");
let variant_field_name = split
.next()
@@ -260,7 +270,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
debug!("{} resolved to {:?} in namespace {:?}", path_str, result, ns);
let result = match result {
Ok((_, Res::Err)) => Err(()),
_ => result.map_err(|_| ()),
x => x,
};

if let Ok((_, res)) = result {
@@ -419,6 +429,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
Ok((ty_res, Some(format!("{}.{}", out, item_name))))
})
} else if ns == Namespace::ValueNS {
debug!("looking for variants or fields named {} for {:?}", item_name, did);
match cx.tcx.type_of(did).kind() {
ty::Adt(def, _) => {
let field = if def.is_enum() {
@@ -838,12 +849,36 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
}
}

// used for reporting better errors
let check_full_res = |this: &mut Self, ns| {
match this.resolve(path_str, ns, &current_item, base_node, &extra_fragment) {
Ok(res) => {
debug!(
"check_full_res: saw res for {} in {:?} ns: {:?}",
path_str, ns, res.0
);
Some(res.0)
}
Err(ErrorKind::Resolve(kind)) => kind.full_res(),
// TODO: add `Res` to AnchorFailure
Err(ErrorKind::AnchorFailure(_)) => None,
}
};

match disambiguator.map(Disambiguator::ns) {
Some(ns @ (ValueNS | TypeNS)) => {
match self.resolve(path_str, ns, &current_item, base_node, &extra_fragment)
{
Ok(res) => res,
Err(ErrorKind::Resolve(kind)) => {
Err(ErrorKind::Resolve(mut kind)) => {
// We only looked in one namespace. Try to give a better error if possible.
// TODO: handle MacroNS too
if kind.full_res().is_none() {
let other_ns = if ns == ValueNS { TypeNS } else { ValueNS };
if let Some(res) = check_full_res(self, other_ns) {
kind = ResolutionFailure::WrongNamespace(res, other_ns);
}
}
resolution_failure(
cx,
&item,
@@ -965,30 +1000,14 @@ impl<'a, 'tcx> DocFolder for LinkCollector<'a, 'tcx> {
Ok(res) => (res, extra_fragment),
Err(mut kind) => {
// `macro_resolve` only looks in the macro namespace. Try to give a better error if possible.
//if kind.res().is_none() {
for &ns in &[TypeNS, ValueNS] {
match self.resolve(
path_str,
ns,
&current_item,
base_node,
&extra_fragment,
) {
Ok(res) => {
kind = ResolutionFailure::WrongNamespace(res.0, MacroNS)
}
// This will show up in the other namespace, no need to handle it here
Err(ErrorKind::Resolve(
ResolutionFailure::WrongNamespace(..),
)) => {}
Err(ErrorKind::AnchorFailure(_)) => {}
Err(ErrorKind::Resolve(inner_kind)) => {
if let Some(res) = inner_kind.res() {
kind =
ResolutionFailure::WrongNamespace(res, MacroNS);
}
}
if let Some(res) = check_full_res(self, ns) {
kind = ResolutionFailure::WrongNamespace(res, MacroNS);
break;
}
}
//}
resolution_failure(
cx,
&item,
1 change: 1 addition & 0 deletions src/test/rustdoc-ui/intra-link-errors.rs
Original file line number Diff line number Diff line change
@@ -54,6 +54,7 @@ impl S {
}

/// [type@T::g]
/// [T::h!]
pub trait T {
fn g() {}
}