Skip to content

Commit e6a3d1a

Browse files
committed
---
yaml --- r: 234972 b: refs/heads/stable c: 1659075 h: refs/heads/master v: v3
1 parent 90e4bc3 commit e6a3d1a

Some content is hidden

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

54 files changed

+684
-356
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: 9b6fe6ca368668f3b4950c49546d3d06125b9f01
32+
refs/heads/stable: 1659075b4aa3f9e61e8d9e27f2f00d768effbc8e
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/librustc/diagnostics.rs

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,40 @@ integer type:
360360
http://doc.rust-lang.org/reference.html#ffi-attributes
361361
"##,
362362

363+
E0109: r##"
364+
You tried to give a type parameter to a type which doesn't need it. Erroneous
365+
code example:
366+
367+
```
368+
type X = u32<i32>; // error: type parameters are not allowed on this type
369+
```
370+
371+
Please check that you used the correct type and recheck its definition. Perhaps
372+
it doesn't need the type parameter.
373+
Example:
374+
375+
```
376+
type X = u32; // ok!
377+
```
378+
"##,
379+
380+
E0110: r##"
381+
You tried to give a lifetime parameter to a type which doesn't need it.
382+
Erroneous code example:
383+
384+
```
385+
type X = u32<'static>; // error: lifetime parameters are not allowed on
386+
// this type
387+
```
388+
389+
Please check that you used the correct type and recheck its definition,
390+
perhaps it doesn't need the lifetime parameter. Example:
391+
392+
```
393+
type X = u32; // ok!
394+
```
395+
"##,
396+
363397
E0133: r##"
364398
Using unsafe functionality, such as dereferencing raw pointers and calling
365399
functions via FFI or marked as unsafe, is potentially dangerous and disallowed
@@ -1055,8 +1089,6 @@ register_diagnostics! {
10551089
E0017,
10561090
E0022,
10571091
E0038,
1058-
E0109,
1059-
E0110,
10601092
E0134,
10611093
E0135,
10621094
E0136,

branches/stable/src/librustc/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
#![feature(str_match_indices)]
6262
#![feature(vec_push_all)]
6363
#![feature(wrapping)]
64+
#![feature(cell_extras)]
6465
#![cfg_attr(test, feature(test))]
6566

6667
#![allow(trivial_casts)]

branches/stable/src/librustc/middle/astencode.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,7 +1027,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10271027
})
10281028
}
10291029

1030-
if let Some(item_substs) = tcx.item_substs.borrow().get(&id) {
1030+
if let Some(item_substs) = tcx.tables.borrow().item_substs.get(&id) {
10311031
rbml_w.tag(c::tag_table_item_subst, |rbml_w| {
10321032
rbml_w.id(id);
10331033
rbml_w.emit_substs(ecx, &item_substs.substs);
@@ -1051,7 +1051,12 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10511051
var_id: var_id,
10521052
closure_expr_id: id
10531053
};
1054-
let upvar_capture = tcx.upvar_capture_map.borrow().get(&upvar_id).unwrap().clone();
1054+
let upvar_capture = tcx.tables
1055+
.borrow()
1056+
.upvar_capture_map
1057+
.get(&upvar_id)
1058+
.unwrap()
1059+
.clone();
10551060
var_id.encode(rbml_w);
10561061
upvar_capture.encode(rbml_w);
10571062
})
@@ -1074,19 +1079,19 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
10741079
}
10751080

