Adjust most comments and messages to not use "unboxed".

This commit is contained in:
Eduard Burtescu 2015-01-24 22:15:08 +02:00
parent e0afa82c67
commit 9690be5ece
15 changed files with 36 additions and 44 deletions

View File

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

View File

@ -57,7 +57,7 @@ pub enum DefIdSource {
// Identifies a region parameter (`fn foo<'X>() { ... }`).
RegionParameter,
// Identifies an unboxed closure
// Identifies a closure
ClosureSource
}

View File

@ -232,10 +232,9 @@ pub enum Vtable<'tcx, N> {
/// Successful resolution for a builtin trait.
VtableBuiltin(VtableBuiltinData<N>),
/// Vtable automatically generated for an unboxed closure. The def
/// ID is the ID of the closure expression. This is a `VtableImpl`
/// in spirit, but the impl is generated by the compiler and does
/// not appear in the source.
/// Vtable automatically generated for a closure. The def ID is the ID
/// of the closure expression. This is a `VtableImpl` in spirit, but the
/// impl is generated by the compiler and does not appear in the source.
VtableClosure(ast::DefId, subst::Substs<'tcx>),
/// Same as above, but for a fn pointer type with the given signature.

View File

@ -943,9 +943,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
}
/// Check for the artificial impl that the compiler will create for an obligation like `X :
/// FnMut<..>` where `X` is an unboxed closure type.
/// FnMut<..>` where `X` is a closure type.
///
/// Note: the type parameters on an unboxed closure candidate are modeled as *output* type
/// Note: the type parameters on a closure candidate are modeled as *output* type
/// parameters and hence do not affect whether this trait is a match or not. They will be
/// unified during the confirmation step.
fn assemble_closure_candidates(&mut self,
@ -1932,7 +1932,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
trait_ref)
}
/// In the case of unboxed closure types and fn pointers,
/// In the case of closure types and fn pointers,
/// we currently treat the input type parameters on the trait as
/// outputs. This means that when we have a match we have only
/// considered the self type, so we have to go back and make sure
@ -1942,7 +1942,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
/// errors as if there is no applicable impl, but rather report
/// errors are about mismatched argument types.
///
/// Here is an example. Imagine we have an unboxed closure expression
/// Here is an example. Imagine we have an closure expression
/// and we desugared it so that the type of the expression is
/// `Closure`, and `Closure` expects an int as argument. Then it
/// is "as if" the compiler generated this impl:

View File

@ -432,7 +432,7 @@ pub enum MethodOrigin<'tcx> {
// fully statically resolved method
MethodStatic(ast::DefId),
// fully statically resolved unboxed closure invocation
// fully statically resolved closure invocation
MethodStaticClosure(ast::DefId),
// method invoked on a type parameter with a bounded trait
@ -565,7 +565,7 @@ pub enum vtable_origin<'tcx> {
vtable_param(param_index, uint),
/*
Vtable automatically generated for an unboxed closure. The def ID is the
Vtable automatically generated for a closure. The def ID is the
ID of the closure expression.
*/
vtable_closure(ast::DefId),
@ -785,8 +785,8 @@ pub struct ctxt<'tcx> {
pub dependency_formats: RefCell<dependency_format::Dependencies>,
/// Records the type of each unboxed closure. The def ID is the ID of the
/// expression defining the unboxed closure.
/// Records the type of each closure. The def ID is the ID of the
/// expression defining the closure.
pub closures: RefCell<DefIdMap<Closure<'tcx>>>,
pub node_lint_levels: RefCell<FnvHashMap<(ast::NodeId, lint::LintId),
@ -2262,12 +2262,12 @@ pub struct ItemSubsts<'tcx> {
pub substs: Substs<'tcx>,
}
/// Records information about each unboxed closure.
/// Records information about each closure.
#[derive(Clone)]
pub struct Closure<'tcx> {
/// The type of the unboxed closure.
/// The type of the closure.
pub closure_type: ClosureTy<'tcx>,
/// The kind of unboxed closure this is.
/// The kind of closure this is.
pub kind: ClosureKind,
}
@ -3416,8 +3416,7 @@ pub fn type_contents<'tcx>(cx: &ctxt<'tcx>, ty: Ty<'tcx>) -> TypeContents {
}
ty_closure(did, r, substs) => {
// FIXME(#14449): `borrowed_contents` below assumes `&mut`
// unboxed closure.
// FIXME(#14449): `borrowed_contents` below assumes `&mut` closure.
let param_env = ty::empty_parameter_environment(cx);
let upvars = closure_upvars(&param_env, did, substs).unwrap();
TypeContents::union(upvars.as_slice(),
@ -3685,7 +3684,7 @@ pub fn is_instantiable<'tcx>(cx: &ctxt<'tcx>, r_ty: Ty<'tcx>) -> bool {
ty_infer(_) |
ty_closure(..) => {
// this check is run on type definitions, so we don't expect to see
// inference by-products or unboxed closure types
// inference by-products or closure types
cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}",
ty).as_slice())
}
@ -3778,8 +3777,8 @@ pub fn is_type_representable<'tcx>(cx: &ctxt<'tcx>, sp: Span, ty: Ty<'tcx>)
find_nonrepresentable(cx, sp, seen, iter)
}
ty_closure(..) => {
// this check is run on type definitions, so we don't expect to see
// unboxed closure types
// this check is run on type definitions, so we don't expect
// to see closure types
cx.sess.bug(format!("requires check invoked on inapplicable type: {:?}",
ty).as_slice())
}

