mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-12 00:24:03 +00:00
db277f5284
This feature extends rustdoc to support the syntax that most users will naturally attempt to use to search for diverging functions. Part of #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.
14 lines
358 B
Rust
14 lines
358 B
Rust
#![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 => {} } }
|