Skip to content

Commit e53f649

Browse files
author
Jakub Wieczorek
committed
---
yaml --- r: 152708 b: refs/heads/try2 c: f5e513b h: refs/heads/master v: v3
1 parent 31223e7 commit e53f649

Some content is hidden

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

41 files changed

+65
-194
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 2563481ca93877551116b11cde3cc7e21f1d6048
8+
refs/heads/try2: f5e513b2b2dd173f16b84f0531fc3628d62beb4d
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/doc/guide-unsafe.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,6 @@ As an example, we give a reimplementation of owned boxes by wrapping
192192
reimplementation is as safe as the `Box` type.
193193

194194
```
195-
#![feature(unsafe_destructor)]
196-
197195
extern crate libc;
198196
use libc::{c_void, size_t, malloc, free};
199197
use std::mem;
@@ -244,12 +242,10 @@ impl<T: Send> Unique<T> {
244242
// A key ingredient for safety, we associate a destructor with
245243
// Unique<T>, making the struct manage the raw pointer: when the
246244
// struct goes out of scope, it will automatically free the raw pointer.
247-
//
248245
// NB: This is an unsafe destructor, because rustc will not normally
249-
// allow destructors to be associated with parameterized types, due to
246+
// allow destructors to be associated with parametrized types, due to
250247
// bad interaction with managed boxes. (With the Send restriction,
251-
// we don't have this problem.) Note that the `#[unsafe_destructor]`
252-
// feature gate is required to use unsafe destructors.
248+
// we don't have this problem.)
253249
#[unsafe_destructor]
254250
impl<T: Send> Drop for Unique<T> {
255251
fn drop(&mut self) {

branches/try2/src/doc/rust.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,13 +1940,12 @@ interpreted:
19401940
enum representation in C is undefined, and this may be incorrect when the C
19411941
code is compiled with certain flags.
19421942
- `simd` - on certain tuple structs, derive the arithmetic operators, which
1943-
lower to the target's SIMD instructions, if any; the `simd` feature gate
1944-
is necessary to use this attribute.
1943+
lower to the target's SIMD instructions, if any.
19451944
- `static_assert` - on statics whose type is `bool`, terminates compilation
19461945
with an error if it is not initialized to `true`.
19471946
- `unsafe_destructor` - allow implementations of the "drop" language item
19481947
where the type it is implemented for does not implement the "send" language
1949-
item; the `unsafe_destructor` feature gate is needed to use this attribute
1948+
item.
19501949
- `unsafe_no_drop_flag` - on structs, remove the flag that prevents
19511950
destructors from being run twice. Destructors might be run multiple times on
19521951
the same object with this attribute.

branches/try2/src/liballoc/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969
html_root_url = "http://doc.rust-lang.org/")]
7070

7171
#![no_std]
72-
#![feature(phase, unsafe_destructor)]
73-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
72+
#![feature(phase)]
7473

7574
#[phase(plugin, link)]
7675
extern crate core;

branches/try2/src/libarena/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@
2727
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
2828
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2929
html_root_url = "http://doc.rust-lang.org/")]
30-
31-
#![feature(unsafe_destructor)]
3230
#![allow(missing_doc)]
33-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
3431

3532
use std::cell::{Cell, RefCell};
3633
use std::cmp;

branches/try2/src/libcollections/lib.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222
html_playground_url = "http://play.rust-lang.org/")]
2323

2424
#![feature(macro_rules, managed_boxes, default_type_params, phase, globs)]
25-
#![feature(unsafe_destructor)]
2625
#![no_std]
27-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
2826

2927
#[phase(plugin, link)] extern crate core;
3028
extern crate alloc;

branches/try2/src/libcore/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,8 @@
5555
html_playground_url = "http://play.rust-lang.org/")]
5656

5757
#![no_std]
58-
#![feature(globs, macro_rules, managed_boxes, phase, simd, unsafe_destructor)]
58+
#![feature(globs, macro_rules, managed_boxes, phase, simd)]
5959
#![deny(missing_doc)]
60-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
6160

6261
#[cfg(test)] extern crate realcore = "core";
6362
#[cfg(test)] extern crate libc;

branches/try2/src/libnative/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,15 @@
5252
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
5353
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
5454
html_root_url = "http://doc.rust-lang.org/")]
55-
5655
#![deny(unused_result, unused_must_use)]
5756
#![allow(non_camel_case_types)]
5857
#![allow(deprecated)]
59-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
6058
#![feature(default_type_params)]
6159

6260
// NB this crate explicitly does *not* allow glob imports, please seriously
6361
// consider whether they're needed before adding that feature here (the
6462
// answer is that you don't need them)
65-
#![feature(macro_rules, unsafe_destructor)]
63+
#![feature(macro_rules)]
6664

6765
extern crate alloc;
6866
extern crate libc;

branches/try2/src/librustc/front/feature_gate.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static KNOWN_FEATURES: &'static [(&'static str, Status)] = &[
5050
("log_syntax", Active),
5151
("trace_macros", Active),
5252
("concat_idents", Active),
53-
("unsafe_destructor", Active),
5453

5554
("simd", Active),
5655
("default_type_params", Active),
@@ -221,17 +220,6 @@ impl<'a> Visitor<()> for Context<'a> {
221220
}
222221
}
223222

