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 10 pull requests #75606

Closed
wants to merge 34 commits into from

Commits on Jul 10, 2020

  1. Don't visit foreign function bodies when lowering ast to hir

    Previously the existence of bodies inside a foreign function block would
    cause a panic in the hir `NodeCollector` during its collection of crate
    bodies to compute a crate hash:
    
    https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_middle/hir/map/collector.rs#L154-L158
    
    The collector walks the hir tree and creates a map of hir nodes, then
    attaching bodies in the crate to their owner in the map. For a code like
    
    ```rust
    extern "C" {
        fn f() {
            fn g() {}
        }
    }
    ```
    
    The crate bodies include the body of the function `g`. But foreign
    functions cannot have bodies, and while the parser AST permits a foreign
    function to have a body, the hir doesn't. This means that the body of
    `f` is not present in the hir, and so neither is `g`. So when the
    `NodeCollector` finishes the walking the hir, it has no record of `g`,
    cannot find an owner for the body of `g` it sees in the crate bodies,
    and blows up.
    
    Why do the crate bodies include the body of `g`? The AST walker has a
    need a for walking function bodies, and FFIs share the same AST node as
    functions in other contexts.
    
    There are at least two options to fix this:
    
    - Don't unwrap the map entry for an hir node in the `NodeCollector`
    - Modifier the ast->hir lowering visitor to ignore foreign function
      blocks
    
    I don't think the first is preferrable, since we want to know when we
    can't find a body for an hir node that we thought had one (dropping this
    information may lead to an invalid hash). So this commit implements the
    second option.
    
    Closes rust-lang#74120
    ayazhafiz committed Jul 10, 2020
    Configuration menu
    Copy the full SHA
    2303939 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    ab4275c View commit details
    Browse the repository at this point in the history

Commits on Jul 15, 2020

  1. Configuration menu
    Copy the full SHA
    68aca3b View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    0c64d32 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2020

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

Commits on Aug 5, 2020

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

Commits on Aug 6, 2020

  1. Add #[track_caller] to Session::delay_span_bug

    This forwards the caller span to `Handler::delay_span_bug`
    Aaron1011 committed Aug 6, 2020
    Configuration menu
    Copy the full SHA
    0d0546a View commit details
    Browse the repository at this point in the history

Commits on Aug 11, 2020

  1. Use intra-doc links

    denisvasilik committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    3c2eb18 View commit details
    Browse the repository at this point in the history
  2. Revert broken link

    denisvasilik committed Aug 11, 2020
    Configuration menu
    Copy the full SHA
    c492341 View commit details
    Browse the repository at this point in the history

Commits on Aug 12, 2020

  1. Remove intra-doc link as it resolves without reference link

    Co-authored-by: Joshua Nelson <joshua@yottadb.com>
    denisvasilik and Joshua Nelson authored Aug 12, 2020
    Configuration menu
    Copy the full SHA
    4c5896f View commit details
    Browse the repository at this point in the history

