diff options
| author | Waffle Maybe <waffle.lapkin@gmail.com> | 2024-04-27 00:47:23 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-27 00:47:23 +0200 |
| commit | b73bfd26e4ddd6e91debf86cbaeb060e7fbb4425 (patch) | |
| tree | e04319de951384c5b05eabf903feabfb4466c994 | |
| parent | 23b67de1513f412d0df37ece3bd90a3fd653c444 (diff) | |
| download | rust-b73bfd26e4ddd6e91debf86cbaeb060e7fbb4425.tar.gz rust-b73bfd26e4ddd6e91debf86cbaeb060e7fbb4425.zip | |
Apply suggestions from code review
Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com>
| -rw-r--r-- | library/core/src/primitive_docs.rs | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/library/core/src/primitive_docs.rs b/library/core/src/primitive_docs.rs index 99b132fe399..1839c56f16d 100644 --- a/library/core/src/primitive_docs.rs +++ b/library/core/src/primitive_docs.rs @@ -270,8 +270,8 @@ mod prim_bool {} /// /// # Never type fallback /// -/// When the compiler sees a value of type `!` it implicitly inserts a coercion (if possible), -/// to allow type check to infer any type: +/// When the compiler sees a value of type `!` it implicitly inserts a coercion (if possible) +/// to allow type checker to infer any type: /// /// ```rust,ignore (illustrative-and-has-placeholders) /// // this @@ -297,8 +297,13 @@ mod prim_bool {} /// { absurd(panic!()) }; // error: can't infer the type of `absurd` /// ``` /// -/// To prevent such errors, compiler remembers where it inserted `absurd` calls, and if it can't -/// infer their type, it sets the type to the fallback type. `{ absurd::<Fallback>(panic!()) };`. +/// To prevent such errors, the compiler remembers where it inserted `absurd` calls, and +/// if it can't infer their type, it sets the type to the fallback type: +/// ```rust, ignore +/// type Fallback = /* An arbitrarily selected type! */; +/// { absurd::<Fallback>(panic!()) } +/// ``` +/// /// This is what is known as "never type fallback". /// /// Historically fallback was [`()`], causing confusing behavior where `!` spontaneously coerced |
