about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2017-09-20Sanity check the Expr visitation countJohn Kåre Alsaker-0/+20
2017-09-20Only consider yields coming after the expressions when computing generator ↵John Kåre Alsaker-33/+85
interiors
2017-09-20Fix HIR printing of yieldJohn Kåre Alsaker-1/+1
2017-09-20Auto merge of #44355 - Xaeroxe:optimize_drain_filter, r=alexcrichtonbors-1/+7
Optimize drain_filter This PR cuts out two copies from each iteration of `drain_filter` by exchanging the swap operation for a copy_nonoverlapping function call instead. Since the data being swapped is not needed anymore we can just overwrite it instead.
2017-09-20Auto merge of #44350 - GuillaumeGomez:id-false-positive, r=QuietMisdreavusbors-24/+44
Improve how rustdoc warnings are displayed cc @rust-lang/dev-tools r? @nrc
2017-09-19Auto merge of #44505 - nikomatsakis:lotsa-comments, r=steveklabnikbors-1757/+2571
rework the README.md for rustc and add other readmes OK, so, long ago I committed to the idea of trying to write some high-level documentation for rustc. This has proved to be much harder for me to get done than I thought it would! This PR is far from as complete as I had hoped, but I wanted to open it so that people can give me feedback on the conventions that it establishes. If this seems like a good way forward, we can land it and I will open an issue with a good check-list of things to write (and try to take down some of them myself). Here are the conventions I established on which I would like feedback. **Use README.md files**. First off, I'm aiming to keep most of the high-level docs in `README.md` files, rather than entries on forge. My thought is that such files are (a) more discoverable than forge and (b) closer to the code, and hence can be edited in a single PR. However, since they are not *in the code*, they will naturally get out of date, so the intention is to focus on the highest-level details, which are least likely to bitrot. I've included a few examples of common functions and so forth, but never tried to (e.g.) exhaustively list the names of functions and so forth. - I would like to use the tidy scripts to try and check that these do not go out of date. Future work. **librustc/README.md as the main entrypoint.** This seems like the most natural place people will look first. It lays out how the crates are structured and **is intended** to give pointers to the main data structures of the compiler (I didn't update that yet; the existing material is terribly dated). **A glossary listing abbreviations and things.** It's much harder to read code if you don't know what some obscure set of letters like `infcx` stands for. **Major modules each have their own README.md that documents the high-level idea.** For example, I wrote some stuff about `hir` and `ty`. Both of them have many missing topics, but I think that is roughly the level of depth that would be good. The idea is to give people a "feeling" for what the code does. What is missing primarily here is lots of content. =) Here are some things I'd like to see: - A description of what a QUERY is and how to define one - Some comments for `librustc/ty/maps.rs` - An overview of how compilation proceeds now (i.e., the hybrid demand-driven and forward model) and how we would like to see it going in the future (all demand-driven) - Some coverage of how incremental will work under red-green - An updated list of the major IRs in use of the compiler (AST, HIR, TypeckTables, MIR) and major bits of interesting code (typeck, borrowck, etc) - More advice on how to use `x.py`, or at least pointers to that - Good choice for `config.toml` - How to use `RUST_LOG` and other debugging flags (e.g., `-Zverbose`, `-Ztreat-err-as-bug`) - Helpful conventions for `debug!` statement formatting cc @rust-lang/compiler @mgattozzi
2017-09-19Improve how warnings are displayedGuillaume Gomez-24/+44
2017-09-19incorporate suggestions from arielb1Niko Matsakis-2/+4
2017-09-19start writing some typeck docs (incomplete)Niko Matsakis-44/+63
2017-09-19define spanNiko Matsakis-0/+6
2017-09-19revamp the Compiler Process section to be more up to dateNiko Matsakis-116/+74
2017-09-19split maps into submodules, documentNiko Matsakis-1117/+1521
2017-09-19Auto merge of #44620 - zackmdavis:rfc_1940_housekeeping, r=nikomatsakisbors-53/+130
RFC 1940 housekeeping * move test to own directory, as requested in https://github.com/rust-lang/rust/issues/43302#issuecomment-329579185 * exercise trait methods in test * unstable book section r? @nikomatsakis
2017-09-19promote maps into its own directoryNiko Matsakis-0/+0
2017-09-19apply various nitsNiko Matsakis-43/+46
2017-09-19rework the README.md for rustc and add other readmesNiko Matsakis-46/+468
This takes way longer than I thought it would. =)
2017-09-19Auto merge of #44601 - alexcrichton:lower-attributes-in-hir, r=nrcbors-91/+143
rustc: Forbid interpolated tokens in the HIR Right now the HIR contains raw `syntax::ast::Attribute` structure but nowadays these can contain arbitrary tokens. One variant of the `Token` enum is an "interpolated" token which basically means to shove all the tokens for a nonterminal in this position. A "nonterminal" in this case is roughly analagous to a macro argument: macro_rules! foo { ($a:expr) => { // $a is a nonterminal as an expression } } Currently nonterminals contain namely items and expressions, and this poses a problem for incremental compilation! With incremental we want a stable hash of all HIR items, but this means we may transitively need a stable hash *of the entire AST*, which is certainly not stable w/ node ids and whatnot. Hence today there's a "bug" where the "stable hash" of an AST is just the raw hash value of the AST, and this only arises with interpolated nonterminals. The downside of this approach, however, is that a bunch of errors get spewed out during compilation about how this isn't a great idea. This PR is focused at fixing these warnings, basically deleting them from the compiler. The implementation here is to alter attributes as they're lowered from the AST to HIR, expanding all nonterminals in-place as we see them. This code for expanding a nonterminal to a token stream already exists for the `proc_macro` crate, so we basically just reuse the same implementation there. After this PR it's considered a bug to have an `Interpolated` token and hence the stable hash implementation simply uses `bug!` in this location. Closes #40946
2017-09-19Auto merge of #44026 - QuietMisdreavus:trimmed-std, r=steveklabnikbors-18/+111
hide internal types/traits from std docs via new #[doc(masked)] attribute Fixes #43701 (hopefully for good this time) This PR introduces a new parameter to the `#[doc]` attribute that rustdoc looks for on `extern crate` statements. When it sees `#[doc(masked)]` on such a statement, it hides traits and types from that crate from appearing in either the "Trait Implementations" section of many type pages, or the "Implementors" section of trait pages. This is then applied to the `libc`/`rand`/`compiler_builtins` imports in libstd to prevent those crates from creating broken links in the std docs. Like in #43348, this also introduces a feature gate, `doc_masked`, that controls the use of this parameter. To view the std docs generated with this change, head to https://tonberry.quietmisdreavus.net/std-43701/std/index.html.
2017-09-18rustc: Forbid interpolated tokens in the HIRAlex Crichton-91/+143
Right now the HIR contains raw `syntax::ast::Attribute` structure but nowadays these can contain arbitrary tokens. One variant of the `Token` enum is an "interpolated" token which basically means to shove all the tokens for a nonterminal in this position. A "nonterminal" in this case is roughly analagous to a macro argument: macro_rules! foo { ($a:expr) => { // $a is a nonterminal as an expression } } Currently nonterminals contain namely items and expressions, and this poses a problem for incremental compilation! With incremental we want a stable hash of all HIR items, but this means we may transitively need a stable hash *of the entire AST*, which is certainly not stable w/ node ids and whatnot. Hence today there's a "bug" where the "stable hash" of an AST is just the raw hash value of the AST, and this only arises with interpolated nonterminals. The downside of this approach, however, is that a bunch of errors get spewed out during compilation about how this isn't a great idea. This PR is focused at fixing these warnings, basically deleting them from the compiler. The implementation here is to alter attributes as they're lowered from the AST to HIR, expanding all nonterminals in-place as we see them. This code for expanding a nonterminal to a token stream already exists for the `proc_macro` crate, so we basically just reuse the same implementation there. After this PR it's considered a bug to have an `Interpolated` token and hence the stable hash implementation simply uses `bug!` in this location. Closes #40946
2017-09-18Auto merge of #44680 - infinity0:master, r=Mark-Simulacrumbors-8/+18
rustbuild: with --no-fail-fast, report the specific commands that failed I'm not sure this is the most elegant way of doing it, I'm still a bit of a rust noob. I tried `Vec<Command>` and keeping `Cell` instead of `RefCell` but couldn't fight my way past the borrow errors, this was the first arrangement that I could make work.
2017-09-18rustbuild: with --no-fail-fast, report the specific commands that failedXimin Luo-8/+18
2017-09-18Add requested commentJacob Kiesel-0/+3
2017-09-18Rollup merge of #44671 - GuillaumeGomez:run-button, r=steveklabnikAlex Crichton-0/+5
Fix run button r? @QuietMisdreavus Before: ![before](https://user-images.githubusercontent.com/3050060/30538927-612c6a44-9c70-11e7-9ca2-f3860d880b95.png) After: ![after](https://user-images.githubusercontent.com/3050060/30538929-6416ea0e-9c70-11e7-990a-7e4fbf5d7319.png) Quite urgent.
2017-09-18Rollup merge of #44668 - iwillspeak:into-iterator-docs, r=steveklabnikAlex Crichton-0/+17
Add Example of `IntoIterator` as Trait Bound to Docs Part of #44600.
2017-09-18Rollup merge of #44661 - GuillaumeGomez:more-links, r=QuietMisdreavusAlex Crichton-5/+15
Add more links and put the link character to the left r? @QuietMisdreavus And of course, a few screenshots: <img width="1440" alt="screen shot 2017-09-17 at 22 08 46" src="https://user-images.githubusercontent.com/3050060/30524496-44a50208-9bf5-11e7-942e-a3707ba125c3.png"> <img width="1440" alt="screen shot 2017-09-17 at 22 09 47" src="https://user-images.githubusercontent.com/3050060/30524502-49068dbc-9bf5-11e7-8e59-ec38664e0e0f.png"> <img width="1440" alt="screen shot 2017-09-17 at 22 10 56" src="https://user-images.githubusercontent.com/3050060/30524503-491c8c34-9bf5-11e7-9ce5-f1bd5ef8600b.png">
2017-09-18Rollup merge of #44657 - Ixrec:patch-1, r=eddybAlex Crichton-4/+4
Replace str's transmute() calls with pointer casts After the following conversation in #rust-lang: ``` [14:43:50] <Ixrec> TIL the implementation of from_utf_unchecked is literally just "mem::transmute(x)" [14:43:59] <Ixrec> no wonder people keep saying transmute is overpowered [15:15:30] <eddyb> Ixrec: it should be a pointer cast lol [15:15:46] <eddyb> unless it doesn't let you [16:50:34] <Ixrec> https://play.rust-lang.org/?gist=d1e6b629ad9ec1baf64ce261c63845e6&version=stable seems like it does let me [16:52:35] <eddyb> Ixrec: yeah that's the preferred impl [16:52:46] <eddyb> Ixrec: it just wasn't in 1.0 [16:52:50] <eddyb> IIRC [16:53:00] <eddyb> (something something fat pointers) ``` Since I already wrote half of the preferred impls in the playground, might as well make an actual PR.
2017-09-18Rollup merge of #44651 - bluss:document-thread-name-no-nuls, r=steveklabnikAlex Crichton-0/+7
Document thread builder panics for nul bytes in thread names This seems to have been undocumented. Mention this where the name is set (Builder::name) and where the panic could happen (Builder::spawn). Thread::new is private and I think the builder is the only user where this matters. A short comment was added to "document" Thread::new too.
2017-09-18Rollup merge of #44640 - budziq:stabilize_splice, r=dtolnayAlex Crichton-14/+12
Stabilized vec_splice and modified splice tracking issue This stabilizes the vec_splice (Vec part of splice RFC) Fixes #32310.
2017-09-18Rollup merge of #44548 - oyvindln:rustc_help_fix, r=arielb1Alex Crichton-3/+3
Add proper help line for `-C inline threshold` Looks like someone accidentally some words when adding this. This also remove a period on a different help line for consistency, as no options have a period.
2017-09-18Rollup merge of #44537 - oli-obk:memchr, r=alexcrichtonAlex Crichton-41/+80
More `align_offset` things cc #44488
2017-09-18Rollup merge of #44466 - clarcharr:cow_error, r=alexcrichtonAlex Crichton-0/+15
Add Cow<str> -> Box<Error> impls. Considering how impls exist for `String` and `&str`, it makes sense to also add an impl for `Cow<str>` as well. This would allow converting `String::from_utf8_lossy` directly into a `Box<Error>` or `io::Error` without having to add an extra `into_ownd()`.
2017-09-18Rollup merge of #44364 - michaelwoerister:hash-all-the-things2, r=nikomatsakisAlex Crichton-731/+1827
incr.comp.: Compute fingerprint for all query results. This PR enables query result fingerprinting in incremental mode. This is an essential piece of infrastructure for red/green tracking. We don't do anything with the fingerprints yet but merging the infrastructure should protect it from bit-rotting and will make it easier to start measuring its performance impact (and thus let us determine if we should switch to a faster hashing algorithm rather sooner than later). Note, this PR also includes the changes from https://github.com/rust-lang/rust/pull/43887 which I'm therefore closing. No need to re-review the first commit though. r? @nikomatsakis
2017-09-18Fix run buttonGuillaume Gomez-0/+5
2017-09-18incr.comp.: Fix ICE caused by trying to hash INVALID_CRATE_NUM.Michael Woerister-19/+16
2017-09-18incr.comp.: Fix rebase fallout.Michael Woerister-31/+138
2017-09-18incr.comp.: Remove tcx from StableHashingContext.Michael Woerister-277/+300
2017-09-18incr.comp.: Make the StableHashingContext mostly independent of the tcx.Michael Woerister-39/+61
2017-09-18incr.comp.: Initialize IGNORED_ATTRS in StableHashingContext lazily.Michael Woerister-10/+21
2017-09-18incr.comp.: Initialize the CachingCodemapView in StableHashingContext lazily.Michael Woerister-9/+21
2017-09-18incr.comp.: Use StableHash impls instead of functions for hashing most maps.Michael Woerister-247/+118
2017-09-18incr.comp.: Already hash HIR bodies during metadata export so they don't ↵Michael Woerister-55/+163
have to be hashed in downstream crates.
2017-09-18Fix issues uncovered by rebasing:Michael Woerister-237/+328
- Don't hash traits in scope as part of HIR hashing any more. - Some queries returned DefIndexes from other crates. - Provide a generic way of stably hashing maps (not used everywhere yet).
2017-09-18incr.comp.: Move result fingerprinting to DepGraph::with_task().Michael Woerister-37/+130
This makes sure that we don't introduce strange cases where we have nodes outside the query system that could break red/green tracking and it will allow to keep red/green neatly encapsulated within the DepGraph implementation.
2017-09-18incr.comp.: Compute hashes of all query results.Michael Woerister-84/+828
2017-09-18Use DefId instead of NodeId as identifier in resolve_lifetime::Region.Michael Woerister-35/+52
These Region values end up in crate metadata so they should not use NodeId.
2017-09-18Auto merge of #44441 - tamird:cargo-bitflags, r=alexcrichtonbors-650/+193
Remove rustc_bitflags; use the bitflags crate r? @alexcrichton
2017-09-18Add Example of `IntoIterator` as Trait Bound to DocsWill Speak-0/+17
Part of #44600.
2017-09-18Auto merge of #43628 - oli-obk:orbital_standard_library, r=alexcrichtonbors-45/+335
Run the miri test suite on the aux builder and travis Reopen of #38350 see https://github.com/rust-lang/rust/pull/43340#issuecomment-316940762 for earlier discussion Rationale for running miri's test suite in rustc's CI is that miri currently contains many features that we want in const eval in the future, and these features would break if the test suite is not run. fixes #44077 r? @nikomatsakis cc @eddyb
2017-09-17Auto merge of #44529 - alexcrichton:trans-query, r=michaelwoeristerbors-1247/+1452
Refactor translation unit partitioning/collection as a query This commit is targeted at #44486 with the ultimate goal of making the `collect_and_partition_translation_items` function a query. This mostly just involved query-ifying a few other systems along with plumbing the tcx instead of `SharedCrateContext` in a few locations. Currently this only tackles the first bullet of #44486 and doesn't add a dedicated query for a particular codegen unit. I wasn't quite sure how to do that yet but figured this was good to put up. Closes #44486
2017-09-17Add more links and put the link character to the leftGuillaume Gomez-5/+15