]> git.lizzy.rs Git - rust.git/blobdiff - compiler/rustc_typeck/src/check/fn_ctxt/suggestions.rs
fix most compiler/ doctests
[rust.git] / compiler / rustc_typeck / src / check / fn_ctxt / suggestions.rs
index 681d1e37f86f1317486616e91aa7b887a29f7ca8..ecb0004c334340cc458d8463b98bb5e892b6e8bc 100644 (file)
@@ -72,7 +72,7 @@ pub fn suggest_mismatched_types_on_tail(
 
     /// When encountering an fn-like ctor that needs to unify with a value, check whether calling
     /// the ctor would successfully solve the type mismatch and if so, suggest it:
-    /// ```
+    /// ```compile_fail,E0308
     /// fn foo(x: usize) -> usize { x }
     /// let x: usize = foo;  // suggest calling the `foo` function: `foo(42)`
     /// ```
@@ -463,7 +463,8 @@ pub(in super::super) fn suggest_calling_boxed_future_when_appropriate(
 
     /// A common error is to forget to add a semicolon at the end of a block, e.g.,
     ///
-    /// ```
+    /// ```compile_fail,E0308
+    /// # fn bar_that_returns_u32() -> u32 { 4 }
     /// fn foo() {
     ///     bar_that_returns_u32()
     /// }
@@ -504,7 +505,8 @@ fn suggest_missing_semicolon(
 
     /// A possible error is to forget to add a return type that is needed:
     ///
-    /// ```
+    /// ```compile_fail,E0308
+    /// # fn bar_that_returns_u32() -> u32 { 4 }
     /// fn foo() {
     ///     bar_that_returns_u32()
     /// }
@@ -569,7 +571,7 @@ pub(in super::super) fn suggest_missing_return_type(
     /// check whether the return type is a generic type with a trait bound
     /// only suggest this if the generic param is not present in the arguments
     /// if this is true, hint them towards changing the return type to `impl Trait`
-    /// ```
+    /// ```compile_fail,E0308
     /// fn cant_name_it<T: Fn() -> u32>() -> T {
     ///     || 3
     /// }