Skip to content

Commit 9690be5

Browse files
committed
Adjust most comments and messages to not use "unboxed".
1 parent e0afa82 commit 9690be5

File tree

15 files changed

+36
-44
lines changed

15 files changed

+36
-44
lines changed

src/librustc/metadata/encoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2148,7 +2148,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter,
21482148
encode_macro_defs(&mut rbml_w, krate);
21492149
stats.macro_defs_bytes = rbml_w.writer.tell().unwrap() - i;
21502150

2151-
// Encode the types of all unboxed closures in this crate.
2151+
// Encode the types of all closures in this crate.
21522152
i = rbml_w.writer.tell().unwrap();
21532153
encode_closures(&ecx, &mut rbml_w);
21542154
stats.closure_bytes = rbml_w.writer.tell().unwrap() - i;
@@ -2193,7 +2193,7 @@ fn encode_metadata_inner(wr: &mut SeekableMemWriter,
21932193
println!(" native bytes: {}", stats.native_lib_bytes);
21942194
println!("plugin registrar bytes: {}", stats.plugin_registrar_fn_bytes);
21952195
println!(" macro def bytes: {}", stats.macro_defs_bytes);
2196-
println!(" unboxed closure bytes: {}", stats.unboxed_closure_bytes);
2196+
println!(" closure bytes: {}", stats.closure_bytes);
21972197
println!(" impl bytes: {}", stats.impl_bytes);
21982198
println!(" misc bytes: {}", stats.misc_bytes);
21992199
println!(" item bytes: {}", stats.item_bytes);

src/librustc/metadata/tydecode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ pub enum DefIdSource {
5757
// Identifies a region parameter (`fn foo<'X>() { ... }`).
5858
RegionParameter,
5959

60-
// Identifies an unboxed closure
60+
// Identifies a closure
6161
ClosureSource
6262
}
6363

src/librustc/middle/traits/mod.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -232,10 +232,9 @@ pub enum Vtable<'tcx, N> {
232232
/// Successful resolution for a builtin trait.
233233
VtableBuiltin(VtableBuiltinData<N>),
234234

235-
/// Vtable automatically generated for an unboxed closure. The def
236-
/// ID is the ID of the closure expression. This is a `VtableImpl`
237-
/// in spirit, but the impl is generated by the compiler and does
238-
/// not appear in the source.
235+
/// Vtable automatically generated for a closure. The def ID is the ID
236+
/// of the closure expression. This is a `VtableImpl` in spirit, but the
237+
/// impl is generated by the compiler and does not appear in the source.
239238
VtableClosure(ast::DefId, subst::Substs<'tcx>),
240239

241240
/// Same as above, but for a fn pointer type with the given signature.

src/librustc/middle/traits/select.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -943,9 +943,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
943943
}
944944

945945
/// Check for the artificial impl that the compiler will create for an obligation like `X :
946-
/// FnMut<..>` where `X` is an unboxed closure type.
946+
/// FnMut<..>` where `X` is a closure type.
947947
///
948-
/// Note: the type parameters on an unboxed closure candidate are modeled as *output* type
948+
/// Note: the type parameters on a closure candidate are modeled as *output* type
949949
/// parameters and hence do not affect whether this trait is a match or not. They will be
950950
/// unified during the confirmation step.
951951
fn assemble_closure_candidates(&mut self,
@@ -1932,7 +1932,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19321932
trait_ref)
19331933
}
19341934

1935-
/// In the case of unboxed closure types and fn pointers,
1935+
/// In the case of closure types and fn pointers,
19361936
/// we currently treat the input type parameters on the trait as
19371937
/// outputs. This means that when we have a match we have only
19381938
/// considered the self type, so we have to go back and make sure
@@ -1942,7 +1942,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19421942
/// errors as if there is no applicable impl, but rather report
19431943
/// errors are about mismatched argument types.
19441944
///
1945-
/// Here is an example. Imagine we have an unboxed closure expression
1945+
/// Here is an example. Imagine we have an closure expression
19461946
/// and we desugared it so that the type of the expression is
19471947
/// `Closure`, and `Closure` expects an int as argument. Then it
19481948
/// is "as if" the compiler generated this impl:

src/librustc/middle/ty.rs

+11-12
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ pub enum MethodOrigin<'tcx> {
432432
// fully statically resolved method
433433
MethodStatic(ast::DefId),
434434

435-
// fully statically resolved unboxed closure invocation
435+
// fully statically resolved closure invocation
436436
MethodStaticClosure(ast::DefId),
437437

