Skip to content

Commit b195b08

Browse files
committed
---
yaml --- r: 111008 b: refs/heads/snap-stage3 c: e163ab2 h: refs/heads/master v: v3
1 parent ae9f097 commit b195b08

File tree

514 files changed

+1018
-1332
lines changed

Some content is hidden

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

514 files changed

+1018
-1332
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: 246ebd2d5aebc68a581c33c33cbce5f2bc7dc7d6
4+
refs/heads/snap-stage3: e163ab215105753fd4e9b60a3786ff4636a0c3ff
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/driver/driver.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -310,10 +310,10 @@ pub fn phase_3_run_analysis_passes(sess: Session,
310310
time(time_passes, "looking for entry point", (),
311311
|_| middle::entry::find_entry_point(&sess, krate, &ast_map));
312312

313-
*sess.macro_registrar_fn.borrow_mut() =
313+
sess.macro_registrar_fn.set(
314314
time(time_passes, "looking for macro registrar", (), |_|
315315
syntax::ext::registrar::find_macro_registrar(
316-
sess.diagnostic(), krate));
316+
sess.diagnostic(), krate)));
317317

318318
let freevars = time(time_passes, "freevar finding", (), |_|
319319
freevars::annotate_freevars(def_map, krate));
@@ -1054,7 +1054,7 @@ pub fn build_session_(sopts: session::Options,
10541054
// For a library crate, this is always none
10551055
entry_fn: RefCell::new(None),
10561056
entry_type: Cell::new(None),
1057-
macro_registrar_fn: RefCell::new(None),
1057+
macro_registrar_fn: Cell::new(None),
10581058
default_sysroot: default_sysroot,
10591059
building_library: Cell::new(false),
10601060
local_crate_source_file: local_crate_source_file,

branches/snap-stage3/src/librustc/driver/session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ pub struct Session {
181181
// For a library crate, this is always none
182182
pub entry_fn: RefCell<Option<(NodeId, codemap::Span)>>,
183183
pub entry_type: Cell<Option<EntryFnType>>,
184-
pub macro_registrar_fn: RefCell<Option<ast::DefId>>,
184+
pub macro_registrar_fn: Cell<Option<ast::NodeId>>,
185185
pub default_sysroot: Option<Path>,
186186
pub building_library: Cell<bool>,
187187
// The name of the root source file of the crate, in the local file system. The path is always

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/metadata/creader.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ use back::link;
1616
use back::svh::Svh;
1717
use driver::{driver, session};
1818
use driver::session::Session;
19-
use metadata::csearch;
2019
use metadata::cstore;
2120
use metadata::cstore::CStore;
2221
use metadata::decoder;
@@ -397,13 +396,14 @@ impl<'a> Loader<'a> {
397396
impl<'a> CrateLoader for Loader<'a> {
398397
fn load_crate(&mut self, krate: &ast::ViewItem) -> MacroCrate {
399398
let info = extract_crate_info(&self.env, krate).unwrap();
400-
let (cnum, data, library) = resolve_crate(&mut self.env, &None,
401-
info.ident, &info.crate_id,
402-
None, true, krate.span);
399+
let (_, data, library) = resolve_crate(&mut self.env, &None,
400+
info.ident, &info.crate_id,
401+
None, info.should_link,
402+
krate.span);
403403
let macros = decoder::get_exported_macros(data);
404-
let cstore = &self.env.sess.cstore;
405-
let registrar = csearch::get_macro_registrar_fn(cstore, cnum)
406-
.map(|did| csearch::get_symbol(cstore, did));
404+
let registrar = decoder::get_macro_registrar_fn(data).map(|id| {
405+
decoder::get_symbol(data.data.as_slice(), id)
406+
});
407407
MacroCrate {
408408
lib: library.dylib,
409409
macros: macros.move_iter().collect(),

branches/snap-stage3/src/librustc/metadata/csearch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ pub fn get_trait_of_method(cstore: &cstore::CStore,
279279

280280
pub fn get_macro_registrar_fn(cstore: &cstore::CStore,
281281
crate_num: ast::CrateNum)
282-
-> Option<ast::DefId> {
282+
-> Option<ast::NodeId> {
283283
let cdata = cstore.get_crate_data(crate_num);
284284
decoder::get_macro_registrar_fn(cdata)
285285
}

branches/snap-stage3/src/librustc/metadata/decoder.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,9 +1235,9 @@ pub fn get_native_libraries(cdata: Cmd) -> Vec<(cstore::NativeLibaryKind, ~str)>
12351235
return result;
12361236
}
12371237

1238-
pub fn get_macro_registrar_fn(cdata: Cmd) -> Option<ast::DefId> {
1238+
pub fn get_macro_registrar_fn(cdata: Cmd) -> Option<ast::NodeId> {
12391239
reader::maybe_get_doc(reader::Doc(cdata.data()), tag_macro_registrar_fn)
1240-
.map(|doc| item_def_id(doc, cdata))
1240+
.map(|doc| FromPrimitive::from_u32(reader::doc_as_u32(doc)).unwrap())
12411241
}
12421242

12431243
pub fn get_exported_macros(cdata: Cmd) -> Vec<~str> {

branches/snap-stage3/src/librustc/metadata/encoder.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,12 +1565,8 @@ fn encode_native_libraries(ecx: &EncodeContext, ebml_w: &mut Encoder) {
15651565
}
15661566

15671567
fn encode_macro_registrar_fn(ecx: &EncodeContext, ebml_w: &mut Encoder) {
1568-
match *ecx.tcx.sess.macro_registrar_fn.borrow() {
1569-
Some(did) => {
1570-
ebml_w.start_tag(tag_macro_registrar_fn);
1571-
encode_def_id(ebml_w, did);
1572-
ebml_w.end_tag();
1573-
}
1568+
match ecx.tcx.sess.macro_registrar_fn.get() {
1569+
Some(id) => { ebml_w.wr_tagged_u32(tag_macro_registrar_fn, id); }
15741570
None => {}
15751571
}
15761572
}

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).ok().unwrap()
269+
did.encode(self).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).ok().unwrap();
281+
let did: ast::DefId = Decodable::decode(self).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).ok().unwrap();
287+
let did: ast::DefId = Decodable::decode(self).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: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,16 @@ 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 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-
}
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)
256255
}
257256

258257
ty::ty_self(_) => {

0 commit comments

Comments
 (0)