Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 8 pull requests #49696

Merged
merged 20 commits into from
Apr 5, 2018
Merged

Rollup of 8 pull requests #49696

merged 20 commits into from
Apr 5, 2018

Commits on Mar 24, 2018

  1. Make queries thread safe. Remove the query stack and make queries poi…

    …nt to their parents instead.
    Zoxc committed Mar 24, 2018
    Configuration menu
    Copy the full SHA
    29a4ec0 View commit details
    Browse the repository at this point in the history
  2. Some cleanups and added comments

    Zoxc committed Mar 24, 2018
    Configuration menu
    Copy the full SHA
    4f7d0fd View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2018

  1. Configuration menu
    Copy the full SHA
    71dc162 View commit details
    Browse the repository at this point in the history

Commits on Apr 2, 2018

  1. Fix comment

    scalexm authored Apr 2, 2018
    Configuration menu
    Copy the full SHA
    1074a22 View commit details
    Browse the repository at this point in the history
  2. 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/
    alexcrichton committed Apr 2, 2018
    Configuration menu
    Copy the full SHA
    553c04d View commit details
    Browse the repository at this point in the history

Commits on Apr 3, 2018

  1. impl Unpin for Pin

    Nemo157 committed Apr 3, 2018
    Configuration menu
    Copy the full SHA
    c4c5214 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5d74990 View commit details
    Browse the repository at this point in the history

Commits on Apr 4, 2018

  1. Tweak doc comment expansion

    * Expand `!` tokens for inner doc comments
    * Trim leading doc comment decoration in the string literal
    
    Both of these should help bring the expansion inline with what `macro_rules!`
    already does.
    
    Closes rust-lang#49655
    Closes rust-lang#49656
    alexcrichton committed Apr 4, 2018
    Configuration menu
    Copy the full SHA
    a57b1fb View commit details
    Browse the repository at this point in the history

Commits on Apr 5, 2018

  1. typos

    memoryleak47 committed Apr 5, 2018
    Configuration menu
    Copy the full SHA
    64ddb39 View commit details
    Browse the repository at this point in the history
  2. Rollup merge of rust-lang#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
    alexcrichton authored Apr 5, 2018
    Configuration menu
    Copy the full SHA
    b0bd9a7 View commit details
    Browse the repository at this point in the history
  3. Rollup merge of rust-lang#49350 - abonander:macros-in-extern, r=petro…

    …chenkov
    
    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 rust-lang#49476
    
    closes rust-lang#48747
    alexcrichton authored Apr 5, 2018
    Configuration menu
    Copy the full SHA
    46492ff View commit details
    Browse the repository at this point in the history
  4. 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.
    kennytm committed Apr 5, 2018
    Configuration menu
    Copy the full SHA
    649f431 View commit details
    Browse the repository at this point in the history
  5. impl Unpin for PinBox

    Nemo157 committed Apr 5, 2018
    Configuration menu
    Copy the full SHA
    a29d4d9 View commit details
    Browse the repository at this point in the history
  6. Rollup merge of rust-lang#49497 - scalexm:hrtb, r=nikomatsakis

    Chalkify - Tweak `Clause` definition and HRTBs
    
    r? @nikomatsakis
    alexcrichton committed Apr 5, 2018
    Configuration menu
    Copy the full SHA
    72ac3eb View commit details
    Browse the repository at this point in the history
  7. Rollup merge of rust-lang#49597 - alexcrichton:proc-macro-v2, r=petro…

    …chenkov
    
    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 rust-lang#49596
    alexcrichton committed Apr 5, 2018
    Configuration menu
    Copy the full SHA
    e6947ec View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    71bf15c View commit details
    Browse the repository at this point in the history
  9. 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 rust-lang#49462 by making the manifests reflect reality, that many targets now
    are missing a `rust-docs` component rather than requiring it exists.
    alexcrichton committed Apr 5, 2018
    Configuration menu
    Copy the full SHA
    59059f2 View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    83669ec View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    4d239ab View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    cd615e9 View commit details
    Browse the repository at this point in the history