about summary refs log tree commit diff
path: root/src/doc
AgeCommit message (Collapse)AuthorLines
2019-10-13Rollup merge of #65039 - HeroicKatora:deny-by-default-book, r=GuillaumeGomezMazdak Farrokhzad-0/+25
Document missing deny by default lints
2019-10-12Auto merge of #64873 - popzxc:prettify-test-time, r=wesleywiserbors-0/+80
Enhance report-time option ## Short overview This PR is a follow-up to a previously closed #64714 PR. ## Changes introduced by this PR * `libtest` now retrieves the type of the test within `TestDesc` (available types are: `UnitTest`, `IntegrationTest`, `DocTest`, `Unknown`). * `--report-time` subcommand of the `libtest` now supports colored output (disabled by default). * Colorized output depends on the threshold values. Default values (proposed by @wesleywiser): - For unit-tests: 50ms warn/100ms critical, - For integration-tests: 500ms warn/1000ms critical, - For doctests: same as for integration tests, - For unknown tests: `TEST_WARN_TIMEOUT_S` warn/ `TEST_WARN_TIMEOUT_S * 2` critical (it will only applied single-threaded mode, because otherwise test will be interrupted after reaching `TEST_WARN_TIMEOUT_S`). - These values can be overrided by setting environment variables (since those thresholds are somewhat constant for every project, it's more flexible to use environment variables than command line arguments). * New optional flag `--ensure-test-time` for `libtest`. With this flag applied, exectuion time limit excesss will cause test failure. ## What have not been done There was a comment that it would be nice to have an entry in the Cargo book about it. However, changes introduced by this PR (and #64663 in which `report-time` flag was added) aren't related directly to `cargo`, it's more about `libtest` itself. I'm considering that [The Unstable Book](https://doc.rust-lang.org/unstable-book/) is more appropriate place, but not sure if I'm right (and if so, how exactly it should be described). As one possible option, this PR may be merged without denoting it in the documentation, and in the next PR adding support of this feature to the `cargo` itself, I'll add a note in the Cargo book. ## Scope of this PR Logical scope of this PR is `libtest` only. However, to get test types, I had to modify also `libsyntax_ext` and `librustdoc` for them to provide information about test type. ## Rationale Rationale for colored output was submitted in #64714 Providing the information about kind of test was also proposed in #64714, and as an additional benefit this information may be useful for the tools using `libtest` (e.g. `cargo`). Adding flag to treat time limits excess seems logical to me, so projects that do care about test execution time won't have to invent a wheel. ## Backward compatibility All the changes are completely backward compatible. ## Demo ![rustc_enhanced_time](https://user-images.githubusercontent.com/12111581/65818381-c04f6800-e219-11e9-9875-322463abe24f.gif) r? @wesleywiser
2019-10-09Move unstable book entry into compiler flags directoryIgor Aleksanov-0/+0
2019-10-09Add an entry to the unstable bookIgor Aleksanov-0/+80
2019-10-07[RFC 2091] Add #[track_caller] attribute.Ayose-0/+5
- The attribute is behind a feature gate. - Error if both #[naked] and #[track_caller] are applied to the same function. - Error if #[track_caller] is applied to a non-function item. - Error if ABI is not "rust" - Error if #[track_caller] is applied to a trait function. Error codes and descriptions are pending.
2019-10-06Update referenceTyler Mandry-0/+0
- 771c5d10cf944bf7d221f5d6cb7abd2a06c400e4 Add macros in extern blocks and new proc-macro support. - 8caabd62ef5fbe99e6be6aa9e76f55bbb8433d95 Update for "modern" `meta` matcher. - 1b44947d36ccf7eba2b3bd245769eff68abf6d4d Update await desugaring after rust-lang/rust#64292
2019-10-03Document current deny by default lintsAndreas Molzer-0/+25
2019-10-02rustc book: nitpick SLP vectorizationRobin Kruppe-1/+1
SLP vectorization (in general and as implemented in LLVM) is not limited to loops.
2019-10-01Update booksEric Huss-0/+0
2019-09-30Remove legacy grammarErin Power-809/+4
2019-09-21Rollup merge of #64010 - c410-f3r:stabilize-attrs-fn, r=CentrilMazdak Farrokhzad-27/+0
Stabilize `param_attrs` in Rust 1.39.0 # Stabilization proposal I propose that we stabilize `#![feature(param_attrs)]`. Tracking issue: #60406 Version: 1.39 (2019-09-26 => beta, 2019-11-07 => stable). ## What is stabilized It is now possible to add outer attributes like `#[cfg(..)]` on formal parameters of functions, closures, and function pointer types. For example: ```rust fn len( #[cfg(windows)] slice: &[u16], #[cfg(not(windows))] slice: &[u8], ) -> usize { slice.len() } ``` ## What isn't stabilized * Documentation comments like `/// Doc` on parameters. * Code expansion of a user-defined `#[proc_macro_attribute]` macro used on parameters. * Built-in attributes other than `cfg`, `cfg_attr`, `allow`, `warn`, `deny`, and `forbid`. Currently, only the lints `unused_variables` and `unused_mut` have effect and may be controlled on parameters. ## Motivation The chief motivations for stabilizing `param_attrs` include: * Finer conditional compilation with `#[cfg(..)]` and linting control of variables. * Richer macro DSLs created by users. * External tools and compiler internals can take advantage of the additional information that the parameters provide. For more examples, see the [RFC][rfc motivation]. ## Reference guide In the grammar of function and function pointer, the grammar of variadic tails (`...`) and parameters are changed respectively from: ```rust FnParam = { pat:Pat ":" }? ty:Type; VaradicTail = "..."; ``` into: ```rust FnParam = OuterAttr* { pat:Pat ":" }? ty:Type; VaradicTail = OuterAttr* "..."; ``` The grammar of a closure parameter is changed from: ```rust ClosureParam = pat:Pat { ":" ty:Type }?; ``` into: ```rust ClosureParam = OuterAttr* pat:Pat { ":" ty:Type }?; ``` More generally, where there's a list of formal (value) parameters separated or terminated by `,` and delimited by `(` and `)`. Each parameter in that list may optionally be prefixed by `OuterAttr+`. Note that in all cases, `OuterAttr*` applies to the whole parameter and not just the pattern. This distinction matters in pretty printing and in turn for macros. ## History * On 2018-10-15, @Robbepop proposes [RFC 2565][rfc], "Attributes in formal function parameter position". * On 2019-04-30, [RFC 2565][rfc] is merged and the tracking issue is made. * On 2019-06-12, a partial implementation was completed. The implementation was done in [#60669][60669] by @c410-f3r and the PR was reviewed by @petrochenkov and @Centril. * On 2019-07-29, [#61238][61238] was fixed in [#61856][61856]. The issue fixed was that lint attributes on function args had no effect. The PR was written by @c410-f3r and reviewed by @matthewjasper, @petrochenkov, and @oli-obk. * On 2019-08-02, a bug [#63210][63210] was filed wherein the attributes on formal parameters would not be passed to macros. The issue was about forgetting to call the relevant method in `fn print_arg` in the pretty printer. In [#63212][63212], written by @Centril on 2019-08-02 and reviewed by @davidtwco, the issue aforementioned was fixed. * This PR stabilizes `param_attrs`. ## Tests * [On Rust 2018, attributes aren't permitted on function parameters without a pattern in trait definitions.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-2018.rs) * [All attributes that should be allowed. This includes `cfg`, `cfg_attr`, and lints check attributes.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-allowed.rs) * [Built-in attributes, which should be forbidden, e.g., `#[test]`, are.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-builtin-attrs.rs) * [`cfg` and `cfg_attr` are properly evaluated.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.rs) * [`unused_mut`](https://github.com/rust-lang/rust/blob/46f405ec4d7c6bf16fc2eaafe7541019f1da2996/src/test/ui/rfc-2565-param-attrs/param-attrs-cfg.rs) and [`unused_variables`](https://github.com/rust-lang/rust/blob/master/src/test/ui/lint/lint-unused-variables.rs) are correctly applied to parameter patterns. * [Pretty printing takes formal parameter attributes into account.](https://github.com/rust-lang/rust/blob/master/src/test/ui/rfc-2565-param-attrs/param-attrs-pretty.rs) ## Possible future work * Custom attributes inside function parameters aren't currently supported but it is something being worked on internally. * Since documentation comments are syntactic sugar for `#[doc(...)]`, it is possible to allow literal `/// Foo` comments on function parameters. [rfc motivation]: https://github.com/rust-lang/rfcs/blob/master/text/2565-formal-function-parameter-attributes.md#motivation [rfc]: https://github.com/rust-lang/rfcs/pull/2565 [60669]: https://github.com/rust-lang/rust/pull/60669 [61856]: https://github.com/rust-lang/rust/pull/61856 [63210]: https://github.com/rust-lang/rust/issues/63210 [61238]: https://github.com/rust-lang/rust/issues/61238 [63212]: https://github.com/rust-lang/rust/pull/63212 This report is a collaborative work with @Centril.
2019-09-18Update booksEric Huss-0/+0
2019-09-17update Nomicon and ReferenceRalf Jung-0/+0
2019-09-11Stabilize `param_attrs` in Rust 1.39.0Caio-27/+0
2019-09-10Auto merge of #60387 - Goirad:test-expansion, r=ollie27bors-0/+50
Allow cross-compiling doctests This PR allows doctest to receive a --runtool argument, as well as possibly many --runtool-arg arguments, which are then used to run cross compiled doctests. Also, functionality has been added to rustdoc to allow it to skip testing doctests on a per-target basis, in the same way that compiletest does it. For example, tagging the doctest with "ignore-sgx" disables testing on any targets that contain "sgx". A plain "ignore" still skips testing on all targets. See [here](https://github.com/rust-lang/cargo/pull/6892) for the companion PR in the cargo project that extends functionality in Cargo so that it passes the appropriate parameters to rustdoc when cross compiling and testing doctests. Part of [#6460](https://github.com/rust-lang/cargo/issues/6460)
2019-09-09update referenceRalf Jung-0/+0
2019-09-08update guidemark-0/+0
2019-09-08update rustc-guideMark Mansi-0/+0
2019-09-05Rollup merge of #64041 - matklad:token-stream-tt, r=petrochenkovMazdak Farrokhzad-3/+3
use TokenStream rather than &[TokenTree] for built-in macros That way, we don't loose the jointness info
2019-09-05Rollup merge of #64092 - michaelwoerister:update-xlto-table-rustc-book-1.37, ↵Mazdak Farrokhzad-0/+1
r=alexcrichton Update xLTO compatibility table in rustc book. This is a combination known to work reliable when building Firefox on all the major platforms. r? @alexcrichton
2019-09-04Update cargo, booksEric Huss-0/+0
2019-09-03added rustdoc book documentation, improved behavior when unstable flag not ↵Dario Gonzalez-0/+50
present
2019-09-03use TokenStream rather than &[TokenTree] for built-in macrosAleksey Kladov-3/+3
That way, we don't loose the jointness info
2019-09-02Update xLTO compatibility table in rustc book.Michael Woerister-0/+1
2019-09-01remove the unstable rustdoc parameter --linkerAndreas Jonson-13/+0
use the code generation parameter -Clinker (same parameter as rustc) to control what linker to use for building the rustdoc test executables. closes: #63816
2019-08-22Update single-use-lifetimesNaja Melan-1/+1
When using this, rustc emits a warning that the lint has been renamed (to having an 's' at the end)
2019-08-22Auto merge of #63175 - jsgf:argsfile, r=jsgfbors-0/+7
rustc: implement argsfiles for command line Many tools, such as gcc and gnu-ld, support "args files" - that is, being able to specify @file on the command line. This causes `file` to be opened and parsed for command line options. They're separated with whitespace; whitespace can be quoted with double or single quotes, and everything can be \\-escaped. Args files may recursively include other args files via `@file2`. See https://sourceware.org/binutils/docs/ld/Options.html#Options for the documentation of gnu-ld's @file parameters. This is useful for very large command lines, or when command lines are being generated into files by other tooling.
2019-08-21Auto merge of #63705 - mark-i-m:fix-guide-1, r=ehussbors-0/+0
Update rustc-guide Should fix toolstate failure r? @ehuss
2019-08-21update rustc-guideMark Mansi-0/+0
2019-08-20Update booksEric Huss-0/+0
2019-08-19rustc: implement argsfiles for command lineJeremy Fitzhardinge-0/+7
This makes `rustc` support `@path` arguments on the command line. The `path` is opened and the file is interpreted as new command line options which are logically inserted at that point in the command-line. The options in the file are one per line. The file is UTF-8 encoded, and may have either Unix or Windows line endings. It does not support recursive use of `@path`. This is useful for very large command lines, or when command-lines are being generated into files by other tooling.
2019-08-20Deprecate using rustc_plugin without the rustc_driver dylib.Simon Sapin-6/+6
CC https://github.com/rust-lang/rust/pull/59800 https://github.com/rust-lang/rust/commit/7198687bb2df13a3298ef1e8f594753073d6b9e8 Fix https://github.com/rust-lang/rust/issues/62717
2019-08-17initial implementation of or-pattern parsingDan Robertson-0/+36
Initial implementation of parsing or-patterns e.g., `Some(Foo | Bar)`. This is a partial implementation of RFC 2535.
2019-08-08Rollup merge of #63353 - ehuss:update-books, r=ehussMazdak Farrokhzad-0/+0
Update books ## nomicon 1 commits in b7f0aba2f88a8feade70595efcfa3438e54e96c0..8a7d05615e5bc0a7fb961b4919c44f5221ee54da 2019-07-11 15:11:36 -0400 to 2019-08-07 07:46:59 -0500 - s/railguard/guardrail/ (rust-lang-nursery/nomicon#156) ## reference 5 commits in 8e7d614303b0dec7492e048e63855fcd3b944ec8..b4b3536839042a6743fc76f0d9ad2a812020aeaa 2019-07-16 21:02:33 +0100 to 2019-08-07 02:29:50 +0200 - Update partially initialized values in drop documentation. (rust-lang-nursery/reference#648) - Define sound and unsound (rust-lang-nursery/reference#647) - Fix a type in the modules section: functions => modules (rust-lang-nursery/reference#645) - Fix some links. (rust-lang-nursery/reference#642) - Update recursion_limit default limit (rust-lang-nursery/reference#633) ## rust-by-example 14 commits in e3679e214d8db44586aca9b20aa27517007d1923..f2c15ba5ee89ae9469a2cf60494977749901d764 2019-07-15 11:13:44 -0300 to 2019-08-07 10:14:25 -0300 - Remove redundant semicolons (rust-lang/rust-by-example#1239) - Rename "Read Lines" chapter title (rust-lang/rust-by-example#1230) - Added space between word and inline code block in unit_testing.md (rust-lang/rust-by-example#1237) - [typo] fix unit_testing wrong output (rust-lang/rust-by-example#1210) - flow_control/match/binding.md: `...' -> `..=' (rust-lang/rust-by-example#1233) - generics/impl.md: follow rustfmt style (rust-lang/rust-by-example#1236) - freeze.md: Incorrect example (rust-lang/rust-by-example#1226) - Make `point` consistent (rust-lang/rust-by-example#1229) - Fix typo at error -> panic (rust-lang/rust-by-example#1227) - Snake didn't deserve to die 🐍 (rust-lang/rust-by-example#1228) - Reorder links in destructuring.md (rust-lang/rust-by-example#1225) - Rename variable names for consistent in iter_result.md (rust-lang/rust-by-example#1224) - Fix several shell output and code highlights. (rust-lang/rust-by-example#1222) - Add new example for Rc. (rust-lang/rust-by-example#1223) ## edition-guide 5 commits in f6c8b92d4e63edd28e862be952f33861f35956f8..e58bc4ca104e890ac56af846877c874c432a64b5 2019-07-06 22:10:32 +0200 to 2019-07-31 20:14:12 +0200 - Hide extraneous `use` in anonymous lifetime example. (rust-lang-nursery/edition-guide#190) - Attempt to clarify "no more mod.rs". (rust-lang-nursery/edition-guide#187) - Remove -preview for rustup components. (rust-lang-nursery/edition-guide#188) - rust-lang-nursery/edition-guide#184 More clear explanation and Title. (rust-lang-nursery/edition-guide#185) - More clear table headers (rust-lang-nursery/edition-guide#186) ## embedded-book 2 commits in ff334e74fdb9f197e621efa6d7c3105be892e888..c5da1e11915d3f28266168baaf55822f7e3fe999 2019-07-16 13:47:34 +0000 to 2019-08-05 23:02:10 +0000 - install/verify: fix next section link (rust-embedded/book#202) - Syst small fix (rust-embedded/book#198)
2019-08-08Rollup merge of #63334 - mark-i-m:fix-guide, r=ehussMazdak Farrokhzad-0/+0
Update to rustc-guide that passes toolstate r? @ehuss Sorry for the trouble. I've been somewhat hard to reach lately. Thanks for your help!
2019-08-07Update booksEric Huss-0/+0
2019-08-06passify tidyMark Mansi-0/+0
2019-08-06redox: convert to target_family unixJeremy Soller-5/+0
2019-08-06update to rustc-guide that passes toolstateMark Mansi-0/+0
2019-07-31Replace AstBuilder with inherent methodsMark Rousskov-8/+0
2019-07-30Auto merge of #62766 - alexcrichton:stabilize-pipelined-compilation, r=oli-obkbors-0/+33
rustc: Stabilize options for pipelined compilation This commit stabilizes options in the compiler necessary for Cargo to enable "pipelined compilation" by default. The concept of pipelined compilation, how it's implemented, and what it means for rustc are documented in #60988. This PR is coupled with a PR against Cargo (rust-lang/cargo#7143) which updates Cargo's support for pipelined compliation to rustc, and also enables support by default in Cargo. (note that the Cargo PR cannot land until this one against rustc lands). The technical changes performed here were to stabilize the functionality proposed in #60419 and #60987, the underlying pieces to enable pipelined compilation support in Cargo. The issues have had some discussion during stabilization, but the newly stabilized surface area here is: * A new `--json` flag was added to the compiler. * The `--json` flag can be passed multiple times. * The value of the `--json` flag is a comma-separated list of directives. * The `--json` flag cannot be combined with `--color` * The `--json` flag must be combined with `--error-format=json` * The acceptable list of directives to `--json` are: * `diagnostic-short` - the `rendered` field of diagnostics will have a "short" rendering matching `--error-format=short` * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics will be colorized with ansi color codes embedded in the string field * `artifacts` - JSON blobs will be emitted for artifacts being emitted by the compiler The unstable `-Z emit-artifact-notifications` and `--json-rendered` flags have also been removed during this commit as well. Closes #60419 Closes #60987 Closes #60988
2019-07-29Rollup merge of #63077 - petrochenkov:nolangfeat, r=petrochenkovMazdak Farrokhzad-0/+0
cleanup: Remove some language features related to built-in macros They are now library features. Cleanup after https://github.com/rust-lang/rust/pull/62086. The unstable book files are moved because tidy complained.
2019-07-28cleanup: Remove some language features related to built-in macrosVadim Petrochenkov-0/+0
They are now library features.
2019-07-28Update unstable book wrt. subslice patterns.Mazdak Farrokhzad-1/+1
2019-07-27Remove run-pass test suitesVadim Petrochenkov-1/+1
2019-07-26rustc: Stabilize options for pipelined compilationAlex Crichton-0/+33
This commit stabilizes options in the compiler necessary for Cargo to enable "pipelined compilation" by default. The concept of pipelined compilation, how it's implemented, and what it means for rustc are documented in #60988. This PR is coupled with a PR against Cargo (rust-lang/cargo#7143) which updates Cargo's support for pipelined compliation to rustc, and also enables support by default in Cargo. (note that the Cargo PR cannot land until this one against rustc lands). The technical changes performed here were to stabilize the functionality proposed in #60419 and #60987, the underlying pieces to enable pipelined compilation support in Cargo. The issues have had some discussion during stabilization, but the newly stabilized surface area here is: * A new `--json` flag was added to the compiler. * The `--json` flag can be passed multiple times. * The value of the `--json` flag is a comma-separated list of directives. * The `--json` flag cannot be combined with `--color` * The `--json` flag must be combined with `--error-format=json` * The acceptable list of directives to `--json` are: * `diagnostic-short` - the `rendered` field of diagnostics will have a "short" rendering matching `--error-format=short` * `diagnostic-rendered-ansi` - the `rendered` field of diagnostics will be colorized with ansi color codes embedded in the string field * `artifacts` - JSON blobs will be emitted for artifacts being emitted by the compiler The unstable `-Z emit-artifact-notifications` and `--json-rendered` flags have also been removed during this commit as well. Closes #60419 Closes #60987 Closes #60988
2019-07-25Rollup merge of #60938 - jonas-schievink:doc-include-paths, r=petrochenkovMazdak Farrokhzad-3/+2
rustdoc: make #[doc(include)] relative to the containing file This matches the behavior of other in-source paths like `#[path]` and the `include_X!` macros. Fixes https://github.com/rust-lang/rust/pull/58373#issuecomment-462349380 Also addresses https://github.com/rust-lang/rust/issues/44732#issuecomment-467660239 cc #44732 This is still missing a stdsimd change (https://github.com/jonas-schievink/stdsimd/commit/42ed30e0b5fb5e2d11765b5d1e1f36234af85984), so CI will currently fail. I'll land that change once I get initial feedback for this PR.
2019-07-23Normalize use of backticks in compiler messages for docSamy Kacimi-22/+22
https://github.com/rust-lang/rust/issues/60532
2019-07-23Adjust docs to new #[doc(include)] behaviourJonas Schievink-3/+2
2019-07-18Auto merge of #61749 - davidtwco:rfc-2203-const-array-repeat-exprs, r=eddybbors-0/+11
rustc/rustc_mir: Implement RFC 2203. This PR implements RFC 2203, allowing constants in array repeat expressions. Part of #49147. r? @eddyb