forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
rustdoc-search: search never type with
!
This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for diverging functions. Part of rust-lang#60485 It's already possible to do this search with `primitive:never`, but that's not what the Rust language itself uses, so nobody will try it if they aren't told or helped along.
- Loading branch information
Showing
7 changed files
with
200 additions
and
24 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 |
---|---|---|
@@ -1,6 +1,14 @@ | ||
const EXPECTED = { | ||
'query': '!', | ||
'others': [ | ||
{ 'path': 'std', 'name': 'never' }, | ||
], | ||
}; | ||
const EXPECTED = [ | ||
{ | ||
'query': '!', | ||
'others': [ | ||
{ 'path': 'std', 'name': 'never' }, | ||
], | ||
}, | ||
{ | ||
'query': '!::clone', | ||
'others': [ | ||
{ 'path': 'std::never', 'name': 'clone' }, | ||
], | ||
}, | ||
]; |
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
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,46 @@ | ||
// exact-check | ||
|
||
const EXPECTED = [ | ||
{ | ||
'query': '-> !', | ||
'others': [ | ||
{ 'path': 'never_search', 'name': 'loops' }, | ||
], | ||
}, | ||
{ | ||
'query': '-> never', | ||
'others': [ | ||
{ 'path': 'never_search', 'name': 'loops' }, | ||
{ 'path': 'never_search', 'name': 'returns' }, | ||
], | ||
}, | ||
{ | ||
'query': '!', | ||
'in_args': [ | ||
{ 'path': 'never_search', 'name': 'impossible' }, | ||
{ 'path': 'never_search', 'name': 'box_impossible' }, | ||
], | ||
}, | ||
{ | ||
'query': 'never', | ||
'in_args': [ | ||
{ 'path': 'never_search', 'name': 'impossible' }, | ||
{ 'path': 'never_search', 'name': 'uninteresting' }, | ||
{ 'path': 'never_search', 'name': 'box_impossible' }, | ||
{ 'path': 'never_search', 'name': 'box_uninteresting' }, | ||
], | ||
}, | ||
{ | ||
'query': 'box<!>', | ||
'in_args': [ | ||
{ 'path': 'never_search', 'name': 'box_impossible' }, | ||
], | ||
}, | ||
{ | ||
'query': 'box<never>', | ||
'in_args': [ | ||
{ 'path': 'never_search', 'name': 'box_impossible' }, | ||
{ 'path': 'never_search', 'name': 'box_uninteresting' }, | ||
], | ||
}, | ||
]; |
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,13 @@ | ||
#![feature(never_type)] | ||
|
||
#[allow(nonstandard_style)] | ||
pub struct never; | ||
|
||
pub fn loops() -> ! { loop {} } | ||
pub fn returns() -> never { never } | ||
|
||
pub fn impossible(x: !) { match x {} } | ||
pub fn uninteresting(x: never) { match x { never => {} } } | ||
|
||
pub fn box_impossible(x: Box<!>) { match *x {} } | ||
pub fn box_uninteresting(x: Box<never>) { match *x { never => {} } } |