Skip to content

Commit cf32851

Browse files
committed
---
yaml --- r: 174329 b: refs/heads/snap-stage3 c: 46366fa h: refs/heads/master i: 174327: 4319fc0 v: v3
1 parent ab4cc22 commit cf32851

File tree

21 files changed

+239
-316
lines changed

21 files changed

+239
-316
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: a833337943300db1c310a4cf9c84b7b4ef4e9468
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 43f2c199e4e87d7ccd15658c52ad8dc5a1d54fb9
4+
refs/heads/snap-stage3: 46366faf613685eeeacf896ee9d284b28d4a3046
55
refs/heads/try: 08f6380a9f0b866796080094f44fe25ea5636547
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d

branches/snap-stage3/src/liblibc/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2207,10 +2207,10 @@ pub mod consts {
22072207
pub const IPPROTO_TCP: c_int = 6;
22082208
pub const IPPROTO_IP: c_int = 0;
22092209
pub const IPPROTO_IPV6: c_int = 41;
2210-
pub const IP_MULTICAST_TTL: c_int = 10;
2211-
pub const IP_MULTICAST_LOOP: c_int = 11;
2212-
pub const IP_ADD_MEMBERSHIP: c_int = 12;
2213-
pub const IP_DROP_MEMBERSHIP: c_int = 13;
2210+
pub const IP_MULTICAST_TTL: c_int = 3;
2211+
pub const IP_MULTICAST_LOOP: c_int = 4;
2212+
pub const IP_ADD_MEMBERSHIP: c_int = 5;
2213+
pub const IP_DROP_MEMBERSHIP: c_int = 6;
22142214
pub const IPV6_ADD_MEMBERSHIP: c_int = 5;
22152215
pub const IPV6_DROP_MEMBERSHIP: c_int = 6;
22162216
pub const IP_TTL: c_int = 4;

branches/snap-stage3/src/librustc/middle/infer/error_reporting.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,6 @@ impl<'a, 'tcx> Rebuilder<'a, 'tcx> {
11771177
ast::Return(ref ret_ty) => ast::Return(
11781178
self.rebuild_arg_ty_or_output(&**ret_ty, lifetime, anon_nums, region_names)
11791179
),
1180-
ast::DefaultReturn(span) => ast::DefaultReturn(span),
11811180
ast::NoReturn(span) => ast::NoReturn(span)
11821181
}
11831182
}

branches/snap-stage3/src/librustc_resolve/build_reduced_graph.rs

Lines changed: 101 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -412,118 +412,118 @@ impl<'a, 'b:'a, 'tcx:'b> GraphBuilder<'a, 'b, 'tcx> {
412412
}
413413
};
414414

