-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #133458 - GuillaumeGomez:fix-prelude-tys-links, r=not…
…riddle Fix `Result` and `Option` not getting a jump to def link generated It was just because we didn't store the "span" in the `PreludeTy` variant. r? ``@notriddle``
- Loading branch information
Showing
2 changed files
with
31 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This test checks that prelude types like `Result` and `Option` still get a link generated. | ||
|
||
//@ compile-flags: -Zunstable-options --generate-link-to-definition | ||
|
||
#![crate_name = "foo"] | ||
|
||
//@ has 'src/foo/jump-to-def-prelude-types.rs.html' | ||
// FIXME: would be nice to be able to check both the class and the href at the same time so | ||
// we could check the text as well... | ||
//@ has - '//a[@class="prelude-ty"]/@href' '{{channel}}/core/result/enum.Result.html' | ||
//@ has - '//a[@class="prelude-ty"]/@href' '{{channel}}/core/option/enum.Option.html' | ||
pub fn foo() -> Result<Option<()>, ()> { Err(()) } | ||
|
||
// This part is to ensure that they are not linking to the actual prelude ty. | ||
pub mod bar { | ||
struct Result; | ||
struct Option; | ||
|
||
//@ has - '//a[@href="#16"]' 'Result' | ||
pub fn bar() -> Result { Result } | ||
//@ has - '//a[@href="#17"]' 'Option' | ||
pub fn bar2() -> Option { Option } | ||
} |