Commit Graph

76614 Commits

Author SHA1 Message Date
bors
a143462783 Auto merge of #49154 - petrochenkov:spident, r=eddyb
AST: Give spans to all identifiers

Change representation of `ast::Ident` from `{ name: Symbol, ctxt: SyntaxContext }` to `{ name: Symbol, span: Span }`.
Syntax contexts still can be extracted from spans (`span.ctxt()`).

Why this should not require more memory:
- `Span` is `u32` just like `SyntaxContext`.
- Despite keeping more spans in AST we don't actually *create* more spans, so the number of "outlined" spans kept in span interner shouldn't become larger.

Why this may be slightly slower:
- When we need to extract ctxt from an identifier instead of just field read we need to do bit field extraction possibly followed by and access by index into span interner's vector. Both operations should be fast (unless the span interner is under some synchronization) and we already do ctxt extraction from spans all the time during macro expansion, so the difference should be lost in noise.

cc https://github.com/rust-lang/rust/pull/48842#issuecomment-373365661
2018-04-06 09:32:03 +00:00
Vadim Petrochenkov
1458684279 Fix feature gating for crate/extern in paths 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
3a30bad6de Use Ident instead of Name in MetaItem 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
303298b1d5 Fix stable hash for identifiers 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
bfaf4180ae Make lifetime nonterminals closer to identifier nonterminals 2018-04-06 11:52:16 +03:00
Vadim Petrochenkov
b3b5ef186c Remove more duplicated spans 2018-04-06 11:50:49 +03:00
Vadim Petrochenkov
62000c072e Rename ast::Variant_::name into ident + Fix rebase 2018-04-06 11:48:19 +03:00
Vadim Petrochenkov
43ad972318 Use Span::apply_mark where possible 2018-04-06 11:48:19 +03:00
Vadim Petrochenkov
e2afefd80b Get rid of SpannedIdent 2018-04-06 11:48:19 +03:00
Vadim Petrochenkov
8719d1ed05 Rename PathSegment::identifier to ident 2018-04-06 11:46:26 +03:00
Vadim Petrochenkov
baae274fb7 Use Span instead of SyntaxContext in Ident 2018-04-06 11:46:26 +03:00
Tatsuyuki Ishi
4c51d47269
bootstrap: Remove the fast path
This is rarely noticed, but when you have old submodules, not updating them will cause you run into https://github.com/rust-lang/cargo/issues/4678.
2018-04-06 16:23:53 +09:00
bors
db4235c4fd Auto merge of #49293 - memoryleak47:add-compiletest-nll-compare-mode, r=pnkfelix
Add compiletest `--compare-mode nll` option

Before implementing the tidy stuff, I'd appreciate if someone reviews the changes so far.
This is my first non-trivial pull request, so I could really use some feedback. :)
closes #48879.

r? @nikomatsakis
2018-04-06 07:04:20 +00:00
Niko Matsakis
939bb32883 do not propagate Err when determing causal info
In intercrate mode, if we determine that a particular `T: Trait` is
unknowable, we sometimes also go and get extra causal information. An
errant `?` was causing us to propagate an error found in that process
out as if `T: Trait` was not unknowable but rather not provable. This
led to an ICE.
2018-04-05 20:15:23 -04:00
Niko Matsakis
40a1ee8efa
add failure-status: 1 to the test 2018-04-05 19:01:45 -04:00
Niko Matsakis
9428a3cea6 make mem-categorization use adjusted type for patterns
Fixes #49631
2018-04-05 18:26:23 -04:00
bors
48fa6f9631 Auto merge of #49696 - alexcrichton:rollup, r=alexcrichton
Rollup of 8 pull requests

Successful merges:

 - #49045 (Make queries thread safe)
 - #49350 (Expand macros in `extern {}` blocks)
 - #49497 (Chalkify - Tweak `Clause` definition and HRTBs)
 - #49597 (proc_macro: Reorganize public API)
 - #49686 (typos)
