From 5720f7055ac13cf616eb3a9a0b187440b56817d5 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Mon, 27 Jul 2015 13:31:48 +0300 Subject: [PATCH 1/2] Register new snapshots (2015-07-26 a5c12f4). --- src/liballoc/lib.rs | 2 -- src/libcore/intrinsics.rs | 9 --------- src/libstd/lib.rs | 1 - src/libstd/rt/unwind/gcc.rs | 8 ++++---- src/libstd/rt/unwind/mod.rs | 6 ------ src/snapshots.txt | 10 ++++++++++ 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/liballoc/lib.rs b/src/liballoc/lib.rs index f66495c4057..fce327398e3 100644 --- a/src/liballoc/lib.rs +++ b/src/liballoc/lib.rs @@ -70,8 +70,6 @@ test(no_crate_inject))] #![no_std] -// SNAP d4432b3 -#![allow(unused_features)] // until feature(placement_in_syntax) is in snap #![feature(allocator)] #![feature(box_syntax)] #![feature(coerce_unsized)] diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs index 1d466895f2c..80b7587ed36 100644 --- a/src/libcore/intrinsics.rs +++ b/src/libcore/intrinsics.rs @@ -184,19 +184,11 @@ extern "rust-intrinsic" { /// elements. pub fn size_of() -> usize; - #[cfg(not(stage0))] /// Moves a value to an uninitialized memory location. /// /// Drop glue is not run on the destination. pub fn move_val_init(dst: *mut T, src: T); - // SNAP d4432b3 - #[cfg(stage0)] - /// Moves a value to an uninitialized memory location. - /// - /// Drop glue is not run on the destination. - pub fn move_val_init(dst: &mut T, src: T); - pub fn min_align_of() -> usize; pub fn pref_align_of() -> usize; @@ -614,6 +606,5 @@ extern "rust-intrinsic" { /// Rust's "try catch" construct which invokes the function pointer `f` with /// the data pointer `data`, returning the exception payload if an exception /// is thrown (aka the thread panics). - #[cfg(not(stage0))] pub fn try(f: fn(*mut u8), data: *mut u8) -> *mut u8; } diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 440e3a26f6b..1fff123c7aa 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -203,7 +203,6 @@ test(no_crate_inject, attr(deny(warnings))), test(attr(allow(dead_code, deprecated, unused_variables, unused_mut))))] -#![cfg_attr(stage0, allow(unused_features))] #![feature(alloc)] #![feature(allow_internal_unstable)] #![feature(associated_consts)] diff --git a/src/libstd/rt/unwind/gcc.rs b/src/libstd/rt/unwind/gcc.rs index 59fc8df6107..23e10ee6c39 100644 --- a/src/libstd/rt/unwind/gcc.rs +++ b/src/libstd/rt/unwind/gcc.rs @@ -115,7 +115,7 @@ pub mod eabi { } } - #[cfg_attr(not(stage0), lang = "eh_personality_catch")] + #[lang = "eh_personality_catch"] #[no_mangle] pub extern fn rust_eh_personality_catch( _version: c_int, @@ -168,7 +168,7 @@ pub mod eabi { } } - #[cfg_attr(not(stage0), lang = "eh_personality_catch")] + #[lang = "eh_personality_catch"] #[no_mangle] pub extern fn rust_eh_personality_catch( _version: c_int, @@ -218,7 +218,7 @@ pub mod eabi { } } - #[cfg_attr(not(stage0), lang = "eh_personality_catch")] + #[lang = "eh_personality_catch"] #[no_mangle] pub extern fn rust_eh_personality_catch( state: uw::_Unwind_State, @@ -307,7 +307,7 @@ pub mod eabi { } } - #[cfg_attr(not(stage0), lang = "eh_personality_catch")] + #[lang = "eh_personality_catch"] #[no_mangle] pub extern fn rust_eh_personality_catch( exceptionRecord: *mut EXCEPTION_RECORD, diff --git a/src/libstd/rt/unwind/mod.rs b/src/libstd/rt/unwind/mod.rs index db2310ba361..60eced014de 100644 --- a/src/libstd/rt/unwind/mod.rs +++ b/src/libstd/rt/unwind/mod.rs @@ -139,7 +139,6 @@ pub unsafe fn try(f: F) -> Result<(), Box> { // `dllexport`, but it's easier to not have conditional `src/rt/rust_try.ll` // files and instead just have this non-generic shim the compiler can take // care of exposing correctly. - #[cfg(not(stage0))] unsafe fn inner_try(f: fn(*mut u8), data: *mut u8) -> Result<(), Box> { let prev = PANICKING.with(|s| s.get()); @@ -152,11 +151,6 @@ pub unsafe fn try(f: F) -> Result<(), Box> { Err(imp::cleanup(ep)) } } - #[cfg(stage0)] - unsafe fn inner_try(f: fn(*mut u8), data: *mut u8) - -> Result<(), Box> { - Ok(f(data)) - } fn try_fn(opt_closure: *mut u8) { let opt_closure = opt_closure as *mut Option; diff --git a/src/snapshots.txt b/src/snapshots.txt index 5c3e55e2862..d317b5be4c1 100644 --- a/src/snapshots.txt +++ b/src/snapshots.txt @@ -1,3 +1,13 @@ +S 2015-07-26 a5c12f4 + bitrig-x86_64 8734eb41ffbe6ddc1120aa2910db4162ec9cf270 + freebsd-x86_64 bc50b0f8d7f6d62f4f5ffa136f5387f5bf6524fd + linux-i386 3459275cdf3896f678e225843fa56f0d9fdbabe8 + linux-x86_64 e451e3bd6e5fcef71e41ae6f3da9fb1cf0e13a0c + macos-i386 428944a7984c0988e77909d82ca2ef77d96a1fbd + macos-x86_64 b0515bb7d2892b9a58282fc865fee11a885406d6 + winnt-i386 22286e815372c3e03729853af48a2f6d538ed086 + winnt-x86_64 f13aa3c02a15f8e794b9e180487bdf04378f8f04 + S 2015-07-17 d4432b3 bitrig-x86_64 af77768e0eb0f4c7ec5a8e36047a08053b54b230 freebsd-i386 b049325e5b2efe5f4884f3dafda448c1dac49b4f From cc09b1a08cc61dd3f485308adf3a5a252c718861 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Mon, 27 Jul 2015 18:11:43 +0300 Subject: [PATCH 2/2] Turn on `box(PLACE) expr` deprecation warning post-snapshot. --- src/liballoc/boxed.rs | 2 +- src/libsyntax/parse/parser.rs | 18 +++++++----------- src/test/compile-fail/borrowck-lend-flow-if.rs | 1 + .../compile-fail/borrowck-lend-flow-loop.rs | 1 + src/test/compile-fail/borrowck-lend-flow.rs | 1 + .../borrowck-loan-in-overloaded-op.rs | 1 + src/test/compile-fail/feature-gate-box-expr.rs | 1 + .../feature-gate-placement-expr.rs | 1 + src/test/compile-fail/issue-14084.rs | 1 + .../compile-fail/moves-based-on-type-tuple.rs | 5 ++++- .../parenthesized-box-expr-message.rs | 1 + 11 files changed, 20 insertions(+), 13 deletions(-) diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index acf22094233..a54b3420353 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -297,7 +297,7 @@ impl Clone for Box { /// let y = x.clone(); /// ``` #[inline] - fn clone(&self) -> Box { box (HEAP) {(**self).clone()} } + fn clone(&self) -> Box { box {(**self).clone()} } /// Copies `source`'s contents into `self` without creating a new allocation. /// /// # Examples diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 04665140e2f..80a10b2463f 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -2637,19 +2637,15 @@ impl<'a> Parser<'a> { // // ... but for now: check for a place: `box(PLACE) EXPR`. - if try!(self.eat(&token::OpenDelim(token::Paren)) ){ - // SNAP d4432b3 - // Enable this warning after snapshot ... - // - // let box_span = mk_sp(lo, self.last_span.hi); - // self.span_warn( - // box_span, - // "deprecated syntax; use the `in` keyword now \ - // (e.g. change `box () ` to \ - // `in { }`)"); + if try!(self.eat(&token::OpenDelim(token::Paren))) { + let box_span = mk_sp(lo, self.last_span.hi); + self.span_warn(box_span, + "deprecated syntax; use the `in` keyword now \ + (e.g. change `box () ` to \ + `in { }`)"); // Continue supporting `box () EXPR` (temporarily) - if !try!(self.eat(&token::CloseDelim(token::Paren)) ){ + if !try!(self.eat(&token::CloseDelim(token::Paren))) { let place = try!(self.parse_expr_nopanic()); try!(self.expect(&token::CloseDelim(token::Paren))); // Give a suggestion to use `box()` when a parenthesised expression is used diff --git a/src/test/compile-fail/borrowck-lend-flow-if.rs b/src/test/compile-fail/borrowck-lend-flow-if.rs index 0efe8622621..a0a6e54e942 100644 --- a/src/test/compile-fail/borrowck-lend-flow-if.rs +++ b/src/test/compile-fail/borrowck-lend-flow-if.rs @@ -24,6 +24,7 @@ fn produce() -> T { panic!(); } fn inc(v: &mut Box) { *v = box() (**v + 1); + //~^ WARN deprecated syntax } fn pre_freeze_cond() { diff --git a/src/test/compile-fail/borrowck-lend-flow-loop.rs b/src/test/compile-fail/borrowck-lend-flow-loop.rs index f841fedf75a..9356eeda605 100644 --- a/src/test/compile-fail/borrowck-lend-flow-loop.rs +++ b/src/test/compile-fail/borrowck-lend-flow-loop.rs @@ -23,6 +23,7 @@ fn produce() -> T { panic!(); } fn inc(v: &mut Box) { *v = box() (**v + 1); + //~^ WARN deprecated syntax } fn loop_overarching_alias_mut() { diff --git a/src/test/compile-fail/borrowck-lend-flow.rs b/src/test/compile-fail/borrowck-lend-flow.rs index 6da8f088b32..c3dcddf8587 100644 --- a/src/test/compile-fail/borrowck-lend-flow.rs +++ b/src/test/compile-fail/borrowck-lend-flow.rs @@ -24,6 +24,7 @@ fn produce() -> T { panic!(); } fn inc(v: &mut Box) { *v = box() (**v + 1); + //~^ WARN deprecated syntax } fn pre_freeze() { diff --git a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs index 8fb527b3242..558475c28d7 100644 --- a/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs +++ b/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs @@ -23,6 +23,7 @@ impl Add for foo { let foo(box i) = self; let foo(box j) = f; foo(box() (i + j)) + //~^ WARN deprecated syntax } } diff --git a/src/test/compile-fail/feature-gate-box-expr.rs b/src/test/compile-fail/feature-gate-box-expr.rs index 9640b2b475b..ace1b399662 100644 --- a/src/test/compile-fail/feature-gate-box-expr.rs +++ b/src/test/compile-fail/feature-gate-box-expr.rs @@ -21,5 +21,6 @@ fn main() { println!("x: {}", x); let x = box () 'c'; //~ ERROR box expression syntax is experimental + //~^ WARN deprecated syntax println!("x: {}", x); } diff --git a/src/test/compile-fail/feature-gate-placement-expr.rs b/src/test/compile-fail/feature-gate-placement-expr.rs index 64a1d49f960..7c75605d57d 100644 --- a/src/test/compile-fail/feature-gate-placement-expr.rs +++ b/src/test/compile-fail/feature-gate-placement-expr.rs @@ -20,6 +20,7 @@ fn main() { use std::boxed::HEAP; let x = box (HEAP) 'c'; //~ ERROR placement-in expression syntax is experimental + //~^ WARN deprecated syntax println!("x: {}", x); let x = in HEAP { 'c' }; //~ ERROR placement-in expression syntax is experimental diff --git a/src/test/compile-fail/issue-14084.rs b/src/test/compile-fail/issue-14084.rs index 8e566d7aafa..b33a6767274 100644 --- a/src/test/compile-fail/issue-14084.rs +++ b/src/test/compile-fail/issue-14084.rs @@ -15,4 +15,5 @@ fn main() { box ( () ) 0; //~^ ERROR: the trait `core::ops::Placer<_>` is not implemented //~| ERROR: the trait `core::ops::Placer<_>` is not implemented + //~| WARN deprecated syntax } diff --git a/src/test/compile-fail/moves-based-on-type-tuple.rs b/src/test/compile-fail/moves-based-on-type-tuple.rs index 30388f9d2f7..e1d462d1700 100644 --- a/src/test/compile-fail/moves-based-on-type-tuple.rs +++ b/src/test/compile-fail/moves-based-on-type-tuple.rs @@ -10,7 +10,10 @@ #![feature(box_syntax)] -fn dup(x: Box) -> Box<(Box,Box)> { box() (x, x) } //~ ERROR use of moved value +fn dup(x: Box) -> Box<(Box,Box)> { + box() (x, x) //~ ERROR use of moved value + //~^ WARN deprecated syntax +} fn main() { dup(box 3); } diff --git a/src/test/parse-fail/parenthesized-box-expr-message.rs b/src/test/parse-fail/parenthesized-box-expr-message.rs index 4c32d2f041e..3cf3685d5bd 100644 --- a/src/test/parse-fail/parenthesized-box-expr-message.rs +++ b/src/test/parse-fail/parenthesized-box-expr-message.rs @@ -14,5 +14,6 @@ fn main() { box (1 + 1) //~^ HELP try using `box ()` instead: //~| SUGGESTION box () (1 + 1) + //~| WARN deprecated syntax ; //~ ERROR expected expression, found `;` }