View File

@ -457,7 +457,7 @@ pub fn trans_fn_ref_with_substs<'a, 'tcx>(
}
};
// If this is an unboxed closure, redirect to it.
// If this is a closure, redirect to it.
match closure::get_or_create_declaration_if_closure(ccx, def_id, &substs) {
None => {}
Some(llfn) => return llfn,

View File

@ -133,14 +133,14 @@ impl<'a, 'tcx> ClosureEnv<'a, 'tcx> {
}
}
/// Returns the LLVM function declaration for an unboxed closure, creating it
/// if necessary. If the ID does not correspond to a closure ID, returns None.
// Not an unboxed closure.
/// Returns the LLVM function declaration for a closure, creating it if
/// necessary. If the ID does not correspond to a closure ID, returns None.
pub fn get_or_create_declaration_if_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>,
closure_id: ast::DefId,
substs: &Substs<'tcx>)
-> Option<Datum<'tcx, Rvalue>> {
if !ccx.tcx().closures.borrow().contains_key(&closure_id) {
// Not a closure.
return None
}
@ -161,8 +161,7 @@ pub fn get_or_create_declaration_if_closure<'a, 'tcx>(ccx: &CrateContext<'a, 'tc
match ccx.closure_vals().borrow().get(&mono_id) {
Some(&llfn) => {
debug!("get_or_create_declaration_if_closure(): found \
closure");
debug!("get_or_create_declaration_if_closure(): found closure");
return Some(Datum::new(llfn, function_type, Rvalue::new(ByValue)))
}
None => {}
@ -230,8 +229,8 @@ pub fn trans_closure_expr<'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
Closure(freevar_mode)));
// Don't hoist this to the top of the function. It's perfectly legitimate
// to have a zero-size unboxed closure (in which case dest will be
// `Ignore`) and we must still generate the closure body.
// to have a zero-size closure (in which case dest will be `Ignore`) and
// we must still generate the closure body.
let dest_addr = match dest {
expr::SaveIn(p) => p,
expr::Ignore => {

View File

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

View File

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

View File

@ -603,7 +603,7 @@ impl<'a,'tcx> ProbeContext<'a,'tcx> {
None => {
self.tcx().sess.span_bug(
self.span,
&format!("No entry for unboxed closure: {}",
&format!("No entry for closure: {}",
closure_def_id.repr(self.tcx()))[]);
}
};

View File

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

View File

@ -409,8 +409,7 @@ impl<'cx, 'tcx> Resolver<'cx, 'tcx> {
ResolvingClosure(_) => {
let span = self.reason.span(self.tcx);
span_err!(self.tcx.sess, span, E0196,
"cannot determine a type for this \
unboxed closure")
"cannot determine a type for this closure")
}
}
}

View File

@ -113,7 +113,7 @@ register_diagnostics! {
// involving type parameters
E0194,
E0195, // lifetime parameters or bounds on method do not match the trait declaration
E0196, // cannot determine a type for this unboxed closure
E0196, // cannot determine a type for this closure
E0197, // inherent impls cannot be declared as unsafe
E0198, // negative implementations are not unsafe
E0199, // implementing trait is not unsafe

View File

@ -741,7 +741,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> {
}
ty::ty_closure(..) => {
self.tcx().sess.bug("Unexpected unboxed closure type in variance computation");
self.tcx().sess.bug("Unexpected closure type in variance computation");
}
ty::ty_rptr(region, ref mt) => {

View File

@ -1133,7 +1133,7 @@ impl<'a> Parser<'a> {
TyInfer
}
/// Parses an optional unboxed closure kind (`&:`, `&mut:`, or `:`).
/// Parses an optional closure kind (`&:`, `&mut:`, or `:`).
pub fn parse_optional_closure_kind(&mut self) -> Option<ClosureKind> {
if self.check(&token::BinOp(token::And)) &&
self.look_ahead(1, |t| t.is_keyword(keywords::Mut)) &&