Skip to content

Commit 95e3927

Browse files
committed
/** -> ///
second half of rust-lang#19288
1 parent 7222ba9 commit 95e3927

File tree

21 files changed

+357
-481
lines changed

21 files changed

+357
-481
lines changed

src/librustc_trans/driver/driver.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,8 @@ pub fn compile_input(sess: Session,
9898
phase_6_link_output(&sess, &trans, &outputs);
9999
}
100100

101-
/**
102-
* The name used for source code that doesn't originate in a file
103-
* (e.g. source from stdin or a string)
104-
*/
101+
/// The name used for source code that doesn't originate in a file
102+
/// (e.g. source from stdin or a string)
105103
pub fn anon_src() -> String {
106104
"<anon>".to_string()
107105
}

src/librustc_trans/trans/_match.rs

+12-15
Original file line numberDiff line numberDiff line change
@@ -325,15 +325,14 @@ pub enum TransBindingMode {
325325
TrByRef,
326326
}
327327

328-
/**
329-
* Information about a pattern binding:
330-
* - `llmatch` is a pointer to a stack slot. The stack slot contains a
331-
* pointer into the value being matched. Hence, llmatch has type `T**`
332-
* where `T` is the value being matched.
333-
* - `trmode` is the trans binding mode
334-
* - `id` is the node id of the binding
335-
* - `ty` is the Rust type of the binding */
336-
#[deriving(Clone)]
328+
/// Information about a pattern binding:
329+
/// - `llmatch` is a pointer to a stack slot. The stack slot contains a
330+
/// pointer into the value being matched. Hence, llmatch has type `T**`
331+
/// where `T` is the value being matched.
332+
/// - `trmode` is the trans binding mode
333+
/// - `id` is the node id of the binding
334+
/// - `ty` is the Rust type of the binding
335+
#[deriving(Clone)]
337336
pub struct BindingInfo<'tcx> {
338337
pub llmatch: ValueRef,
339338
pub trmode: TransBindingMode,
@@ -350,12 +349,10 @@ struct ArmData<'p, 'blk, 'tcx: 'blk> {
350349
bindings_map: BindingsMap<'tcx>
351350
}
352351

353-
/**
354-
* Info about Match.
355-
* If all `pats` are matched then arm `data` will be executed.
356-
* As we proceed `bound_ptrs` are filled with pointers to values to be bound,
357-
* these pointers are stored in llmatch variables just before executing `data` arm.
358-
*/
352+
/// Info about Match.
353+
/// If all `pats` are matched then arm `data` will be executed.
354+
/// As we proceed `bound_ptrs` are filled with pointers to values to be bound,
355+
/// these pointers are stored in llmatch variables just before executing `data` arm.
359356
struct Match<'a, 'p: 'a, 'blk: 'a, 'tcx: 'blk> {
360357
pats: Vec<&'p ast::Pat>,
361358
data: &'a ArmData<'p, 'blk, 'tcx>,

src/librustc_trans/trans/adt.rs