438438
// method invoked on a type parameter with a bounded trait
@@ -565,7 +565,7 @@ pub enum vtable_origin<'tcx> {
565565
vtable_param(param_index, uint),
566566

567567
/*
568-
Vtable automatically generated for an unboxed closure. The def ID is the
568+
Vtable automatically generated for a closure. The def ID is the
569569
ID of the closure expression.
570570
*/
571571
vtable_closure(ast::DefId),
@@ -785,8 +785,8 @@ pub struct ctxt<'tcx> {
785785

786786
pub dependency_formats: RefCell<dependency_format::Dependencies>,
787787

788-
/// Records the type of each unboxed closure. The def ID is the ID of the
789-
/// expression defining the unboxed closure.
788+
/// Records the type of each closure. The def ID is the ID of the
789+
/// expression defining the closure.
790790
pub closures: RefCell<DefIdMap<Closure<'tcx>>>,
791791

792792
pub node_lint_levels: RefCell<FnvHashMap<(ast::NodeId, lint::LintId),
@@ -2262,12 +2262,12 @@ pub struct ItemSubsts<'tcx> {
22622262
pub substs: Substs<'tcx>,
22632263
}
22642264

2265-
/// Records information about each unboxed closure.
2265+
/// Records information about each closure.
22662266
#[derive(Clone)]
22672267
pub struct Closure<'tcx> {
2268-
/// The type of the unboxed closure.
2268+
/// The type of the closure.
22692269
pub closure_type: ClosureTy<'tcx>,
2270-
/// The kind of unboxed closure this is.
2270+
/// The kind of closure this is.
22712271
pub kind: ClosureKind,
22722272
}
22732273

@@ -3416,8 +3416,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
34163416
}
34173417

34183418
ty_closure(did, r, substs) => {
3419-
// FIXME(#14449): `borrowed_contents` below assumes `&mut`
3420-
// unboxed closure.
3419+
// FIXME(#14449): `borrowed_contents` below assumes `&mut` closure.
34213420
let param_env = ty::empty_parameter_environment(cx);
34223421
let upvars = closure_upvars(&param_env, did, substs).unwrap();
34233422
TypeContents::union(upvars.as_slice(),
@@ -3685,7 +3684,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
36853684
ty_infer(_) |
36863685
ty_closure(..) => {
36873686
// this check is run on type definitions, so we don't expect to see
3688-
// inference by-products or unboxed closure types
3687+
// inference by-products or closure types
36893688
cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}",
36903689
ty).as_slice())
36913690
}
@@ -3778,8 +3777,8 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
37783777
find_nonrepresentable(cx, sp, seen, iter)
37793778
}
37803779
ty_closure(..) => {
3781-
// this check is run on type definitions, so we don't expect to see
3782-
// unboxed closure types
3780+
// this check is run on type definitions, so we don't expect
3781+
// to see closure types
37833782
cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}",
37843783
ty).as_slice())
37853784
}

src/librustc_trans/trans/callee.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
457457
}
458458
};
459459

460-
// If this is an unboxed closure, redirect to it.
460+
// If this is a closure, redirect to it.
461461
match closure::get_or_create_declaration_if_closure(ccx, def_id, &substs) {
462462
None => {}
463463
Some(llfn) => return llfn,

src/librustc_trans/trans/closure.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ impl<'a, 'tcx> ClosureEnv<'a, 'tcx> {
133133
}
134134
}
135135

136-
/// Returns the LLVM function declaration for an unboxed closure, creating it
137-
/// if necessary. If the ID does not correspond to a closure ID, returns None.
138-
// Not an unboxed closure.
136+
/// Returns the LLVM function declaration for a closure, creating it if
137+
/// necessary. If the ID does not correspond to a closure ID, returns None.
139138
pub fn get_or_create_declaration_if_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
140139
closure_id: ast::DefId,
141140
substs: &Substs<'tcx>)
142141
-> Option<Datum<'tcx, Rvalue>> {
143142
if !ccx.tcx().closures.borrow().contains_key(&closure_id) {
143+
// Not a closure.
144144
return None
145145
}
146146

@@ -161,8 +161,7 @@ pub fn get_or_create_declaration_if_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tc
161161

162162
match ccx.closure_vals().borrow().get(&mono_id) {
163163
Some(&llfn) => {
164-
debug!("get_or_create_declaration_if_closure(): found \
165-
closure");
164+
debug!("get_or_create_declaration_if_closure(): found closure");
166165
return Some(Datum::new(llfn, function_type, Rvalue::new(ByValue)))
167166
}
168167
None => {}
@@ -230,8 +229,8 @@ pub fn trans_closure_expr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
230229
Closure(freevar_mode)));
231230