224-
ast::ItemImpl(..) => {
225-
if attr::contains_name(i.attrs.as_slice(),
226-
"unsafe_destructor") {
227-
self.gate_feature("unsafe_destructor",
228-
i.span,
229-
"`#[unsafe_destructor]` allows too \
230-
many unsafe patterns and may be \
231-
removed in the future");
232-
}
233-
}
234-
235223
_ => {}
236224
}
237225

branches/try2/src/librustc/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ This API is completely unstable and subject to change.
2929
html_root_url = "http://doc.rust-lang.org/")]
3030

3131
#![allow(deprecated)]
32-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
33-
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote)]
34-
#![feature(default_type_params, phase, unsafe_destructor)]
32+
#![feature(macro_rules, globs, struct_variant, managed_boxes, quote,
33+
default_type_params, phase)]
3534

3635
extern crate arena;
3736
extern crate debug;

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

Lines changed: 26 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -750,12 +750,15 @@ fn check_local(cx: &mut MatchCheckCtxt, loc: &Local) {
750750
LocalFor => "`for` loop"
751751
};
752752

753-
let mut spans = vec![];
754-
find_refutable(cx, &*loc.pat, &mut spans);
755-
756-
for span in spans.iter() {
757-
cx.tcx.sess.span_err(*span,
758-
format!("refutable pattern in {} binding", name).as_slice());
753+
match is_refutable(cx, loc.pat) {
754+
Some(pat) => {
755+
let msg = format!(
756+
"refutable pattern in {} binding: {} not covered",
757+
name, pat_to_str(&*pat)
758+
);
759+
cx.tcx.sess.span_err(loc.pat.span, msg.as_slice());
760+
},
761+
None => ()
759762
}
760763

761764
// Check legality of move bindings.
@@ -769,67 +772,27 @@ fn check_fn(cx: &mut MatchCheckCtxt,
769772
sp: Span) {
770773
visit::walk_fn(cx, kind, decl, body, sp, ());
771774
for input in decl.inputs.iter() {
772-
let mut spans = vec![];
773-
find_refutable(cx, &*input.pat, &mut spans);
774-
775-
for span in spans.iter() {
776-
cx.tcx.sess.span_err(*span,
777-
"refutable pattern in function argument");
775+
match is_refutable(cx, input.pat) {
776+
Some(pat) => {
777+
let msg = format!(
778+
"refutable pattern in function argument: {} not covered",
779+
pat_to_str(&*pat)
780+
);
781+
cx.tcx.sess.span_err(input.pat.span, msg.as_slice());
782+
},
783+
None => ()
778784
}
779785
}
780786
}
781787

782-
fn find_refutable(cx: &MatchCheckCtxt, pat: &Pat, spans: &mut Vec<Span>) {
783-
macro_rules! this_pattern {
784-
() => {
785-
{
786-
spans.push(pat.span);
787-
return
788-
}
789-
}
790-
}
791-
let opt_def = cx.tcx.def_map.borrow().find_copy(&pat.id);
792-
match opt_def {
793-
Some(DefVariant(enum_id, _, _)) => {
794-
if ty::enum_variants(cx.tcx, enum_id).len() != 1u {
795-
this_pattern!()
796-
}
797-
}
798-
Some(DefStatic(..)) => this_pattern!(),
799-
_ => ()
800-
}
801-
802-
match pat.node {
803-
PatBox(ref sub) | PatRegion(ref sub) | PatIdent(_, _, Some(ref sub)) => {
804-
find_refutable(cx, &**sub, spans)
805-
}
806-
PatWild | PatWildMulti | PatIdent(_, _, None) => {}
807-
PatLit(lit) => {
808-
match lit.node {
809-
ExprLit(lit) => {
810-
match lit.node {
811-
LitNil => {} // `()`
812-
_ => this_pattern!(),
813-
}
814-
}
815-
_ => this_pattern!(),
816-
}
817-
}
818-
PatRange(_, _) => { this_pattern!() }
819-
PatStruct(_, ref fields, _) => {
820-
for f in fields.iter() {
821-
find_refutable(cx, &*f.pat, spans);
822-
}
823-
}
824-
PatTup(ref elts) | PatEnum(_, Some(ref elts))=> {
825-
for elt in elts.iter() {
826-
find_refutable(cx, &**elt, spans)
827-
}
828-
}
829-
PatEnum(_,_) => {}
830-
PatVec(..) => { this_pattern!() }
831-
PatMac(_) => cx.tcx.sess.bug("unexpanded macro"),
832-
}
788+
fn is_refutable(cx: &MatchCheckCtxt, pat: Gc<Pat>) -> Option<Gc<Pat>> {
789+
let pats = vec!(vec!(pat));
790+
is_useful(cx, &pats, [wild()])
791+
.useful()
792+
.map(|pats| {
793+
assert_eq!(pats.len(), 1);
794+
pats.get(0).clone()
795+
})
833796
}
834797

835798
// Legality of move bindings checking

branches/try2/src/librustrt/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
1616
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
1717
html_root_url = "http://doc.rust-lang.org/")]
18-
19-
#![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm)]
20-
#![feature(linkage, unsafe_destructor)]
18+
#![feature(macro_rules, phase, globs, thread_local, managed_boxes, asm,
19+
linkage)]
2120
#![no_std]
2221
#![experimental]
23-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
2422

