Skip to content

Commit fc3a4e3

Browse files
committed
---
yaml --- r: 234702 b: refs/heads/tmp c: 655b2ef h: refs/heads/master v: v3
1 parent f12d3d7 commit fc3a4e3

File tree

40 files changed

+299
-204
lines changed

40 files changed

+299
-204
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
2626
refs/heads/beta: d2e13e822a73e0ea46ae9e21afdd3155fc997f6d
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
28-
refs/heads/tmp: 913fe6dbe9425330027b7d75ba16be47d7280d66
28+
refs/heads/tmp: 655b2ef45fb87925fcdd4ceb44eb36e0c62dad24
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: ab792abf1fcc28afbd315426213f6428da25c085
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828

branches/tmp/RELEASES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Version 1.3.0 (September 2015)
1+
Version 1.3.0 (2015-09-17)
22
==============================
33

44
* ~900 changes, numerous bugfixes

branches/tmp/src/doc/reference.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,11 +1178,22 @@ let px: i32 = match p { Point(x, _) => x };
11781178
```
11791179

11801180
A _unit-like struct_ is a structure without any fields, defined by leaving off
1181-
the list of fields entirely. Such types will have a single value. For example:
1181+
the list of fields entirely. Such a structure implicitly defines a constant of
1182+
its type with the same name. For example:
11821183

11831184
```
1185+
# #![feature(braced_empty_structs)]
11841186
struct Cookie;
1185-
let c = [Cookie, Cookie, Cookie, Cookie];
1187+
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
1188+
```
1189+
1190+
is equivalent to
1191+
1192+
```
1193+
# #![feature(braced_empty_structs)]
1194+
struct Cookie {}
1195+
const Cookie: Cookie = Cookie {};
1196+
let c = [Cookie, Cookie {}, Cookie, Cookie {}];
11861197
```
11871198

11881199
The precise memory layout of a structure is not specified. One can specify a
@@ -2411,6 +2422,7 @@ The currently implemented features of the reference compiler are:
24112422
terms of encapsulation).
24122423
* - `default_type_parameter_fallback` - Allows type parameter defaults to
24132424
influence type inference.
2425+
* - `braced_empty_structs` - Allows use of empty structs with braces.
24142426

24152427
If a feature is promoted to a language feature, then all existing programs will
24162428
start to receive compilation warnings about `#![feature]` directives which enabled

branches/tmp/src/doc/trpl/error-handling.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ thread '<main>' panicked at 'Invalid number: 11', src/bin/panic-simple.rs:5
8787
Here's another example that is slightly less contrived. A program that accepts
8888
an integer as an argument, doubles it and prints it.
8989

90-
<a name="code-unwrap-double"/>
90+
<div id="code-unwrap-double">
9191
```rust,should_panic
9292
9393
use std::env;
@@ -99,6 +99,7 @@ fn main() {
9999
println!("{}", 2 * n);
100100
}
101101
```
102+
</div>
102103

103104
If you give this program zero arguments (error 1) or if the first argument
104105
isn't an integer (error 2), the program will panic just like in the first
@@ -139,7 +140,7 @@ system is an important concept because it will cause the compiler to force the
139140
programmer to handle that absence. Let's take a look at an example that tries
140141
to find a character in a string:
141142

142-
<a name="code-option-ex-string-find"/>
143+
<div id="code-option-ex-string-find">
143144
```rust
144145
// Searches `haystack` for the Unicode character `needle`. If one is found, the
145146
// byte offset of the character is returned. Otherwise, `None` is returned.
@@ -152,6 +153,7 @@ fn find(haystack: &str, needle: char) -> Option<usize> {
152153
None
153154
}
154155
```
156+
</div>
155157

156158
Notice that when this function finds a matching character, it doen't just
157159
return the `offset`. Instead, it returns `Some(offset)`. `Some` is a variant or

branches/tmp/src/librustc_front/fold.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ pub fn noop_fold_foreign_mod<T: Folder>(ForeignMod {abi, items}: ForeignMod,
415415
}
416416

