@@ -333,7 +333,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
333333 /// the required captured paths.
334334 ///
335335 /// Eg:
336- /// ```rust
336+ /// ```rust,no_run
337337 /// struct Point { x: i32, y: i32 }
338338 ///
339339 /// let s: String; // hir_id_s
@@ -575,7 +575,9 @@ struct InferBorrowKind<'a, 'tcx> {
575575 /// Consider closure where s.str1 is captured via an ImmutableBorrow and
576576 /// s.str2 via a MutableBorrow
577577 ///
578- /// ```rust
578+ /// ```rust,no_run
579+ /// struct SomeStruct { str1: String, str2: String }
580+ ///
579581 /// // Assume that the HirId for the variable definition is `V1`
580582 /// let mut s = SomeStruct { str1: format!("s1"), str2: format!("s2") }
581583 ///
@@ -584,7 +586,7 @@ struct InferBorrowKind<'a, 'tcx> {
584586 /// println!("Updating SomeStruct with str1=", s.str1);
585587 /// // Assume that the HirId for the expression `*s.str2` is `E2`
586588 /// s.str2 = new_s2;
587- /// }
589+ /// };
588590 /// ```
589591 ///
590592 /// For closure `fix_s`, (at a high level) the map contains
@@ -931,7 +933,8 @@ fn var_name(tcx: TyCtxt<'_>, var_hir_id: hir::HirId) -> Symbol {
931933/// `determine_capture_info(existing_info, current_info)`. This works out because the
932934/// expressions that occur earlier in the closure body than the current expression are processed before.
933935/// Consider the following example
934- /// ```rust
936+ /// ```rust,no_run
937+ /// struct Point { x: i32, y: i32 }
935938/// let mut p: Point { x: 10, y: 10 };
936939///
937940/// let c = || {
@@ -942,7 +945,7 @@ fn var_name(tcx: TyCtxt<'_>, var_hir_id: hir::HirId) -> Symbol {
942945/// // ...
943946/// p.x += 10; // E2
944947/// // ^ E2 ^
945- /// }
948+ /// };
946949/// ```
947950/// `CaptureKind` associated with both `E1` and `E2` will be ByRef(MutBorrow),
948951/// and both have an expression associated, however for diagnostics we prefer reporting
0 commit comments