Skip to content

Commit c8d6e3b

Browse files
committed
auto merge of #18993 : nikomatsakis/rust/hrtb-5, r=pcwalton
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. :)
2 parents 09e2ad1 + 6866bf3 commit c8d6e3b

File tree

126 files changed

+3954
-2004
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3954
-2004
lines changed

src/doc/reference.md

+2-10
Original file line numberDiff line numberDiff line change
@@ -2513,11 +2513,6 @@ The currently implemented features of the reference compiler are:
25132513
closure as `once` is unlikely to be supported going forward. So
25142514
they are hidden behind this feature until they are to be removed.
25152515

2516-
* `overloaded_calls` - Allow implementing the `Fn*` family of traits on user
2517-
types, allowing overloading the call operator (`()`).
2518-
This feature may still undergo changes before being
2519-
stabilized.
2520-
25212516
* `phase` - Usage of the `#[phase]` attribute allows loading compiler plugins
25222517
for custom lints or syntax extensions. The implementation is
25232518
considered unwholesome and in need of overhaul, and it is not clear
@@ -2560,11 +2555,8 @@ The currently implemented features of the reference compiler are:
25602555
* `trace_macros` - Allows use of the `trace_macros` macro, which is a nasty
25612556
hack that will certainly be removed.
25622557

2563-
* `unboxed_closure_sugar` - Allows using `|Foo| -> Bar` as a trait bound
2564-
meaning one of the `Fn` traits. Still
2565-
experimental.
2566-
2567-
* `unboxed_closures` - A work in progress feature with many known bugs.
2558+
* `unboxed_closures` - Rust's new closure design, which is currently a work in
2559+
progress feature with many known bugs.
25682560

25692561
* `unsafe_destructor` - Allows use of the `#[unsafe_destructor]` attribute,
25702562
which is considered wildly unsafe and will be

src/librustc/diagnostics.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,6 @@ register_diagnostics!(
144144
E0165,
145145
E0166,
146146
E0167,
147-
E0168
147+
E0168,
148+
E0169
148149
)