+81-109
Original file line numberDiff line numberDiff line change
@@ -79,46 +79,38 @@ type Hint = attr::ReprAttr;
7979
pub enum Repr<'tcx> {
8080
/// C-like enums; basically an int.
8181
CEnum(IntType, Disr, Disr), // discriminant range (signedness based on the IntType)
82-
/**
83-
* Single-case variants, and structs/tuples/records.
84-
*
85-
* Structs with destructors need a dynamic destroyedness flag to
86-
* avoid running the destructor too many times; this is included
87-
* in the `Struct` if present.
88-
*/
82+
/// Single-case variants, and structs/tuples/records.
83+
///
84+
/// Structs with destructors need a dynamic destroyedness flag to
85+
/// avoid running the destructor too many times; this is included
86+
/// in the `Struct` if present.
8987
Univariant(Struct<'tcx>, bool),
90-
/**
91-
* General-case enums: for each case there is a struct, and they
92-
* all start with a field for the discriminant.
93-
*
94-
* Types with destructors need a dynamic destroyedness flag to
95-
* avoid running the destructor too many times; the last argument
96-
* indicates whether such a flag is present.
97-
*/
88+
/// General-case enums: for each case there is a struct, and they
89+
/// all start with a field for the discriminant.
90+
///
91+
/// Types with destructors need a dynamic destroyedness flag to
92+
/// avoid running the destructor too many times; the last argument
93+
/// indicates whether such a flag is present.
9894
General(IntType, Vec<Struct<'tcx>>, bool),
99-
/**
100-
* Two cases distinguished by a nullable pointer: the case with discriminant
101-
* `nndiscr` must have single field which is known to be nonnull due to its type.
102-
* The other case is known to be zero sized. Hence we represent the enum
103-
* as simply a nullable pointer: if not null it indicates the `nndiscr` variant,
104-
* otherwise it indicates the other case.
105-
*/
95+
/// Two cases distinguished by a nullable pointer: the case with discriminant
96+
/// `nndiscr` must have single field which is known to be nonnull due to its type.
97+
/// The other case is known to be zero sized. Hence we represent the enum
98+
/// as simply a nullable pointer: if not null it indicates the `nndiscr` variant,
99+
/// otherwise it indicates the other case.
106100
RawNullablePointer {
107101
nndiscr: Disr,
108102
nnty: Ty<'tcx>,
109103
nullfields: Vec<Ty<'tcx>>
110104
},
111-
/**
112-
* Two cases distinguished by a nullable pointer: the case with discriminant
113-
* `nndiscr` is represented by the struct `nonnull`, where the `ptrfield`th
114-
* field is known to be nonnull due to its type; if that field is null, then
115-
* it represents the other case, which is inhabited by at most one value
116-
* (and all other fields are undefined/unused).
117-
*
118-
* For example, `std::option::Option` instantiated at a safe pointer type
119-
* is represented such that `None` is a null pointer and `Some` is the
120-
* identity function.
121-
*/
105+
/// Two cases distinguished by a nullable pointer: the case with discriminant
106+
/// `nndiscr` is represented by the struct `nonnull`, where the `ptrfield`th
107+
/// field is known to be nonnull due to its type; if that field is null, then
108+
/// it represents the other case, which is inhabited by at most one value
109+
/// (and all other fields are undefined/unused).
110+
///
111+
/// For example, `std::option::Option` instantiated at a safe pointer type
112+
/// is represented such that `None` is a null pointer and `Some` is the
113+
/// identity function.
122114
StructWrappedNullablePointer {
123115
nonnull: Struct<'tcx>,
124116
nndiscr: Disr,
@@ -139,11 +131,9 @@ pub struct Struct<'tcx> {
139131
pub fields: Vec<Ty<'tcx>>
140132
}
141133

142-
/**
143-
* Convenience for `represent_type`. There should probably be more or
144-
* these, for places in trans where the `Ty` isn't directly
145-
* available.
146-
*/
134+
/// Convenience for `represent_type`. There should probably be more or
135+
/// these, for places in trans where the `Ty` isn't directly
136+
/// available.
147137
pub fn represent_node<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
148138
node: ast::NodeId) -> Rc<Repr<'tcx>> {
149139
represent_type(bcx.ccx(), node_id_type(bcx, node))
@@ -514,16 +504,14 @@ fn ensure_enum_fits_in_address_space<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
514504
}
515505

516506

517-
/**
518-
* LLVM-level types are a little complicated.
519-
*
520-
* C-like enums need to be actual ints, not wrapped in a struct,
521-
* because that changes the ABI on some platforms (see issue #10308).
522-
*
523-
* For nominal types, in some cases, we need to use LLVM named structs
524-
* and fill in the actual contents in a second pass to prevent
525-
* unbounded recursion; see also the comments in `trans::type_of`.
526-
*/
507+
/// LLVM-level types are a little complicated.
508+
///
509+
/// C-like enums need to be actual ints, not wrapped in a struct,
510+
/// because that changes the ABI on some platforms (see issue #10308).
511+
///
512+
/// For nominal types, in some cases, we need to use LLVM named structs
513+
/// and fill in the actual contents in a second pass to prevent
514+
/// unbounded recursion; see also the comments in `trans::type_of`.
527515
pub fn type_of<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, r: &Repr<'tcx>) -> Type {
528516
generic_type_of(cx, r, None, false, false)
529517
}
@@ -620,12 +608,10 @@ fn struct_llfields<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, st: &Struct<'tcx>,
620608
}
621609
}
622610