Commits on Aug 15, 2020

  1. Bump minor version of emsdk to 1.38.47

    Release Notes:
    
    ```
    v1.38.47: 10/02/2019
    --------------------
     - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
       main thread (`USE_FETCH_WORKER=0` is enforced). rust-lang#9490
     - Redefine errno values to be consistent with wasi. This will let us avoid
       needing to convert the values back and forth as we use more wasi APIs.
       This is an ABI change, which should not be noticeable from user code
       unless you use errno defines (like EAGAIN) *and* keep around binaries
       compiled with an older version that you link against. In that case, you
       should rebuild them. See rust-lang#9545.
     - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
       for that, like building to a wasm object file or using `STANDALONE_WASM`
       etc. (see
       https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
     - Emscripten now supports the config file (.emscripten) being placed in the
       emscripten directory rather that the current user's home directory.
       See rust-lang#9543
    ```
    tmiasko committed Aug 15, 2020
    Configuration menu
    Copy the full SHA
    8de63eb View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2020

  1. lang_items: add support for lang items on variants

    This commit adds support for lang items (`#[lang = "..."]` attributes)
    on enum variants.
    
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    764dc3d View commit details
    Browse the repository at this point in the history
  2. tests: add test for rust-lang#61019's current behaviour

    This commit adds a test for rust-lang#61019 where a extern crate is imported as
    `std` which results in name resolution to fail due to the uses of `std`
    types introduced from lowering.
    
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    734441c View commit details
    Browse the repository at this point in the history
  3. hir: introduce lang items for AST lowering

    This commit adds new lang items which will be used in AST lowering once
    `QPath::LangItem` is introduced.
    
    Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco and matthewjasper committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    7dee5f8 View commit details
    Browse the repository at this point in the history
  4. hir: introduce QPath::LangItem

    This commit introduces `QPath::LangItem` to the HIR and uses it in AST
    lowering instead of constructing a `hir::Path` from a slice of symbols.
    
    This might be better for performance, but is also much cleaner as the
    previous approach is fragile. In addition, it resolves a bug (rust-lang#61019)
    where an extern crate imported as "std" would result in the paths
    created during AST lowering being resolved incorrectly (or not at all).
    
    Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco and matthewjasper committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    762137e View commit details
    Browse the repository at this point in the history
  5. save_analysis: support QPath::LangItem

    This commit implements support for `QPath::LangItem` and
    `GenericBound::LangItemTrait` in save analysis.
    
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    1e2f350 View commit details
    Browse the repository at this point in the history
  6. hir: simplify is_range_literal

    This commit simplifies `is_range_literal` by checking for
    `QPath::LangItem` containing range-related lang items, rather than using
    a heuristic.
    
    Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco and matthewjasper committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    664ecf1 View commit details
    Browse the repository at this point in the history
  7. resolve: support GenericBound::LangItemTrait

    This commit modifies name resolution to ensure that new scopes are
    introduced from lang-item generic bounds.
    
    Co-authored-by: Matthew Jasper <mjjasper1@gmail.com>
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco and matthewjasper committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    8367af4 View commit details
    Browse the repository at this point in the history
  8. rustdoc: clean QPath::LangItem

    This commit adds support for cleaning `QPath::LangItem` and
    `hir::GenericBound::LangItemTrait` in rustdoc. `QPath::LangItem`
    does not require lowering, and `hir::GenericBound::LangItemTrait`
    is lowered to a `GenericBound::TraitBound`.
    
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    dde93c9 View commit details
    Browse the repository at this point in the history
  9. clippy: support QPath::LangItem

    This commit updates clippy with the introduction of `QPath::LangItem` so
    that it still compiles.
    
    Signed-off-by: David Wood <david@davidtw.co>
    davidtwco committed Aug 16, 2020
    Configuration menu
    Copy the full SHA
    bde529f View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    0a96e08 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    8b86b28 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    5d44d54 View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    e1cd185 View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#74204 - ayazhafiz:i/74120, r=eddyb

    Don't visit foreign function bodies when lowering ast to hir
    
    Previously the existence of bodies inside a foreign function block would
    cause a panic in the hir `NodeCollector` during its collection of crate
    bodies to compute a crate hash:
    
    https://github.com/rust-lang/rust/blob/e59b08e62ea691916d2f063cac5aab4634128022/src/librustc_middle/hir/map/collector.rs#L154-L158
    
    The collector walks the hir tree and creates a map of hir nodes, then
    attaching bodies in the crate to their owner in the map. For a code like
    
    ```rust
    extern "C" {
        fn f() {
            fn g() {}
        }
    }
    ```
    
    The crate bodies include the body of the function `g`. But foreign
    functions cannot have bodies, and while the parser AST permits a foreign
    function to have a body, the hir doesn't. This means that the body of
    `f` is not present in the hir, and so neither is `g`. So when the
    `NodeCollector` finishes the walking the hir, it has no record of `g`,
    cannot find an owner for the body of `g` it sees in the crate bodies,
    and blows up.
    
    Why do the crate bodies include the body of `g`? The AST walker has a
    need a for walking function bodies, and FFIs share the same AST node as
    functions in other contexts.
    
    There are at least two options to fix this:
    
    - Don't unwrap the map entry for an hir node in the `NodeCollector`
    - Modifier the ast->hir lowering visitor to ignore foreign function
      blocks
    
    I don't think the first is preferrable, since we want to know when we
    can't find a body for an hir node that we thought had one (dropping this
    information may lead to an invalid hash). So this commit implements the
    second option.
    
    Closes rust-lang#74120
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    67f02ea View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#74314 - eddyb:closure-substs-direct, r=niko…

    …matsakis
    
    rustc_typeck: construct {Closure,Generator}Substs more directly.
    
    We've previously not had a way to create `{Closure,Generator}Substs` other than instantiating all generics as inference variables and unifying the inference types (extracted using the regular `{Closure,Generator}Substs` accessors), with the actual types.
    
    With this PR, those hacks, and assumptions about the order of closure/generator-specific components, are replaced with a simple API where the base `Substs` are combined with the additional information into a `{Closure,Generator}Substs`.
    This might also be faster than relying inference, although probably not by much.
    
    r? @nikomatsakis cc rust-lang#53488 @blitzerr
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    772038d View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#74346 - eddyb:reachable-defs, r=nikomatsakis

    Use LocalDefId instead of HirId for reachable_set elements.
    
    The only `HirId`s being tracked there that don't have matching `DefId`s are local variables, and that's an accident from rust-lang#44316 (where I preserved the old behavior, even if nothing relied on reachability tracking local variables).
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    c531545 View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#74399 - mark-i-m:ty-err-4, r=eddyb

    Move DelaySpanBugEmitted to ty::context
    
    This makes it even hard to abuse.
    
    r? @eddyb
    
    cc @LeSeulArtichaut as this will probably conflict with your PR :/
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    c8a5acd View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#75145 - davidtwco:issue-60607-preallocate-d…

    …efid-for-lang-items, r=petrochenkov
    
    Preallocate `DefId`s for lang items
    
    Fixes rust-lang#60607 and fixes rust-lang#61019.
    
    This PR introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols:
    
    - Credit for much of this work goes to @matthewjasper, I basically just [rebased their earlier work](matthewjasper@a227c70#diff-c0f791ead38d2d02916faaad0f56f41d).
    - Changes to Clippy might not be correct, they compile but attempting to run tests through `./x.py` produced failures which appeared spurious, so I didn't run any clippy tests.
    - Changes to save analysis might not be correct - tests pass but I don't have a lot of confidence in those changes being correct.
    - I've used `GenericBounds::LangItemTrait` rather than changing `PolyTraitRef`, as suggested by @matthewjasper [in this comment](matthewjasper@a227c70#r40107992) but I'd prefer that be left for a follow-up.
    - I've split things into smaller commits fairly arbitrarily to make the diff easier to review, each commit should compile but might not pass tests until the final commit.
    
    r? @oli-obk
    cc @matthewjasper
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    3e5ce7b View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#75177 - JohnTitor:broken-mir-test, r=eddyb

    Add regression test for issue-66768
    
    Fixes rust-lang#66768
    
    This is fixed by rust-lang#70452 (in particular, https://github.com/rust-lang/rust/pull/70452/files#diff-53aef089a36a8e2ed07627fc8915fe63R1763) and I'm not sure it's worth to add this test (i.e. the tests in rust-lang#70452 are enough), so r? @eddyb to confirm it.
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    f33f111 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#75223 - Aaron1011:feature/session-track-cal…

    …ler, r=eddyb
    
    Add #[track_caller] to `Session::delay_span_bug`
    
    This forwards the caller span to `Handler::delay_span_bug`
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    60fc66b View commit details
    Browse the repository at this point in the history
  21. Rollup merge of rust-lang#75423 - denisvasilik:intra-doc-links-core-h…

    …int, r=dtolnay
    
    Move to intra-doc links for /library/core/src/hint.rs
    
    Helps with rust-lang#75080.
    
    @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    58a0860 View commit details
    Browse the repository at this point in the history
  22. Rollup merge of rust-lang#75569 - tmiasko:emscripten, r=tlively

    Bump minor version of emsdk to 1.38.47
    
    Release Notes:
    
    ```
    v1.38.47: 10/02/2019
    --------------------
     - Add support for FETCH API in WASM backend. This doesn't support FETCH in the
       main thread (`USE_FETCH_WORKER=0` is enforced). rust-lang#9490
     - Redefine errno values to be consistent with wasi. This will let us avoid
       needing to convert the values back and forth as we use more wasi APIs.
       This is an ABI change, which should not be noticeable from user code
       unless you use errno defines (like EAGAIN) *and* keep around binaries
       compiled with an older version that you link against. In that case, you
       should rebuild them. See rust-lang#9545.
     - Removed build option `-s ONLY_MY_CODE` as we now have much better solutions
       for that, like building to a wasm object file or using `STANDALONE_WASM`
       etc. (see
       https://github.com/emscripten-core/emscripten/wiki/WebAssembly-Standalone).
     - Emscripten now supports the config file (.emscripten) being placed in the
       emscripten directory rather that the current user's home directory.
       See rust-lang#9543
    ```
    
    Motivated by changes to errno values which are currently out of sync with those
    in libc crate which uses wasi values already. Helps with rust-lang#72808 and rust-lang#75532.
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    f350f9c View commit details
    Browse the repository at this point in the history
  23. Rollup merge of rust-lang#75596 - nixphix:docs/windows-ext, r=jyn514

    Switch to intra-doc links in /sys/windows/ext/{ffi,fs,process}.rs
    
    Partial fix for rust-lang#75080
    
    @rustbot modify labels: T-doc, A-intra-doc-links, T-rustdoc
    
    r? @jyn514
    Dylan-DPC authored Aug 16, 2020
    Configuration menu
    Copy the full SHA
    76d61c7 View commit details
    Browse the repository at this point in the history