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 12 pull requests #70085

Closed
wants to merge 56 commits into from

Commits on Feb 10, 2020

  1. Fix Peekable::next_back

    timvermeulen committed Feb 10, 2020
    Configuration menu
    Copy the full SHA
    14bcf0a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    16a23e7 View commit details
    Browse the repository at this point in the history

Commits on Mar 11, 2020

  1. Compute the correct layout for variants of uninhabited enums and read…

    …d a long lost assertion
    
    This reverts part of commit 9712fa4.
    oli-obk committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    cdc7304 View commit details
    Browse the repository at this point in the history
  2. Comment nits

    Co-Authored-By: Ralf Jung <post@ralfj.de>
    oli-obk and RalfJung committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    ec88ffa View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    74608c7 View commit details
    Browse the repository at this point in the history
  4. miri: categorize errors into "unsupported" and "UB"

    Also slightly refactor pointer bounds checks to avoid creating unnecessary temporary Errors
    RalfJung committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    f5efb68 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d02543a View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    9a95b01 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3ebcd78 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    2764d3d View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3e61442 View commit details
    Browse the repository at this point in the history
  10. avoid boolean inversion

    RalfJung committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    d8f8168 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    9681422 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    93436d8 View commit details
    Browse the repository at this point in the history
  13. fmt

    RalfJung committed Mar 11, 2020
    Configuration menu
    Copy the full SHA
    e219dd4 View commit details
    Browse the repository at this point in the history

Commits on Mar 13, 2020

  1. Configuration menu
    Copy the full SHA
    349fcb9 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3f45da0 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    be10f14 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bc738f2 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    3c48c89 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2e46faa View commit details
    Browse the repository at this point in the history
  7. tidy: Sort WHITELIST.

    ehuss committed Mar 13, 2020
    Configuration menu
    Copy the full SHA
    9a53cf3 View commit details
    Browse the repository at this point in the history
  8. tidy: Remove chalk-engine/chalk-macros.

    Removed in rust-lang#69247 while this PR was waiting to merge.
    ehuss committed Mar 13, 2020
    Configuration menu
    Copy the full SHA
    ed0158d View commit details
    Browse the repository at this point in the history
  9. Properly handle Spans that reference imported SourceFiles

    Previously, metadata encoding used DUMMY_SP to represent any spans that
    referenced an 'imported' SourceFile - e.g. a SourceFile from an upstream
    dependency. These leads to sub-optimal error messages in certain cases
    (see the included test).
    
    This PR changes how we encode and decode spans in crate metadata. We
    encode spans in one of two ways:
    
    * 'Local' spans, which reference non-imported SourceFiles, are encoded
      exactly as before.
    * 'Foreign' spans, which reference imported SourceFiles, are encoded
      with the CrateNum of their 'originating' crate. Additionally, their
    'lo' and 'high' values are rebased on top of the 'originating' crate,
    which allows them to be used with the SourceMap data encoded for that
    crate.
    
    The `ExternalSource` enum is renamed to `ExternalSourceKind`. There is
    now a struct called `ExternalSource`, which holds an
    `ExternalSourceKind` along with the original line number information for
    the file. This is used during `Span` serialization to rebase spans onto
    their 'owning' crate.
    Aaron1011 committed Mar 13, 2020
    Configuration menu
    Copy the full SHA
    76c7144 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2020

  1. Configuration menu
    Copy the full SHA
    51ea260 View commit details
    Browse the repository at this point in the history
  2. rustc: tweak comments on InstanceDef.

    anyska authored and eddyb committed Mar 15, 2020
    Configuration menu
    Copy the full SHA
    bc8ff3f View commit details
    Browse the repository at this point in the history

