Skip to content

Commit 9d78c47

Browse files
committed
---
yaml --- r: 118057 b: refs/heads/try c: 0935beb h: refs/heads/master i: 118055: 3e5121d v: v3
1 parent d8a393a commit 9d78c47

File tree

23 files changed

+58
-48
lines changed

23 files changed

+58
-48
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3770c42a4959cbabc73da52abc7e3db96657974e
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: d6736a1440d42f6af967a8a20ab8d73522112b72
5-
refs/heads/try: eea329b0f71905518902d34ef77c0923096dde1d
5+
refs/heads/try: 0935beba717bf6d3b54ad1b2eace359dea5dfca0
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c

branches/try/src/doc/rust.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1036,6 +1036,7 @@ Unsafe operations are those that potentially violate the memory-safety guarantee
10361036
The following language level features cannot be used in the safe subset of Rust:
10371037

10381038
- Dereferencing a [raw pointer](#pointer-types).
1039+
- Reading or writing a [mutable static variable](#mutable-statics).
10391040
- Calling an unsafe function (including an intrinsic or foreign function).
10401041

10411042
##### Unsafe functions

branches/try/src/liballoc/arc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ impl<T: Send + Share + Clone> Arc<T> {
160160
// reference count is guaranteed to be 1 at this point, and we required
161161
// the Arc itself to be `mut`, so we're returning the only possible
162162
// reference to the inner data.
163-
unsafe { mem::transmute::<&_, &mut _>(self.deref()) }
163+
let inner = unsafe { &mut *self._ptr };
164+
&mut inner.data
164165
}
165166
}
166167

branches/try/src/libcore/cmp.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
//! assert!(SketchyNum {num: 25} != SketchyNum {num: 57});
3838
//! ```
3939
40+
pub use PartialEq = cmp::Eq;
41+
pub use PartialOrd = cmp::Ord;
42+
4043
/// Trait for values that can be compared for equality and inequality.
4144
///
4245
/// This trait allows partial equality, where types can be unordered instead of

branches/try/src/libnative/io/file_win32.rs

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,25 @@ impl FileDesc {
9090
pub fn handle(&self) -> libc::HANDLE {
9191
unsafe { libc::get_osfhandle(self.fd()) as libc::HANDLE }
9292
}
93+
94+
// A version of seek that takes &self so that tell can call it
95+
// - the private seek should of course take &mut self.
96+
fn seek_common(&self, pos: i64, style: io::SeekStyle) -> Result<u64, IoError> {
97+
let whence = match style {
98+
io::SeekSet => libc::FILE_BEGIN,
99+
io::SeekEnd => libc::FILE_END,
100+
io::SeekCur => libc::FILE_CURRENT,
101+
};
102+
unsafe {
103+
let mut newpos = 0;
104+
match libc::SetFilePointerEx(self.handle(), pos, &mut newpos,
105+
whence) {
106+
0 => Err(super::last_error()),
107+
_ => Ok(newpos as u64),
108+
}
109+
}
110+
}
111+
93112
}
94113

95114
impl io::Reader for FileDesc {
@@ -151,26 +170,13 @@ impl rtio::RtioFileStream for FileDesc {
151170
}
152171
Ok(())
153172
}
173+
154174
fn seek(&mut self, pos: i64, style: io::SeekStyle) -> Result<u64, IoError> {
155-
let whence = match style {
156-
io::SeekSet => libc::FILE_BEGIN,
157-
io::SeekEnd => libc::FILE_END,
158-
io::SeekCur => libc::FILE_CURRENT,
159-
};
160-
unsafe {
161-
let mut newpos = 0;
162-
match libc::SetFilePointerEx(self.handle(), pos, &mut newpos,
163-
whence) {
164-
0 => Err(super::last_error()),
165-
_ => Ok(newpos as u64),
166-
}
167-
}
175+
self.seek_common(pos, style)
168176
}
177+
169178
fn tell(&self) -> Result<u64, IoError> {
170-
// This transmute is fine because our seek implementation doesn't
171-
// actually use the mutable self at all.
172-
// FIXME #13933: Remove/justify all `&T` to `&mut T` transmutes
173-
unsafe { mem::transmute::<&_, &mut FileDesc>(self).seek(0, io::SeekCur) }
179+
self.seek_common(0, io::SeekCur)
174180
}
175181

176182
fn fsync(&mut self) -> Result<(), IoError> {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'a> CFGBuilder<'a> {
113113
self.add_node(pat.id, [pred])
114114
}
115115

116-
ast::PatUniq(subpat) |
116+
ast::PatBox(subpat) |
117117
ast::PatRegion(subpat) |
118118
ast::PatIdent(_, _, Some(subpat)) => {
119119
let subpat_exit = self.pat(subpat, pred);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ fn pat_ctor_id(cx: &MatchCheckCtxt, p: @Pat) -> Option<ctor> {
383383
_ => Some(single)
384384
}
385385
}
386-
PatUniq(_) | PatTup(_) | PatRegion(..) => {
386+
PatBox(_) | PatTup(_) | PatRegion(..) => {
387387
Some(single)
388388
}
389389
PatVec(ref before, slice, ref after) => {
@@ -764,7 +764,7 @@ fn specialize(cx: &MatchCheckCtxt,
764764
PatTup(args) => {
765765
Some(args.iter().map(|x| *x).collect::<Vec<_>>().append(r.tail()))
766766
}
767-
PatUniq(a) | PatRegion(a) => {
767+
PatBox(a) | PatRegion(a) => {
768768
Some((vec!(a)).append(r.tail()))
769769
}
770770
PatLit(expr) => {
@@ -924,7 +924,7 @@ fn find_refutable(cx: &MatchCheckCtxt, pat: &Pat, spans: &mut Vec<Span>) {
924924
}
925925

926926
match pat.node {
927-
PatUniq(sub) | PatRegion(sub) | PatIdent(_, _, Some(sub)) => {
927+
PatBox(sub) | PatRegion(sub) | PatIdent(_, _, Some(sub)) => {
928928
find_refutable(cx, sub, spans)
929929
}
930930
PatWild | PatWildMulti | PatIdent(_, _, None) => {}

branches/try/src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ impl<'t,TYPER:Typer> MemCategorizationContext<'t,TYPER> {
10641064
}
10651065
}
10661066

1067-
ast::PatUniq(subpat) | ast::PatRegion(subpat) => {
1067+
ast::PatBox(subpat) | ast::PatRegion(subpat) => {
10681068
// @p1, ~p1
10691069
let subcmt = self.cat_deref(pat, cmt, 0);
10701070
if_ok!(self.cat_pattern(subcmt, subpat, op));

branches/try/src/librustc/middle/region.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ fn resolve_local(visitor: &mut RegionResolutionVisitor,
671671
subpats.iter().any(|&p| is_binding_pat(p))
672672
}
673673

674-
ast::PatUniq(subpat) => {
674+
ast::PatBox(subpat) => {
675675
is_binding_pat(subpat)
676676
}
677677

branches/try/src/librustc/middle/trans/_match.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ fn enter_uniq<'a, 'b>(
838838
let dummy = @ast::Pat {id: 0, node: ast::PatWild, span: DUMMY_SP};
839839
enter_match(bcx, dm, m, col, val, |p| {
840840
match p.node {
841-
ast::PatUniq(sub) => {
841+
ast::PatBox(sub) => {
842842
Some(vec!(sub))
843843
}
844844
_ => {
@@ -1105,7 +1105,7 @@ macro_rules! any_pat (
11051105
)
11061106

11071107
fn any_uniq_pat(m: &[Match], col: uint) -> bool {
1108-
any_pat!(m, ast::PatUniq(_))
1108+
any_pat!(m, ast::PatBox(_))
11091109
}
11101110

11111111
fn any_region_pat(m: &[Match], col: uint) -> bool {
@@ -2270,7 +2270,7 @@ fn bind_irrefutable_pat<'a>(
22702270
binding_mode, cleanup_scope);
22712271
}
22722272
}
2273-
ast::PatUniq(inner) => {
2273+
ast::PatBox(inner) => {
22742274
let llbox = Load(bcx, val);
22752275
bcx = bind_irrefutable_pat(bcx, inner, llbox, binding_mode, cleanup_scope);
22762276
}

branches/try/src/librustc/middle/trans/debuginfo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2752,7 +2752,7 @@ fn populate_scope_map(cx: &CrateContext,
27522752
}
27532753
}
27542754

2755-
ast::PatUniq(sub_pat) | ast::PatRegion(sub_pat) => {
2755+
ast::PatBox(sub_pat) | ast::PatRegion(sub_pat) => {
27562756
scope_map.insert(pat.id, scope_stack.last().unwrap().scope_metadata);
27572757
walk_pattern(cx, sub_pat, scope_stack, scope_map);
27582758
}

branches/try/src/librustc/middle/typeck/check/_match.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ pub fn check_pat(pcx: &pat_ctxt, pat: &ast::Pat, expected: ty::t) {
626626
}
627627
}
628628
}
629-
ast::PatUniq(inner) => {
629+
ast::PatBox(inner) => {
630630
check_pointer_pat(pcx, Send, inner, pat.id, pat.span, expected);
631631
}
632632
ast::PatRegion(inner) => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ fn name_from_pat(p: &ast::Pat) -> String {
17211721
PatStruct(..) => fail!("tried to get argument name from pat_struct, \
17221722
which is not allowed in function arguments"),
17231723
PatTup(..) => "(tuple arg NYI)".to_string(),
1724-
PatUniq(p) => name_from_pat(p),
1724+
PatBox(p) => name_from_pat(p),
17251725
PatRegion(p) => name_from_pat(p),
17261726
PatLit(..) => {
17271727
warn!("tried to get argument name from PatLit, \

branches/try/src/librustuv/file.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ impl FileWatcher {
377377
let r = FsRequest::write(&self.loop_, self.fd, buf, offset);
378378
r.map_err(uv_error_to_io_error)
379379
}
380-
fn seek_common(&mut self, pos: i64, whence: c_int) ->
380+
fn seek_common(&self, pos: i64, whence: c_int) ->
381381
Result<u64, IoError>{
382382
unsafe {
383383
match libc::lseek(self.fd, pos as libc::off_t, whence) {
@@ -446,10 +446,8 @@ impl rtio::RtioFileStream for FileWatcher {
446446
}
447447
fn tell(&self) -> Result<u64, IoError> {
448448
use libc::SEEK_CUR;
449-
// this is temporary
450-
// FIXME #13933: Remove/justify all `&T` to `&mut T` transmutes
451-
let self_ = unsafe { mem::transmute::<&_, &mut FileWatcher>(self) };
452-
self_.seek_common(0, SEEK_CUR)
449+
450+
self.seek_common(0, SEEK_CUR)
453451
}
454452
fn fsync(&mut self) -> Result<(), IoError> {
455453
let _m = self.fire_homing_missile();

branches/try/src/libsyntax/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ pub enum Pat_ {
347347
* we don't bind the fields to names */
348348
PatStruct(Path, Vec<FieldPat> , bool),
349349
PatTup(Vec<@Pat> ),
350-
PatUniq(@Pat),
350+
PatBox(@Pat),
351351
PatRegion(@Pat), // reference pattern
352352
PatLit(@Expr),
353353
PatRange(@Expr, @Expr),

branches/try/src/libsyntax/ast_util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -657,7 +657,7 @@ pub fn walk_pat(pat: &Pat, it: |&Pat| -> bool) -> bool {
657657
PatEnum(_, Some(ref s)) | PatTup(ref s) => {
658658
s.iter().advance(|&p| walk_pat(p, |p| it(p)))
659659
}
660-
PatUniq(s) | PatRegion(s) => {
660+
PatBox(s) | PatRegion(s) => {
661661
walk_pat(s, it)
662662
}
663663
PatVec(ref before, ref slice, ref after) => {

branches/try/src/libsyntax/ext/deriving/cmp/eq.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt,
5353
let trait_def = TraitDef {
5454
span: span,
5555
attributes: Vec::new(),
56-
path: Path::new(vec!("std", "cmp", "Eq")),
56+
path: Path::new(vec!("std", "cmp", "PartialEq")),
5757
additional_bounds: Vec::new(),
5858
generics: LifetimeBounds::empty(),
5959
methods: vec!(

branches/try/src/libsyntax/ext/deriving/cmp/ord.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt,
4343
let trait_def = TraitDef {
4444
span: span,
4545
attributes: Vec::new(),
46-
path: Path::new(vec!("std", "cmp", "Ord")),
46+
path: Path::new(vec!("std", "cmp", "PartialOrd")),
4747
additional_bounds: Vec::new(),
4848
generics: LifetimeBounds::empty(),
4949
methods: vec!(

branches/try/src/libsyntax/ext/deriving/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ pub fn expand_meta_deriving(cx: &mut ExtCtxt,
7777
"Encodable" => expand!(encodable::expand_deriving_encodable),
7878
"Decodable" => expand!(decodable::expand_deriving_decodable),
7979

80-
"Eq" => expand!(eq::expand_deriving_eq),
80+
// NOTE this needs treatment after a stage0 snap
81+
"PartialEq" | "Eq" => expand!(eq::expand_deriving_eq),
8182
"TotalEq" => expand!(totaleq::expand_deriving_totaleq),
82-
"Ord" => expand!(ord::expand_deriving_ord),
83+
"PartialOrd" | "Ord" => expand!(ord::expand_deriving_ord),
8384
"TotalOrd" => expand!(totalord::expand_deriving_totalord),
8485

8586
"Rand" => expand!(rand::expand_deriving_rand),

branches/try/src/libsyntax/fold.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ pub fn noop_fold_pat<T: Folder>(p: @Pat, folder: &mut T) -> @Pat {
760760
PatStruct(pth_, fs, etc)
761761
}
762762
PatTup(ref elts) => PatTup(elts.iter().map(|x| folder.fold_pat(*x)).collect()),
763-
PatUniq(inner) => PatUniq(folder.fold_pat(inner)),
763+
PatBox(inner) => PatBox(folder.fold_pat(inner)),
764764
PatRegion(inner) => PatRegion(folder.fold_pat(inner)),
765765
PatRange(e1, e2) => {
766766
PatRange(folder.fold_expr(e1), folder.fold_expr(e2))

branches/try/src/libsyntax/parse/parser.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use ast::{MutImmutable, MutMutable, Mac_, MacInvocTT, Matcher, MatchNonterminal}
3939
use ast::{MatchSeq, MatchTok, Method, MutTy, BiMul, Mutability};
4040
use ast::{NamedField, UnNeg, NoReturn, UnNot, P, Pat, PatEnum};
4141
use ast::{PatIdent, PatLit, PatRange, PatRegion, PatStruct};
42-
use ast::{PatTup, PatUniq, PatWild, PatWildMulti};
42+
use ast::{PatTup, PatBox, PatWild, PatWildMulti};
4343
use ast::{BiRem, Required};
4444
use ast::{RetStyle, Return, BiShl, BiShr, Stmt, StmtDecl};
4545
use ast::{Sized, DynSize, StaticSize};
@@ -2784,7 +2784,7 @@ impl<'a> Parser<'a> {
27842784
// parse ~pat
27852785
self.bump();
27862786
let sub = self.parse_pat();
2787-
pat = PatUniq(sub);
2787+
pat = PatBox(sub);
27882788
hi = self.last_span.hi;
27892789
self.obsolete(self.last_span, ObsoleteOwnedPattern);
27902790
return @ast::Pat {
@@ -2888,7 +2888,7 @@ impl<'a> Parser<'a> {
28882888
// FIXME(#13910): Rename to `PatBox` and extend to full DST
28892889
// support.
28902890
let sub = self.parse_pat();
2891-
pat = PatUniq(sub);
2891+
pat = PatBox(sub);
28922892
hi = self.last_span.hi;
28932893
return @ast::Pat {
28942894
id: ast::DUMMY_NODE_ID,

branches/try/src/libsyntax/print/pprust.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1721,7 +1721,7 @@ impl<'a> State<'a> {
17211721
}
17221722
try!(self.pclose());
17231723
}
1724-
ast::PatUniq(inner) => {
1724+
ast::PatBox(inner) => {
17251725
try!(word(&mut self.s, "box "));
17261726
try!(self.print_pat(inner));
17271727
}

branches/try/src/libsyntax/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ pub fn walk_pat<E: Clone, V: Visitor<E>>(visitor: &mut V, pattern: &Pat, env: E)
429429
visitor.visit_pat(*tuple_element, env.clone())
430430
}
431431
}
432-
PatUniq(subpattern) |
432+
PatBox(subpattern) |
433433
PatRegion(subpattern) => {
434434
visitor.visit_pat(subpattern, env)
435435
}

0 commit comments

Comments
 (0)