623-
/**
624-
* Obtain a representation of the discriminant sufficient to translate
625-
* destructuring; this may or may not involve the actual discriminant.
626-
*
627-
* This should ideally be less tightly tied to `_match`.
628-
*/
611+
/// Obtain a representation of the discriminant sufficient to translate
612+
/// destructuring; this may or may not involve the actual discriminant.
613+
///
614+
/// This should ideally be less tightly tied to `_match`.
629615
pub fn trans_switch<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
630616
r: &Repr<'tcx>, scrutinee: ValueRef)
631617
-> (_match::BranchKind, Option<ValueRef>) {
@@ -713,12 +699,10 @@ fn load_discr(bcx: Block, ity: IntType, ptr: ValueRef, min: Disr, max: Disr)
713699
}
714700
}
715701

716-
/**
717-
* Yield information about how to dispatch a case of the
718-
* discriminant-like value returned by `trans_switch`.
719-
*
720-
* This should ideally be less tightly tied to `_match`.
721-
*/
702+
/// Yield information about how to dispatch a case of the
703+
/// discriminant-like value returned by `trans_switch`.
704+
///
705+
/// This should ideally be less tightly tied to `_match`.
722706
pub fn trans_case<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr, discr: Disr)
723707
-> _match::OptResult<'blk, 'tcx> {
724708
match *r {
@@ -741,10 +725,8 @@ pub fn trans_case<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr, discr: Disr)
741725
}
742726
}
743727

744-
/**
745-
* Set the discriminant for a new value of the given case of the given
746-
* representation.
747-
*/
728+
/// Set the discriminant for a new value of the given case of the given
729+
/// representation.
748730
pub fn trans_set_discr<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, r: &Repr<'tcx>,
749731
val: ValueRef, discr: Disr) {
750732
match *r {
@@ -799,10 +781,8 @@ fn assert_discr_in_range(ity: IntType, min: Disr, max: Disr, discr: Disr) {
799781
}
800782
}
801783

802-
/**
803-
* The number of fields in a given case; for use when obtaining this
804-
* information from the type or definition is less convenient.
805-
*/
784+
/// The number of fields in a given case; for use when obtaining this
785+
/// information from the type or definition is less convenient.
806786
pub fn num_args(r: &Repr, discr: Disr) -> uint {
807787
match *r {
808788
CEnum(..) => 0,
@@ -946,27 +926,25 @@ pub fn trans_drop_flag_ptr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>, r: &Repr<'tcx
946926
}
947927
}
948928

949-
/**
950-
* Construct a constant value, suitable for initializing a
951-
* GlobalVariable, given a case and constant values for its fields.
952-
* Note that this may have a different LLVM type (and different
953-
* alignment!) from the representation's `type_of`, so it needs a
954-
* pointer cast before use.
955-
*
956-
* The LLVM type system does not directly support unions, and only
957-
* pointers can be bitcast, so a constant (and, by extension, the
958-
* GlobalVariable initialized by it) will have a type that can vary
959-
* depending on which case of an enum it is.
960-
*
961-
* To understand the alignment situation, consider `enum E { V64(u64),
962-
* V32(u32, u32) }` on Windows. The type has 8-byte alignment to
963-
* accommodate the u64, but `V32(x, y)` would have LLVM type `{i32,
964-
* i32, i32}`, which is 4-byte aligned.
965-
*
966-
* Currently the returned value has the same size as the type, but
967-
* this could be changed in the future to avoid allocating unnecessary
968-
* space after values of shorter-than-maximum cases.
969-
*/
929+
/// Construct a constant value, suitable for initializing a
930+
/// GlobalVariable, given a case and constant values for its fields.
931+
/// Note that this may have a different LLVM type (and different
932+
/// alignment!) from the representation's `type_of`, so it needs a
933+
/// pointer cast before use.
934+
///
935+
/// The LLVM type system does not directly support unions, and only
936+
/// pointers can be bitcast, so a constant (and, by extension, the
937+
/// GlobalVariable initialized by it) will have a type that can vary
938+
/// depending on which case of an enum it is.
939+
///
940+
/// To understand the alignment situation, consider `enum E { V64(u64),
941+
/// V32(u32, u32) }` on Windows. The type has 8-byte alignment to
942+
/// accommodate the u64, but `V32(x, y)` would have LLVM type `{i32,
943+
/// i32, i32}`, which is 4-byte aligned.
944+
///
945+
/// Currently the returned value has the same size as the type, but
946+
/// this could be changed in the future to avoid allocating unnecessary
947+
/// space after values of shorter-than-maximum cases.
970948
pub fn trans_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, r: &Repr<'tcx>, discr: Disr,
971949
vals: &[ValueRef]) -> ValueRef {
972950
match *r {
@@ -1019,9 +997,7 @@ pub fn trans_const<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, r: &Repr<'tcx>, discr
1019997
}
1020998
}
1021999

