Skip to content

Commit

Permalink
auto merge of #18993 : nikomatsakis/rust/hrtb-5, r=pcwalton
Browse files Browse the repository at this point in the history
Enough said.

Fixes #18639.

r? @pcwalton (or someone else?)

This is a [breaking-change]. In particular, several feature gates related to unboxed closures were consolidated into one (`overloaded_calls`, `unboxed_closure_sugar` => `unboxed_closures`). Otherwise, I think everything that worked before should still work. File a bug and cc @nikomatsakis if you find otherwise. :)
  • Loading branch information
bors committed Nov 18, 2014
2 parents 09e2ad1 + 6866bf3 commit c8d6e3b
Show file tree
Hide file tree
Showing 126 changed files with 3,954 additions and 2,004 deletions.
12 changes: 2 additions & 10 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -2513,11 +2513,6 @@ The currently implemented features of the reference compiler are:
closure as `once` is unlikely to be supported going forward. So
they are hidden behind this feature until they are to be removed.

* `overloaded_calls` - Allow implementing the `Fn*` family of traits on user
types, allowing overloading the call operator (`()`).
This feature may still undergo changes before being
stabilized.

* `phase` - Usage of the `#[phase]` attribute allows loading compiler plugins
for custom lints or syntax extensions. The implementation is
considered unwholesome and in need of overhaul, and it is not clear
Expand Down Expand Up @@ -2560,11 +2555,8 @@ The currently implemented features of the reference compiler are:
* `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
hack that will certainly be removed.

* `unboxed_closure_sugar` - Allows using `|Foo| -> Bar` as a trait bound
meaning one of the `Fn` traits. Still
experimental.

* `unboxed_closures` - A work in progress feature with many known bugs.
* `unboxed_closures` - Rust's new closure design, which is currently a work in
progress feature with many known bugs.

* `unsafe_destructor` - Allows use of the `#[unsafe_destructor]` attribute,
which is considered wildly unsafe and will be
Expand Down
3 changes: 2 additions & 1 deletion src/librustc/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@ register_diagnostics!(
E0165,
E0166,
E0167,
E0168
E0168,
E0169
)
7 changes: 2 additions & 5 deletions src/librustc/metadata/tydecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ fn parse_region(st: &mut PState, conv: conv_did) -> ty::Region {
match next(st) {
'b' => {
assert_eq!(next(st), '[');
let id = parse_uint(st) as ast::NodeId;
let id = ty::DebruijnIndex::new(parse_uint(st));
assert_eq!(next(st), '|');
let br = parse_bound_region(st, |x,y| conv(x,y));
assert_eq!(next(st), ']');
Expand Down Expand Up @@ -579,8 +579,6 @@ fn parse_bare_fn_ty(st: &mut PState, conv: conv_did) -> ty::BareFnTy {

fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
assert_eq!(next(st), '[');
let id = parse_uint(st) as ast::NodeId;
assert_eq!(next(st), '|');
let mut inputs = Vec::new();
while peek(st) != ']' {
inputs.push(parse_ty(st, |x,y| conv(x,y)));
Expand All @@ -598,8 +596,7 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
}
_ => ty::FnConverging(parse_ty(st, |x,y| conv(x,y)))
};
ty::FnSig {binder_id: id,
inputs: inputs,
ty::FnSig {inputs: inputs,
output: output,
variadic: variadic}
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/tyencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ fn enc_region_substs(w: &mut SeekableMemWriter, cx: &ctxt, substs: &subst::Regio
pub fn enc_region(w: &mut SeekableMemWriter, cx: &ctxt, r: ty::Region) {
match r {
ty::ReLateBound(id, br) => {
mywrite!(w, "b[{}|", id);
mywrite!(w, "b[{}|", id.depth);
enc_bound_region(w, cx, br);
mywrite!(w, "]");
}
Expand Down Expand Up @@ -331,7 +331,7 @@ pub fn enc_closure_ty(w: &mut SeekableMemWriter, cx: &ctxt, ft: &ty::ClosureTy)
}

fn enc_fn_sig(w: &mut SeekableMemWriter, cx: &ctxt, fsig: &ty::FnSig) {
mywrite!(w, "[{}|", fsig.binder_id);
mywrite!(w, "[");
for ty in fsig.inputs.iter() {
enc_ty(w, cx, *ty);
}
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,8 @@ impl tr for def::Def {
impl tr for ty::Region {
fn tr(&self, dcx: &DecodeContext) -> ty::Region {
match *self {
ty::ReLateBound(id, br) => {
ty::ReLateBound(dcx.tr_id(id), br.tr(dcx))
ty::ReLateBound(debruijn, br) => {
ty::ReLateBound(debruijn, br.tr(dcx))
}
ty::ReEarlyBound(id, space, index, ident) => {
ty::ReEarlyBound(dcx.tr_id(id), space, index, ident)
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator

impl<'a, 'tcx, 'v> Visitor<'v> for BorrowckCtxt<'a, 'tcx> {
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
b: &'v Block, s: Span, n: NodeId) {
borrowck_fn(self, fk, fd, b, s, n);
b: &'v Block, s: Span, id: ast::NodeId) {
borrowck_fn(self, fk, fd, b, s, id);
}

fn visit_item(&mut self, item: &ast::Item) {
Expand Down
7 changes: 4 additions & 3 deletions src/librustc/middle/check_match.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
check_local(self, l);
}
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
b: &'v Block, s: Span, _: NodeId) {
check_fn(self, fk, fd, b, s);
b: &'v Block, s: Span, n: NodeId) {
check_fn(self, fk, fd, b, s, n);
}
}

Expand Down Expand Up @@ -920,7 +920,8 @@ fn check_fn(cx: &mut MatchCheckCtxt,
kind: FnKind,
decl: &FnDecl,
body: &Block,
sp: Span) {
sp: Span,
_: NodeId) {
visit::walk_fn(cx, kind, decl, body, sp);
for input in decl.inputs.iter() {
is_refutable(cx, &*input.pat, |pat| {
Expand Down
10 changes: 4 additions & 6 deletions src/librustc/middle/liveness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,8 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
}

impl<'a, 'tcx, 'v> Visitor<'v> for IrMaps<'a, 'tcx> {
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
b: &'v Block, s: Span, n: NodeId) {
visit_fn(self, fk, fd, b, s, n);
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: &'v Block, s: Span, id: ast::NodeId) {
visit_fn(self, fk, fd, b, s, id);
}
fn visit_local(&mut self, l: &ast::Local) { visit_local(self, l); }
fn visit_expr(&mut self, ex: &Expr) { visit_expr(self, ex); }
Expand Down Expand Up @@ -374,9 +373,8 @@ fn visit_fn(ir: &mut IrMaps,
decl: &FnDecl,
body: &Block,
sp: Span,
id: NodeId) {
debug!("visit_fn: id={}", id);
let _i = ::util::common::indenter();
id: ast::NodeId) {
debug!("visit_fn");

// swap in a new set of IR maps for this function body:
let mut fn_maps = IrMaps::new(ir.tcx);
Expand Down
6 changes: 3 additions & 3 deletions src/librustc/middle/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5038,10 +5038,10 @@ impl<'a> Resolver<'a> {
visit::walk_ty(self, ty);
}

TyPolyTraitRef(ref poly_trait_ref) => {
self.resolve_poly_trait_reference(
TyPolyTraitRef(ref bounds) => {
self.resolve_type_parameter_bounds(
ty.id,
&**poly_trait_ref,
bounds,
TraitObject);
visit::walk_ty(self, ty);
}
Expand Down
Loading

0 comments on commit c8d6e3b

Please sign in to comment.