From b73bfd26e4ddd6e91debf86cbaeb060e7fbb4425 Mon Sep 17 00:00:00 2001 From: Waffle Maybe Date: Sat, 27 Apr 2024 00:47:23 +0200 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Jubilee <46493976+workingjubilee@users.noreply.github.com> --- library/core/src/primitive_docs.rs | 13 +++++++++---- 1 file 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::(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::(panic!()) } +/// ``` +/// /// This is what is known as "never type fallback". /// /// Historically fallback was [`()`], causing confusing behavior where `!` spontaneously coerced