Commits on Mar 16, 2020

  1. Configuration menu
    Copy the full SHA
    b9167e6 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    2f44857 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e78c451 View commit details
    Browse the repository at this point in the history
  4. formatting

    GuillaumeGomez committed Mar 16, 2020
    Configuration menu
    Copy the full SHA
    5654cde View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    d964e60 View commit details
    Browse the repository at this point in the history
  6. Update src/librustdoc/html/static/main.js

    Fix variable name
    
    Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
    GuillaumeGomez and Centril committed Mar 16, 2020
    Configuration menu
    Copy the full SHA
    496256c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    9b85213 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    cff1182 View commit details
    Browse the repository at this point in the history
  9. Add tests

    timvermeulen committed Mar 16, 2020
    Configuration menu
    Copy the full SHA
    8cf33b0 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2020

  1. Remove free_region_map from TypeckTables

    It was unused.
    matthewjasper committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    5a9ccc9 View commit details
    Browse the repository at this point in the history
  2. Don't use TypeckTables in NiceRegionError

    Regions in TypeckTables will be erased, so are unusable for error
    reporting.
    matthewjasper committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    cefd030 View commit details
    Browse the repository at this point in the history
  3. Erase regions in writeback

    Also skip duplicated region solving entirely with `-Zborrowck=mir`.
    matthewjasper committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    0a7f16e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    1ee5829 View commit details
    Browse the repository at this point in the history
  5. Fix abort-on-eprintln during process shutdown

    This commit fixes an issue where if `eprintln!` is used in a TLS
    destructor it can accidentally cause the process to abort. TLS
    destructors are executed after `main` returns on the main thread, and at
    this point we've also deinitialized global `Lazy` values like those
    which store the `Stderr` and `Stdout` internals. This means that despite
    handling TLS not being accessible in `eprintln!`, we will fail due to
    not being able to call `stderr()`. This means that we'll double-panic
    quickly because panicking also attempt to write to stderr.
    
    The fix here is to reimplement the global stderr handle to avoid the
    need for destruction. This avoids the need for `Lazy` as well as the
    hidden panic inside of the `stderr` function.
    
    Overall this should improve the robustness of printing errors and/or
    panics in weird situations, since the `stderr` accessor should be
    infallible in more situations.
    alexcrichton committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    a4cbcb2 View commit details
    Browse the repository at this point in the history
  6. std: Don't abort process when printing panics in tests

    This commit fixes an issue when using `set_print` and friends, notably
    used by libtest, to avoid aborting the process if printing panics. This
    previously panicked due to borrowing a mutable `RefCell` twice, and this
    is worked around by borrowing these cells for less time, instead
    taking out and removing contents temporarily.
    
    Closes rust-lang#69558
    alexcrichton committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    773c04c View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    3314a34 View commit details
    Browse the repository at this point in the history
  8. Update test

    Zoxc committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    bdaf9e4 View commit details
    Browse the repository at this point in the history
  9. Allow hir().find to return None

    Zoxc committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    37bee6d View commit details
    Browse the repository at this point in the history
  10. Rollup merge of rust-lang#68915 - timvermeulen:non_fused_iter, r=Amanieu

    Fix bugs in Peekable and Flatten when using non-fused iterators
    
    I fixed a couple of bugs with regard to the `Peekable` and `Flatten`/`FlatMap` iterators when the underlying iterator isn't fused. For testing, I also added a `NonFused` iterator wrapper that panics when `next` or `next_back` is called on an iterator that has returned `None` before, which will hopefully make it easier to spot these mistakes in the future.
    
    ### Peekable
    
    `Peekable::next_back` was implemented as
    ```rust
    self.iter.next_back().or_else(|| self.peeked.take().and_then(|x| x))
    ```
    which is incorrect because when the `peeked` field is `Some(None)`, then `None` has already been returned from the inner iterator and what it returns from `next_back` can no longer be relied upon. `test_peekable_non_fused` tests this.
    
    ### Flatten
    
    When a `FlattenCompat` instance only has a `backiter` remaining (i.e. `self.frontiter` is `None` and `self.iter` is empty), then `next` will call `self.iter.next()` every time, so the `iter` field needs to be fused. I fixed it by giving it the type `Fuse<I>` instead of `I`, I think this is the only way to fix it. `test_flatten_non_fused_outer` tests this.
    
    Furthermore, previously `FlattenCompat::next` did not set `self.frontiter` to `None` after it returned `None`, which is incorrect when the inner iterator type isn't fused. I just delegated it to `try_fold` because that already handles it correctly. `test_flatten_non_fused_inner` tests this.
    
    r? @scottmcm
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    9825d5c View commit details
    Browse the repository at this point in the history
  11. Rollup merge of rust-lang#68941 - Aaron1011:fix/imported-span, r=petr…

    …ochenkov
    
    Properly handle Spans that reference imported SourceFiles
    
    Previously, metadata encoding used DUMMY_SP to represent any spans that
    referenced an 'imported' SourceFile - e.g. a SourceFile from an upstream
    dependency. This currently has no visible consequences, since these
    kinds of spans don't currently seem to be emitted anywhere. However,
    there's no reason that we couldn't start using such spans in
    diagnostics.
    
    This PR changes how we encode and decode spans in crate metadata. We
    encode spans in one of two ways:
    
    * 'Local' spans, which reference non-imported SourceFiles, are encoded
      exactly as before.
    * 'Foreign' spans, which reference imported SourceFiles, are encoded
      with the CrateNum of their 'originating' crate. Additionally, their
    'lo' and 'high' values are rebased on top of the 'originating' crate,
    which allows them to be used with the SourceMap data encoded for that
    crate.
    
    To support this change, I've also made the following modifications:
    
    * `DefId` and related structs are now moved to `rustc_span`. This allows
      us to use a `CrateNum` inside `SourceFile`. `CrateNum` has special
    handling during deserialization (it gets remapped to be the proper
    `CrateNum` from the point of view of the current compilation session),
    so using a `CrateNum` instead of a plain integer 'workaround type' helps
    to simplify deserialization.
    * The `ExternalSource` enum is renamed to `ExternalSourceKind`. There is
    now a struct called `ExternalSource`, which holds an
    `ExternalSourceKind` along with the original line number information for
    the file. This is used during `Span` serialization to rebase spans onto
    their 'owning' crate.
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    af55daf View commit details
    Browse the repository at this point in the history
  12. Rollup merge of rust-lang#69036 - eddyb:monoshim, r=nikomatsakis

    rustc: don't resolve Instances which would produce malformed shims.
    
    There are some `InstanceDef` variants (shims and drop "glue") which contain a `Ty`, and that `Ty` is used in generating the shim MIR. But if that `Ty` mentions any generic parameters, the generated shim would refer to them (but they won't match the `Substs` of the `Instance`), or worse, generating the shim would fail because not enough of the type is known.
    
    Ideally we would always produce a "skeleton" of the type, e.g. `(_, _)` for dropping any tuples with two elements, or `Vec<_>` for dropping any `Vec` value, but that's a lot of work, and they would still not match the `Substs` of the `Instance` as it exists today, so `Instance` would probably need to change.
    
    By making `Instance::resolve` return `None` in the still-generic cases, we get behavior similar to specialization, where a default can only be used if there are no more generic parameters which would allow a more specialized `impl` to match.
    
    <hr/>
    
    This was found while testing the MIR inliner with rust-lang#68965, because it was trying to inline shims.
    
    cc @rust-lang/wg-mir-opt
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    60f7aa1 View commit details
    Browse the repository at this point in the history
  13. Rollup merge of rust-lang#69189 - matthewjasper:erase-the-world, r=ni…

    …komatsakis
    
    Erase regions in writeback
    
    Regions in `TypeckTables` (except canonicalized user annotations) are now erased. Further, we no longer do lexical region solving on item bodies with `-Zborrowck=mir`.
    
    cc rust-lang#68261
    r? @nikomatsakis
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    59e1a3d View commit details
    Browse the repository at this point in the history
  14. Rollup merge of rust-lang#69402 - GuillaumeGomez:extend-search, r=kin…

    …nison
    
    Extend search
    
    I realized that when looking for "struct:String" in the rustdoc search for example, the "in arguments" and "returned" tabs were always empty. After some investigation, I realized it was because we only provided the name, and not the type, making it impossible to pass the "type filtering" check.
    
    To resolve this, I added the type alongside the name. Note for the future: we could improve this by instead only registering the path id and use the path dictionary directly. The only problem with that solution (which I already tested) is that it becomes complicated for types in other crates. It'd force us to handle both case with an id and a case with `(name, type)`. I found the current PR big enough to not want to provide it directly. However, I think this is definitely worth it to make it work this way in the future.
    
    About the two tests I added: they don't have much interest except checking that we actually have something returned in the search in the cases of a type filtering with and without literal search.
    
    I also had to update a bit the test script to add the new locally global (haha) variable I created (`NO_TYPE_FILTER`). I added this variable to make the code easier to read than just "-1".
    
    r? @kinnison
    
    cc @ollie27
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    b960a1b View commit details
    Browse the repository at this point in the history
  15. Rollup merge of rust-lang#69443 - ehuss:tidy-license, r=skade,Mark-Si…

    …mulacrum
    
    tidy: Better license checks.
    
    This implements some improvements to the license checks in tidy:
    
    * Use `cargo_metadata` instead of parsing vendored crates. This allows license checks to run without vendoring enabled, and allows the checks to run on PR builds.
    * Check for stale entries.
    * Check that the licenses for exceptions are what we think they are.
    * Verify exceptions do not leak into the runtime.
    
    Closes rust-lang#62618
    Closes rust-lang#62619
    Closes rust-lang#63238 (I think)
    
    There are some substantive changes here. The follow licenses have changed from the original comments:
    
    * openssl BSD+advertising clause to Apache-2.0
    * pest MPL2 to MIT/Apache-2.0
    * smallvec MPL2 to MIT/Apache-2.0
    * clippy lints MPL2 to MIT OR Apache-2.0
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    f4090a6 View commit details
    Browse the repository at this point in the history
  16. Rollup merge of rust-lang#69497 - Zoxc:ast-fragment-error, r=petroche…

    …nkov
    
    Don't unwind when hitting the macro expansion recursion limit
    
    This removes one use of `FatalError.raise()`.
    
    r? @petrochenkov
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    e80c8ad View commit details
    Browse the repository at this point in the history
  17. Rollup merge of rust-lang#69768 - oli-obk:union_field_ice, r=eddyb,Ra…

    …lfJung
    
    Compute the correct layout for variants of uninhabited enums
    
    r? @eddyb
    cc @RalfJung
    
    fixes rust-lang#69191
    cc rust-lang#69763
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    45ed7e1 View commit details
    Browse the repository at this point in the history
  18. Rollup merge of rust-lang#69839 - RalfJung:miri-error-cleanup, r=oli-obk

    Miri error reform
    
    Some time ago we started moving Miri errors into a few distinct categories, but we never classified all the old errors. That's what this PR does.
    
    ~~This is on top of rust-lang#69762; [relative diff](RalfJung/rust@validity-errors...RalfJung:miri-error-cleanup).~~
    
    r? @oli-obk
    
    Fixes rust-lang/const-eval#4
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    c74d524 View commit details
    Browse the repository at this point in the history
  19. Rollup merge of rust-lang#69955 - alexcrichton:stderr-infallible, r=s…

    …fackler
    
    Fix abort-on-eprintln during process shutdown
    
    This commit fixes an issue where if `eprintln!` is used in a TLS
    destructor it can accidentally cause the process to abort. TLS
    destructors are executed after `main` returns on the main thread, and at
    this point we've also deinitialized global `Lazy` values like those
    which store the `Stderr` and `Stdout` internals. This means that despite
    handling TLS not being accessible in `eprintln!`, we will fail due to
    not being able to call `stderr()`. This means that we'll double-panic
    quickly because panicking also attempt to write to stderr.
    
    The fix here is to reimplement the global stderr handle to avoid the
    need for destruction. This avoids the need for `Lazy` as well as the
    hidden panic inside of the `stderr` function.
    
    Overall this should improve the robustness of printing errors and/or
    panics in weird situations, since the `stderr` accessor should be
    infallible in more situations.
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    d6f4e39 View commit details
    Browse the repository at this point in the history
  20. Rollup merge of rust-lang#69959 - alexcrichton:fix-panic-in-print, r=…

    …Mark-Simulacrum
    
    std: Don't abort process when printing panics in tests
    
    This commit fixes an issue when using `set_print` and friends, notably
    used by libtest, to avoid aborting the process if printing panics. This
    previously panicked due to borrowing a mutable `RefCell` twice, and this
    is worked around by borrowing these cells for less time, instead
    taking out and removing contents temporarily.
    
    Closes rust-lang#69558
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    63e67ce View commit details
    Browse the repository at this point in the history
  21. Rollup merge of rust-lang#70051 - Zoxc:opt-find, r=eddyb

    Allow `hir().find` to return `None`
    
    Fixes rust-lang#70041
    
    r? @eddyb
    Manishearth committed Mar 17, 2020
    Configuration menu
    Copy the full SHA
    c0f826a View commit details
    Browse the repository at this point in the history