- #49621
- #49697
- #49705

Failed merges:
2018-04-05 19:25:37 +00:00
steveklabnik
ecfbaca13e update mdbook
This includes search for all books, a long-requested feature!
2018-04-05 15:03:26 -04:00
Alex Crichton
cd615e9863 Rollup merge of #49705 - alexcrichton:less-manifest-docs, r=kennytm 2018-04-05 12:03:03 -07:00
Alex Crichton
4d239ab14e Rollup merge of #49697 - kennytm:name-every-builder, r=aturon 2018-04-05 11:50:46 -07:00
Alex Crichton
83669ecc1f Rollup merge of #49621 - Nemo157:impl-unpin-for-pin, r=withoutboats 2018-04-05 11:50:12 -07:00
Alex Crichton
59059f2ed1 Filter out missing components from manifests
This commit updates our manifest generation for rustup to filter out any
components/extensions which are actually missing. This is intended to help
mitigate #49462 by making the manifests reflect reality, that many targets now
are missing a `rust-docs` component rather than requiring it exists.
2018-04-05 11:38:03 -07:00
leonardo.yvens
933f9ebaae Fix #49344 2018-04-05 15:21:56 -03:00
Alex Crichton
71bf15c6e8 Rollup merge of #49686 - memoryleak47:typo, r=alexcrichton
typos
2018-04-05 11:18:17 -07:00
Alex Crichton
e6947ecf4d Rollup merge of #49597 - alexcrichton:proc-macro-v2, r=petrochenkov
proc_macro: Reorganize public API

This commit is a reorganization of the `proc_macro` crate's public user-facing
API. This is the result of a number of discussions at the recent Rust All-Hands
where we're hoping to get the `proc_macro` crate into ship shape for
stabilization of a subset of its functionality in the Rust 2018 release.

The reorganization here is motivated by experiences from the `proc-macro2`,
`quote`, and `syn` crates on crates.io (and other crates which depend on them).
The main focus is future flexibility along with making a few more operations
consistent and/or fixing bugs. A summary of the changes made from today's
`proc_macro` API is:

* The `TokenNode` enum has been removed and the public fields of `TokenTree`
  have also been removed. Instead the `TokenTree` type is now a public enum
  (what `TokenNode` was) and each variant is an opaque struct which internally
  contains `Span` information. This makes the various tokens a bit more
  consistent, require fewer wrappers, and otherwise provides good
  future-compatibility as opaque structs are easy to modify later on.

* `Literal` integer constructors have been expanded to be unambiguous as to what
  they're doing and also allow for more future flexibility. Previously
  constructors like `Literal::float` and `Literal::integer` were used to create
  unsuffixed literals and the concrete methods like `Literal::i32` would create
  a suffixed token. This wasn't immediately clear to all users (the
  suffixed/unsuffixed aspect) and having *one* constructor for unsuffixed
  literals required us to pick a largest type which may not always be true. To
  fix these issues all constructors are now of the form
  `Literal::i32_unsuffixed` or `Literal::i32_suffixed` (for all integral types).
  This should allow future compatibility as well as being immediately clear
  what's suffixed and what isn't.

* Each variant of `TokenTree` internally contains a `Span` which can also be
  configured via `set_span`. For example `Literal` and `Term` now both
  internally contain a `Span` rather than having it stored in an auxiliary
  location.

* Constructors of all tokens are called `new` now (aka `Term::intern` is gone)
  and most do not take spans. Manufactured tokens typically don't have a fresh
  span to go with them and the span is purely used for error-reporting
  **except** the span for `Term`, which currently affects hygiene. The default
  spans for all these constructed tokens is `Span::call_site()` for now.

  The `Term` type's constructor explicitly requires passing in a `Span` to
  provide future-proofing against possible hygiene changes. It's intended that a
  first pass of stabilization will likely only stabilize `Span::call_site()`
  which is an explicit opt-in for "I would like no hygiene here please". The
  intention here is to make this explicit in procedural macros to be
  forwards-compatible with a hygiene-specifying solution.

