about summary refs log tree commit diff
path: root/src/test/rustdoc
diff options
context:
space:
mode:
authorJoshua Nelson <jyn514@gmail.com>2020-09-20 00:32:00 -0400
committerJoshua Nelson <jyn514@gmail.com>2020-09-23 21:04:20 -0400
commitdd7b8c85a6a2bffb2cce1c40ba72680a1d7be93b (patch)
tree2a23e7415df3f7537d4399bce754b155fc1388ac /src/test/rustdoc
parentcbc5e4d4d5715cfe111def11bbd1d8afae2ea80e (diff)
downloadrust-dd7b8c85a6a2bffb2cce1c40ba72680a1d7be93b.tar.gz
rust-dd7b8c85a6a2bffb2cce1c40ba72680a1d7be93b.zip
Perform most diagnostic lookups in `resolution_failure`
Previously, these were spread throughout the codebase. This had two
drawbacks:

1. It caused the fast path to be slower: even if a link resolved,
rustdoc would still perform various lookups for the error diagnostic.
2. It was inconsistent and didn't always give all diagnostics (https://github.com/rust-lang/rust/issues/76925)

Now, diagnostics only perform expensive lookups in the error case.
Additionally, the error handling is much more consistent, both in
wording and behavior.

- Remove `CannotHaveAssociatedItems`, `NotInScope`, `NoAssocItem`, and `NotAVariant`
  in favor of the more general `NotResolved`

  `resolution_failure` will now look up which of the four above
  categories is relevant, instead of requiring the rest of the code to
  be consistent and accurate in which it picked.

- Remove unnecessary lookups throughout the intra-doc link pass. These
are now done by `resolution_failure`.
  + Remove unnecessary `extra_fragment` argument to `variant_field()`;
    it was only used to do lookups on failure.
  + Remove various lookups related to associated items
  + Remove distinction between 'not in scope' and 'no associated item'

- Don't perform unnecessary copies
- Remove unused variables and code
- Update tests
- Note why looking at other namespaces is still necessary
- 'has no inner item' -> 'contains no item'

bless tests
Diffstat (limited to 'src/test/rustdoc')
-rw-r--r--src/test/rustdoc/intra-link-associated-items.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/test/rustdoc/intra-link-associated-items.rs b/src/test/rustdoc/intra-link-associated-items.rs
index 16a21e33748..dec0deae5df 100644
--- a/src/test/rustdoc/intra-link-associated-items.rs
+++ b/src/test/rustdoc/intra-link-associated-items.rs
@@ -3,8 +3,10 @@
 
 /// [`std::collections::BTreeMap::into_iter`]
 /// [`String::from`] is ambiguous as to which `From` impl
+/// [type@Vec::into_iter] uses a disambiguator
 // @has 'intra_link_associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/collections/btree/map/struct.BTreeMap.html#method.into_iter"]' 'std::collections::BTreeMap::into_iter'
 // @has 'intra_link_associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html#method.from"]' 'String::from'
+// @has 'intra_link_associated_items/fn.foo.html' '//a[@href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html#method.into_iter"]' 'Vec::into_iter'
 pub fn foo() {}
 
 /// Link to [MyStruct], [link from struct][MyStruct::method], [MyStruct::clone], [MyStruct::Input]