Skip to content

Commit d562f4d

Browse files
WaffleLapkinkpreidskogsethworkingjubilee
authored
Apply suggestions from code review
Co-authored-by: Kevin Reid <[email protected]> Co-authored-by: Herman Skogseth <[email protected]> Co-authored-by: Jubilee <[email protected]>
1 parent 0cfee71 commit d562f4d

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Diff for: core/src/primitive_docs.rs

+7-8
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ mod prim_bool {}
270270
///
271271
/// # Never type fallback
272272
///
273-
/// When the compiler sees a value of type `!` it implicitly inserts a coercion (if possible)
274-
/// to allow type checker to infer any type:
273+
/// When the compiler sees a value of type `!` in a [coercion site](https://doc.rust-lang.org/reference/type-coercions.html#coercion-sites), it implicitly inserts a coercion
274+
/// to allow the type checker to infer any type:
275275
///
276276
/// ```rust,ignore (illustrative-and-has-placeholders)
277277
/// // this
@@ -286,8 +286,7 @@ mod prim_bool {}
286286
// FIXME: use `core::convert::absurd` here instead, once it's merged
287287
/// ```
288288
///
289-
/// While it's convenient to be able to use non-diverging code in one of the branches (like
290-
/// `if a { b } else { return }`) this could lead to compilation errors:
289+
/// This can lead to compilation errors if the type cannot be inferred:
291290
///
292291
/// ```compile_fail
293292
/// // this
@@ -298,17 +297,17 @@ mod prim_bool {}
298297
/// ```
299298
///
300299
/// To prevent such errors, the compiler remembers where it inserted `absurd` calls, and
301-
/// if it can't infer their type, it sets the type to the fallback type:
300+
/// if it can't infer the type, it uses the fallback type instead:
302301
/// ```rust, ignore
303302
/// type Fallback = /* An arbitrarily selected type! */;
304303
/// { absurd::<Fallback>(panic!()) }
305304
/// ```
306305
///
307306
/// This is what is known as "never type fallback".
308307
///
309-
/// Historically fallback was [`()`], causing confusing behavior where `!` spontaneously coerced
310-
/// to `()`, even though `()` was never mentioned (because of the fallback). There are plans to
311-
/// change it in 2024 edition (and possibly in all editions on a later date), see
308+
/// Historically, the fallback type was [`()`], causing confusing behavior where `!` spontaneously coerced
309+
/// to `()`, even when it would not infer `()` without the fallback. There are plans to
310+
/// change it in the [2024 edition](https://doc.rust-lang.org/nightly/edition-guide/rust-2024/index.html) (and possibly in all editions on a later date); see
312311
/// [Tracking Issue for making `!` fall back to `!`][fallback-ti].
313312
///
314313
/// [`()`]: prim@unit

0 commit comments

Comments
 (0)