* Some of the conversions for `TokenStream` have been simplified a little.

* The `TokenTreeIter` iterator was renamed to `token_stream::IntoIter`.

Overall the hope is that this is the "final pass" at the API of `TokenStream`
and most of `TokenTree` before stabilization. Explicitly left out here is any
changes to `Span`'s API which will likely need to be re-evaluated before
stabilization.

All changes in this PR have already been reflected to the [`proc-macro2`],
`quote`, and `syn` crates. New versions of all these crates have also been
published to crates.io.

Once this lands in nightly I plan on making an internals post again summarizing
the changes made here and also calling on all macro authors to give the APIs a
spin and see how they work. Hopefully pending no major issues we can then have
an FCP to stabilize later this cycle!

[`proc-macro2`]: https://docs.rs/proc-macro2/0.3.1/proc_macro2/

Closes #49596
2018-04-05 11:18:16 -07:00
Alex Crichton
72ac3ebf68 Rollup merge of #49497 - scalexm:hrtb, r=nikomatsakis
Chalkify - Tweak `Clause` definition and HRTBs

r? @nikomatsakis
2018-04-05 11:18:16 -07:00
Alex Crichton
323f808791 std: Inline some Termination-related methods
These were showing up in tests and in binaries but are trivially optimize-able
away, so add `#[inline]` attributes so LLVM has an opportunity to optimize them
out.
2018-04-05 11:07:19 -07:00
Wim Looman
a29d4d9ad6 impl Unpin for PinBox 2018-04-05 20:04:21 +02:00
kennytm
649f431acf
Give a name to every CI job.
Bots that read the log can simply look for `[CI_JOB_NAME=...]` to find out
the job's name.
2018-04-06 01:09:59 +08:00
bors
7222241e7c Auto merge of #49045 - Zoxc:tls, r=michaelwoerister
Make queries thread safe

This makes queries thread safe by removing the query stack and making queries point to their parents. Queries write to the query map when starting and cycles are detected by checking if there's already an entry in the query map. This makes cycle detection O(1) instead of O(n), where `n` is the size of the query stack.

This is mostly corresponds to the method I described [here](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606).

cc @rust-lang/compiler

r? @michaelwoerister
2018-04-05 16:38:15 +00:00
Alex Crichton
46492ffabd
Rollup merge of #49350 - abonander:macros-in-extern, r=petrochenkov
Expand macros in `extern {}` blocks

This permits macro and proc-macro and attribute invocations (the latter only with the `proc_macro` feature of course) in `extern {}` blocks, gated behind a new `macros_in_extern` feature.

A tracking issue is now open at #49476

closes #48747
2018-04-05 10:49:14 -05:00
Alex Crichton
b0bd9a771e
Rollup merge of #49045 - Zoxc:tls, r=michaelwoerister
Make queries thread safe

This makes queries thread safe by removing the query stack and making queries point to their parents. Queries write to the query map when starting and cycles are detected by checking if there's already an entry in the query map. This makes cycle detection O(1) instead of O(n), where `n` is the size of the query stack.