2523
#[phase(plugin, link)] extern crate core;
2624
extern crate alloc;

branches/try2/src/librustuv/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ via `close` and `delete` methods.
4040
#![crate_type = "rlib"]
4141
#![crate_type = "dylib"]
4242

43-
#![feature(macro_rules, unsafe_destructor)]
43+
#![feature(macro_rules)]
4444
#![deny(unused_result, unused_must_use)]
4545
#![allow(visible_private_types)]
4646

branches/try2/src/libstd/lib.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,14 @@
103103
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
104104
html_root_url = "http://doc.rust-lang.org/",
105105
html_playground_url = "http://play.rust-lang.org/")]
106-
107-
#![feature(macro_rules, globs, managed_boxes)]
108-
#![feature(linkage, default_type_params, phase, unsafe_destructor)]
106+
#![feature(macro_rules, globs, managed_boxes,
107+
linkage, default_type_params, phase)]
109108

110109
// Don't link to std. We are std.
111110
#![no_std]
112111

113112
#![allow(deprecated)]
114113
#![deny(missing_doc)]
115-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
116114

117115
// When testing libstd, bring in libuv as the I/O backend so tests can print
118116
// things and all of the std::io tests have an I/O interface to run on top

branches/try2/src/libsync/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@
2626
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2727
html_root_url = "http://doc.rust-lang.org/",
2828
html_playground_url = "http://play.rust-lang.org/")]
29+
#![feature(phase, globs, macro_rules)]
2930

30-
#![feature(phase, globs, macro_rules, unsafe_destructor)]
3131
#![deny(missing_doc)]
3232
#![no_std]
33-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
3433

3534
#[phase(plugin, link)] extern crate core;
3635
extern crate alloc;

branches/try2/src/libsyntax/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,9 @@ This API is completely unstable and subject to change.
2727
html_favicon_url = "http://www.rust-lang.org/favicon.ico",
2828
html_root_url = "http://doc.rust-lang.org/")]
2929

30-
#![feature(macro_rules, globs, managed_boxes, default_type_params, phase)]
31-
#![feature(quote, unsafe_destructor)]
30+
#![feature(macro_rules, globs, managed_boxes, default_type_params, phase,
31+
quote)]
3232
#![allow(deprecated)]
33-
#![allow(unknown_features)] // NOTE: remove after a stage0 snap
3433

3534
extern crate serialize;
3635
extern crate term;

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

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -706,16 +706,6 @@ impl<'a> Parser<'a> {
706706
let lo = span.lo + BytePos(1);
707707
self.replace_token(token::GT, lo, span.hi)
708708
}
709-
token::BINOPEQ(token::SHR) => {
710-
let span = self.span;
711-
let lo = span.lo + BytePos(1);
712-
self.replace_token(token::GE, lo, span.hi)
713-
}
714-
token::GE => {
715-
let span = self.span;
716-
let lo = span.lo + BytePos(1);
717-
self.replace_token(token::EQ, lo, span.hi)
718-
}
719709
_ => {
720710
let gt_str = Parser::token_to_str(&token::GT);
721711
let this_token_str = self.this_token_to_str();
@@ -736,9 +726,7 @@ impl<'a> Parser<'a> {
736726
let mut first = true;
737727
let mut v = Vec::new();
738728
while self.token != token::GT
739-
&& self.token != token::BINOP(token::SHR)
740-
&& self.token != token::GE
741-
&& self.token != token::BINOPEQ(token::SHR) {
729+
&& self.token != token::BINOP(token::SHR) {
742730
match sep {
743731
Some(ref t) => {
744732
if first { first = false; }

branches/try2/src/test/auxiliary/issue-2526.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
#![crate_id="issue_2526#0.2"]
1212
#![crate_type = "lib"]
1313

14-
#![feature(unsafe_destructor)]
15-
1614
struct arc_destruct<T> {
1715
_data: int,
1816
}

branches/try2/src/test/bench/task-perf-alloc-unwind.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(managed_boxes, unsafe_destructor)]
11+
#![feature(managed_boxes)]
1212

1313
extern crate collections;
1414
extern crate time;

branches/try2/src/test/compile-fail/borrowck-borrowed-uniq-rvalue-2.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(unsafe_destructor)]
12-
1311
extern crate debug;
1412

1513
struct defer<'a> {

branches/try2/src/test/compile-fail/no-send-res-ports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(managed_boxes, unsafe_destructor)]
11+
#![feature(managed_boxes)]
1212

1313
extern crate debug;
1414

branches/try2/src/test/compile-fail/pinned-deep-copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(managed_boxes, unsafe_destructor)]
11+
#![feature(managed_boxes)]
1212

1313
extern crate debug;
1414

0 commit comments

Comments
 (0)