@@ -333,7 +333,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
333
333
/// the required captured paths.
334
334
///
335
335
/// Eg:
336
- /// ```rust
336
+ /// ```rust,no_run
337
337
/// struct Point { x: i32, y: i32 }
338
338
///
339
339
/// let s: String; // hir_id_s
@@ -575,7 +575,9 @@ struct InferBorrowKind<'a, 'tcx> {
575
575
/// Consider closure where s.str1 is captured via an ImmutableBorrow and
576
576
/// s.str2 via a MutableBorrow
577
577
///
578
- /// ```rust
578
+ /// ```rust,no_run
579
+ /// struct SomeStruct { str1: String, str2: String }
580
+ ///
579
581
/// // Assume that the HirId for the variable definition is `V1`
580
582
/// let mut s = SomeStruct { str1: format!("s1"), str2: format!("s2") }
581
583
///
@@ -584,7 +586,7 @@ struct InferBorrowKind<'a, 'tcx> {
584
586
/// println!("Updating SomeStruct with str1=", s.str1);
585
587
/// // Assume that the HirId for the expression `*s.str2` is `E2`
586
588
/// s.str2 = new_s2;
587
- /// }
589
+ /// };
588
590
/// ```
589
591
///
590
592
/// 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 {
931
933
/// `determine_capture_info(existing_info, current_info)`. This works out because the
932
934
/// expressions that occur earlier in the closure body than the current expression are processed before.
933
935
/// Consider the following example
934
- /// ```rust
936
+ /// ```rust,no_run
937
+ /// struct Point { x: i32, y: i32 }
935
938
/// let mut p: Point { x: 10, y: 10 };
936
939
///
937
940
/// let c = || {
@@ -942,7 +945,7 @@ fn var_name(tcx: TyCtxt<'_>, var_hir_id: hir::HirId) -> Symbol {
942
945
/// // ...
943
946
/// p.x += 10; // E2
944
947
/// // ^ E2 ^
945
- /// }
948
+ /// };
946
949
/// ```
947
950
/// `CaptureKind` associated with both `E1` and `E2` will be ByRef(MutBorrow),
948
951
/// and both have an expression associated, however for diagnostics we prefer reporting
0 commit comments