Skip to content

Commit 56fc3c5

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 c5a3305 + 9c5f684 commit 56fc3c5

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
@@ -159,21 +159,21 @@ pub struct Pick<'tcx> {
159159
pub kind: PickKind<'tcx>,
160160
pub import_ids: SmallVec<[LocalDefId; 1]>,
161161

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

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

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

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

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

0 commit comments

Comments
 (0)