Skip to content

Commit d7cda17

Browse files
committed
---
yaml --- r: 111003 b: refs/heads/snap-stage3 c: 2f41a85 h: refs/heads/master i: 111001: ac2d3f0 110999: 9f35011 v: v3
1 parent aa3cb14 commit d7cda17

File tree

17 files changed

+326
-233
lines changed

17 files changed

+326
-233
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: 296e60be6b027a52de58251848037a92f23a0878
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
4-
refs/heads/snap-stage3: 8f5d71cf71849bea25f87836cec1b06b476baf37
4+
refs/heads/snap-stage3: 2f41a85d8e1f577f17e5b17a1d648508e1ac5001
55
refs/heads/try: 38201d7c6bf0c32b0e5bdc8ecd63976ebc1b3a4c
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b

branches/snap-stage3/src/doc/guide-macros.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ As an example, `loop` and `for-loop` labels (discussed in the lifetimes guide)
407407
will not clash. The following code will print "Hello!" only once:
408408

409409
~~~
410-
#[feature(macro_rules)];
410+
#![feature(macro_rules)]
411411
412412
macro_rules! loop_x (
413413
($e: expr) => (

branches/snap-stage3/src/doc/guide-pointers.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ struct.
250250
# Managed Pointers
251251

252252
> **Note**: the `@` form of managed pointers is deprecated and behind a
253-
> feature gate (it requires a `#[feature(managed_pointers)];` attribute on
253+
> feature gate (it requires a `#![feature(managed_pointers)]` attribute on
254254
> the crate root; remember the semicolon!). There are replacements, currently
255255
> there is `std::rc::Rc` and `std::gc::Gc` for shared ownership via reference
256256
> counting and garbage collection respectively.

branches/snap-stage3/src/doc/guide-testing.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ amount.
185185
For example:
186186

187187
~~~
188-
# #[allow(unused_imports)];
188+
# #![allow(unused_imports)]
189189
extern crate test;
190190
191191
use std::slice;
@@ -247,7 +247,7 @@ recognize that some calculation has no external effects and remove
247247
it entirely.
248248

249249
~~~
250-
# #[allow(unused_imports)];
250+
# #![allow(unused_imports)]
251251
extern crate test;
252252
use test::Bencher;
253253

branches/snap-stage3/src/doc/guide-unsafe.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -424,14 +424,14 @@ Current valid options are:
424424
# Avoiding the standard library
425425

426426
By default, `std` is linked to every Rust crate. In some contexts,
427-
this is undesirable, and can be avoided with the `#[no_std];`
427+
this is undesirable, and can be avoided with the `#![no_std]`
428428
attribute attached to the crate.
429429

430430
```ignore
431431
# // FIXME #12903: linking failures due to no_std
432432
// the minimal library
433-
#[crate_type="lib"];
434-
#[no_std];
433+
#![crate_type="lib"]
434+
#![no_std]
435435
436436
# // fn main() {} tricked you, rustdoc!
437437
```
@@ -446,7 +446,7 @@ in the same format as a C:
446446

447447
```ignore
448448
# // FIXME #12903: linking failures due to no_std
449-
#[no_std];
449+
#![no_std]
450450
451451
extern "rust-intrinsic" { fn abort() -> !; }
452452
#[no_mangle] pub extern fn rust_stack_exhausted() {
@@ -462,14 +462,14 @@ fn start(_argc: int, _argv: **u8) -> int {
462462
```
463463

464464
To override the compiler-inserted `main` shim, one has to disable it
465-
with `#[no_main];` and then create the appropriate symbol with the
465+
with `#![no_main]` and then create the appropriate symbol with the
466466
correct ABI and the correct name, which requires overriding the
467467
compiler's name mangling too:
468468

469469
```ignore
470470
# // FIXME #12903: linking failures due to no_std
471-
#[no_std];
472-
#[no_main];
471+
#![no_std]
472+
#![no_main]
473473
474474
extern "rust-intrinsic" { fn abort() -> !; }
475475
#[no_mangle] pub extern fn rust_stack_exhausted() {
@@ -543,7 +543,7 @@ sugar for dynamic allocations via `malloc` and `free`:
543543

544544
```ignore
545545
# // FIXME #12903: linking failures due to no_std
546-
#[no_std];
546+
#![no_std]
547547
548548
#[allow(ctypes)] // `uint` == `size_t` on Rust's platforms
549549
extern {

branches/snap-stage3/src/doc/po/ja/rust.md.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ msgstr "# モジュールとクレート"
252252
#: src/doc/rust.md:627
253253
#, fuzzy
254254
#| msgid "// Turn on a warning #[warn(non_camel_case_types)]"
255-
msgid "// Turn on a warning #[ warn(non_camel_case_types) ]; ~~~~"
255+
msgid "// Turn on a warning #![ warn(non_camel_case_types) ] ~~~~"
256256
msgstr ""
257257
"// 警告を有効にする\n"
258258
"#[warn(non_camel_case_types)]"

branches/snap-stage3/src/doc/po/ja/tutorial.md.po

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4851,13 +4851,13 @@ msgstr ""
48514851
#. type: Plain text
48524852
#: src/doc/tutorial.md:3134
48534853
#, fuzzy
4854-
#| msgid "// Make a library (\"bin\" is the default) #[crate_type = \"lib\"];"
4854+
#| msgid "// Make a library (\"bin\" is the default) #![crate_type = \"lib\"]"
48554855
msgid ""
48564856
"// This crate is a library (\"bin\" is the default) #[crate_id = "
4857-
"\"farm#2.5\"]; #[crate_type = \"lib\"];"
4857+
"\"farm#2.5\"]; #![crate_type = \"lib\"]"
48584858
msgstr ""
48594859
"// ライブラリを作成する (\"bin\" がデフォルト値)\n"
4860-
"#[crate_type = \"lib\"];"
4860+
"#![crate_type = \"lib\"]"
48614861

48624862
#. type: Plain text
48634863
#: src/doc/tutorial.md:3139
@@ -4888,15 +4888,15 @@ msgstr ""
48884888
#: src/doc/tutorial.md:3153
48894889
#, fuzzy
48904890
#| msgid ""
4891-
#| "~~~~ // world.rs #[link(name = \"world\", vers = \"1.0\")]; pub fn "
4891+
#| "~~~~ // world.rs #![link(name = \"world\", vers = \"1.0\")] pub fn "
48924892
#| "explore() -> &str { \"world\" } ~~~~"
48934893
msgid ""
4894-
"~~~~ // `world.rs` #[crate_id = \"world#0.42\"]; # extern crate extra; pub fn "
4894+
"~~~~ // `world.rs` #![crate_id = \"world#0.42\"] # extern crate extra; pub fn "
48954895
"explore() -> &'static str { \"world\" } # fn main() {} ~~~~"
48964896
msgstr ""
48974897
"~~~~\n"
48984898
"// world.rs\n"
4899-
"#[link(name = \"world\", vers = \"1.0\")];\n"
4899+
"#![link(name = \"world\", vers = \"1.0\")]\n"
49004900
"pub fn explore() -> &str { \"world\" }\n"
49014901
"~~~~"
49024902

branches/snap-stage3/src/doc/rustdoc.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ comments":
1313
~~~
1414
// the "link" crate attribute is currently required for rustdoc, but normally
1515
// isn't needed.
16-
#[crate_id = "universe"];
17-
#[crate_type="lib"];
16+
#![crate_id = "universe"]
17+
#![crate_type="lib"]
1818
1919
//! Tools for dealing with universes (this is a doc comment, and is shown on
2020
//! the crate index page. The ! makes it apply to the parent of the comment,

branches/snap-stage3/src/doc/tutorial.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3096,8 +3096,8 @@ Therefore, if you plan to compile your crate as a library, you should annotate i
30963096
~~~~
30973097
// `lib.rs`
30983098
3099-
# #[crate_type = "lib"];
3100-
#[crate_id = "farm#2.5"];
3099+
# #![crate_type = "lib"]
3100+
#![crate_id = "farm#2.5"]
31013101
31023102
// ...
31033103
# fn farm() {}
@@ -3121,8 +3121,8 @@ or setting the crate type (library or executable) explicitly:
31213121
// ...
31223122
31233123
// This crate is a library ("bin" is the default)
3124-
#[crate_id = "farm#2.5"];
3125-
#[crate_type = "lib"];
3124+
#![crate_id = "farm#2.5"]
3125+
#![crate_type = "lib"]
31263126
31273127
// Turn on a warning
31283128
#[warn(non_camel_case_types)]
@@ -3137,7 +3137,7 @@ We define two crates, and use one of them as a library in the other.
31373137

31383138
~~~~
31393139
// `world.rs`
3140-
#[crate_id = "world#0.42"];
3140+
#![crate_id = "world#0.42"]
31413141
31423142
# mod secret_module_to_make_this_test_run {
31433143
pub fn explore() -> &'static str { "world" }
@@ -3211,12 +3211,12 @@ Both auto-insertions can be disabled with an attribute if necessary:
32113211

32123212
~~~
32133213
// In the crate root:
3214-
#[no_std];
3214+
#![no_std]
32153215
~~~
32163216

32173217
~~~
32183218
// In any module:
3219-
#[no_implicit_prelude];
3219+
#![no_implicit_prelude]
32203220
~~~
32213221

32223222
See the [API documentation][stddoc] for details.

branches/snap-stage3/src/librustc/middle/astencode.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ trait def_id_encoder_helpers {
266266

267267
impl<S:serialize::Encoder<E>, E> def_id_encoder_helpers for S {
268268
fn emit_def_id(&mut self, did: ast::DefId) {
269-
did.encode(self).unwrap()
269+
did.encode(self).ok().unwrap()
270270
}
271271
}
272272

@@ -278,13 +278,13 @@ trait def_id_decoder_helpers {
278278

279279
impl<D:serialize::Decoder<E>, E> def_id_decoder_helpers for D {
280280
fn read_def_id(&mut self, xcx: &ExtendedDecodeContext) -> ast::DefId {
281-
let did: ast::DefId = Decodable::decode(self).unwrap();
281+
let did: ast::DefId = Decodable::decode(self).ok().unwrap();
282282
did.tr(xcx)
283283
}
284284

285285
fn read_def_id_noxcx(&mut self,
286286
cdata: @cstore::crate_metadata) -> ast::DefId {
287-
let did: ast::DefId = Decodable::decode(self).unwrap();
287+
let did: ast::DefId = Decodable::decode(self).ok().unwrap();
288288
decoder::translate_def_id(cdata, did)
289289
}
290290
}

branches/snap-stage3/src/libstd/comm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ impl<T: Send> Sender<T> {
496496
// This send cannot fail because the task is
497497
// asleep (we're looking at it), so the receiver
498498
// can't go away.
499-
(*a.get()).send(t).unwrap();
499+
(*a.get()).send(t).ok().unwrap();
500500
task.wake().map(|t| t.reawaken());
501501
(a, Ok(()))
502502
}

branches/snap-stage3/src/libstd/path/mod.rs

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ println!("path exists: {}", path.exists());
6363
6464
*/
6565

66+
#![deny(deprecated_owned_vector)]
67+
6668
use container::Container;
6769
use c_str::CString;
6870
use clone::Clone;
6971
use fmt;
7072
use iter::Iterator;
7173
use option::{Option, None, Some};
7274
use str;
73-
use str::{MaybeOwned, OwnedStr, Str, StrSlice, from_utf8_lossy};
74-
use slice;
75-
use slice::{CloneableVector, OwnedCloneableVector, OwnedVector, Vector};
75+
use str::{MaybeOwned, Str, StrSlice, from_utf8_lossy};
76+
use strbuf::StrBuf;
77+
use slice::{OwnedCloneableVector, OwnedVector, Vector};
7678
use slice::{ImmutableEqVector, ImmutableVector};
79+
use vec::Vec;
7780

7881
/// Typedef for POSIX file paths.
7982
/// See `posix::Path` for more info.
@@ -184,7 +187,7 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
184187
fn as_vec<'a>(&'a self) -> &'a [u8];
185188

186189
/// Converts the Path into an owned byte vector
187-
fn into_vec(self) -> ~[u8];
190+
fn into_vec(self) -> Vec<u8>;
188191

189192
/// Returns an object that implements `Show` for printing paths
190193
///
@@ -293,15 +296,15 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
293296
let extlen = extension.container_as_bytes().len();
294297
match (name.rposition_elem(&dot), extlen) {
295298
(None, 0) | (Some(0), 0) => None,
296-
(Some(idx), 0) => Some(name.slice_to(idx).to_owned()),
299+
(Some(idx), 0) => Some(Vec::from_slice(name.slice_to(idx))),
297300
(idx, extlen) => {
298301
let idx = match idx {
299302
None | Some(0) => name.len(),
300303
Some(val) => val
301304
};
302305

303306
let mut v;
304-
v = slice::with_capacity(idx + extlen + 1);
307+
v = Vec::with_capacity(idx + extlen + 1);
305308
v.push_all(name.slice_to(idx));
306309
v.push(dot);
307310
v.push_all(extension.container_as_bytes());
@@ -441,10 +444,10 @@ pub trait GenericPath: Clone + GenericPathUnsafe {
441444
pub trait BytesContainer {
442445
/// Returns a &[u8] representing the receiver
443446
fn container_as_bytes<'a>(&'a self) -> &'a [u8];
444-
/// Consumes the receiver and converts it into ~[u8]
447+
/// Consumes the receiver and converts it into Vec<u8>
445448
#[inline]
446-
fn container_into_owned_bytes(self) -> ~[u8] {
447-
self.container_as_bytes().to_owned()
449+
fn container_into_owned_bytes(self) -> Vec<u8> {
450+
Vec::from_slice(self.container_as_bytes())
448451
}
449452
/// Returns the receiver interpreted as a utf-8 string, if possible
450453
#[inline]
@@ -522,15 +525,27 @@ impl BytesContainer for ~str {
522525
self.as_bytes()
523526
}
524527
#[inline]
525-
fn container_into_owned_bytes(self) -> ~[u8] {
528+
fn container_as_str<'a>(&'a self) -> Option<&'a str> {
529+
Some(self.as_slice())
530+
}
531+
#[inline]
532+
fn is_str(_: Option<~str>) -> bool { true }
533+
}
534+
impl BytesContainer for StrBuf {
535+
#[inline]
536+
fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
537+
self.as_bytes()
538+
}
539+
#[inline]
540+
fn container_into_owned_bytes(self) -> Vec<u8> {
526541
self.into_bytes()
527542
}
528543
#[inline]
529544
fn container_as_str<'a>(&'a self) -> Option<&'a str> {
530545
Some(self.as_slice())
531546
}
532547
#[inline]
533-
fn is_str(_: Option<~str>) -> bool { true }
548+
fn is_str(_: Option<StrBuf>) -> bool { true }
534549
}
535550

536551
impl<'a> BytesContainer for &'a [u8] {
@@ -545,8 +560,15 @@ impl BytesContainer for ~[u8] {
545560
fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
546561
self.as_slice()
547562
}
563+
}
564+
565+
impl BytesContainer for Vec<u8> {
566+
#[inline]
567+
fn container_as_bytes<'a>(&'a self) -> &'a [u8] {
568+
self.as_slice()
569+
}
548570
#[inline]
549-
fn container_into_owned_bytes(self) -> ~[u8] {
571+
fn container_into_owned_bytes(self) -> Vec<u8> {
550572
self
551573
}
552574
}
@@ -564,10 +586,6 @@ impl<'a> BytesContainer for str::MaybeOwned<'a> {
564586
self.as_slice().as_bytes()
565587
}
566588
#[inline]
567-
fn container_into_owned_bytes(self) -> ~[u8] {
568-
self.into_owned().into_bytes()
569-
}
570-
#[inline]
571589
fn container_as_str<'b>(&'b self) -> Option<&'b str> {
572590
Some(self.as_slice())
573591
}

0 commit comments

Comments
 (0)