10761081
let method_call = MethodCall::expr(id);
1077-
if let Some(method) = tcx.method_map.borrow().get(&method_call) {
1082+
if let Some(method) = tcx.tables.borrow().method_map.get(&method_call) {
10781083
rbml_w.tag(c::tag_table_method_map, |rbml_w| {
10791084
rbml_w.id(id);
10801085
encode_method_callee(ecx, rbml_w, method_call.autoderef, method)
10811086
})
10821087
}
10831088

1084-
if let Some(adjustment) = tcx.adjustments.borrow().get(&id) {
1089+
if let Some(adjustment) = tcx.tables.borrow().adjustments.get(&id) {
10851090
match *adjustment {
10861091
ty::AdjustDerefRef(ref adj) => {
10871092
for autoderef in 0..adj.autoderefs {
10881093
let method_call = MethodCall::autoderef(id, autoderef as u32);
1089-
if let Some(method) = tcx.method_map.borrow().get(&method_call) {
1094+
if let Some(method) = tcx.tables.borrow().method_map.get(&method_call) {
10901095
rbml_w.tag(c::tag_table_method_map, |rbml_w| {
10911096
rbml_w.id(id);
10921097
encode_method_callee(ecx, rbml_w,
@@ -1104,14 +1109,14 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
11041109
})
11051110
}
11061111

1107-
if let Some(closure_type) = tcx.closure_tys.borrow().get(&ast_util::local_def(id)) {
1112+
if let Some(closure_type) = tcx.tables.borrow().closure_tys.get(&ast_util::local_def(id)) {
11081113
rbml_w.tag(c::tag_table_closure_tys, |rbml_w| {
11091114
rbml_w.id(id);
11101115
rbml_w.emit_closure_type(ecx, closure_type);
11111116
})
11121117
}
11131118

1114-
if let Some(closure_kind) = tcx.closure_kinds.borrow().get(&ast_util::local_def(id)) {
1119+
if let Some(closure_kind) = tcx.tables.borrow().closure_kinds.get(&ast_util::local_def(id)) {
11151120
rbml_w.tag(c::tag_table_closure_kinds, |rbml_w| {
11161121
rbml_w.id(id);
11171122
encode_closure_kind(rbml_w, *closure_kind)
@@ -1630,7 +1635,7 @@ fn decode_side_tables(dcx: &DecodeContext,
16301635
let item_substs = ty::ItemSubsts {
16311636
substs: val_dsr.read_substs(dcx)
16321637
};
1633-
dcx.tcx.item_substs.borrow_mut().insert(
1638+
dcx.tcx.tables.borrow_mut().item_substs.insert(
16341639
id, item_substs);
16351640
}
16361641
c::tag_table_freevars => {
@@ -1646,7 +1651,7 @@ fn decode_side_tables(dcx: &DecodeContext,
16461651
closure_expr_id: id
16471652
};
16481653
let ub: ty::UpvarCapture = Decodable::decode(val_dsr).unwrap();
1649-
dcx.tcx.upvar_capture_map.borrow_mut().insert(upvar_id, ub.tr(dcx));
1654+
dcx.tcx.tables.borrow_mut().upvar_capture_map.insert(upvar_id, ub.tr(dcx));
16501655
}
16511656
c::tag_table_tcache => {
16521657
let type_scheme = val_dsr.read_type_scheme(dcx);
@@ -1663,22 +1668,22 @@ fn decode_side_tables(dcx: &DecodeContext,
16631668
expr_id: id,
16641669
autoderef: autoderef
16651670
};
1666-
dcx.tcx.method_map.borrow_mut().insert(method_call, method);
1671+
dcx.tcx.tables.borrow_mut().method_map.insert(method_call, method);
16671672
}
16681673
c::tag_table_adjustments => {
16691674
let adj: ty::AutoAdjustment = val_dsr.read_auto_adjustment(dcx);
1670-
dcx.tcx.adjustments.borrow_mut().insert(id, adj);
1675+
dcx.tcx.tables.borrow_mut().adjustments.insert(id, adj);
16711676
}
16721677
c::tag_table_closure_tys => {
16731678
let closure_ty =
16741679
val_dsr.read_closure_ty(dcx);
1675-
dcx.tcx.closure_tys.borrow_mut().insert(ast_util::local_def(id),
1680+
dcx.tcx.tables.borrow_mut().closure_tys.insert(ast_util::local_def(id),
16761681
closure_ty);
16771682
}
16781683
c::tag_table_closure_kinds => {
16791684
let closure_kind =
16801685
val_dsr.read_closure_kind(dcx);
1681-
dcx.tcx.closure_kinds.borrow_mut().insert(ast_util::local_def(id),
1686+
dcx.tcx.tables.borrow_mut().closure_kinds.insert(ast_util::local_def(id),
16821687
closure_kind);
16831688
}
16841689
c::tag_table_cast_kinds => {

branches/stable/src/librustc/middle/cfg/construct.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
411411
func_or_rcvr: &ast::Expr,
412412
args: I) -> CFGIndex {
413413
let method_call = ty::MethodCall::expr(call_expr.id);
414-
let fn_ty = match self.tcx.method_map.borrow().get(&method_call) {
414+
let fn_ty = match self.tcx.tables.borrow().method_map.get(&method_call) {
415415
Some(method) => method.ty,
416416
None => self.tcx.expr_ty_adjusted(func_or_rcvr)
417417
};
@@ -634,6 +634,6 @@ impl<'a, 'tcx> CFGBuilder<'a, 'tcx> {
634634

635635
fn is_method_call(&self, expr: &ast::Expr) -> bool {
636636
let method_call = ty::MethodCall::expr(expr.id);
637-
self.tcx.method_map.borrow().contains_key(&method_call)
637+
self.tcx.tables.borrow().method_map.contains_key(&method_call)
638638
}
639639
}

branches/stable/src/librustc/middle/check_const.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,11 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> {
283283

284284
fn check_static_type(&self, e: &ast::Expr) {
285285
let ty = self.tcx.node_id_to_type(e.id);
286-
let infcx = infer::new_infer_ctxt(self.tcx);
286+
let infcx = infer::new_infer_ctxt(self.tcx, &self.tcx.tables, None);
287287
let mut fulfill_cx = traits::FulfillmentContext::new(false);
288288
let cause = traits::ObligationCause::new(e.span, e.id, traits::SharedStatic);
289289
fulfill_cx.register_builtin_bound(&infcx, ty, ty::BoundSync, cause);
290-
let env = self.tcx.empty_parameter_environment();
291-
match fulfill_cx.select_all_or_error(&infcx, &env) {
290+
match fulfill_cx.select_all_or_error(&infcx, &infcx.parameter_environment) {
292291
Ok(()) => { },
293292
Err(ref errors) => {
294293
traits::report_fulfillment_errors(&infcx, errors);
@@ -544,7 +543,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
544543
match e.node {
545544
ast::ExprUnary(..) |
546545
ast::ExprBinary(..) |
547-
ast::ExprIndex(..) if v.tcx.method_map.borrow().contains_key(&method_call) => {
546+
ast::ExprIndex(..) if v.tcx.tables.borrow().method_map.contains_key(&method_call) => {
548547
v.add_qualif(ConstQualif::NOT_CONST);
549548
if v.mode != Mode::Var {
550549
span_err!(v.tcx.sess, e.span, E0011,
@@ -695,7 +694,7 @@ fn check_expr<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>,
695694
}
696695
}
697696
ast::ExprMethodCall(..) => {
698-
let method_did = match v.tcx.method_map.borrow()[&method_call].origin {
697+
let method_did = match v.tcx.tables.borrow().method_map[&method_call].origin {
699698
ty::MethodStatic(did) => Some(did),
700699
_ => None
701700
};

branches/stable/src/librustc/middle/check_match.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ impl<'a> FromIterator<Vec<&'a Pat>> for Matrix<'a> {
9898
}
9999
}
100100

101+
//NOTE: appears to be the only place other then InferCtxt to contain a ParamEnv
101102
pub struct MatchCheckCtxt<'a, 'tcx: 'a> {
102103
pub tcx: &'a ty::ctxt<'tcx>,
103104
pub param_env: ParameterEnvironment<'a, 'tcx>,

branches/stable/src/librustc/middle/const_eval.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,10 +1031,9 @@ fn resolve_trait_associated_const<'a, 'tcx: 'a>(tcx: &'a ty::ctxt<'tcx>,
10311031
substs: trait_substs });
10321032

10331033
tcx.populate_implementations_for_trait_if_necessary(trait_ref.def_id());
1034-
let infcx = infer::new_infer_ctxt(tcx);
1034+
let infcx = infer::new_infer_ctxt(tcx, &tcx.tables, None);
10351035

1036-
let param_env = tcx.empty_parameter_environment();
1037-
let mut selcx = traits::SelectionContext::new(&infcx, &param_env);
1036+
let mut selcx = traits::SelectionContext::new(&infcx, &infcx.parameter_environment);
10381037
let obligation = traits::Obligation::new(traits::ObligationCause::dummy(),
10391038
trait_ref.to_poly_trait_predicate());
10401039
let selection = match selcx.select(&obligation) {

branches/stable/src/librustc/middle/dead.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ impl<'a, 'tcx> MarkSymbolVisitor<'a, 'tcx> {
9696
fn lookup_and_handle_method(&mut self, id: ast::NodeId,
9797
span: codemap::Span) {
9898
let method_call = ty::MethodCall::expr(id);
99-
match self.tcx.method_map.borrow().get(&method_call) {
99+
match self.tcx.tables.borrow().method_map.get(&method_call) {
100100
Some(method) => {
101101
match method.origin {
102102
ty::MethodStatic(def_id) => {

branches/stable/src/librustc/middle/effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<'a, 'tcx, 'v> Visitor<'v> for EffectCheckVisitor<'a, 'tcx> {
140140
match expr.node {
141141
ast::ExprMethodCall(_, _, _) => {
142142
let method_call = MethodCall::expr(expr.id);
143-
let base_type = self.tcx.method_map.borrow().get(&method_call).unwrap().ty;
143+
let base_type = self.tcx.tables.borrow().method_map.get(&method_call).unwrap().ty;
144144
debug!("effect: method call case, base type is {:?}",
145145
base_type);
146146
if type_is_unsafe_function(base_type) {

branches/stable/src/librustc/middle/expr_use_visitor.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,9 @@ impl OverloadedCallType {
257257
fn from_closure(tcx: &ty::ctxt, closure_did: ast::DefId)
258258
-> OverloadedCallType {
259259
let trait_did =
260-
tcx.closure_kinds
260+
tcx.tables
261261
.borrow()
262+
.closure_kinds
262263
.get(&closure_did)
263264
.expect("OverloadedCallType::from_closure: didn't find closure id")
264265
.trait_did(tcx);
@@ -787,8 +788,10 @@ impl<'d,'t,'tcx,TYPER:mc::Typer<'tcx>> ExprUseVisitor<'d,'t,'tcx,TYPER> {
787788
// process.
788789
fn walk_adjustment(&mut self, expr: &ast::Expr) {
789790
let typer = self.typer;
790-
if let Some(adjustment) = typer.adjustments().borrow().get(&expr.id) {
791-
match *adjustment {
791+
//NOTE(@jroesch): mixed RefCell borrow causes crash
792+
let adj = typer.adjustments().get(&expr.id).map(|x| x.clone());
793+
if let Some(adjustment) = adj {
794+
match adjustment {
792795
ty::AdjustReifyFnPointer |
793796
ty::AdjustUnsafeFnPointer => {
794797
// Creating a closure/fn-pointer or unsizing consumes

0 commit comments

Comments
 (0)