415-
match mod_name {
415+
let mod_name = match mod_name {
416+
Some(mod_name) => mod_name,
416417
None => {
417418
self.resolve_error(ty.span,
418419
"inherent implementations may \
419420
only be implemented in the same \
420421
module as the type they are \
421-
implemented for")
422+
implemented for");
423+
return parent.clone();
422424
}
423-
Some(mod_name) => {
424-
// Create the module and add all methods.
425-
let parent_opt = parent.children.borrow().get(&mod_name).cloned();
426-
let new_parent = match parent_opt {
427-
// It already exists
428-
Some(ref child) if child.get_module_if_available()
429-
.is_some() &&
430-
(child.get_module().kind.get() == ImplModuleKind ||
431-
child.get_module().kind.get() == TraitModuleKind) => {
432-
child.get_module()
433-
}
434-
Some(ref child) if child.get_module_if_available()
435-
.is_some() &&
436-
child.get_module().kind.get() ==
437-
EnumModuleKind => child.get_module(),
438-
// Create the module
439-
_ => {
440-
let name_bindings =
441-
self.add_child(mod_name, parent, ForbidDuplicateModules, sp);
442-
443-
let parent_link = self.get_parent_link(parent, name);
444-
let def_id = local_def(item.id);
445-
let ns = TypeNS;
446-
let is_public =
447-
!name_bindings.defined_in_namespace(ns) ||
448-
name_bindings.defined_in_public_namespace(ns);
449-
450-
name_bindings.define_module(parent_link,
451-
Some(def_id),
452-
ImplModuleKind,
453-
false,
454-
is_public,
455-
sp);
456-
457-
name_bindings.get_module()
458-
}
459-
};
425+
};
460426

461-
// For each implementation item...
462-
for impl_item in impl_items.iter() {
463-
match *impl_item {
464-
MethodImplItem(ref method) => {
465-
// Add the method to the module.
466-
let name = method.pe_ident().name;
467-
let method_name_bindings =
468-
self.add_child(name,
469-
&new_parent,
470-
ForbidDuplicateValues,
471-
method.span);
472-
let def = match method.pe_explicit_self()
473-
.node {
474-
SelfStatic => {
475-
// Static methods become
476-
// `DefStaticMethod`s.
477-
DefStaticMethod(local_def(method.id),
478-
FromImpl(local_def(item.id)))
479-
}
480-
_ => {
481-
// Non-static methods become
482-
// `DefMethod`s.
483-
DefMethod(local_def(method.id),
484-
None,
485-
FromImpl(local_def(item.id)))
486-
}
487-
};
427+
// Create the module and add all methods.
428+
let parent_opt = parent.children.borrow().get(&mod_name).cloned();
429+
let new_parent = match parent_opt {
430+
// It already exists
431+
Some(ref child) if child.get_module_if_available()
432+
.is_some() &&
433+
(child.get_module().kind.get() == ImplModuleKind ||
434+
child.get_module().kind.get() == TraitModuleKind) => {
435+
child.get_module()
436+
}
437+
Some(ref child) if child.get_module_if_available()
438+
.is_some() &&
439+
child.get_module().kind.get() ==
440+
EnumModuleKind => child.get_module(),
441+
// Create the module
442+
_ => {
443+
let name_bindings =
444+
self.add_child(mod_name, parent, ForbidDuplicateModules, sp);
445+
446+
let parent_link = self.get_parent_link(parent, name);
447+
let def_id = local_def(item.id);
448+
let ns = TypeNS;
449+
let is_public =
450+
!name_bindings.defined_in_namespace(ns) ||
451+
name_bindings.defined_in_public_namespace(ns);
452+
453+
name_bindings.define_module(parent_link,
454+
Some(def_id),
455+
ImplModuleKind,
456+
false,
457+
is_public,
458+
sp);
488459

489-
// NB: not IMPORTABLE
490-
let modifiers = if method.pe_vis() == ast::Public {
491-
PUBLIC
492-
} else {
493-
DefModifiers::empty()
494-
};
495-
method_name_bindings.define_value(
496-
def,
497-
method.span,
498-
modifiers);
499-
}
500-
TypeImplItem(ref typedef) => {
501-
// Add the typedef to the module.
502-
let name = typedef.ident.name;
503-
let typedef_name_bindings =
504-
self.add_child(
505-
name,
506-
&new_parent,
507-
ForbidDuplicateTypesAndModules,
508-
typedef.span);
509-
let def = DefAssociatedTy(local_def(
510-
typedef.id));
511-
// NB: not IMPORTABLE
512-
let modifiers = if typedef.vis == ast::Public {
513-
PUBLIC
514-
} else {
515-
DefModifiers::empty()
516-
};
517-
typedef_name_bindings.define_type(
518-
def,
519-
typedef.span,
520-
modifiers);
521-
}
522-
}
460+
name_bindings.get_module()
461+
}
462+
};
463+
464+
// For each implementation item...
465+
for impl_item in impl_items.iter() {
466+
match *impl_item {
467+
MethodImplItem(ref method) => {
468+
// Add the method to the module.
469+
let name = method.pe_ident().name;
470+
let method_name_bindings =
471+
self.add_child(name,
472+
&new_parent,
473+
ForbidDuplicateValues,
474+
method.span);
475+
let def = match method.pe_explicit_self()
476+
.node {
477+
SelfStatic => {
478+
// Static methods become
479+
// `DefStaticMethod`s.
480+
DefStaticMethod(local_def(method.id),
481+
FromImpl(local_def(item.id)))
482+
}
483+
_ => {
484+
// Non-static methods become
485+
// `DefMethod`s.
486+
DefMethod(local_def(method.id),
487+
None,
488+
FromImpl(local_def(item.id)))
489+
}
490+
};
491+
492+
// NB: not IMPORTABLE
493+
let modifiers = if method.pe_vis() == ast::Public {
494+
PUBLIC
495+
} else {
496+
DefModifiers::empty()
497+
};
498+
method_name_bindings.define_value(
499+
def,
500+
method.span,
501+
modifiers);
502+
}
503+
TypeImplItem(ref typedef) => {
504+
// Add the typedef to the module.
505+
let name = typedef.ident.name;
506+
let typedef_name_bindings =
507+
self.add_child(
508+
name,
509+
&new_parent,
510+
ForbidDuplicateTypesAndModules,
511+
typedef.span);
512+
let def = DefAssociatedTy(local_def(
513+
typedef.id));
514+
// NB: not IMPORTABLE
515+
let modifiers = if typedef.vis == ast::Public {
516+
PUBLIC
517+
} else {
518+
DefModifiers::empty()
519+
};
520+
typedef_name_bindings.define_type(
521+
def,
522+
typedef.span,
523+
modifiers);
523524
}
524525
}
525526
}
526-
527527
parent.clone()
528528
}
529529

branches/snap-stage3/src/librustc_trans/trans/debuginfo.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1450,15 +1450,18 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>,
14501450
let mut signature = Vec::with_capacity(fn_decl.inputs.len() + 1);
14511451

14521452
// Return type -- llvm::DIBuilder wants this at index 0
1453-
assert_type_for_node_id(cx, fn_ast_id, error_reporting_span);
1454-
let return_type = ty::node_id_to_type(cx.tcx(), fn_ast_id);
1455-
let return_type = monomorphize::apply_param_substs(cx.tcx(),
1456-
param_substs,
1457-
&return_type);
1458-
if ty::type_is_nil(return_type) {
1459-
signature.push(ptr::null_mut())
1460-
} else {
1461-
signature.push(type_metadata(cx, return_type, codemap::DUMMY_SP));
1453+
match fn_decl.output {
1454+
ast::Return(ref ret_ty) if ret_ty.node == ast::TyTup(vec![]) =>
1455+
signature.push(ptr::null_mut()),
1456+
_ => {
1457+
assert_type_for_node_id(cx, fn_ast_id, error_reporting_span);
1458+
1459+
let return_type = ty::node_id_to_type(cx.tcx(), fn_ast_id);
1460+
let return_type = monomorphize::apply_param_substs(cx.tcx(),
1461+
param_substs,
1462+
&return_type);
1463+
signature.push(type_metadata(cx, return_type, codemap::DUMMY_SP));
1464+
}
14621465
}
14631466

14641467
// Arguments types

branches/snap-stage3/src/librustc_trans/trans/foreign.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,9 @@ fn gate_simd_ffi(tcx: &ty::ctxt, decl: &ast::FnDecl, ty: &ty::BareFnTy) {
445445
for (input, ty) in decl.inputs.iter().zip(sig.inputs.iter()) {
446446
check(&*input.ty, *ty)
447447
}
448-
if let ast::Return(ref ty) = decl.output {
449-
check(&**ty, sig.output.unwrap())
448+
match decl.output {
449+
ast::NoReturn(_) => {}
450+
ast::Return(ref ty) => check(&**ty, sig.output.unwrap())
450451
}
451452
}
452453
}

branches/snap-stage3/src/librustc_trans/trans/intrinsic.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,12 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
361361
}
362362
(_, "init") => {
363363
let tp_ty = *substs.types.get(FnSpace, 0);
364-
if !return_type_is_void(ccx, tp_ty) {
365-
// Just zero out the stack slot. (See comment on base::memzero for explaination)
366-
zero_mem(bcx, llresult, tp_ty);
364+
let lltp_ty = type_of::arg_type_of(ccx, tp_ty);
365+
if return_type_is_void(ccx, tp_ty) {
366+
C_nil(ccx)
367+
} else {
368+
C_null(lltp_ty)
367369
}
368-
C_nil(ccx)
369370
}
370371
// Effectively no-ops
371372
(_, "uninit") | (_, "forget") => {

branches/snap-stage3/src/librustc_typeck/astconv.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,8 +1359,7 @@ fn ty_of_method_or_bare_fn<'a, 'tcx>(this: &AstConv<'tcx>,
13591359
implied_output_region,
13601360
lifetimes_for_params,
13611361
&**output)),
1362-
ast::DefaultReturn(..) => ty::FnConverging(ty::mk_nil(this.tcx())),
1363-
ast::NoReturn(..) => ty::FnDiverging
1362+
ast::NoReturn(_) => ty::FnDiverging
13641363
};
13651364

13661365
(ty::BareFnTy {
@@ -1487,21 +1486,14 @@ pub fn ty_of_closure<'tcx>(
14871486

14881487
let expected_ret_ty = expected_sig.map(|e| e.output);
14891488

1490-
let is_infer = match decl.output {
1491-
ast::Return(ref output) if output.node == ast::TyInfer => true,
1492-
ast::DefaultReturn(..) => true,
1493-
_ => false
1494-
};
1495-
14961489
let output_ty = match decl.output {
1497-
_ if is_infer && expected_ret_ty.is_some() =>
1490+
ast::Return(ref output) if output.node == ast::TyInfer && expected_ret_ty.is_some() =>
14981491
expected_ret_ty.unwrap(),
1499-
_ if is_infer =>
1500-
ty::FnConverging(this.ty_infer(decl.output.span())),
1492+
ast::Return(ref output) if output.node == ast::TyInfer =>
1493+
ty::FnConverging(this.ty_infer(output.span)),
15011494
ast::Return(ref output) =>
15021495
ty::FnConverging(ast_ty_to_ty(this, &rb, &**output)),
1503-
ast::DefaultReturn(..) => unreachable!(),
1504-
ast::NoReturn(..) => ty::FnDiverging
1496+
ast::NoReturn(_) => ty::FnDiverging
15051497
};
15061498

15071499
debug!("ty_of_closure: input_tys={}", input_tys.repr(this.tcx()));

branches/snap-stage3/src/librustc_typeck/collect.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,9 +1488,7 @@ fn ty_of_foreign_fn_decl<'a, 'tcx>(ccx: &CollectCtxt<'a, 'tcx>,
14881488
let output = match decl.output {
14891489
ast::Return(ref ty) =>
14901490
ty::FnConverging(ast_ty_to_ty(ccx, &rb, &**ty)),
1491-
ast::DefaultReturn(..) =>
1492-
ty::FnConverging(ty::mk_nil(ccx.tcx)),
1493-
ast::NoReturn(..) =>
1491+
ast::NoReturn(_) =>
14941492
ty::FnDiverging
14951493
};
14961494

branches/snap-stage3/src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,16 +1141,14 @@ impl Clean<Argument> for ast::Arg {
11411141
#[derive(Clone, RustcEncodable, RustcDecodable, PartialEq, Show)]
11421142
pub enum FunctionRetTy {
11431143
Return(Type),
1144-
DefaultReturn,
11451144
NoReturn
11461145
}
11471146

11481147
impl Clean<FunctionRetTy> for ast::FunctionRetTy {
11491148
fn clean(&self, cx: &DocContext) -> FunctionRetTy {
11501149
match *self {
11511150
ast::Return(ref typ) => Return(typ.clean(cx)),
1152-
ast::DefaultReturn(..) => DefaultReturn,
1153-
ast::NoReturn(..) => NoReturn
1151+
ast::NoReturn(_) => NoReturn
11541152
}
11551153
}
11561154
}

branches/snap-stage3/src/librustdoc/html/format.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,6 @@ impl fmt::String for clean::FunctionRetTy {
557557
match *self {
558558
clean::Return(clean::Tuple(ref tys)) if tys.is_empty() => Ok(()),
559559
clean::Return(ref ty) => write!(f, " -&gt; {}", ty),
560-
clean::DefaultReturn => Ok(()),
561560
clean::NoReturn => write!(f, " -&gt; !")
562561
}
563562
}

0 commit comments

Comments
 (0)