src/librustc/metadata/tydecode.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ fn parse_region(st: &mut PState, conv: conv_did) -> ty::Region {
294294
match next(st) {
295295
'b' => {
296296
assert_eq!(next(st), '[');
297-
let id = parse_uint(st) as ast::NodeId;
297+
let id = ty::DebruijnIndex::new(parse_uint(st));
298298
assert_eq!(next(st), '|');
299299
let br = parse_bound_region(st, |x,y| conv(x,y));
300300
assert_eq!(next(st), ']');
@@ -579,8 +579,6 @@ fn parse_bare_fn_ty(st: &mut PState, conv: conv_did) -> ty::BareFnTy {
579579

580580
fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
581581
assert_eq!(next(st), '[');
582-
let id = parse_uint(st) as ast::NodeId;
583-
assert_eq!(next(st), '|');
584582
let mut inputs = Vec::new();
585583
while peek(st) != ']' {
586584
inputs.push(parse_ty(st, |x,y| conv(x,y)));
@@ -598,8 +596,7 @@ fn parse_sig(st: &mut PState, conv: conv_did) -> ty::FnSig {
598596
}
599597
_ => ty::FnConverging(parse_ty(st, |x,y| conv(x,y)))
600598
};
601-
ty::FnSig {binder_id: id,
602-
inputs: inputs,
599+
ty::FnSig {inputs: inputs,
603600
output: output,
604601
variadic: variadic}
605602
}

src/librustc/metadata/tyencode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ fn enc_region_substs(w: &mut SeekableMemWriter, cx: &ctxt, substs: &subst::Regio
130130
pub fn enc_region(w: &mut SeekableMemWriter, cx: &ctxt, r: ty::Region) {
131131
match r {
132132
ty::ReLateBound(id, br) => {
133-
mywrite!(w, "b[{}|", id);
133+
mywrite!(w, "b[{}|", id.depth);
134134
enc_bound_region(w, cx, br);
135135
mywrite!(w, "]");
136136
}
@@ -331,7 +331,7 @@ pub fn enc_closure_ty(w: &mut SeekableMemWriter, cx: &ctxt, ft: &ty::ClosureTy)
331331
}
332332

333333
fn enc_fn_sig(w: &mut SeekableMemWriter, cx: &ctxt, fsig: &ty::FnSig) {
334-
mywrite!(w, "[{}|", fsig.binder_id);
334+
mywrite!(w, "[");
335335
for ty in fsig.inputs.iter() {
336336
enc_ty(w, cx, *ty);
337337
}

src/librustc/middle/astencode.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,8 @@ impl tr for def::Def {
483483
impl tr for ty::Region {
484484
fn tr(&self, dcx: &DecodeContext) -> ty::Region {
485485
match *self {
486-
ty::ReLateBound(id, br) => {
487-
ty::ReLateBound(dcx.tr_id(id), br.tr(dcx))
486+
ty::ReLateBound(debruijn, br) => {
487+
ty::ReLateBound(debruijn, br.tr(dcx))
488488
}
489489
ty::ReEarlyBound(id, space, index, ident) => {
490490
ty::ReEarlyBound(dcx.tr_id(id), space, index, ident)

src/librustc/middle/borrowck/mod.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ pub type LoanDataFlow<'a, 'tcx> = DataFlowContext<'a, 'tcx, LoanDataFlowOperator
6565

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

7272
fn visit_item(&mut self, item: &ast::Item) {

src/librustc/middle/check_match.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ impl<'a, 'tcx, 'v> Visitor<'v> for MatchCheckCtxt<'a, 'tcx> {
139139
check_local(self, l);
140140
}
141141
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
142-
b: &'v Block, s: Span, _: NodeId) {
143-
check_fn(self, fk, fd, b, s);
142+
b: &'v Block, s: Span, n: NodeId) {
143+
check_fn(self, fk, fd, b, s, n);
144144
}
145145
}
146146

@@ -920,7 +920,8 @@ fn check_fn(cx: &mut MatchCheckCtxt,
920920
kind: FnKind,
921921
decl: &FnDecl,
922922
body: &Block,
923-
sp: Span) {
923+
sp: Span,
924+
_: NodeId) {
924925
visit::walk_fn(cx, kind, decl, body, sp);
925926
for input in decl.inputs.iter() {
926927
is_refutable(cx, &*input.pat, |pat| {

src/librustc/middle/liveness.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,8 @@ fn live_node_kind_to_string(lnk: LiveNodeKind, cx: &ty::ctxt) -> String {
187187
}
188188

189189
impl<'a, 'tcx, 'v> Visitor<'v> for IrMaps<'a, 'tcx> {
190-
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl,
191-
b: &'v Block, s: Span, n: NodeId) {
192-
visit_fn(self, fk, fd, b, s, n);
190+
fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: &'v Block, s: Span, id: ast::NodeId) {
191+
visit_fn(self, fk, fd, b, s, id);
193192
}
194193
fn visit_local(&mut self, l: &ast::Local) { visit_local(self, l); }
195194
fn visit_expr(&mut self, ex: &Expr) { visit_expr(self, ex); }
@@ -374,9 +373,8 @@ fn visit_fn(ir: &mut IrMaps,
374373
decl: &FnDecl,
375374
body: &Block,
376375
sp: Span,
377-
id: NodeId) {
378-
debug!("visit_fn: id={}", id);
379-
let _i = ::util::common::indenter();
376+
id: ast::NodeId) {
377+
debug!("visit_fn");
380378

381379
// swap in a new set of IR maps for this function body:
382380
let mut fn_maps = IrMaps::new(ir.tcx);

src/librustc/middle/resolve.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5038,10 +5038,10 @@ impl<'a> Resolver<'a> {
50385038
visit::walk_ty(self, ty);
50395039
}
50405040

5041-
TyPolyTraitRef(ref poly_trait_ref) => {
5042-
self.resolve_poly_trait_reference(
5041+
TyPolyTraitRef(ref bounds) => {
5042+
self.resolve_type_parameter_bounds(
50435043
ty.id,
5044-
&**poly_trait_ref,
5044+
bounds,
50455045
TraitObject);
50465046
visit::walk_ty(self, ty);
50475047
}

0 commit comments

Comments
 (0)