Skip to content

Commit 40294b6

Browse files
committed
---
yaml --- r: 162295 b: refs/heads/auto c: 456ffcd h: refs/heads/master i: 162293: 8fbc28a 162291: 80a9073 162287: ab327f9 v: v3
1 parent c2cb93d commit 40294b6

File tree

7 files changed

+60
-62
lines changed

7 files changed

+60
-62
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1010
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1111
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1212
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
13-
refs/heads/auto: eacbd296fa153f809038a27898290638bd0b2b35
13+
refs/heads/auto: 456ffcdc560c1c7baea116ef1ea03e0f7568102d
1414
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1515
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1616
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/libcore/ops.rs

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,3 +832,53 @@ impl<F,A,R> FnOnce<A,R> for F
832832
self.call_mut(args)
833833
}
834834
}
835+
836+
#[cfg(stage0)]
837+
mod fn_impls {
838+
use super::Fn;
839+
840+
impl<Result> Fn<(),Result> for extern "Rust" fn() -> Result {
841+
#[allow(non_snake_case)]
842+
extern "rust-call" fn call(&self, _args: ()) -> Result {
843+
(*self)()
844+
}
845+
}
846+
847+
impl<Result,A0> Fn<(A0,),Result> for extern "Rust" fn(A0) -> Result {
848+
#[allow(non_snake_case)]
849+
extern "rust-call" fn call(&self, args: (A0,)) -> Result {
850+
let (a0,) = args;
851+
(*self)(a0)
852+
}
853+
}
854+
855+
macro_rules! def_fn(
856+
($($args:ident)*) => (
857+
impl<Result$(,$args)*>
858+
Fn<($($args,)*),Result>
859+
for extern "Rust" fn($($args: $args,)*) -> Result {
860+
#[allow(non_snake_case)]
861+
extern "rust-call" fn call(&self, args: ($($args,)*)) -> Result {
862+
let ($($args,)*) = args;
863+
(*self)($($args,)*)
864+
}
865+
}
866+
)
867+
)
868+
869+
def_fn!(A0 A1)
870+
def_fn!(A0 A1 A2)
871+
def_fn!(A0 A1 A2 A3)
872+
def_fn!(A0 A1 A2 A3 A4)
873+
def_fn!(A0 A1 A2 A3 A4 A5)
874+
def_fn!(A0 A1 A2 A3 A4 A5 A6)
875+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7)
876+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8)
877+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9)
878+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10)
879+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11)
880+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12)
881+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13)
882+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14)
883+
def_fn!(A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 A10 A11 A12 A13 A14 A15)
884+
}

branches/auto/src/librustc_typeck/check/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ fn check_bare_fn<'a, 'tcx>(ccx: &CrateCtxt<'a, 'tcx>,
406406
decl, id, body, &inh);
407407

408408
vtable::select_all_fcx_obligations_or_error(&fcx);
409-
regionck::regionck_fn(&fcx, id, decl, body);
409+
regionck::regionck_fn(&fcx, id, body);
410410
fcx.default_diverging_type_variables_to_nil();
411411
writeback::resolve_type_vars_in_fn(&fcx, decl, body);
412412
}

branches/auto/src/librustc_typeck/check/regionck.rs

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -158,11 +158,11 @@ pub fn regionck_item(fcx: &FnCtxt, item: &ast::Item) {
158158
fcx.infcx().resolve_regions_and_report_errors();
159159
}
160160