This is mostly corresponds to the method I described [here](https://internals.rust-lang.org/t/parallelizing-rustc-using-rayon/6606).

cc @rust-lang/compiler

r? @michaelwoerister
2018-04-05 10:49:13 -05:00
Shotaro Yamada
dc9128fff8 Fix ICE with main's return type containing lifetimes 2018-04-06 00:39:36 +09:00
Alex Crichton
8958815916 Bump the bootstrap compiler to 1.26.0 beta
Holy cow that's a lot of `cfg(stage0)` removed and a lot of new stable language
features!
2018-04-05 07:13:45 -07:00
bors
56714acc5e Auto merge of #49684 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests

Successful merges:

 - #48658 (Add a generic CAS loop to std::sync::Atomic*)
 - #49253 (Take the original extra-filename passed to a crate into account when resolving it as a dependency)
 - #49345 (RFC 2008: Finishing Touches)
 - #49432 (Flush executables to disk after linkage)
 - #49496 (Add more vec![... ; n] optimizations)
 - #49563 (add a dist builder to build rust-std components for the THUMB targets)
 - #49654 (Host compiler documentation: Include private items)
 - #49667 (Add more features to rust_2018_preview)
 - #49674 (ci: Remove x86_64-gnu-incremental builder)

Failed merges:
2018-04-05 13:07:45 +00:00
memoryleak47
64ddb390ef typos 2018-04-05 13:04:00 +02:00
kennytm
f4511e2437
Rollup merge of #49674 - alexcrichton:no-incremental-rustc, r=michaelwoerister
ci: Remove x86_64-gnu-incremental builder

This builder is starting to time out frequently causing PRs to bounce and
otherwise doesn't seem to be catching too many bugs, so this commit removes it
entirely. We've had a number of timeouts in the last few weeks related to this
builder:

* https://travis-ci.org/rust-lang/rust/jobs/360947582
* https://travis-ci.org/rust-lang/rust/jobs/360464190
* https://travis-ci.org/rust-lang/rust/jobs/359946975
* https://travis-ci.org/rust-lang/rust/jobs/361213241
* https://travis-ci.org/rust-lang/rust/jobs/362346279
* https://travis-ci.org/rust-lang/rust/jobs/362072331

On a good run this builder takes about 2h15m, which is already too long for
Travis and the variable build times end up pushing it beyond the 3h limit
occasionally.

The timeouts here are somewhat expected in that an incrementally compiled rustc
compiler isn't optimized like a normal rustc, disallowing inlining between
codegen units and losing lots of optimization opportunities.
2018-04-05 18:38:53 +08:00
kennytm
d05009bfa1
Rollup merge of #49667 - Manishearth:preview-features, r=nikomatsakis
Add more features to rust_2018_preview

Doesn't handle lib features like never_type; we need to figure out a scheme for that.
2018-04-05 18:37:29 +08:00
kennytm
84f6440d79
Rollup merge of #49654 - davidtwco:issue-29893, r=alexcrichton
Host compiler documentation: Include private items

Fixes #29893. Now that compiler documentation is being hosted, including private items seems sensible as these types are going to be being used by contributors working on the compiler.

However, including this means that doc comments that contain codeblocks with invalid Rust and can fail the documenting of a given crate (as evidenced by the changes in the second commit included in this PR). We'd need some way of ensuring that this cannot happen so that these failures don't cause documenting to fail. I'm unsure whether this change to documentation steps will cause this to happen already or if something new will be required.

r? @alexcrichton
2018-04-05 18:37:28 +08:00
kennytm
b146e33518
Rollup merge of #49563 - japaric:std-thumb, r=alexcrichton
add a dist builder to build rust-std components for the THUMB targets

the rust-std component only contains the core and compiler-builtins (+c +mem) crates

cc #49382

- I'm not entirely sure if this PR alone will produce rust-std components installable by rustup or if something else needs to be changed
- I could have done the THUMB builds in an existing builder / image; I wasn't sure if that was a good idea so I added a new image
- I could build other crates like alloc into the rust-std component but, AFAICT, that would require calling Cargo a second time (one for alloc and one for compiler-builtins), or have alloc depend on compiler-builtins (#49503 will perform that change) *and* have alloc resurface the "c" and "mem" Cargo features.

r? @alexcrichton
2018-04-05 18:37:25 +08:00
kennytm
23689cc8e9
Rollup merge of #49496 - glandium:master, r=sfackler
Add more vec![... ; n] optimizations

vec![0; n], via implementations of SpecFromElem, has an optimization that uses with_capacity_zeroed instead of with_capacity, which will use calloc instead of malloc, and avoid an extra memset.

This PR adds the same optimization for ptr::null, ptr::null_mut, and None, when their in-memory representation is zeroes.
2018-04-05 16:51:21 +08:00
kennytm
19c69082f5
Rollup merge of #49432 - nabijaczleweli:master, r=michaelwoerister
Flush executables to disk after linkage

A problem caused by not doing so in Chrome has been reported [here](https://randomascii.wordpress.com/2018/02/25/compiler-bug-linker-bug-windows-kernel-bug/amp/).

`File::sync_all()` calls `FlushFileBuffers()` down the line, causing potentially unflushed buffers on high I/O-load systems to flush and preventing nasty non-reproducible bugs.

Closes #48545
2018-04-05 16:51:20 +08:00
kennytm
a70f844012
Rollup merge of #49345 - davidtwco:issue-44109, r=nikomatsakis
RFC 2008: Finishing Touches

Part of #44109.

r? @nikomatsakis
(not sure who was best for this PR).
2018-04-05 16:51:19 +08:00
kennytm
46d0befb8e
Rollup merge of #49253 - chmanchester:probing_fix, r=alexcrichton
Take the original extra-filename passed to a crate into account when resolving it as a dependency

resolving it as a dependency.

Fixes #46816
2018-04-05 16:51:18 +08:00
kennytm
920249abdd
Rollup merge of #48658 - llogiq:no-more-cas, r=kennytm
Add a generic CAS loop to std::sync::Atomic*

This adds two new methods to both `AtomicIsize` and `AtomicUsize` with optimized safe compare-and-set loops, so users will no longer need to write their own, except in *very* strange circumstances.

`update_and_fetch` will apply the function and return its result, whereas `fetch_and_update` will apply the function and return the previous value.

This solves #48384 with `x.update_and_fetch(|x| x.max(y))`. It also relates to #48655 (which I misuse as tracking issue for now)..

*note* This *might* need a crater run because the functions could clash with third party extension traits.
2018-04-05 16:51:16 +08:00
bors
01d0be9925 Auto merge of #48851 - petrochenkov:genparattr, r=nikomatsakis
Stabilize attributes on generic parameters

Closes https://github.com/rust-lang/rust/issues/48848
2018-04-05 07:31:56 +00:00
bors
4bf76d6745 Auto merge of #48709 - tinaun:issue48703, r=nikomatsakis
remove erroneous error message when checking impl trait params

fixes #48703
2018-04-05 05:04:27 +00:00
bobtwinkles
0801bd1d0e two-phase borrows: support multiple activations in one statement
The need for this has arisen since the introduction of two-phase borrows on
method autorefs.

Fixes 49635
Fixes 49662
2018-04-04 23:08:10 -04:00
Alex Crichton
621ccf8917 ci: Remove x86_64-gnu-incremental builder
This builder is starting to time out frequently causing PRs to bounce and
otherwise doesn't seem to be catching too many bugs, so this commit removes it
entirely. We've had a number of timeouts in the last few weeks related to this
builder:

* https://travis-ci.org/rust-lang/rust/jobs/360947582
* https://travis-ci.org/rust-lang/rust/jobs/360464190
* https://travis-ci.org/rust-lang/rust/jobs/359946975
* https://travis-ci.org/rust-lang/rust/jobs/361213241
* https://travis-ci.org/rust-lang/rust/jobs/362346279
* https://travis-ci.org/rust-lang/rust/jobs/362072331

On a good run this builder takes about 2h15m, which is already too long for
Travis and the variable build times end up pushing it beyond the 3h limit
occasionally.

The timeouts here are somewhat expected in that an incrementally compiled rustc
compiler isn't optimized like a normal rustc, disallowing inlining between
codegen units and losing lots of optimization opportunities.
2018-04-04 17:35:42 -07:00
bors
3b1fa867f2 Auto merge of #49587 - Bobo1239:master, r=nrc
Update RLS

Includes https://github.com/rust-lang-nursery/rls/pull/793 which fixes https://github.com/rust-lang-nursery/rls/issues/803.
2018-04-05 00:19:46 +00:00