Skip to content

Commit e2e7548

Browse files
committed
auto merge of rust-lang#13477 : Manishearth/rust/newattr, r=brson
See rust-lang#13476
2 parents 5dd94d8 + d0aed09 commit e2e7548

8 files changed

+28
-28
lines changed

src/doc/guide-macros.md

+1-1
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) => (

src/doc/guide-pointers.md

+1-1
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.

src/doc/guide-testing.md

+2-2
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

src/doc/guide-unsafe.md

+8-8
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 {

src/doc/po/ja/rust.md.po

+1-1
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)]"

src/doc/po/ja/tutorial.md.po

+6-6
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

src/doc/rustdoc.md

+2-2
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,

src/doc/tutorial.md

+7-7
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.

0 commit comments

Comments
 (0)