417417
pub fn noop_fold_variant<T: Folder>(v: P<Variant>, fld: &mut T) -> P<Variant> {
418-
v.map(|Spanned {node: Variant_ {id, name, attrs, kind, disr_expr, vis}, span}| Spanned {
418+
v.map(|Spanned {node: Variant_ {id, name, attrs, kind, disr_expr}, span}| Spanned {
419419
node: Variant_ {
420420
id: fld.new_id(id),
421421
name: name,
@@ -430,7 +430,6 @@ pub fn noop_fold_variant<T: Folder>(v: P<Variant>, fld: &mut T) -> P<Variant> {
430430
}
431431
},
432432
disr_expr: disr_expr.map(|e| fld.fold_expr(e)),
433-
vis: vis,
434433
},
435434
span: fld.new_span(span),
436435
})

branches/tmp/src/librustc_front/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,6 @@ pub struct Variant_ {
10521052
pub id: NodeId,
10531053
/// Explicit discriminant, eg `Foo = 1`
10541054
pub disr_expr: Option<P<Expr>>,
1055-
pub vis: Visibility,
10561055
}
10571056

10581057
pub type Variant = Spanned<Variant_>;

branches/tmp/src/librustc_front/lowering.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,6 @@ pub fn lower_variant(v: &Variant) -> P<hir::Variant> {
147147
}
148148
},
149149
disr_expr: v.node.disr_expr.as_ref().map(|e| lower_expr(e)),
150-
vis: lower_visibility(v.node.vis),
151150
},
152151
span: v.span,
153152
})

branches/tmp/src/librustc_front/print/pprust.rs

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -944,7 +944,6 @@ impl<'a> State<'a> {
944944
}
945945

