Skip to content

Commit 9a540cb

Browse files
authored
Rollup merge of #82468 - osa1:pick_by_value_method_docs, r=petrochenkov
Move pick_by_value_method docs above function header - Currently style triggers #81183 so we can't add `#[instrument]` to this function. - Having docs above the header is more consistent with the rest of the code base.
2 parents befa2df + 9c5f684 commit 9a540cb

File tree

1 file changed

+17
-19
lines changed
  • compiler/rustc_typeck/src/check/method

1 file changed

+17
-19
lines changed

compiler/rustc_typeck/src/check/method/probe.rs

+17-19
Original file line numberDiff line numberDiff line change
@@ -160,21 +160,21 @@ pub struct Pick<'tcx> {
160160
pub kind: PickKind<'tcx>,
161161
pub import_ids: SmallVec<[LocalDefId; 1]>,
162162

163-
// Indicates that the source expression should be autoderef'd N times
164-
//
165-
// A = expr | *expr | **expr | ...
163+
/// Indicates that the source expression should be autoderef'd N times
164+
///
165+
/// A = expr | *expr | **expr | ...
166166
pub autoderefs: usize,
167167

168-
// Indicates that an autoref is applied after the optional autoderefs
169-
//
170-
// B = A | &A | &mut A
168+
/// Indicates that an autoref is applied after the optional autoderefs
169+
///
170+
/// B = A | &A | &mut A
171171
pub autoref: Option<hir::Mutability>,
172172

173-
// Indicates that the source expression should be "unsized" to a
174-
// target type. This should probably eventually go away in favor
175-
// of just coercing method receivers.
176-
//
177-
// C = B | unsize(B)
173+
/// Indicates that the source expression should be "unsized" to a
174+
/// target type. This should probably eventually go away in favor
175+
/// of just coercing method receivers.
176+
///
177+
/// C = B | unsize(B)
178178
pub unsize: Option<Ty<'tcx>>,
179179
}
180180

@@ -1091,19 +1091,17 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> {
10911091
.next()
10921092
}
10931093

1094+
/// For each type `T` in the step list, this attempts to find a method where
1095+
/// the (transformed) self type is exactly `T`. We do however do one
1096+
/// transformation on the adjustment: if we are passing a region pointer in,
1097+
/// we will potentially *reborrow* it to a shorter lifetime. This allows us
1098+
/// to transparently pass `&mut` pointers, in particular, without consuming
1099+
/// them for their entire lifetime.
10941100
fn pick_by_value_method(
10951101
&mut self,
10961102
step: &CandidateStep<'tcx>,
10971103
self_ty: Ty<'tcx>,
10981104
) -> Option<PickResult<'tcx>> {
1099-
//! For each type `T` in the step list, this attempts to find a
1100-
//! method where the (transformed) self type is exactly `T`. We
1101-
//! do however do one transformation on the adjustment: if we
1102-
//! are passing a region pointer in, we will potentially
1103-
//! *reborrow* it to a shorter lifetime. This allows us to
1104-
//! transparently pass `&mut` pointers, in particular, without
1105-
//! consuming them for their entire lifetime.
1106-
11071105
if step.unsize {
11081106
return None;
11091107
}

0 commit comments

Comments
 (0)