X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;ds=sidebyside;f=compiler%2Frustc_hir_typeck%2Fsrc%2Fcoercion.rs;h=bbf7b81a2cc66ca82ccff36b50b0947c99710b77;hb=240cc81768f678bb4a6f8369080ef77515971963;hp=7e1c0faa453a26f08b87472f77d09cc51b237a2e;hpb=43134714f529d087aecb8c6327ca282c2fa261f1;p=rust.git diff --git a/compiler/rustc_hir_typeck/src/coercion.rs b/compiler/rustc_hir_typeck/src/coercion.rs index 7e1c0faa453..bbf7b81a2cc 100644 --- a/compiler/rustc_hir_typeck/src/coercion.rs +++ b/compiler/rustc_hir_typeck/src/coercion.rs @@ -313,7 +313,7 @@ fn coerce_borrowed_pointer( // If we have a parameter of type `&M T_a` and the value // provided is `expr`, we will be adding an implicit borrow, - // meaning that we convert `f(expr)` to `f(&M *expr)`. Therefore, + // meaning that we convert `f(expr)` to `f(&M *expr)`. Therefore, // to type check, we will construct the type that `&M*expr` would // yield. @@ -340,7 +340,7 @@ fn coerce_borrowed_pointer( continue; } - // At this point, we have deref'd `a` to `referent_ty`. So + // At this point, we have deref'd `a` to `referent_ty`. So // imagine we are coercing from `&'a mut Vec` to `&'b mut [T]`. // In the autoderef loop for `&'a mut Vec`, we would get // three callbacks: @@ -371,7 +371,7 @@ fn coerce_borrowed_pointer( // - if in sub mode, that means we want to use `'b` (the // region from the target reference) for both // pointers [2]. This is because sub mode (somewhat - // arbitrarily) returns the subtype region. In the case + // arbitrarily) returns the subtype region. In the case // where we are coercing to a target type, we know we // want to use that target type region (`'b`) because -- // for the program to type-check -- it must be the @@ -383,7 +383,7 @@ fn coerce_borrowed_pointer( // annotate the region of a borrow), and regionck has // code that adds edges from the region of a borrow // (`'b`, here) into the regions in the borrowed - // expression (`*x`, here). (Search for "link".) + // expression (`*x`, here). (Search for "link".) // - if in lub mode, things can get fairly complicated. The // easiest thing is just to make a fresh // region variable [4], which effectively means we defer @@ -457,7 +457,7 @@ fn coerce_borrowed_pointer( if ty == a && mt_a.mutbl.is_not() && autoderef.step_count() == 1 { // As a special case, if we would produce `&'a *x`, that's // a total no-op. We end up with the type `&'a T` just as - // we started with. In that case, just skip it + // we started with. In that case, just skip it // altogether. This is just an optimization. // // Note that for `&mut`, we DO want to reborrow -- @@ -1476,7 +1476,7 @@ pub(crate) fn coerce_inner<'a>( // if let Some(x) = ... { } // // we wind up with a second match arm that is like `_ => - // ()`. That is the case we are considering here. We take + // ()`. That is the case we are considering here. We take // a different path to get the right "expected, found" // message and so forth (and because we know that // `expression_ty` will be unit).