232231
// Don't hoist this to the top of the function. It's perfectly legitimate
233-
// to have a zero-size unboxed closure (in which case dest will be
234-
// `Ignore`) and we must still generate the closure body.
232+
// to have a zero-size closure (in which case dest will be `Ignore`) and
233+
// we must still generate the closure body.
235234
let dest_addr = match dest {
236235
expr::SaveIn(p) => p,
237236
expr::Ignore => {

src/librustc_trans/trans/expr.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1098,10 +1098,6 @@ fn trans_rvalue_dps_unadjusted<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
10981098
tvec::trans_fixed_vstore(bcx, expr, dest)
10991099
}
11001100
ast::ExprClosure(_, _, ref decl, ref body) => {
1101-
// Check the side-table to see whether this is an unboxed
1102-
// closure or an older, legacy style closure. Store this
1103-
// into a variable to ensure the the RefCell-lock is
1104-
// released before we recurse.
11051101
closure::trans_closure_expr(bcx, &**decl, &**body, expr.id, dest)
11061102
}
11071103
ast::ExprCall(ref f, ref args) => {

src/librustc_typeck/check/closure.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn check_expr_closure<'a,'tcx>(fcx: &FnCtxt<'a,'tcx>,
4242
// If users didn't specify what sort of closure they want,
4343
// examine the expected type. For now, if we see explicit
4444
// evidence than an unboxed closure is desired, we'll use
45-
// that, otherwise we'll fall back to boxed closures.
45+
// that, otherwise we'll error, requesting an annotation.
4646
match expected_sig_and_kind {
4747
None => { // don't have information about the kind, request explicit annotation
4848
// NB We still need to typeck the body, so assume `FnMut` kind just for that

src/librustc_typeck/check/method/probe.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
603603
None => {
604604
self.tcx().sess.span_bug(
605605
self.span,
606-
&format!("No entry for unboxed closure: {}",
606+
&format!("No entry for closure: {}",
607607
closure_def_id.repr(self.tcx()))[]);
608608
}
609609
};

src/librustc_typeck/check/regionmanip.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
6969
}
7070

7171
ty::ty_closure(_, region, _) => {
72-
// An "unboxed closure type" is basically
72+
// An "closure type" is basically
7373
// modeled here as equivalent to a struct like
7474
//
7575
// struct TheClosure<'b> {
@@ -79,7 +79,7 @@ impl<'a, 'tcx> Wf<'a, 'tcx> {
7979
// where the `'b` is the lifetime bound of the
8080
// contents (i.e., all contents must outlive 'b).
8181
//
82-
// Even though unboxed closures are glorified structs
82+
// Even though closures are glorified structs
8383
// of upvars, we do not need to consider them as they
8484
// can't generate any new constraints. The
8585
// substitutions on the closure are equal to the free

src/librustc_typeck/check/writeback.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
409409
ResolvingClosure(_) => {
410410
let span = self.reason.span(self.tcx);
411411
span_err!(self.tcx.sess, span, E0196,
412-
"cannot determine a type for this \
413-
unboxed closure")
412+
"cannot determine a type for this closure")
414413
}
415414
}
416415
}

src/librustc_typeck/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ register_diagnostics! {
113113
// involving type parameters
114114
E0194,
115115
E0195, // lifetime parameters or bounds on method do not match the trait declaration
116-
E0196, // cannot determine a type for this unboxed closure
116+
E0196, // cannot determine a type for this closure
117117
E0197, // inherent impls cannot be declared as unsafe
118118
E0198, // negative implementations are not unsafe
119119
E0199, // implementing trait is not unsafe

src/librustc_typeck/variance.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -741,7 +741,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
741741
}
742742

743743
ty::ty_closure(..) => {
744-
self.tcx().sess.bug("Unexpected unboxed closure type in variance computation");
744+
self.tcx().sess.bug("Unexpected closure type in variance computation");
745745
}
746746

747747
ty::ty_rptr(region, ref mt) => {

src/libsyntax/parse/parser.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ impl<'a> Parser<'a> {
11331133
TyInfer
11341134
}
11351135

1136-
/// Parses an optional unboxed closure kind (`&:`, `&mut:`, or `:`).
1136+
/// Parses an optional closure kind (`&:`, `&mut:`, or `:`).
11371137
pub fn parse_optional_closure_kind(&mut self) -> Option<ClosureKind> {
11381138
if self.check(&token::BinOp(token::And)) &&
11391139
self.look_ahead(1, |t| t.is_keyword(keywords::Mut)) &&

0 commit comments

Comments
 (0)