Skip to content

Commit 76d2abe

Browse files
committed
rollup merge of rust-lang#18630 : nikomatsakis/purge-the-bars
2 parents 08ddfc1 + d0fa4c6 commit 76d2abe

Some content is hidden

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

45 files changed

+953
-629
lines changed

src/librustc/diagnostics.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ register_diagnostics!(
5757
E0044,
5858
E0045,
5959
E0046,
60-
E0047,
6160
E0049,
6261
E0050,
6362
E0051,
@@ -111,7 +110,6 @@ register_diagnostics!(
111110
E0108,
112111
E0109,
113112
E0110,
114-
E0113,
115113
E0116,
116114
E0117,
117115
E0118,
@@ -145,5 +143,6 @@ register_diagnostics!(
145143
E0163,
146144
E0164,
147145
E0165,
148-
E0166
146+
E0166,
147+
E0167
149148
)

src/librustc/middle/check_const.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ fn check_expr(v: &mut CheckCrateVisitor, e: &Expr) -> bool {
138138
// to handle on-demand instantiation of functions via
139139
// foo::<bar> in a const. Currently that is only done on
140140
// a path in trans::callee that only works in block contexts.
141-
if !pth.segments.iter().all(|segment| segment.types.is_empty()) {
141+
if !pth.segments.iter().all(|segment| segment.parameters.is_empty()) {
142142
span_err!(v.tcx.sess, e.span, E0013,
143143
"paths in constants may only refer to items without \
144144
type parameters");

src/librustc/middle/pat_util.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use std::collections::HashMap;
1616
use syntax::ast::*;
1717
use syntax::ast_util::{walk_pat};
1818
use syntax::codemap::{Span, DUMMY_SP};
19-
use syntax::owned_slice::OwnedSlice;
2019

2120
pub type PatIdMap = HashMap<Ident, NodeId>;
2221

@@ -133,8 +132,7 @@ pub fn def_to_path(tcx: &ty::ctxt, id: DefId) -> Path {
133132
global: false,
134133
segments: path.last().map(|elem| PathSegment {
135134
identifier: Ident::new(elem.name()),
136-
lifetimes: vec!(),
137-
types: OwnedSlice::empty()
135+
parameters: PathParameters::none(),
138136
}).into_iter().collect(),
139137
span: DUMMY_SP,
140138
})

src/librustc/middle/privacy.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use syntax::ast_map;
2727
use syntax::ast_util::{is_local, local_def, PostExpansionMethod};
2828
use syntax::codemap::Span;
2929
use syntax::parse::token;
30-
use syntax::owned_slice::OwnedSlice;
3130
use syntax::visit;
3231
use syntax::visit::Visitor;
3332

@@ -945,8 +944,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for PrivacyVisitor<'a, 'tcx> {
945944
debug!("privacy - ident item {}", id);
946945
let seg = ast::PathSegment {
947946
identifier: name,
948-
lifetimes: Vec::new(),
949-
types: OwnedSlice::empty(),
947+
parameters: ast::PathParameters::none(),
950948
};
951949
let segs = vec![seg];
952950
let path = ast::Path {

src/librustc/middle/resolve.rs

Lines changed: 5 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ use syntax::ast::{TupleVariantKind, Ty, TyBool, TyChar, TyClosure, TyF32};
4040
use syntax::ast::{TyF64, TyFloat, TyI, TyI8, TyI16, TyI32, TyI64, TyInt};
4141
use syntax::ast::{TyParam, TyParamBound, TyPath, TyPtr, TyProc, TyQPath};
4242
use syntax::ast::{TyRptr, TyStr, TyU, TyU8, TyU16, TyU32, TyU64, TyUint};
43-
use syntax::ast::{TypeImplItem, UnboxedFnTyParamBound, UnnamedField};
43+
use syntax::ast::{TypeImplItem, UnnamedField};
4444
use syntax::ast::{Variant, ViewItem, ViewItemExternCrate};
4545
use syntax::ast::{ViewItemUse, ViewPathGlob, ViewPathList, ViewPathSimple};
4646
use syntax::ast::{Visibility};
@@ -4523,41 +4523,6 @@ impl<'a> Resolver<'a> {
45234523
TraitTyParamBound(ref tref) => {
45244524
self.resolve_trait_reference(id, tref, reference_type)
45254525
}
4526-
UnboxedFnTyParamBound(ref unboxed_function) => {
4527-
match self.resolve_path(unboxed_function.ref_id,
4528-
&unboxed_function.path,
4529-
TypeNS,
4530-
true) {
4531-
None => {
4532-
let path_str = self.path_names_to_string(
4533-
&unboxed_function.path);
4534-
self.resolve_error(unboxed_function.path.span,
4535-
format!("unresolved trait `{}`",
4536-
path_str).as_slice())
4537-
}
4538-
Some(def) => {
4539-
match def {
4540-
(DefTrait(_), _) => {
4541-
self.record_def(unboxed_function.ref_id, def);
4542-
}
4543-
_ => {
4544-
let msg =
4545-
format!("`{}` is not a trait",
4546-
self.path_names_to_string(
4547-
&unboxed_function.path));
4548-
self.resolve_error(unboxed_function.path.span,
4549-
msg.as_slice());
4550-
}
4551-
}
4552-
}
4553-
}
4554-
4555-
for argument in unboxed_function.decl.inputs.iter() {
4556-
self.resolve_type(&*argument.ty);
4557-
}
4558-
4559-
self.resolve_type(&*unboxed_function.decl.output);
4560-
}
45614526
RegionTyParamBound(..) => {}
45624527
}
45634528
}
@@ -4951,12 +4916,12 @@ impl<'a> Resolver<'a> {
49514916

49524917
if path.segments
49534918
.iter()
4954-
.any(|s| !s.lifetimes.is_empty()) {
4919+
.any(|s| s.parameters.has_lifetimes()) {
49554920
span_err!(self.session, path.span, E0157,
49564921
"lifetime parameters are not allowed on this type");
49574922
} else if path.segments
49584923
.iter()
4959-
.any(|s| s.types.len() > 0) {
4924+
.any(|s| !s.parameters.is_empty()) {
49604925
span_err!(self.session, path.span, E0153,
49614926
"type parameters are not allowed on this type");
49624927
}
@@ -5234,7 +5199,7 @@ impl<'a> Resolver<'a> {
52345199
// Check the types in the path pattern.
52355200
for ty in path.segments
52365201
.iter()
5237-
.flat_map(|s| s.types.iter()) {
5202+
.flat_map(|s| s.parameters.types().into_iter()) {
52385203
self.resolve_type(&**ty);
52395204
}
52405205
}
@@ -5340,7 +5305,7 @@ impl<'a> Resolver<'a> {
53405305
namespace: Namespace,
53415306
check_ribs: bool) -> Option<(Def, LastPrivate)> {
53425307
// First, resolve the types.
5343-
for ty in path.segments.iter().flat_map(|s| s.types.iter()) {
5308+
for ty in path.segments.iter().flat_map(|s| s.parameters.types().into_iter()) {
53445309
self.resolve_type(&**ty);
53455310
}
53465311

src/librustc/middle/resolve_lifetime.rs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,6 @@ impl<'a> LifetimeContext<'a> {
204204
ast::TraitTyParamBound(ref trait_ref) => {
205205
self.visit_trait_ref(trait_ref);
206206
}
207-
ast::UnboxedFnTyParamBound(ref fn_decl) => {
208-
self.visit_unboxed_fn_ty_param_bound(&**fn_decl);
209-
}
210207
ast::RegionTyParamBound(ref lifetime) => {
211208
self.visit_lifetime_ref(lifetime);
212209
}
@@ -226,18 +223,6 @@ impl<'a> LifetimeContext<'a> {
226223
})
227224
}
228225

229-
fn visit_unboxed_fn_ty_param_bound(&mut self,
230-
bound: &ast::UnboxedFnBound) {
231-
self.with(|scope, f| {
232-
f(LateScope(bound.ref_id, &bound.lifetimes, scope))
233-
}, |v| {
234-
for argument in bound.decl.inputs.iter() {
235-
v.visit_ty(&*argument.ty);
236-
}
237-
v.visit_ty(&*bound.decl.output);
238-
})
239-
}
240-
241226
/// Visits self by adding a scope and handling recursive walk over the contents with `walk`.
242227
fn visit_fn_decl(&mut self,
243228
n: ast::NodeId,

src/librustc/middle/save/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ impl <'l, 'tcx> DxrVisitor<'l, 'tcx> {
705705
ast::TraitTyParamBound(ref trait_ref) => {
706706
trait_ref
707707
}
708-
ast::UnboxedFnTyParamBound(..) | ast::RegionTyParamBound(..) => {
708+
ast::RegionTyParamBound(..) => {
709709
continue;
710710
}
711711
};

src/librustc/middle/trans/base.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1836,11 +1836,7 @@ pub fn trans_closure(ccx: &CrateContext,
18361836
NotUnboxedClosure => monomorphized_arg_types,
18371837

18381838
// Tuple up closure argument types for the "rust-call" ABI.
1839-
IsUnboxedClosure => vec![if monomorphized_arg_types.is_empty() {
1840-
ty::mk_nil()
1841-
} else {
1842-
ty::mk_tup(ccx.tcx(), monomorphized_arg_types)
1843-
}]
1839+
IsUnboxedClosure => vec![ty::mk_tup_or_nil(ccx.tcx(), monomorphized_arg_types)]
18441840
};
18451841
for monomorphized_arg_type in monomorphized_arg_types.iter() {
18461842
debug!("trans_closure: monomorphized_arg_type: {}",

src/librustc/middle/trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ fn const_expr_unadjusted(cx: &CrateContext, e: &ast::Expr) -> ValueRef {
625625
}
626626
ast::ExprPath(ref pth) => {
627627
// Assert that there are no type parameters in this path.
628-
assert!(pth.segments.iter().all(|seg| seg.types.is_empty()));
628+
assert!(pth.segments.iter().all(|seg| !seg.parameters.has_types()));
629629

630630
let opt_def = cx.tcx().def_map.borrow().find_copy(&e.id);
631631
match opt_def {

src/librustc/middle/ty.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1838,6 +1838,14 @@ pub fn mk_slice(cx: &ctxt, r: Region, tm: mt) -> t {
18381838

18391839
pub fn mk_tup(cx: &ctxt, ts: Vec<t>) -> t { mk_t(cx, ty_tup(ts)) }
18401840

1841+
pub fn mk_tup_or_nil(cx: &ctxt, ts: Vec<t>) -> t {
1842+
if ts.len() == 0 {
1843+
ty::mk_nil()
1844+
} else {
1845+
mk_t(cx, ty_tup(ts))
1846+
}
1847+
}
1848+
18411849
pub fn mk_closure(cx: &ctxt, fty: ClosureTy) -> t {
18421850
mk_t(cx, ty_closure(box fty))
18431851
}

0 commit comments

Comments
 (0)