Skip to content

Commit 25305c2

Browse files
committed
---
yaml --- r: 111009 b: refs/heads/snap-stage3 c: 168b2d1 h: refs/heads/master i: 111007: ae9f097 v: v3
1 parent b195b08 commit 25305c2

File tree

505 files changed

+1321
-979
lines changed

Some content is hidden

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

505 files changed

+1321
-979
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: e163ab215105753fd4e9b60a3786ff4636a0c3ff
4+
refs/heads/snap-stage3: 168b2d1a3f4569706fe4f9a2baee04e37f85d297
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/etc/generate-deriving-span-tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
3838
// This file was auto-generated using 'src/etc/generate-keyword-span-tests.py'
3939
40-
#[feature(struct_variant)];
40+
#![feature(struct_variant)]
4141
extern crate rand;
4242
4343
{error_deriving}

branches/snap-stage3/src/etc/unicode.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -411,8 +411,8 @@ def emit_decomp_module(f, canon, compat, combine):
411411
412412
// The following code was generated by "src/etc/unicode.py"
413413
414-
#[allow(missing_doc)];
415-
#[allow(non_uppercase_statics)];
414+
#![allow(missing_doc)]
415+
#![allow(non_uppercase_statics)]
416416
417417
''')
418418

branches/snap-stage3/src/librustc/front/std_inject.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
126126
fn fold_crate(&mut self, krate: ast::Crate) -> ast::Crate {
127127
if !no_prelude(krate.attrs.as_slice()) {
128128
// only add `use std::prelude::*;` if there wasn't a
129-
// `#[no_implicit_prelude];` at the crate level.
129+
// `#![no_implicit_prelude]` at the crate level.
130130
ast::Crate {
131131
module: self.fold_mod(&krate.module),
132132
..krate
@@ -138,7 +138,7 @@ impl<'a> fold::Folder for PreludeInjector<'a> {
138138

139139
fn fold_item(&mut self, item: @ast::Item) -> SmallVector<@ast::Item> {
140140
if !no_prelude(item.attrs.as_slice()) {
141-
// only recur if there wasn't `#[no_implicit_prelude];`
141+
// only recur if there wasn't `#![no_implicit_prelude]`
142142
// on this item, i.e. this means that the prelude is not
143143
// implicitly imported though the whole subtree
144144
fold::noop_fold_item(item, self)

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/librustc/middle/typeck/check/regionmanip.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-
// #[warn(deprecated_mode)];
11+
// #![warn(deprecated_mode)]
1212

1313
use middle::ty;
1414
use middle::ty_fold;

branches/snap-stage3/src/librustc/middle/typeck/check/vtable.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,17 @@ fn lookup_vtable(vcx: &VtableContext,
242242
// bounds to see if they include the trait we are looking for.
243243
let vtable_opt = match ty::get(ty).sty {
244244
ty::ty_param(param_ty {idx: n, ..}) => {
245-
let type_param_bounds: &[@ty::TraitRef] =
246-
vcx.param_env
247-
.type_param_bounds
248-
.get(n)
249-
.trait_bounds
250-
.as_slice();
251-
lookup_vtable_from_bounds(vcx, span,
252-
type_param_bounds,
253-
param_numbered(n),
254-
trait_ref)
245+
let env_bounds = &vcx.param_env.type_param_bounds;
246+
if env_bounds.len() > n {
247+
let type_param_bounds: &[@ty::TraitRef] =
248+
env_bounds.get(n).trait_bounds.as_slice();
249+
lookup_vtable_from_bounds(vcx, span,
250+
type_param_bounds,
251+
param_numbered(n),
252+
trait_ref)
253+
} else {
254+
None
255+
}
255256
}
256257

257258
ty::ty_self(_) => {

branches/snap-stage3/src/librustc/util/ppaux.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,8 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> ~str {
341341
ty_bot => ~"!",
342342
ty_bool => ~"bool",
343343
ty_char => ~"char",
344-
ty_int(ast::TyI) => ~"int",
345-
ty_int(t) => ast_util::int_ty_to_str(t),
346-
ty_uint(ast::TyU) => ~"uint",
347-
ty_uint(t) => ast_util::uint_ty_to_str(t),
344+
ty_int(t) => ast_util::int_ty_to_str(t, None),
345+
ty_uint(t) => ast_util::uint_ty_to_str(t, None),
348346
ty_float(t) => ast_util::float_ty_to_str(t),
349347
ty_box(typ) => ~"@" + ty_to_str(cx, typ),
350348
ty_uniq(typ) => ~"~" + ty_to_str(cx, typ),
@@ -367,8 +365,9 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> ~str {
367365
ty_param(param_ty {idx: id, def_id: did}) => {
368366
let ident = match cx.ty_param_defs.borrow().find(&did.node) {
369367
Some(def) => token::get_ident(def.ident).get().to_str(),
370-
// This should not happen...
371-
None => format!("BUG[{:?}]", id)
368+
// This can only happen when a type mismatch error happens and
369+
// the actual type has more type parameters than the expected one.
370+
None => format!("<generic \\#{}>", id)
372371
};
373372
if !cx.sess.verbose() {
374373
ident

0 commit comments

Comments
 (0)