1022-
/**
1023-
* Compute struct field offsets relative to struct begin.
1024-
*/
1000+
/// Compute struct field offsets relative to struct begin.
10251001
fn compute_struct_field_offsets<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
10261002
st: &Struct<'tcx>) -> Vec<u64> {
10271003
let mut offsets = vec!();
@@ -1040,16 +1016,14 @@ fn compute_struct_field_offsets<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
10401016
offsets
10411017
}
10421018

1043-
/**
1044-
* Building structs is a little complicated, because we might need to
1045-
* insert padding if a field's value is less aligned than its type.
1046-
*
1047-
* Continuing the example from `trans_const`, a value of type `(u32,
1048-
* E)` should have the `E` at offset 8, but if that field's
1049-
* initializer is 4-byte aligned then simply translating the tuple as
1050-
* a two-element struct will locate it at offset 4, and accesses to it
1051-
* will read the wrong memory.
1052-
*/
1019+
/// Building structs is a little complicated, because we might need to
1020+
/// insert padding if a field's value is less aligned than its type.
1021+
///
1022+
/// Continuing the example from `trans_const`, a value of type `(u32,
1023+
/// E)` should have the `E` at offset 8, but if that field's
1024+
/// initializer is 4-byte aligned then simply translating the tuple as
1025+
/// a two-element struct will locate it at offset 4, and accesses to it
1026+
/// will read the wrong memory.
10531027
fn build_const_struct<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
10541028
st: &Struct<'tcx>, vals: &[ValueRef])
10551029
-> Vec<ValueRef> {
@@ -1130,13 +1104,11 @@ pub fn const_get_discrim(ccx: &CrateContext, r: &Repr, val: ValueRef)
11301104
}
11311105
}
11321106

1133-
/**
1134-
* Extract a field of a constant value, as appropriate for its
1135-
* representation.
1136-
*
1137-
* (Not to be confused with `common::const_get_elt`, which operates on
1138-
* raw LLVM-level structs and arrays.)
1139-
*/
1107+
/// Extract a field of a constant value, as appropriate for its
1108+
/// representation.
1109+
///
1110+
/// (Not to be confused with `common::const_get_elt`, which operates on
1111+
/// raw LLVM-level structs and arrays.)
11401112
pub fn const_get_field(ccx: &CrateContext, r: &Repr, val: ValueRef,
11411113
_discr: Disr, ix: uint) -> ValueRef {
11421114
match *r {

src/librustc_trans/trans/basic_block.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ pub struct BasicBlock(pub BasicBlockRef);
1717

1818
pub type Preds<'a> = Map<'a, Value, BasicBlock, Filter<'a, Value, Users>>;
1919

20-
/**
21-
* Wrapper for LLVM BasicBlockRef
22-
*/
20+
/// Wrapper for LLVM BasicBlockRef
2321
impl BasicBlock {
2422
pub fn get(&self) -> BasicBlockRef {
2523
let BasicBlock(v) = *self; v

0 commit comments

Comments
 (0)