Commit graph

5020 commits

Author SHA1 Message Date
Pietro Albini
888a0348fb
Rollup merge of #54281 - GuillaumeGomez:search-box, r=QuietMisdreavus
Search box

Follow up of #54244.

r? @QuietMisdreavus

<img width="1440" alt="screen shot 2018-09-16 at 21 23 05" src="https://user-images.githubusercontent.com/3050060/45600056-cbf93380-b9f6-11e8-904a-d76ddbc5ed69.png">
2018-09-25 22:34:39 +02:00
bors
4141a4079e Auto merge of #53542 - alexreg:impl-trait-in-bindings, r=cramertj
`impl trait` in bindings (feature: impl-trait-existential-types)

This PR enables `impl Trait` syntax (opaque types) to be used in bindings, e.g.

* `let foo: impl Clone = 1;`
* `static foo: impl Clone = 2;`
* `const foo: impl Clone = 3;`

This is part of [RFC 2071](https://github.com/rust-lang/rfcs/blob/master/text/2071-impl-trait-existential-types.md) ([tracking issue](https://github.com/rust-lang/rust/issues/34511)), but exists behind the separate feature gate `impl_trait_in_bindings`.

CC @cramertj @oli-obk @eddyb @Centril @varkor
2018-09-25 20:02:14 +00:00
bors
287187230b Auto merge of #53693 - scottmcm:marker-trait-attribute, r=nikomatsakis
Support an explicit annotation for marker traits

From the tracking issue for rust-lang/rfcs#1268:
> It seems obvious that we should make a `#[marker]` annotation. ~ https://github.com/rust-lang/rust/issues/29864#issuecomment-368959441

This PR allows you to put `#[marker]` on a trait, at which point:
- [x] The trait must not have any items ~~All of the trait's items must have defaults~~
- [x] Any impl of the trait must be empty (not override any items)
- [x] But impls of the trait are allowed to overlap

r? @nikomatsakis
2018-09-25 03:42:46 +00:00
Alexander Regueiro
16cf404f98 Added section to Unstable Book. 2018-09-25 03:09:47 +01:00
Sylvestre Ledru
5139865af1
and llvm has https now 2018-09-23 08:27:39 +02:00
Sylvestre Ledru
d14db1165a
The project moved under the Mozilla umbrella 2018-09-23 08:26:34 +02:00
bors
af50e3822c Auto merge of #54457 - pietroalbini:rollup, r=pietroalbini
Rollup of 16 pull requests

Successful merges:

 - #53652 (define copy_within on slices)
 - #54261 (Make `dyn` a keyword in the 2018 edition)
 - #54280 (remove (more) CAS API from Atomic* types where not natively supported)
 - #54323 (rustbuild: drop color handling)
 - #54350 (Support specifying edition in doc test)
 - #54370 (Improve handling of type bounds in `bit_set.rs`.)
 - #54371 (add -Zui-testing to rustdoc)
 - #54374 (Make 'proc_macro::MultiSpan' public.)
 - #54402 (Use no_default_libraries for all NetBSD flavors)
 - #54409 (Detect `for _ in in bar {}` typo)
 - #54412 (add applicability to span_suggestion call)
 - #54413 (Add UI test for deref recursion limit printing twice)
 - #54415 (parser: Tweak function parameter parsing to avoid rollback on succesfull path)
 - #54420 (Compress `Liveness` data some more.)
 - #54422 (Simplify slice's first(_mut) and last(_mut) with get)
 - #54446 (Unify christianpoveda's emails)

Failed merges:

 - #54058 (Introduce the partition_dedup/by/by_key methods for slices)

r? @ghost
2018-09-22 14:26:15 +00:00
Pietro Albini
23636e3f99
Rollup merge of #54350 - Munksgaard:support-edition-in-doc-test, r=steveklabnik
Support specifying edition in doc test

Fixes #52623

r? @QuietMisdreavus
2018-09-22 09:56:30 +02:00
Eduard-Mihai Burtescu
fa2c246384 Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions. 2018-09-22 09:26:40 +03:00
Philip Munksgaard
06b197582e Add documentation about the edition flag 2018-09-20 08:36:07 +02:00
Philip Munksgaard
ac8d8d71fa Add test for doctest edition support 2018-09-20 08:36:07 +02:00
Scott McMurray
3932249249 Add marker_trait_attr to the unstable book 2018-09-19 22:41:07 -07:00
steveklabnik
e3d0d0f5ed Update The Book to latest
Let's check out https://github.com/rust-lang/book/pull/1505 on nightly
2018-09-18 16:52:47 -04:00
Guillaume Gomez
6a4e7bb968
Rollup merge of #54311 - frewsxcv:frewsxcv-readme, r=GuillaumeGomez
Remove README with now-out-of-date docs about docs.

These docs haven't really been touched in years, and from what I tried, the `rustdoc` commands don't work. Seems like we don't need this?
2018-09-18 10:21:42 +02:00
Corey Farwell
ff617943e9 Remove REAMDE with now-out-of-date docs about docs. 2018-09-17 20:11:29 -04:00
Guillaume Gomez
9d5ca397c7 Improve search box display 2018-09-17 22:17:06 +02:00
Guillaume Gomez
8b1e5e1f01
Rollup merge of #54244 - kzys:search-box, r=GuillaumeGomez
Add a small search box to seach Rust's standary library

This change partially addresses #14572. No CSS doesn't look fancy
but at least it is functional.
2018-09-16 12:25:46 +02:00
Kazuyoshi Kato
d63fd46929 Add a small search box to seach Rust's standary library
This change partially addresses #14572. No CSS doesn't look fancy
but at least it is functional.
2018-09-14 23:28:32 -07:00
F001
2157958b27 introduce SelfCtor 2018-09-13 12:27:29 +08:00
F001
a489169912 implement feature tuple_struct_self_ctor 2018-09-13 10:57:28 +08:00
bors
6810f5286b Auto merge of #53793 - toidiu:ak-stabalize, r=nikomatsakis
stabilize outlives requirements

https://github.com/rust-lang/rust/issues/44493

r? @nikomatsakis
2018-09-12 11:27:48 +00:00
kennytm
61fe064a30
Rollup merge of #54073 - behnam:docs-1, r=frewsxcv
docs: Use dollar sign for all bash prompts

Making it consistent across the board, as most of them already use `$`.

Also split one continues bash run into two, to make it easier see
different runs: one with warning and another with error.
2018-09-12 12:17:32 +08:00
toidiu
731f4efae5 stabalize infer outlives requirements (RFC 2093).
Co-authored-by: nikomatsakis
2018-09-11 11:40:04 -04:00
bors
7ee72070bd Auto merge of #51363 - japaric:stable-used, r=cramertj
stabilize #[used]

closes #40289

RFC for stabilization: rust-lang/rfcs#2386

r? @Centril

Where should this be documented? Currently the documentation is in the unstable book
2018-09-11 08:54:11 +00:00
Jorge Aparicio
f4148a6adb remove #[used] from the unstable book
it'll be documented in the reference
2018-09-09 15:55:59 +02:00
Behnam Esfahbod
88fe8acd89 docs: Use dollar sign for all bash prompts
Making it consistent across the board, as most of them already use `$`.

Also split one continues bash run into two, to make it easier see
different runs: one with warning and another with error.
2018-09-08 21:22:00 -07:00
Mark Rousskov
4d1ec81811 Stabilize the 2018 edition 2018-09-09 02:28:13 +02:00
kennytm
0b58d2d4e1
Rollup merge of #54040 - steveklabnik:update-books, r=Mark-Simulacrum
update books for next release
2018-09-08 18:27:15 +08:00
steveklabnik
de6a61110c update books for next release 2018-09-07 15:30:35 -04:00
kennytm
1805f3c2fb
Rollup merge of #53550 - brson:recurring, r=estebank
librustc_lint: In recursion warning, change 'recurring' to 'recursing'

The existing wording seems incorrect.

Aside: This warning, 'function cannot return without recursing' is not perfectly clear - it implies that the function _can_ return, it's just got to recurse. But really the fn cannot return period. Clearer wording: 'function recurses infinitely; it cannot return'; or 'function is infinitely self-recursive; it cannot return, and this is probably an error'. I like that.
2018-09-07 15:26:40 +08:00
John Renner
e5ed105716 Document #[test_case] and #![test_runner] 2018-09-04 22:33:11 -07:00
kennytm
d0f8cf32b3
Rollup merge of #53076 - QuietMisdreavus:cfg-rustdoc, r=GuillaumeGomez
set cfg(rustdoc) when rustdoc is running on a crate

When using `#[doc(cfg)]` to document platform-specific items, it's a little cumbersome to get all the platforms' items to appear all at once. For example, the standard library adds `--cfg dox` to rustdoc's command line whenever it builds docs, and the documentation for `#![feature(doc_cfg)]` suggests using a Cargo feature to approximate the same thing. This is a little awkward, because you always need to remember to set `--features dox` whenever you build documentation.

This PR proposes making rustdoc set `#[cfg(rustdoc)]` whenever it runs on a crate, to provide an officially-sanctioned version of this that is set automatically. This way, there's a standardized way to declare that a certain version of an item is specifically when building docs.

To try to prevent the spread of this feature from happening too quickly, this PR also restricts the use of this flag to whenever `#![feature(doc_cfg)]` is active. I'm sure there are other uses for this, but right now i'm tying it to this feature. (If it makes more sense to give this its own feature, i can easily do that.)
2018-09-01 23:18:41 +08:00
QuietMisdreavus
d7e496f442 feature(doc_cfg): add docs for cfg(rustdoc) 2018-08-31 13:29:10 -05:00
bors
aaa170bebe Auto merge of #51384 - QuietMisdreavus:extern-version, r=GuillaumeGomez
rustdoc: add flag to control the html_root_url of dependencies

The `--extern-html-root-url` flag in this PR allows one to override links to crates whose docs are not already available locally in the doc bundle. Docs.rs currently uses a version of this to make sure links to other crates go into that crate's docs.rs page. See the included test for intended use, but the idea is as follows:

Calling rustdoc with `--extern-html-root-url crate=https://some-url.com` will cause rustdoc to override links that point to that crate to instead be replaced with a link rooted at `https://some-url.com/`. (e.g. for docs.rs this would be `https://docs.rs/crate/0.1.0` or the like.) Cheekily, rustup could use these options to redirect links to std/core/etc to instead point to locally-downloaded docs, if it so desired.

Fixes https://github.com/rust-lang/rust/issues/19603
2018-08-31 17:39:28 +00:00
bors
691638582a Auto merge of #53619 - japaric:panic-handler, r=SimonSapin
add #[panic_handler]; deprecate #[panic_implementation]

r? @SimonSapin
cc #44489
2018-08-26 04:02:19 +00:00
bors
727eabd681 Auto merge of #53662 - kennytm:rollup, r=kennytm
Rollup of 16 pull requests

Successful merges:

 - #53311 (Window Mutex: Document that we properly initialize the SRWLock)
 - #53503 (Discourage overuse of mem::forget)
 - #53545 (Fix #50865: ICE on impl-trait returning functions reaching private items)
 - #53559 (add macro check for lint)
 - #53562 (Lament the invincibility of the Turbofish)
 - #53563 (use String::new() instead of String::from(""), "".to_string(), "".to_owned() or "".into())
 - #53592 (docs: minor stylistic changes to str/string docs)
 - #53594 (Update RELEASES.md to include clippy-preview)
 - #53600 (Fix a grammatical mistake in "expected generic arguments" errors)
 - #53614 (update nomicon and book)
 - #53617 (tidy: Stop requiring a license header)
 - #53618 (Add missing fmt examples)
 - #53636 (Prefer `.nth(n)` over `.skip(n).next()`.)
 - #53644 (Use SmallVec for SmallCStr)
 - #53664 (Remove unnecessary closure in rustc_mir/build/mod.rs)
 - #53666 (Added rustc_codegen_llvm to compiler documentation.)
2018-08-24 17:02:23 +00:00
kennytm
ff4500c389
Rollup merge of #53614 - RalfJung:nomicon, r=kennytm
update nomicon and book
2018-08-24 19:24:38 +08:00
Sergio Benitez
ed0bd38cac Stabilize 'attr_literals' feature. 2018-08-23 19:06:07 -07:00
Jorge Aparicio
40a38b0164 update the unstable book 2018-08-23 21:44:45 +02:00
bors
35bf1ae257 Auto merge of #52602 - scottmcm:tryblock-expr, r=nikomatsakis
Implement try block expressions

I noticed that `try` wasn't a keyword yet in Rust 2018, so...

~~Fix​es https://github.com/rust-lang/rust/issues/52604~~ That was fixed by PR https://github.com/rust-lang/rust/pull/53135
cc https://github.com/rust-lang/rust/issues/31436 https://github.com/rust-lang/rust/issues/50412
2018-08-23 11:46:24 +00:00
Vadim Petrochenkov
b34503e60e Stabilize a few secondary macro features
`tool_attributes`, `proc_macro_path_invoc`, partially `proc_macro_gen`
2018-08-23 01:13:17 +03:00
Ralf Jung
276253e66a update nomicon and book 2018-08-22 21:17:58 +02:00
kennytm
b5519db323
Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkor
Fix typos found by codespell.
2018-08-21 17:51:49 +08:00
Brian Anderson
f4d6362518 librustc_lint: In recursion warning, change 'recurring' to 'recursing' 2018-08-20 23:09:15 -07:00
Scott McMurray
9f683bed3d Rename catch_expr feature to try_blocks 2018-08-19 16:53:43 -07:00
Scott McMurray
ef198867a7 Fix the unstable book
I ignored the code block as I didn't see a way to run the doctest in 2018 -- I noticed the edition guide is also not testing its 2018 code snippits.
2018-08-19 16:53:41 -07:00
Jakub Kozlowski
00920c0024 Stabilize macro_vis_matcher 2018-08-19 17:08:00 +01:00
Matthias Krüger
71120ef1e5 Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
Masaki Hara
a0c422a752 Remove a now-unnecessary paragraph.
The paragraph described a case where we can't optimize away repetitive
dynamic stack allocation. However, as arielb1 pointed out, it can
actually optimizable by dynamically delaying the stack unwinding.
2018-08-19 08:07:33 +09:00
Masaki Hara
438edc3d5e Update the unstable book regarding [e; dyn n]. 2018-08-19 08:07:33 +09:00
Masaki Hara
c72e87e30a Add an unstable-book article about unsized_locals. 2018-08-19 08:07:33 +09:00
bors
33b923fd44 Auto merge of #53324 - alexreg:self_in_typedefs, r=eddyb
`Self` in type definitions (self_in_typedefs)

This implements the [`self_in_typedefs` feature](https://github.com/rust-lang/rfcs/blob/master/text/2300-self-in-typedefs.md) ([tracking issue 49303](https://github.com/rust-lang/rust/issues/49303)).

r? @eddyb

CC @Centril
2018-08-18 19:34:24 +00:00
Alexander Regueiro
4e7d3f5a5e Added page for feature to unstable book. 2018-08-18 18:56:31 +01:00
Eduard-Mihai Burtescu
9b1d3c70ac rustc_resolve: don't allow paths starting with ::crate. 2018-08-17 12:59:56 +03:00
kennytm
6e98ed9650
Rollup merge of #53395 - varkor:__Nonexhaustive-to-non_exhaustive, r=shepmaster
Use #[non_exhaustive] on internal enums

This replaces `__Nonexhaustive` variants (and variants thereof)  with `#[non_exhaustive]`. These were mostly unstable previously, with the exception of the `cloudabi` enums and `Level` in proc_macro: these were `#[doc(hidden)]`, so clearly intended not to be used directly. It should be safe to replace all of these.
2018-08-17 00:13:26 +08:00
varkor
27f2a8420f Remove outdated Unstable Book sections 2018-08-15 17:56:53 +01:00
Esteban Küber
d35e2677fc review comment 2018-08-13 12:57:21 -07:00
Esteban Küber
54e11c96a6 Extend documentation of rustc_on_unimplemented 2018-08-11 15:01:06 -07:00
Pietro Albini
8b31f00401
Rollup merge of #52831 - dsciarra:rm-ref-to-author-file, r=alexcrichton
remove references to AUTHORS.txt file

Rust does not ship an AUTHORS.txt file anymore.
2018-08-01 10:12:47 +02:00
bors
4fbd4a55f7 Auto merge of #52863 - steveklabnik:update-books, r=Mark-Simulacrum
update books for new release

r? @Mark-Simulacrum
2018-07-31 03:30:47 +00:00
steveklabnik
7a8693861e update books for new release 2018-07-30 11:09:48 -04:00
Donato Sciarra
c57deb923e Remove references to AUTHORS.txt file
Refer instead to thanks page.
2018-07-30 07:47:12 +02:00
bors
26e73dabeb Auto merge of #52711 - eddyb:unsized-manuallydrop, r=nikomatsakis
Change ManuallyDrop<T> to a lang item.

This PR implements the approach @RalfJung proposes in https://internals.rust-lang.org/t/pre-rfc-unions-drop-types-and-manuallydrop/8025 (lang item `struct` instead of `union`).

A followup PR can easily solve #47034 as well, by just adding a few `?Sized` to `libcore/mem.rs`.

r? @nikomatsakis
2018-07-28 14:26:16 +00:00
Ralf Jung
4e6aea1a10 uodate reference again to hopefully fix all link issues 2018-07-27 18:40:47 +02:00
toidiu
130e3ab31b add section in book 2018-07-27 10:18:06 -04:00
Ralf Jung
c9eef35429 update reference to fix links 2018-07-27 13:38:20 +02:00
mark
63c2d06a0d update nightly book 2018-07-23 21:54:43 -05:00
Eric Huss
3074c42bfe Fix links in rustdoc book.
Due to a change in how mdbook generates section anchors, headers
with non-alphabetic characters now start with "a".
2018-07-18 21:10:25 -07:00
kennytm
a07f213974
Rollup merge of #52338 - RalfJung:miri, r=oli-obk
update miri
2018-07-17 19:24:50 +08:00
Alex Crichton
65f3007fa8 rustc: Stabilize much of the proc_macro feature
This commit stabilizes some of the `proc_macro` language feature as well as a
number of APIs in the `proc_macro` crate as [previously discussed][1]. This
means that on stable Rust you can now define custom procedural macros which
operate as attributes attached to items or `macro_rules!`-like bang-style
invocations. This extends the suite of currently stable procedural macros,
custom derives, with custom attributes and custom bang macros.

Note though that despite the stabilization in this commit procedural macros are
still not usable on stable Rust. To stabilize that we'll need to stabilize at
least part of the `use_extern_macros` feature. Currently you can define a
procedural macro attribute but you can't import it to call it!

A summary of the changes made in this PR (as well as the various consequences)
is:

* The `proc_macro` language and library features are now stable.
* Other APIs not stabilized in the `proc_macro` crate are now named under a
  different feature, such as `proc_macro_diagnostic` or `proc_macro_span`.
* A few checks in resolution for `proc_macro` being enabled have switched over
  to `use_extern_macros` being enabled. This means that code using
  `#![feature(proc_macro)]` today will likely need to move to
  `#![feature(use_extern_macros)]`.

It's intended that this PR, once landed, will be followed up with an attempt to
stabilize a small slice of `use_extern_macros` just for procedural macros to
make this feature 100% usable on stable.

[1]: https://internals.rust-lang.org/t/help-stabilize-a-subset-of-macros-2-0/7252
2018-07-16 07:58:06 -07:00
Ralf Jung
21a179649f update nomicon 2018-07-16 16:36:32 +02:00
eonil
d61540ed0b Update lint plugin sample code. 2018-07-14 21:23:31 +07:00
bors
3ea16c3493 Auto merge of #52018 - flip1995:rfc2103, r=oli-obk
Implementation of tool lints.

Tracking issue: #44690
2018-07-06 18:03:46 +00:00
bors
afaa406465 Auto merge of #51803 - lucasem:rustdoc-code-hash-escape, r=GuillaumeGomez
rustdoc codeblock hash escape

So that docstring text such as the following (in a code block) can be created ergonomically:

```rust
let s = "
    foo
    # bar
    baz
";
```

Such code in a docstring hide the <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> line.

Previously, using two consecutive hashes <code>&nbsp;&nbsp;&nbsp;&nbsp;## bar</code> would turn the line into _shown_ `# bar`, losing the leading whitespace. A line of code like <code>&nbsp;&nbsp;&nbsp;&nbsp;# bar</code> (such as in the example above) **could not be represented** in the docstring text.

This commit makes the two consecutive hashes not also trim the leading whitespace — the two hashes simply **escape** into a single hash and do not hide the line, leaving the rest of that line unaffected. The new docstring text to achieve the above code block is:

```rust
/// ```
/// let s = "
///     foo
///     ## bar
///     baz
/// ";
/// ```
```
2018-07-04 20:21:01 +00:00
Lucas Morales
ff2ff2b2b8
rustdoc book on codeblock hash escaping 2018-07-04 12:41:45 -04:00
flip1995
a9634fcd01
Unstable book documentation of tool lints 2018-07-04 12:16:46 +02:00
bors
309fd8a6fb Auto merge of #49469 - Nokel81:allow-irrefutable-let-patterns, r=nikomatsakis
Implementation of RFC 2086 - Allow Irrefutable Let patterns

This is the set of changes for RFC2086. Tracking issue #44495. Rendered [here](https://github.com/rust-lang/rfcs/pull/2086)
2018-06-26 09:20:33 +00:00
Niko Matsakis
91680347a7
make the while let loop terminate 2018-06-25 17:33:49 -04:00
kennytm
8ef9e2c260
Rollup merge of #51158 - ogham:patch-1, r=steveklabnik
Mention spec and indented blocks in doctest docs

Fixes #49717.

This commit adds a new section to the Documentation Test docs, which briefly mentions indented code blocks, and links to the CommonMark specification for both.

I’m not sure about saying "fenced code blocks the more popular choice in the Rust community” because it seems like I’m speaking for everyone, but I can’t think of a better way to phrase it!
2018-06-22 16:50:39 +08:00
Mark Simulacrum
deaba27861 Update books for next release 2018-06-18 10:34:48 -06:00
QuietMisdreavus
db113f5319 rustdoc: add --extern-html-root-url flag 2018-06-12 15:19:21 -05:00
Niko Matsakis
d6f13c0e20 update wording, do not change parser 2018-06-12 14:49:17 -04:00
Simon Sapin
e2aef92c19 Stabilize #[repr(transparent)]
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318
Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-12 06:49:07 +02:00
Simon Sapin
b2d526cc8c Mark alloc_jemalloc as perma-unstable 2018-06-11 13:48:57 -07:00
Simon Sapin
a24924f683 Move Unstable Book sections for #[global_allocator] and System to std::alloc docs 2018-06-11 13:48:57 -07:00
Simon Sapin
fd6e08a1e6 Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
Mike Hommey
f6ab74b8e7 Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAlloc 2018-06-11 13:47:23 -07:00
Guillaume Gomez
861c7cb9fd Stabilize entry-or-default 2018-06-10 12:59:12 +02:00
Niko Matsakis
92d4ae2be2 rename irrefutable_let_pattern to irrefutable_let_patterns 2018-06-08 11:37:35 -04:00
Mark Simulacrum
1225faf1a4
Rollup merge of #51183 - teiesti:rustdoc-book-termination, r=steveklabnik
Update rustdoc book to suggest using Termination trait instead of hidden ‘foo’ function

Closes #50721.

I suggest that someone double-checks my English since I am not a native speaker.

r? @steveklabnik
2018-06-05 08:33:45 -06:00
Mark Simulacrum
bcba3b9968
Rollup merge of #50852 - mandeep:fix-rustdoc-example-testing, r=GuillaumeGomez
Add doc comment to hiding portions of code example

fixes #50816

Not sure if this is all that's needed, but I think it's a good start. One thing to note is that the code block is a text block where it could possibly be a rust block.
2018-06-05 08:33:43 -06:00
Sebastian Malton
4fe40635ef Implementation of RFC 2086 - Allow Irrefutable Let patterns 2018-06-05 10:19:21 -04:00
Tobias Stolzmann
089da06cc4
Improve wording 2018-06-05 12:03:54 +02:00
Tobias Stolzmann
63885f7f72
Update rustdoc book to suggest using Termination trait instead of hidden ‘foo’ function 2018-06-05 12:03:50 +02:00
Jorge Aparicio
63f18e108a s/panic_fmt/panic_impl/g in docs 2018-06-03 13:46:19 +02:00
Benjamin Sago
8f8a7b9a7b
Phrasing tweak in doctest docs 2018-05-29 16:04:37 +02:00
Benjamin Sago
9fcc61bf9f
Mention spec and indented blocks in doctest docs
This commit adds a new section to the Documentation Test docs, which briefly mentions indented code blocks, and links to the CommonMark specification for both.

I’m not sure about saying "fenced code blocks the more popular choice in the Rust community” because it seems like I’m speaking for everyone, but I can’t think of a better way to phrase it!
2018-05-29 11:31:14 +02:00
bors
f0805a4421 Auto merge of #51066 - est31:master, r=sfackler
Point to the current box syntax tracking issue

The issue was used for both box syntax as well as placement new.
It got closed due to placement new being unapproved.
So a new one got created for box syntax, yet neither
the unstable book nor feature_gate.rs got updated.
We are doing this now.

r? @aidanhs
2018-05-27 00:54:12 +00:00
est31
20ab8841b1 Point to the current box syntax tracking issue
The issue was used for both box syntax as well as placement new.
It got closed due to placement new being unapproved.
So a new one got created for box syntax, yet neither
the unstable book nor feature_gate.rs got updated.
We are doing this now.
2018-05-26 19:27:21 +02:00
Vadim Petrochenkov
1e4269cb83 Add Ident::as_str helper 2018-05-26 15:20:23 +03:00
bors
49a97ef010 Auto merge of #50070 - toidiu:ak-2093-outlives, r=nikomatsakis
2093 infer outlives requirements

Tracking issue:  #44493
RFC: https://github.com/rust-lang/rfcs/pull/2093

- [x] add `rustc_attrs` flag
- [x] use `RequirePredicates` type
- [x]  handle explicit predicates on `dyn` Trait
- [x] handle explicit predicates on projections
- [x] more tests
- [x]  remove `unused`, `dead_code` and etc..
- [x]  documentation
2018-05-26 01:09:02 +00:00
toidiu
3da712381d Implement outlives requirements inference for dyn and projections.
Add tests, documentation and attr for feature.
2018-05-25 09:58:00 -04:00
Vadim Petrochenkov
e60eaf59df Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
steveklabnik
292be70f9d build the 2018 edition 2018-05-22 11:30:15 -04:00
kennytm
974396b991
Rollup merge of #50858 - robinkrahl:rustdoc-fix-order, r=steveklabnik
Reorder description for snippets in rustdoc documentation

The example code snippets for the `no_run` and `compile_fail` attributes in the rustdoc documentation were followed by the description for the wrong attribute.  This patch reorders the descriptions to match the code snippets.
2018-05-20 04:16:08 +08:00
bors
ef8ee64774 Auto merge of #50760 - petrochenkov:legimp, r=nikomatsakis
Turn deprecation lint `legacy_imports` into a hard error

Closes https://github.com/rust-lang/rust/issues/38260

The lint was introduced in Dec 2016, then made deny-by-default in Jun 2017 when crater run found 0 regressions caused by it.

This lint requires some not entirely trivial amount of import resolution logic that (surprisingly or not) interacts with `feature(use_extern_macros)` (https://github.com/rust-lang/rust/issues/35896), so it would be desirable to remove it before stabilizing `use_extern_macros`.
In particular, this PR fixes the failing example in https://github.com/rust-lang/rust/issues/50725 (but not the whole issue, `use std::panic::{self}` still can cause other undesirable errors when `use_extern_macros` is enabled).
2018-05-19 12:16:50 +00:00
mandeep
8d74cf8705 Add println statement to rendered code block example 2018-05-18 10:06:38 -05:00
mandeep
6dc824257a Add doc comment to hiding portions of code example
Refactor hiding example to be more complete
2018-05-18 10:06:38 -05:00
Robin Krahl
cf1f0385a8
Reorder description for snippets in rustdoc documentation
The example code snippets for the `no_run` and `compile_fail` attributes
in the rustdoc documentation were followed by the description for the
wrong attribute.  This patch reorders the descriptions to match the code
snippets.
2018-05-18 14:12:25 +02:00
Mark Simulacrum
faa1f21298
Rollup merge of #50839 - glassresistor:master, r=steveklabnik
Make sure people know the book is free oline

I've used the tutorial a number of times to relearn rust basics.  When i saw this for a moment I was sad thinking it had been taken offline.
2018-05-17 13:51:30 -06:00
Mark Simulacrum
c95267e3a1
Rollup merge of #50791 - bstrie:null, r=QuietMisdreavus
Fix null exclusions in grammar docs

The grammar documentation incorrectly says that comments, character literals,
and string literals may not include null.
2018-05-17 13:51:25 -06:00
Mark Simulacrum
77a4296b07
Rollup merge of #50790 - bstrie:grammar, r=steveklabnik
Fix grammar documentation wrt Unicode identifiers

The grammar defines identifiers in terms of XID_start and XID_continue,
but this is referring to the unstable non_ascii_idents feature.
The documentation implies that non_ascii_idents is forthcoming, but this
is left over from pre-1.0 documentation; in reality, non_ascii_idents
has been without even an RFC for several years now, and will not be
stabilized anytime soon. Furthermore, according to the tracking issue at
https://github.com/rust-lang/rust/issues/28979 , it's highly
questionable whether or not this feature will use XID_start or
XID_continue even when or if non_ascii_idents is stabilized.
This commit fixes this by respecifying identifiers as the usual
[a-zA-Z_][a-zA-Z0-9_]*
2018-05-17 13:51:24 -06:00
Mikela
cfa26da963
Update tutorial.md 2018-05-17 12:25:24 -07:00
Mikela
ec0d946b28
Make sure people know the book is free oline 2018-05-17 09:49:28 -07:00
Irina Popa
b63d7e2b1c Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
bstrie
ab4735e2ea Null exclusions in grammar docs
The grammar documentation incorrectly says that comments, character literals,
and string literals may not include null.
2018-05-16 01:16:01 +00:00
bstrie
ce0b7cc529 Fix grammar documentation wrt Unicode identifiers
The grammar defines identifiers in terms of XID_start and XID_continue,
but this is referring to the unstable non_ascii_idents feature.
The documentation implies that non_ascii_idents is forthcoming, but this
is left over from pre-1.0 documentation; in reality, non_ascii_idents
has been without even an RFC for several years now, and will not be
stabilized anytime soon. Furthermore, according to the tracking issue at
https://github.com/rust-lang/rust/issues/28979 , it's highly
questionable whether or not this feature will use XID_start or
XID_continue even when or if non_ascii_idents is stabilized.
This commit fixes this by respecifying identifiers as the usual
[a-zA-Z_][a-zA-Z0-9_]*
2018-05-16 00:56:56 +00:00
Guillaume Gomez
30c0b56e8f
Rollup merge of #50594 - sanxiyn:man-print, r=steveklabnik
Update the man page with additional --print options

`\:` is a `groff` for `<wbr>` to get better line breaking.
2018-05-15 14:26:56 +02:00
Vadim Petrochenkov
d1b027421e Turn deprecation lint legacy_imports into a hard error 2018-05-15 02:25:04 +03:00
Alex Burka
394945ee36 stabilize :lifetime 2018-05-13 19:51:32 +00:00
Dan Aloni
37ed2ab910 Macros: Add a 'literal' fragment specifier
Implements RFC 1576.

See: https://github.com/rust-lang/rfcs/blob/master/text/1576-macros-literal-matcher.md

Changes are mostly in libsyntax, docs, and tests. Feature gate is
enabled for 1.27.0.

Many thanks to Vadim Petrochenkov for following through code reviews
and suggestions.

Example:

````rust

macro_rules! test_literal {
    ($l:literal) => {
        println!("literal: {}", $l);
    };
    ($e:expr) => {
        println!("expr: {}", $e);
    };
}

fn main() {
    let a = 1;
    test_literal!(a);
    test_literal!(2);
    test_literal!(-3);
}
```

Output:

```
expr: 1
literal: 2
literal: -3
```
2018-05-13 19:17:02 +03:00
Seo Sanghyeon
37783563ed Update the man page with additional --print options 2018-05-10 12:11:47 +09:00
bors
295d98069f Auto merge of #50390 - hdhoang:46205_deny_by_default, r=nikomatsakis
lint: deny incoherent_fundamental_impls by default

Warn the ecosystem of the pending intent-to-disallow in #49799.

There are 4 ICEs on my machine, look unrelated (having happened before in https://github.com/rust-lang/rust/issues/49146#issuecomment-384473523)

```rust
thread 'main' panicked at 'assertion failed: position <= slice.len()', libserialize/leb128.rs:97:1
```

```
    [run-pass] run-pass/allocator/xcrate-use2.rs
    [run-pass] run-pass/issue-12133-3.rs
    [run-pass] run-pass/issue-32518.rs
    [run-pass] run-pass/trait-default-method-xc-2.rs
```

r? @nikomatsakis
2018-05-08 04:56:01 +00:00
Corey Farwell
7364d26921 Update books for the next release. 2018-05-05 19:02:13 -04:00
Hoàng Đức Hiếu
cabbe50c55 ignore erroneous example 2018-05-03 08:17:21 +07:00
Hoàng Đức Hiếu
8e4072cb4b fix error text 2018-05-03 08:16:34 +07:00
Hoàng Đức Hiếu
2fce5b34f6 doc: move incoherent_fundamental_impls to deny-by-default listing 2018-05-03 07:52:36 +07:00
Seiichi Uchida
8ad2d21a9c
Add tool_attributes feature to unstable book 2018-05-02 11:48:11 +02:00
bors
357bf00f1c Auto merge of #48925 - zackmdavis:fn_must_stabilize, r=nikomatsakis
stabilize `#[must_use]` for functions and must-use comparison operators (RFC 1940)

r? @nikomatsakis
2018-04-30 22:02:33 +00:00
bors
4745092d60 Auto merge of #50163 - kornelski:error, r=Kimundi
Bury Error::description()

Second attempt of #49536 https://github.com/rust-lang/rfcs/pull/2230

The exact wording of the default implementation is still up in the air, but I think it's a detail that can be amended later.
2018-04-30 15:17:01 +00:00
Zack M. Davis
3dbdccc6a9 stabilize #[must_use] for functions and must-use operators
This is in the matter of RFC 1940 and tracking issue #43302.
2018-04-28 20:32:49 -07:00
kennytm
d403d82b0a
Rollup merge of #49707 - steveklabnik:rustc-book, r=QuietMisdreavus
Add "the Rustc book"

This PR introduces a new book into the documentation, "The rustc book". We already have books for Cargo, and for Rustdoc, rustc should have some too. This book is focused on *users* of rustc, and provides a nice place to write documentation for users.

I haven't put content here, but plan on scaffolding it out very soon, and wanted this PR open for a few discussions first. One of those is "what exactly should said TOC be?" I plan on having a proposed one up tomorrow, but figured I'd let people know to start thinking about it now.

The big one is that we also will want to put https://github.com/rust-lang-nursery/rustc-guide in-tree as well, and the naming is... tough. I'm proposing:

* doc.rust-lang.org/rustc is "The Rustc book", to mirror the other tools' books.
* doc.rust-lang.org/rustc-contribution is "The Rustc contribution guide", and contains that book

@nikomatsakis et al, any thoughts on this? I'm not attached to it in particular, but had to put something together to get this discussion going. I think mirroring the other tools is a good idea for this work, but am not sure where exactly that leaves yours.

Fixes https://github.com/rust-docs/team/issues/11
2018-04-27 14:16:42 +08:00
Kornel
1912f39e7c Update book submodule to pass linkchecker test 2018-04-25 21:56:06 +01:00
steveklabnik
36475d947b more nits 2018-04-24 12:21:08 -04:00
steveklabnik
ac79c41edc review nits 2018-04-23 11:58:11 -04:00
Guillaume Gomez
1ed3e77b8a Add doc about doc alias feature 2018-04-22 00:30:48 +02:00
tinaun
edc412c5a9 stabilize slice_rsplit feature 2018-04-17 00:48:23 -04:00
kennytm
932431ceda
Rollup merge of #49994 - frewsxcv:frewsxcv-doc-tests, r=QuietMisdreavus
Remove unnecessary indentation in rustdoc book codeblock.

None
2018-04-17 03:34:34 +08:00
steveklabnik
00c860e8a9 write docs for targets 2018-04-16 12:57:16 -04:00
steveklabnik
b204968239 fill out contributing 2018-04-16 12:57:09 -04:00
steveklabnik
cd3f6cf3fe fill out command line arguments 2018-04-16 12:57:01 -04:00
Corey Farwell
afa22d63d7 Remove unnecessary indentation in rustdoc book codeblock. 2018-04-16 16:25:57 +09:00
bors
3e70dfd655 Auto merge of #49956 - QuietMisdreavus:rustdoc-codegen, r=GuillaumeGomez
rustdoc: port the -C option from rustc

Blocked on https://github.com/rust-lang/rust/pull/49864. The included test won't work without those changes, so this PR includes those commits as well.

When documenting items that require certain target features, it helps to be able to force those target features into existence. Rather than include a flag just to parse those features, i instead decided to port the `-C` flag from rustc in its entirety. It takes the same parameters, because it runs through the same parsing function. This has the added benefit of being able to control the codegen of doctests as well.

One concern i have with the flag is that i set it to stable here. My rationale is that it is a direct port of functionality on rustc that is currently stable, used only in mechanisms that it is originally used for. If needed, i can set it back to be unstable.
2018-04-16 05:00:14 +00:00
Mike Hommey
4c8e9b9751 Replace remaining uses of deprecated std::heap with std::alloc 2018-04-14 16:47:38 +09:00
QuietMisdreavus
a5456bdd87 add -C to the rustdoc book 2018-04-13 16:21:27 -05:00
Simon Sapin
f607a3872a Rename alloc::Void to alloc::Opaque 2018-04-12 22:53:22 +02:00
Mike Hommey
fddf51ee0b Use NonNull<Void> instead of *mut u8 in the Alloc trait
Fixes #49608
2018-04-12 22:53:22 +02:00
Simon Sapin
86753ce1cc Use the GlobalAlloc trait for #[global_allocator] 2018-04-12 22:53:12 +02:00
bors
252a459d37 Auto merge of #49371 - scottmcm:catch-wrapping, r=nikomatsakis
Add ok-wrapping to catch blocks, per RFC

Updates the `catch{}` lowering to wrap the result in `Try::from_ok`.

r? @nikomatsakis

Fixes #41414
Fixes #43818
2018-04-12 05:38:49 +00:00
bors
47778811d9 Auto merge of #48528 - bitshifter:repr_packed, r=eddyb
Implementation of `#[repr(packed(n))]` RFC 1399.

Tracking issue https://github.com/rust-lang/rust/issues/33158.
2018-04-12 03:08:14 +00:00
Simon Sapin
b2027ef17c Deprecate the std_unicode crate 2018-04-12 00:13:51 +02:00
Cameron Hart
15d1c4d213 Implementation of #[repr(packed(n))] RFC 1399. 2018-04-11 22:13:13 +10:00
Scott McMurray
c88efe46b8 Fix the unstable book to account for ok-wrapping 2018-04-10 20:03:40 -07:00
steveklabnik
cb6a19925a add codegen options section 2018-04-10 16:35:28 -04:00
steveklabnik
142c52f4a3 fix tests 2018-04-09 14:04:58 -04:00
steveklabnik
758a77d46c more lints 2018-04-09 14:04:58 -04:00
steveklabnik
df81ca3764 document deny by default lints 2018-04-09 14:04:58 -04:00
steveklabnik
50b3a3d121 add a lot of text about lints 2018-04-09 14:04:58 -04:00
steveklabnik
78b076dadb add targets to TOC 2018-04-09 14:04:58 -04:00
steveklabnik
cd55364248 write 'what is rustc' 2018-04-09 14:04:58 -04:00
steveklabnik
5424dc46b7 write headings for command line arguments 2018-04-09 14:04:57 -04:00
steveklabnik
4f6ed513d1 fix authorship in book.toml 2018-04-09 14:04:57 -04:00
steveklabnik
c942bf42fc Add a TOC 2018-04-09 14:04:57 -04:00
steveklabnik
7de5b6034d update doc index to link to the rustc book 2018-04-09 14:04:57 -04:00
steveklabnik
0dd0a5bc03 initialize the rustc book 2018-04-09 14:04:10 -04:00
Pulkit Goyal
ee880b96ae Using X headings instead of 0.X #49739 2018-04-07 00:42:47 +05:30
kennytm
d6f19b676f
Rollup merge of #49628 - steveklabnik:learn-use-master, r=QuietMisdreavus
Re-write the documentation index

The docs team has decided that we're framing resources in three ways:
"learning Rust," "using Rust," "mastering Rust." This is a more useful
split than "beginner/intermediate/advanced." As we add more resources
in the future, we expect "using Rust" to grow. "the bookshelf" as a
concept is great, but isn't really organized along these lines. As such,
this reorganizes the docs along these lines.
2018-04-05 02:17:02 +08:00
steveklabnik
77b570f831 Re-write the documentation index
The docs team has decided that we're framing resources in three ways:
"learning Rust," "using Rust," "mastering Rust." This is a more useful
split than "beginner/intermediate/advanced." As we add more resources
in the future, we expect "using Rust" to grow. "the bookshelf" as a
concept is great, but isn't really organized along these lines. As such,
this reorganizes the docs along these lines.
2018-04-03 15:58:15 -04:00
Thayne McCombs
e75c6a741e Remove splice page from unstable book. 2018-04-02 19:41:22 -06:00
Mark Simulacrum
5d3916d566
Rollup merge of #49451 - QuietMisdreavus:epoch-doctests, r=GuillaumeGomez
rustdoc: add an --edition flag to compile docs/doctests with a certain edition

To correspond with the 2018 edition, this adds a (currently unstable) `--edition` flag to rustdoc that makes it compile crates and doctests with the given edition. Once this lands, Cargo should be updated to pass this flag when the edition configuration option is given.
2018-04-01 18:04:54 +02:00
kennytm
eb3e2feb0d
Rollup merge of #49445 - GuillaumeGomez:light-theme, r=QuietMisdreavus
Rename main theme into light theme

r? @QuietMisdreavus
2018-03-30 01:31:12 +02:00
Guillaume Gomez
772a8028ff Rename main theme into light theme 2018-03-29 13:45:56 +02:00
bors
d52c44ea8d Auto merge of #49460 - kennytm:rollup, r=kennytm
Rollup of 12 pull requests

- Successful merges: #49243, #49329, #49364, #49400, #49405, #49427, #49428, #49429, #49439, #49442, #49444, #49452
- Failed merges:
2018-03-28 22:18:13 +00:00
kennytm
43f56ce131
Rollup merge of #49243 - murarth:stabilize-retain, r=BurntSushi
Stabilize method `String::retain`

Closes #43874
2018-03-28 17:55:05 +02:00
Taylor Cramer
3c65f53620 Stabilize match_default_bindings
This includes a submodule update to rustfmt
in order to allow a stable feature declaration.
2018-03-28 11:13:13 +02:00
QuietMisdreavus
a0e48dde7c talk about --edition in the Rustdoc Book 2018-03-27 16:36:15 +02:00
Mark Mansi
07104692d5 Fix missed i128 feature gates 2018-03-26 08:37:56 -05:00
Mark Mansi
a249d25625 Rename unstable book correctly 2018-03-26 08:37:56 -05:00
Mark Mansi
a89d1d0b02 Rename unstable-book chapter 2018-03-26 08:37:56 -05:00
Mark Mansi
db7d9ea480 Stabilize i128 feature too 2018-03-26 08:37:56 -05:00
Mark Mansi
33d9d8e0c6 Update nightly book 2018-03-26 08:36:50 -05:00
Taylor Cramer
0f5b52e4a8 Stabilize conservative_impl_trait 2018-03-26 10:43:03 +02:00
Taylor Cramer
c393db67ba Stabilize universal_impl_trait 2018-03-26 07:39:38 +02:00
kennytm
54544515ce
Rollup merge of #49318 - steveklabnik:update-books, r=kennytm
update books for next release
2018-03-25 01:26:48 +08:00
kennytm
e2b89221f1
Rollup merge of #49194 - Zoxc:unsafe-generator, r=cramertj
Make resuming generators unsafe instead of the creation of immovable generators

cc @withoutboats

Fixes #47787
2018-03-25 01:26:34 +08:00
steveklabnik
36322d00df update books for next release 2018-03-24 15:31:02 +01:00
Alex Crichton
f74d01cf29 Rollup merge of #49028 - QuietMisdreavus:the-dark-forbidden-corners-of-rustdoc, r=frewsxcv
add an "unstable features" chapter to the rustdoc book

There are several rustdoc features that currently are undocumented, but also don't fit with the rest of the Rustdoc Book since they're also unstable. Some of these have corresponding feature gates and chapters in the Unstable Book, but many don't, and i wanted a place to talk about them officially.

Goal: talk about everything rustdoc can do that needs nightly

- [x] Feature gates (extensions to the doc attribute that can be caught by the compiler)
  - [x] doc(cfg)
  - [x] doc(masked)
  - [x] doc(spotlight)
  - [x] doc(include)
- [x] Command-line flags (features that require a CLI flag to use, where the flag itself is a `-Z` command or otherwise requires `-Z unstable-options` before rustdoc will accept it)
  - [x] markdown-before-content/markdown-after-content
  - [x] playground-url
  - [x] display-warnings
  - [x] crate-version
  - [x] linker
  - [x] sort-modules-by-appearance
  - [x] themes/theme-checker
  - [x] resource-suffix
  - [x] `-Z force-unstable-if-unmarked`
- [x] Nightly-gated functionality (features that are gated by requiring a nightly build without needing a CLI flag or a feature gate to unlock)
  - [x] intra-links
  - [x] error numbers for `compile_fail` doctests
2018-03-23 10:16:08 -07:00
Murarth
7c442e5c9b Stabilize method String::retain 2018-03-21 15:36:50 -07:00
QuietMisdreavus
b996f9d60f review comments 2018-03-21 09:52:18 -05:00
John Kåre Alsaker
57896abc38 Make resuming generators unsafe instead of the creation of immovable generators. Fixes #47787 2018-03-21 00:09:58 +01:00
QuietMisdreavus
83e9f395d1 talk about force-unstable-if-unmarked 2018-03-20 11:23:48 -05:00
QuietMisdreavus
5e93394d32 talk about --display-warnings 2018-03-20 11:18:42 -05:00
Vadim Petrochenkov
7c90189e13 Stabilize slice patterns without ..
Merge `feature(advanced_slice_patterns)` into `feature(slice_patterns)`
2018-03-20 02:27:40 +03:00
QuietMisdreavus
b5ab5ceb4b talk about --resource-suffix 2018-03-16 15:06:36 -05:00
QuietMisdreavus
6b2906018f talk about --themes and --theme-checker 2018-03-16 14:41:51 -05:00
QuietMisdreavus
cc4f97e883 talk about --sort-modules-by-appearance 2018-03-16 14:30:56 -05:00
QuietMisdreavus
33ed787b49 talk about --linker 2018-03-16 13:46:10 -05:00
QuietMisdreavus
f9d3845138 talk about --crate-version 2018-03-16 13:38:06 -05:00
bors
36b6687318 Auto merge of #49051 - kennytm:rollup, r=kennytm
Rollup of 17 pull requests

- Successful merges: #48706, #48875, #48892, #48922, #48957, #48959, #48961, #48965, #49007, #49024, #49042, #49050, #48853, #48990, #49037, #49049, #48972
- Failed merges:
2018-03-16 00:09:14 +00:00
QuietMisdreavus
5d8443aeb1 talk about --playground-url 2018-03-15 14:44:17 -05:00