Skip to content

Commit 8b7b1f7

Browse files
committed
Minor syntax and formatting update to doc comment
The comment is on find_vtable_types_for_unsizing, but there is another unrelated typo fix as well.
1 parent 9c20b2a commit 8b7b1f7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

compiler/rustc_monomorphize/src/collector.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
//! #### Unsizing Casts
129129
//! A subtle way of introducing neighbor edges is by casting to a trait object.
130130
//! Since the resulting fat-pointer contains a reference to a vtable, we need to
131-
//! instantiate all object-save methods of the trait, as we need to store
131+
//! instantiate all object-safe methods of the trait, as we need to store
132132
//! pointers to these functions even if they never get called anywhere. This can
133133
//! be seen as a special case of taking a function reference.
134134
//!
@@ -1044,10 +1044,12 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: &Instance<'tcx>) ->
10441044
/// them.
10451045
///
10461046
/// For example, the source type might be `&SomeStruct` and the target type
1047-
/// might be `&SomeTrait` in a cast like:
1047+
/// might be `&dyn SomeTrait` in a cast like:
10481048
///
1049+
/// ```rust,ignore (not real code)
10491050
/// let src: &SomeStruct = ...;
1050-
/// let target = src as &SomeTrait;
1051+
/// let target = src as &dyn SomeTrait;
1052+
/// ```
10511053
///
10521054
/// Then the output of this function would be (SomeStruct, SomeTrait) since for
10531055
/// constructing the `target` fat-pointer we need the vtable for that pair.
@@ -1068,8 +1070,10 @@ fn should_codegen_locally<'tcx>(tcx: TyCtxt<'tcx>, instance: &Instance<'tcx>) ->
10681070
/// for the pair of `T` (which is a trait) and the concrete type that `T` was
10691071
/// originally coerced from:
10701072
///
1073+
/// ```rust,ignore (not real code)
10711074
/// let src: &ComplexStruct<SomeStruct> = ...;
1072-
/// let target = src as &ComplexStruct<SomeTrait>;
1075+
/// let target = src as &ComplexStruct<dyn SomeTrait>;
1076+
/// ```
10731077
///
10741078
/// Again, we want this `find_vtable_types_for_unsizing()` to provide the pair
10751079
/// `(SomeStruct, SomeTrait)`.

0 commit comments

Comments
 (0)