Skip to content

Commit f346785

Browse files
committed
---
yaml --- r: 95724 b: refs/heads/dist-snap c: 01ab854 h: refs/heads/master v: v3
1 parent 94db7d9 commit f346785

File tree

26 files changed

+149
-144
lines changed

26 files changed

+149
-144
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: fc766efd16231e521365a29a73bca7f2c4178e9c
9+
refs/heads/dist-snap: 01ab8542fbcfbea2cb0dcdc538e56a7167f70f51
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/src/libextra/future.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,10 @@ impl<A:Clone> Future<A> {
5151

5252
impl<A> Future<A> {
5353
/// Gets the value from this future, forcing evaluation.
54-
pub fn unwrap(mut self) -> A {
55-
self.get_ref();
56-
let state = replace(&mut self.state, Evaluating);
54+
pub fn unwrap(self) -> A {
55+
let mut this = self;
56+
this.get_ref();
57+
let state = replace(&mut this.state, Evaluating);
5758
match state {
5859
Forced(v) => v,
5960
_ => fail!( "Logic error." ),

branches/dist-snap/src/librustc/lib/llvm.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,6 @@ pub mod llvm {
693693
pub fn LLVMAddReturnAttribute(Fn: ValueRef, PA: c_uint);
694694
pub fn LLVMRemoveReturnAttribute(Fn: ValueRef, PA: c_uint);
695695

696-
pub fn LLVMAddColdAttribute(Fn: ValueRef);
697-
698696
pub fn LLVMRemoveFunctionAttr(Fn: ValueRef,
699697
PA: c_ulonglong,
700698
HighPA: c_ulonglong);

branches/dist-snap/src/librustc/middle/moves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ impl VisitContext {
420420
// specified and (2) have a type that
421421
// moves-by-default:
422422
let consume_with = with_fields.iter().any(|tf| {
423-
!fields.iter().any(|f| f.ident.name == tf.ident.name) &&
423+
!fields.iter().any(|f| f.ident.node.name == tf.ident.name) &&
424424
ty::type_moves_by_default(self.tcx, tf.mt.ty)
425425
});
426426

branches/dist-snap/src/librustc/middle/privacy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,15 +716,15 @@ impl<'self> Visitor<()> for PrivacyVisitor<'self> {
716716
match ty::get(ty::expr_ty(self.tcx, expr)).sty {
717717
ty::ty_struct(id, _) => {
718718
for field in (*fields).iter() {
719-
self.check_field(expr.span, id, field.ident);
719+
self.check_field(expr.span, id, field.ident.node);
720720
}
721721
}
722722
ty::ty_enum(_, _) => {
723723
match self.tcx.def_map.get_copy(&expr.id) {
724724
ast::DefVariant(_, variant_id, _) => {
725725
for field in fields.iter() {
726726
self.check_field(expr.span, variant_id,
727-
field.ident);
727+
field.ident.node);
728728
}
729729
}
730730
_ => self.tcx.sess.span_bug(expr.span,

branches/dist-snap/src/librustc/middle/trans/base.rs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -202,21 +202,19 @@ pub fn get_extern_fn(externs: &mut ExternMap, llmod: ModuleRef, name: &str,
202202
f
203203
}
204204

205-
fn get_extern_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
206-
name: &str, did: ast::DefId) -> ValueRef {
205+
pub fn get_extern_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
206+
name: &str) -> ValueRef {
207207
match ccx.externs.find_equiv(&name) {
208208
Some(n) => return *n,
209209
None => ()
210210
}
211211
let f = decl_rust_fn(ccx, inputs, output, name);
212-
do csearch::get_item_attrs(ccx.tcx.cstore, did) |meta_items| {
213-
set_llvm_fn_attrs(meta_items.iter().map(|&x| attr::mk_attr(x)).to_owned_vec(), f)
214-
}
215212
ccx.externs.insert(name.to_owned(), f);
216213
f
217214
}
218215

219-
fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t, name: &str) -> ValueRef {
216+
pub fn decl_rust_fn(ccx: &mut CrateContext, inputs: &[ty::t], output: ty::t,
217+
name: &str) -> ValueRef {
220218
let llfty = type_of_rust_fn(ccx, inputs, output);
221219
let llfn = decl_cdecl_fn(ccx.llmod, name, llfty);
222220

@@ -483,10 +481,6 @@ pub fn set_llvm_fn_attrs(attrs: &[ast::Attribute], llfn: ValueRef) {
483481
if contains_name(attrs, "no_split_stack") {
484482
set_no_split_stack(llfn);
485483
}
486-
487-
if contains_name(attrs, "cold") {
488-
unsafe { llvm::LLVMAddColdAttribute(llfn) }
489-
}
490484
}
491485

492486
pub fn set_always_inline(f: ValueRef) {
@@ -846,7 +840,7 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
846840
ty::ty_bare_fn(ref fn_ty) => {
847841
match fn_ty.abis.for_arch(ccx.sess.targ_cfg.arch) {
848842
Some(Rust) | Some(RustIntrinsic) => {
849-
get_extern_rust_fn(ccx, fn_ty.sig.inputs, fn_ty.sig.output, name, did)
843+
get_extern_rust_fn(ccx, fn_ty.sig.inputs, fn_ty.sig.output, name)
850844
}
851845
Some(*) | None => {
852846
let c = foreign::llvm_calling_convention(ccx, fn_ty.abis);
@@ -857,7 +851,7 @@ pub fn trans_external_path(ccx: &mut CrateContext, did: ast::DefId, t: ty::t) ->
857851
}
858852
}
859853
ty::ty_closure(ref f) => {
860-
get_extern_rust_fn(ccx, f.sig.inputs, f.sig.output, name, did)
854+
get_extern_rust_fn(ccx, f.sig.inputs, f.sig.output, name)
861855
}
862856
_ => {
863857
let llty = type_of(ccx, t);

branches/dist-snap/src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext,
508508
|discr, field_tys| {
509509
let cs = field_tys.iter().enumerate()
510510
.map(|(ix, &field_ty)| {
511-
match fs.iter().find(|f| field_ty.ident.name == f.ident.name) {
511+
match fs.iter().find(|f| field_ty.ident.name == f.ident.node.name) {
512512
Some(f) => const_expr(cx, (*f).expr),
513513
None => {
514514
match base_val {

branches/dist-snap/src/librustc/middle/trans/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1211,7 +1211,7 @@ fn trans_rec_or_struct(bcx: @mut Block,
12111211
let numbered_fields = do fields.map |field| {
12121212
let opt_pos =
12131213
field_tys.iter().position(|field_ty|
1214-
field_ty.ident.name == field.ident.name);
1214+
field_ty.ident.name == field.ident.node.name);
12151215
match opt_pos {
12161216
Some(i) => {
12171217
need_base[i] = false;

branches/dist-snap/src/librustc/middle/typeck/check/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2030,28 +2030,28 @@ pub fn check_expr_with_unifier(fcx: @mut FnCtxt,
20302030
for field in ast_fields.iter() {
20312031
let mut expected_field_type = ty::mk_err();
20322032

2033-
let pair = class_field_map.find(&field.ident.name).map(|x| *x);
2033+
let pair = class_field_map.find(&field.ident.node.name).map(|x| *x);
20342034
match pair {
20352035
None => {
20362036
tcx.sess.span_err(
2037-
field.span,
2037+
field.ident.span,
20382038
format!("structure has no field named `{}`",
2039-
tcx.sess.str_of(field.ident)));
2039+
tcx.sess.str_of(field.ident.node)));
20402040
error_happened = true;
20412041
}
20422042
Some((_, true)) => {
20432043
tcx.sess.span_err(
2044-
field.span,
2044+
field.ident.span,
20452045
format!("field `{}` specified more than once",
2046-
tcx.sess.str_of(field.ident)));
2046+
tcx.sess.str_of(field.ident.node)));
20472047
error_happened = true;
20482048
}
20492049
Some((field_id, false)) => {
20502050
expected_field_type =
20512051
ty::lookup_field_type(
20522052
tcx, class_id, field_id, &substitutions);
20532053
class_field_map.insert(
2054-
field.ident.name, (field_id, true));
2054+
field.ident.node.name, (field_id, true));
20552055
fields_found += 1;
20562056
}
20572057
}

branches/dist-snap/src/libstd/rt/borrowck.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ pub fn clear_task_borrow_list() {
5757
let _ = try_take_task_borrow_list();
5858
}
5959

60-
#[cold]
6160
unsafe fn fail_borrowed(box: *mut raw::Box<()>, file: *c_char, line: size_t) -> ! {
6261
debug_borrow("fail_borrowed: ", box, 0, 0, file, line);
6362

branches/dist-snap/src/libstd/rt/comm.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<T> ChanOne<T> {
113113

114114
// 'do_resched' configures whether the scheduler immediately switches to
115115
// the receiving task, or leaves the sending task still running.
116-
fn try_send_inner(mut self, val: T, do_resched: bool) -> bool {
116+
fn try_send_inner(self, val: T, do_resched: bool) -> bool {
117117
if do_resched {
118118
rtassert!(!rt::in_sched_context());
119119
}
@@ -129,8 +129,9 @@ impl<T> ChanOne<T> {
129129
sched.maybe_yield();
130130
}
131131

132+
let mut this = self;
132133
let mut recvr_active = true;
133-
let packet = self.packet();
134+
let packet = this.packet();
134135

135136
unsafe {
136137

@@ -149,15 +150,15 @@ impl<T> ChanOne<T> {
149150
// done with the packet. NB: In case of do_resched, this *must*
150151
// happen before waking up a blocked task (or be unkillable),
151152
// because we might get a kill signal during the reschedule.
152-
self.suppress_finalize = true;
153+
this.suppress_finalize = true;
153154

154155
match oldstate {
155156
STATE_BOTH => {
156157
// Port is not waiting yet. Nothing to do
157158
}
158159
STATE_ONE => {
159160
// Port has closed. Need to clean up.
160-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
161+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
161162
recvr_active = false;
162163
}
163164
task_as_state => {
@@ -201,20 +202,22 @@ impl<T> PortOne<T> {
201202
}
202203

203204
/// As `recv`, but returns `None` if the send end is closed rather than failing.
204-
pub fn try_recv(mut self) -> Option<T> {
205+
pub fn try_recv(self) -> Option<T> {
206+
let mut this = self;
207+
205208
// Optimistic check. If data was sent already, we don't even need to block.
206209
// No release barrier needed here; we're not handing off our task pointer yet.
207-
if !self.optimistic_check() {
210+
if !this.optimistic_check() {
208211
// No data available yet.
209212
// Switch to the scheduler to put the ~Task into the Packet state.
210213
let sched: ~Scheduler = Local::take();
211214
do sched.deschedule_running_task_and_then |sched, task| {
212-
self.block_on(sched, task);
215+
this.block_on(sched, task);
213216
}
214217
}
215218

216219
// Task resumes.
217-
self.recv_ready()
220+
this.recv_ready()
218221
}
219222
}
220223

@@ -322,8 +325,9 @@ impl<T> SelectInner for PortOne<T> {
322325
impl<T> Select for PortOne<T> { }
323326

324327
impl<T> SelectPortInner<T> for PortOne<T> {
325-
fn recv_ready(mut self) -> Option<T> {
326-
let packet = self.packet();
328+
fn recv_ready(self) -> Option<T> {
329+
let mut this = self;
330+
let packet = this.packet();
327331

328332
// No further memory barrier is needed here to access the
329333
// payload. Some scenarios:
@@ -344,9 +348,9 @@ impl<T> SelectPortInner<T> for PortOne<T> {
344348
let payload = (*packet).payload.take();
345349

346350
// The sender has closed up shop. Drop the packet.
347-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
351+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
348352
// Suppress the synchronizing actions in the finalizer. We're done with the packet.
349-
self.suppress_finalize = true;
353+
this.suppress_finalize = true;
350354
return payload;
351355
}
352356
}
@@ -374,17 +378,18 @@ impl<T> Drop for ChanOne<T> {
374378
if self.suppress_finalize { return }
375379

376380
unsafe {
377-
let oldstate = (*self.packet()).state.swap(STATE_ONE, SeqCst);
381+
let this = cast::transmute_mut(self);
382+
let oldstate = (*this.packet()).state.swap(STATE_ONE, SeqCst);
378383
match oldstate {
379384
STATE_BOTH => {
380385
// Port still active. It will destroy the Packet.
381386
},
382387
STATE_ONE => {
383-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
388+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
384389
},
385390
task_as_state => {
386391
// The port is blocked waiting for a message we will never send. Wake it.
387-
rtassert!((*self.packet()).payload.is_none());
392+
rtassert!((*this.packet()).payload.is_none());
388393
let recvr = BlockedTask::cast_from_uint(task_as_state);
389394
do recvr.wake().map |woken_task| {
390395
Scheduler::run_task(woken_task);
@@ -401,13 +406,14 @@ impl<T> Drop for PortOne<T> {
401406
if self.suppress_finalize { return }
402407

403408
unsafe {
404-
let oldstate = (*self.packet()).state.swap(STATE_ONE, SeqCst);
409+
let this = cast::transmute_mut(self);
410+
let oldstate = (*this.packet()).state.swap(STATE_ONE, SeqCst);
405411
match oldstate {
406412
STATE_BOTH => {
407413
// Chan still active. It will destroy the packet.
408414
},
409415
STATE_ONE => {
410-
let _packet: ~Packet<T> = cast::transmute(self.void_packet);
416+
let _packet: ~Packet<T> = cast::transmute(this.void_packet);
411417
}
412418
task_as_state => {
413419
// This case occurs during unwinding, when the blocked

0 commit comments

Comments
 (0)