946946
pub fn print_variant(&mut self, v: &hir::Variant) -> io::Result<()> {
947-
try!(self.print_visibility(v.node.vis));
948947
match v.node.kind {
949948
hir::TupleVariantKind(ref args) => {
950949
try!(self.print_ident(v.node.name));
@@ -1218,34 +1217,34 @@ impl<'a> State<'a> {
12181217
fields: &[hir::Field],
12191218
wth: &Option<P<hir::Expr>>) -> io::Result<()> {
12201219
try!(self.print_path(path, true, 0));
1221-
if !(fields.is_empty() && wth.is_none()) {
1222-
try!(word(&mut self.s, "{"));
1223-
try!(self.commasep_cmnt(
1224-
Consistent,
1225-
&fields[..],
1226-
|s, field| {
1227-
try!(s.ibox(indent_unit));
1228-
try!(s.print_ident(field.ident.node));
1229-
try!(s.word_space(":"));
1230-
try!(s.print_expr(&*field.expr));
1231-
s.end()
1232-
},
1233-
|f| f.span));
1234-
match *wth {
1235-
Some(ref expr) => {
1236-
try!(self.ibox(indent_unit));
1237-
if !fields.is_empty() {
1238-
try!(word(&mut self.s, ","));
1239-
try!(space(&mut self.s));
1240-
}
1241-
try!(word(&mut self.s, ".."));
1242-
try!(self.print_expr(&**expr));
1243-
try!(self.end());
1220+
try!(word(&mut self.s, "{"));
1221+
try!(self.commasep_cmnt(
1222+
Consistent,
1223+
&fields[..],
1224+
|s, field| {
1225+
try!(s.ibox(indent_unit));
1226+
try!(s.print_ident(field.ident.node));
1227+
try!(s.word_space(":"));
1228+
try!(s.print_expr(&*field.expr));
1229+
s.end()
1230+
},
1231+
|f| f.span));
1232+
match *wth {
1233+
Some(ref expr) => {
1234+
try!(self.ibox(indent_unit));
1235+
if !fields.is_empty() {
1236+
try!(word(&mut self.s, ","));
1237+
try!(space(&mut self.s));
12441238
}
1245-
_ => try!(word(&mut self.s, ",")),
1239+
try!(word(&mut self.s, ".."));
1240+
try!(self.print_expr(&**expr));
1241+
try!(self.end());
1242+
}
1243+
_ => if !fields.is_empty() {
1244+
try!(word(&mut self.s, ","))
12461245
}
1247-
try!(word(&mut self.s, "}"));
12481246
}
1247+
try!(word(&mut self.s, "}"));
12491248
Ok(())
12501249
}
12511250

branches/tmp/src/librustc_lint/builtin.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ use std::{i8, i16, i32, i64, u8, u16, u32, u64, f32, f64};
4949
use syntax::{abi, ast};
5050
use syntax::attr::{self, AttrMetaMethods};
5151
use syntax::codemap::{self, Span};
52-
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType};
52+
use syntax::feature_gate::{KNOWN_ATTRIBUTES, AttributeType, emit_feature_err, GateIssue};
5353
use syntax::ast::{TyIs, TyUs, TyI8, TyU8, TyI16, TyU16, TyI32, TyU32, TyI64, TyU64};
5454
use syntax::ptr::P;
5555

@@ -381,13 +381,12 @@ impl LateLintPass for TypeLimits {
381381

382382
fn check_unsigned_negation_feature(cx: &LateContext, span: Span) {
383383
if !cx.sess().features.borrow().negate_unsigned {
384-
// FIXME(#27141): change this to syntax::feature_gate::emit_feature_err…
385-
cx.sess().span_warn(span,
386-
"unary negation of unsigned integers will be feature gated in the future");
387-
// …and remove following two expressions.
388-
if option_env!("CFG_DISABLE_UNSTABLE_FEATURES").is_some() { return; }
389-
cx.sess().fileline_help(span, "add #![feature(negate_unsigned)] to the \
390-
crate attributes to enable the gate in advance");
384+
emit_feature_err(
385+
&cx.sess().parse_sess.span_diagnostic,
386+
"negate_unsigned",
387+
span,
388+
GateIssue::Language,
389+
"unary negation of unsigned integers may be removed in the future");
391390
}
392391
}
393392
}

branches/tmp/src/librustc_privacy/lib.rs

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,20 +1075,7 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
10751075
instead");
10761076
}
10771077

1078-
hir::ItemEnum(ref def, _) => {
1079-
for v in &def.variants {
1080-
match v.node.vis {
1081-
hir::Public => {
1082-
if item.vis == hir::Public {
1083-
span_err!(tcx.sess, v.span, E0448,
1084-
"unnecessary `pub` visibility");
1085-
}
1086-
}
1087-
hir::Inherited => {}
1088-
}
1089-
}
1090-
}
1091-
1078+
hir::ItemEnum(..) |
10921079
hir::ItemTrait(..) | hir::ItemDefaultImpl(..) |
10931080
hir::ItemConst(..) | hir::ItemStatic(..) | hir::ItemStruct(..) |
10941081
hir::ItemFn(..) | hir::ItemMod(..) | hir::ItemTy(..) |
@@ -1131,14 +1118,10 @@ impl<'a, 'tcx> SanePrivacyVisitor<'a, 'tcx> {
11311118
check_inherited(tcx, i.span, i.vis);
11321119
}
11331120
}
1134-
hir::ItemEnum(ref def, _) => {
1135-
for v in &def.variants {
1136-
check_inherited(tcx, v.span, v.node.vis);
1137-
}
1138-
}
11391121

11401122
hir::ItemStruct(ref def, _) => check_struct(&**def),
11411123

1124+
hir::ItemEnum(..) |
11421125
hir::ItemExternCrate(_) | hir::ItemUse(_) |
11431126
hir::ItemTrait(..) | hir::ItemDefaultImpl(..) |
11441127
hir::ItemStatic(..) | hir::ItemConst(..) |

branches/tmp/src/librustc_trans/save/dump_csv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ impl<'l, 'tcx, 'v> Visitor<'v> for DumpCsvVisitor<'l, 'tcx> {
10971097

10981098
self.visit_expr(&**sub_ex);
10991099

1100-
let hir_node = self.tcx.map.expect_expr(sub_ex.id);
1100+
let hir_node = lower_expr(sub_ex);
11011101
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
11021102
match *ty {
11031103
ty::TyStruct(def, _) => {

branches/tmp/src/librustc_trans/save/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ use std::path::{Path, PathBuf};
1818

1919
use rustc_front;
2020
use rustc::front::map::NodeItem;
21-
use rustc_front::hir;
21+
use rustc_front::{hir, lowering};
2222

2323
use syntax::attr;
2424
use syntax::ast::{self, NodeId};
@@ -442,7 +442,7 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
442442
pub fn get_expr_data(&self, expr: &ast::Expr) -> Option<Data> {
443443
match expr.node {
444444
ast::ExprField(ref sub_ex, ident) => {
445-
let hir_node = self.tcx.map.expect_expr(sub_ex.id);
445+
let hir_node = lowering::lower_expr(sub_ex);
446446
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
447447
match *ty {
448448
ty::TyStruct(def, _) => {
@@ -462,8 +462,8 @@ impl<'l, 'tcx: 'l> SaveContext<'l, 'tcx> {
462462
}
463463
}
464464
ast::ExprStruct(ref path, _, _) => {
465-
let hir_node = self.tcx.map.expect_expr(expr.id);
466-
let ty = &self.tcx.expr_ty_adjusted(hir_node).sty;
465+
let hir_node = lowering::lower_expr(expr);
466+
let ty = &self.tcx.expr_ty_adjusted(&hir_node).sty;
467467
match *ty {
468468
ty::TyStruct(def, _) => {
469469
let sub_span = self.span_utils.span_for_last_ident(path.span);

branches/tmp/src/librustc_trans/trans/expr.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ pub fn trans_into<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
119119

120120
debuginfo::set_source_location(bcx.fcx, expr.id, expr.span);
121121

122-
if bcx.tcx().tables.borrow().adjustments.contains_key(&expr.id) {
122+
if adjustment_required(bcx, expr) {
123123
// use trans, which may be less efficient but
124124
// which will perform the adjustments:
125125
let datum = unpack_datum!(bcx, trans(bcx, expr));
@@ -334,6 +334,37 @@ pub fn unsized_info<'ccx, 'tcx>(ccx: &CrateContext<'ccx, 'tcx>,
334334
}
335335
}
336336

337+
fn adjustment_required<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,
338+
expr: &hir::Expr) -> bool {
339+
let adjustment = match bcx.tcx().tables.borrow().adjustments.get(&expr.id).cloned() {
340+
None => { return false; }
341+
Some(adj) => adj
342+
};
343+
344+
// Don't skip a conversion from Box<T> to &T, etc.
345+
if bcx.tcx().is_overloaded_autoderef(expr.id, 0) {
346+
return true;
347+
}
348+
349+
match adjustment {
350+
AdjustReifyFnPointer => {
351+
// FIXME(#19925) once fn item types are
352+
// zero-sized, we'll need to return true here
353+
false
354+
}
355+
AdjustUnsafeFnPointer => {
356+
// purely a type-level thing
357+
false
358+
}
359+
AdjustDerefRef(ref adj) => {
360+
// We are a bit paranoid about adjustments and thus might have a re-
361+
// borrow here which merely derefs and then refs again (it might have
362+
// a different region or mutability, but we don't care here).
363+
!(adj.autoderefs == 1 && adj.autoref.is_some() && adj.unsize.is_none())
364+
}
365+
}
366+
}
367+
337368
/// Helper for trans that apply adjustments from `expr` to `datum`, which should be the unadjusted
338369
/// translation of `expr`.
339370
fn apply_adjustments<'blk, 'tcx>(bcx: Block<'blk, 'tcx>,

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,14 +1473,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14731473
_ => return None
14741474
};
14751475

1476-
if let ty::VariantKind::Dict = variant.kind() {
1476+
let var_kind = variant.kind();
1477+
if var_kind == ty::VariantKind::Dict || var_kind == ty::VariantKind::Unit {
14771478
Some((adt, variant))
14781479
} else {
14791480
None
14801481
}
14811482
}
14821483

1483-
14841484
pub fn write_nil(&self, node_id: ast::NodeId) {
14851485
self.write_ty(node_id, self.tcx().mk_nil());
14861486
}

branches/tmp/src/librustdoc/clean/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1850,7 +1850,7 @@ impl Clean<Item> for doctree::Variant {
18501850
name: Some(self.name.clean(cx)),
18511851
attrs: self.attrs.clean(cx),
18521852
source: self.whence.clean(cx),
1853-
visibility: self.vis.clean(cx),
1853+
visibility: None,
18541854
stability: self.stab.clean(cx),
18551855
def_id: DefId::local(self.id),
18561856
inner: VariantItem(Variant {

branches/tmp/src/librustdoc/doctree.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,6 @@ pub struct Variant {
121121
pub attrs: Vec<ast::Attribute>,
122122
pub kind: hir::VariantKind,
123123
pub id: ast::NodeId,
124-
pub vis: hir::Visibility,
125124
pub stab: Option<attr::Stability>,
126125
pub whence: Span,
127126
}

branches/tmp/src/librustdoc/visit_ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
109109
variants: def.variants.iter().map(|v| Variant {
110110
name: v.node.name,
111111
attrs: v.node.attrs.clone(),
112-
vis: v.node.vis,
113112
stab: self.stability(v.node.id),
114113
id: v.node.id,
115114
kind: v.node.kind.clone(),

branches/tmp/src/libsyntax/ast.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,6 @@ pub struct Variant_ {
16141614
pub id: NodeId,
16151615
/// Explicit discriminant, eg `Foo = 1`
16161616
pub disr_expr: Option<P<Expr>>,
1617-
pub vis: Visibility,
16181617
}
16191618

16201619
pub type Variant = Spanned<Variant_>;

0 commit comments

Comments
 (0)