161-
pub fn regionck_fn(fcx: &FnCtxt, id: ast::NodeId, decl: &ast::FnDecl, blk: &ast::Block) {
161+
pub fn regionck_fn(fcx: &FnCtxt, id: ast::NodeId, blk: &ast::Block) {
162162
let mut rcx = Rcx::new(fcx, blk.id);
163163
if fcx.err_count_since_creation() == 0 {
164164
// regionck assumes typeck succeeded
165-
rcx.visit_fn_body(id, decl, blk);
165+
rcx.visit_fn_body(id, blk);
166166
}
167167

168168
// Region checking a fn can introduce new trait obligations,
@@ -328,7 +328,6 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
328328

329329
fn visit_fn_body(&mut self,
330330
id: ast::NodeId,
331-
fn_decl: &ast::FnDecl,
332331
body: &ast::Block)
333332
{
334333
// When we enter a function, we can derive
@@ -344,7 +343,6 @@ impl<'a, 'tcx> Rcx<'a, 'tcx> {
344343

345344
let len = self.region_param_pairs.len();
346345
self.relate_free_regions(fn_sig.as_slice(), body.id);
347-
link_fn_args(self, CodeExtent::from_node_id(body.id), fn_decl.inputs.as_slice());
348346
self.visit_block(body);
349347
self.visit_region_obligations(body.id);
350348
self.region_param_pairs.truncate(len);
@@ -482,9 +480,9 @@ impl<'a, 'tcx, 'v> Visitor<'v> for Rcx<'a, 'tcx> {
482480
// hierarchy, and in particular the relationships between free
483481
// regions, until regionck, as described in #3238.
484482

485-
fn visit_fn(&mut self, _fk: visit::FnKind<'v>, fd: &'v ast::FnDecl,
483+
fn visit_fn(&mut self, _fk: visit::FnKind<'v>, _fd: &'v ast::FnDecl,
486484
b: &'v ast::Block, _s: Span, id: ast::NodeId) {
487-
self.visit_fn_body(id, fd, b)
485+
self.visit_fn_body(id, b)
488486
}
489487

490488
fn visit_item(&mut self, i: &ast::Item) { visit_item(self, i); }
@@ -1290,6 +1288,7 @@ fn link_local(rcx: &Rcx, local: &ast::Local) {
12901288
/// then ensures that the lifetime of the resulting pointer is
12911289
/// linked to the lifetime of its guarantor (if any).
12921290
fn link_match(rcx: &Rcx, discr: &ast::Expr, arms: &[ast::Arm]) {
1291+
12931292
debug!("regionck::for_match()");
12941293
let mc = mc::MemCategorizationContext::new(rcx);
12951294
let discr_cmt = ignore_err!(mc.cat_expr(discr));
@@ -1301,32 +1300,12 @@ fn link_match(rcx: &Rcx, discr: &ast::Expr, arms: &[ast::Arm]) {
13011300
}
13021301
}
13031302

1304-
/// Computes the guarantors for any ref bindings in a match and
1305-
/// then ensures that the lifetime of the resulting pointer is
1306-
/// linked to the lifetime of its guarantor (if any).
1307-
fn link_fn_args(rcx: &Rcx, body_scope: CodeExtent, args: &[ast::Arg]) {
1308-
debug!("regionck::link_fn_args(body_scope={})", body_scope);
1309-
let mc = mc::MemCategorizationContext::new(rcx);
1310-
for arg in args.iter() {
1311-
let arg_ty = rcx.fcx.node_ty(arg.id);
1312-
let re_scope = ty::ReScope(body_scope);
1313-
let arg_cmt = mc.cat_rvalue(arg.id, arg.ty.span, re_scope, arg_ty);
1314-
debug!("arg_ty={} arg_cmt={}",
1315-
arg_ty.repr(rcx.tcx()),
1316-
arg_cmt.repr(rcx.tcx()));
1317-
link_pattern(rcx, mc, arg_cmt, &*arg.pat);
1318-
}
1319-
}
1320-
13211303
/// Link lifetimes of any ref bindings in `root_pat` to the pointers found in the discriminant, if
13221304
/// needed.
13231305
fn link_pattern<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
13241306
mc: mc::MemCategorizationContext<Rcx<'a, 'tcx>>,
13251307
discr_cmt: mc::cmt<'tcx>,
13261308
root_pat: &ast::Pat) {
1327-
debug!("link_pattern(discr_cmt={}, root_pat={})",
1328-
discr_cmt.repr(rcx.tcx()),
1329-
root_pat.repr(rcx.tcx()));
13301309
let _ = mc.cat_pattern(discr_cmt, root_pat, |mc, sub_cmt, sub_pat| {
13311310
match sub_pat.node {
13321311
// `ref x` pattern

branches/auto/src/libsyntax/parse/lexer/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ impl<'a> StringReader<'a> {
763763
}
764764
}
765765

766-
// SNAP 361baab
766+
// SNAP c9f6d69
767767
#[allow(unused)]
768768
fn old_escape_warning(&mut self, sp: Span) {
769769
self.span_diagnostic
@@ -796,15 +796,15 @@ impl<'a> StringReader<'a> {
796796
self.scan_unicode_escape(delim)
797797
} else {
798798
let res = self.scan_hex_digits(4u, delim, false);
799-
// SNAP 361baab
799+
// SNAP c9f6d69
800800
//let sp = codemap::mk_sp(escaped_pos, self.last_pos);
801801
//self.old_escape_warning(sp);
802802
res
803803
}
804804
}
805805
'U' if !ascii_only => {
806806
let res = self.scan_hex_digits(8u, delim, false);
807-
// SNAP 361baab
807+
// SNAP c9f6d69
808808
//let sp = codemap::mk_sp(escaped_pos, self.last_pos);
809809
//self.old_escape_warning(sp);
810810
res

branches/auto/src/snapshots.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,3 @@
1-
S 2014-12-05 361baab
2-
freebsd-x86_64 73cbae4168538a07facd81cca45ed672badb7c3a
3-
linux-i386 211cf0fbdbc7045b765e7b92d92049bbe6788513
4-
linux-x86_64 f001cec306fc1ac77504884acf5dac2e7b39e164
5-
macos-i386 751dc02fac96114361c56eb45ce52e7a58d555e0
6-
macos-x86_64 58cad0275d7b33412501d7dd3386b924d2304e83
7-
winnt-i386 872c56b88cebd7d590fd00bcbd264f0003b4427b
8-
winnt-x86_64 2187d8b3187c03f95cd4e56a582f55ec0cfa8df9
9-
101
S 2014-11-21 c9f6d69
112
freebsd-x86_64 0ef316e7c369177de043e69e964418bd637cbfc0
123
linux-i386 c8342e762a1720be939ed7c6a39bdaa27892f66f

branches/auto/src/test/run-pass/regions-link-fn-args.rs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)