1. 01 5月, 2020 25 次提交
    • R
      fix Miri error message padding · 1bab6a4d
      Ralf Jung 提交于
      1bab6a4d
    • B
      Auto merge of #71704 - RalfJung:miri-error-print, r=oli-obk · fd61d067
      bors 提交于
      Miri: tweak error print
      
      I started by adjusting the "invalid use of int as pointer" message (it wasn't really clear what is invalid about the use). But then I realized that these are all `Debug` impls we use for these errors, for some reason, so I fixed that to use `Display` instead.
      
      ~~This includes https://github.com/rust-lang/rust/pull/71590 (to get the `Display` impl for `Pointer`), so the diff will look better once that finally lands. Here's the [relative diff](https://github.com/RalfJung/rust/compare/e72ebf5119e833b70231c3f2f8c7ca4904b1f0a3...RalfJung:miri-error-print).~~
      
      r? @oli-obk
      fd61d067
    • R
      cce0cb3c
    • R
      rename InvalidIntPtrUsage · 707bd7b2
      Ralf Jung 提交于
      707bd7b2
    • R
      bless you · 2feeb88b
      Ralf Jung 提交于
      2feeb88b
    • R
      InterpError printing really is more Display than Debug · f9489956
      Ralf Jung 提交于
      also tweak InvalidDiscriminant message
      f9489956
    • R
      tweak InvalidIntPointerUsage message · 671bc08e
      Ralf Jung 提交于
      671bc08e
    • B
      Auto merge of #71623 - petrochenkov:localink, r=estebank · bd0bacc6
      bors 提交于
      Disable localization for all linkers
      
      We previously disabled non-English output from `link.exe` due to encoding issues (#35785).
      
      In https://github.com/rust-lang/rust/pull/70740 it was pointed out that it also prevents correct inspection of the linker output, which we have to do occasionally.
      
      So this PR disables localization for all linkers.
      bd0bacc6
    • B
      Auto merge of #70674 - cjgillot:query-arena-all, r=matthewjasper · e94eaa6d
      bors 提交于
      Have the per-query caches store the results on arenas
      
      This PR leverages the cache for each query to serve as storage area for the query results.
      
      It introduces a new cache `ArenaCache`, which moves the result to an arena,
      and only stores the reference in the hash map.
      This allows to remove a sizeable part of the usage of the global `TyCtxt` arena.
      
      I only migrated queries that already used arenas before.
      e94eaa6d
    • B
      Auto merge of #71721 - tmandry:rollup-e27pxex, r=tmandry · 614f273e
      bors 提交于
      Rollup of 8 pull requests
      
      Successful merges:
      
       - #71148 (Vec drop and truncate: drop using raw slice *mut [T])
       - #71465 (Add a convenience method on `TyCtxt` for checking for thread locals)
       - #71567 (Handle build completion message from Cargo)
       - #71590 (MIR dump: print pointers consistently with Miri output)
       - #71682 (Bump pulldown-cmark)
       - #71688 (Allow `Downcast` projections unconditionally in const-checking)
       - #71691 (Allow `Unreachable` terminators unconditionally in const-checking)
       - #71719 (Update backtrace-sys)
      
      Failed merges:
      
      r? @ghost
      614f273e
    • T
      Rollup merge of #71719 - tmandry:update-backtrace-sys, r=Mark-Simulacrum · 59abc2af
      Tyler Mandry 提交于
      Update backtrace-sys
      
      Diff:
      
      - Don't look for old RUSTC_DEBUGINFO vars (rust-lang/backtrace-rs#313)
      
      This fixes an issue of libbacktrace never being built with debuginfo.
      
      r? @Mark-Simulacrum
      cc @alexcrichton
      59abc2af
    • T
      Rollup merge of #71691 - ecstatic-morse:const-unreachable, r=oli-obk,RalfJung · 1b62bb67
      Tyler Mandry 提交于
      Allow `Unreachable` terminators unconditionally in const-checking
      
      If we ever actually reach an `Unreachable` terminator while executing, the MIR is ill-formed or the user's program is UB due to something like `unreachable_unchecked`. I don't think we need to forbid these in `qualify_min_const_fn`.
      
      r? @oli-obk
      1b62bb67
    • T
      Rollup merge of #71688 - ecstatic-morse:const-downcast, r=oli-obk · a8e0511b
      Tyler Mandry 提交于
      Allow `Downcast` projections unconditionally in const-checking
      
      `ProjectionElem::Downcast` sounds scary, but it's really just the projection we use to access a particular enum variant. They usually appear in the lowering of a `match` statement, so they have been associated with control flow in const-checking, but they don't do any control flow by themselves. We already have a HIR pass that looks for `if` and `match` (even ones that have 1 or fewer reachable branches). That pass is double-checked by a MIR pass that looks for `SwitchInt`s and `FakeRead`s for match scrutinees. In my opinion, there's no need to look for `Downcast` as well.
      
      r? @oli-obk
      a8e0511b
    • T
      Rollup merge of #71682 - ehuss:bump-pulldown-cmark, r=Dylan-DPC · 8192cb6e
      Tyler Mandry 提交于
      Bump pulldown-cmark
      
      Pulls in 0.7.1 with the following fixes:
      
      - Update html5ever to 0.25
      - Fix hang on unclosed html element
      
      Closes #70871
      8192cb6e
    • T
      Rollup merge of #71590 - RalfJung:mir-dump-pointers, r=oli-obk · 3c75f701
      Tyler Mandry 提交于
      MIR dump: print pointers consistently with Miri output
      
      This makes MIR allocation dump pointer printing consistent with Miri output: both use hexadecimal offsets with a `0x` prefix. To save some space, MIR dump replaces the `alloc` prefix by `a` when necessary.
      
      I also made AllocId/Pointer printing more consistent in their Debug/Display handling, and adjusted Display printing for Scalar a bit to avoid using decimal printing when we do not know the sign with which to interpret the value (IMO using decimal then is misleading).
      3c75f701
    • T
      Rollup merge of #71567 - Mark-Simulacrum:no-success, r=matthiaskrgr · 01fffff6
      Tyler Mandry 提交于
      Handle build completion message from Cargo
      
      This was introduced in the recent bump to 1.44 bootstrap cargo
      
      Fixes #71561.
      01fffff6
    • T
      Rollup merge of #71465 - oli-obk:is_thread_local_cleanup, r=matthewjasper · 94433a60
      Tyler Mandry 提交于
      Add a convenience method on `TyCtxt` for checking for thread locals
      
      This PR extracts the cleanup part of #71192
      
      r? @bjorn3
      94433a60
    • T
      Rollup merge of #71148 - bluss:vec-drop-raw-slice, r=RalfJung · 4adebb9f
      Tyler Mandry 提交于
      Vec drop and truncate: drop using raw slice *mut [T]
      
      By creating a *mut [T] directly (without going through &mut [T]), avoid
      questions of validity of the contents of the slice.
      
      Consider the following risky code:
      
      ```rust
      unsafe {
          let mut v = Vec::<bool>::with_capacity(16);
          v.set_len(16);
      }
      ```
      
      The intention is that with this change, we avoid one of the soundness
      questions about the above snippet, because Vec::drop no longer
      produces a mutable slice of the vector's contents.
      
      r? @RalfJung
      4adebb9f
    • T
      Update backtrace-sys · 2bafb1b1
      Tyler Mandry 提交于
      Diff:
      
      - Don't look for old RUSTC_DEBUGINFO vars (rust-lang/backtrace-rs#313)
      2bafb1b1
    • B
      Auto merge of #71717 - Dylan-DPC:rollup-av5vjor, r=Dylan-DPC · 7ced01a7
      bors 提交于
      Rollup of 5 pull requests
      
      Successful merges:
      
       - #70950 (extend NLL checker to understand `'empty` combined with universes)
       - #71433 (Add help message for missing right operand in condition)
       - #71449 (Move `{Free,}RegionRelations` and `FreeRegionMap` to `rustc_infer`)
       - #71559 (Detect git version before attempting to use --progress)
       - #71597 (Rename Unique::empty() -> Unique::dangling())
      
      Failed merges:
      
      r? @ghost
      7ced01a7
    • D
      Rollup merge of #71597 - CohenArthur:refactor-unique-empty, r=shepmaster · 97a88700
      Dylan DPC 提交于
      Rename Unique::empty() -> Unique::dangling()
      
      A `FIXME` comment in `src/libcore/ptr/unique.rs` suggested refactoring `Unique::empty()` to `Unique::dangling()` which this PR does.
      97a88700
    • D
      Rollup merge of #71559 - dillona:detect_git_progress_version, r=Mark-Simulacrum · 2770f820
      Dylan DPC 提交于
      Detect git version before attempting to use --progress
      
      Otherwise each update is run twice and errors are printed
      
      I've tested this with:
      git version 2.8.2.windows.1 (Windows)
      git version 2.26.2.266.ge870325ee8 (Linux built from source)
      git version 2.17.1 (Linux)
      git version 2.21.1 (Apple Git-122.3) (MacOS)
      
      I've tested with Python 2.7 (Windows, Linux, MacOS), 3.6 (Linux), and 3.7 (MacOS)
      2770f820
    • D
      Rollup merge of #71449 - ecstatic-morse:free-region-cleanup, r=Mark-Simulacrum · 5e53f80d
      Dylan DPC 提交于
      Move `{Free,}RegionRelations` and `FreeRegionMap` to `rustc_infer`
      
      ...and out of `rustc_middle`. This is to further #65031, albeit in a very minor way
      
      r? @Mark-Simulacrum
      5e53f80d
    • D
      Rollup merge of #71433 - antoyo:error/missing-right-operand, r=Dylan-DPC · be3faf3f
      Dylan DPC 提交于
      Add help message for missing right operand in condition
      
      closes #30035
      be3faf3f
    • D
      Rollup merge of #70950 - nikomatsakis:leak-check-nll-2, r=matthewjasper · 09f3c908
      Dylan DPC 提交于
      extend NLL checker to understand `'empty` combined with universes
      
      This PR extends the NLL region checker to understand `'empty` combined with universes. In particular, it means that the NLL region checker no longer considers `exists<R2> { forall<R1> { R1: R2 } }` to be provable. This is work towards https://github.com/rust-lang/rust/issues/59490, but we're not all the way there. One thing in particular it does not address is error messages.
      
      The modifications to the NLL region inference code turned out to be simpler than expected. The main change is to require that if `R1: R2` then `universe(R1) <= universe(R2)`.
      
      This constraint follows from the region lattice (shown below), because we assume then that `R2` is "at least" `empty(Universe(R2))`, and hence if `R1: R2` (i.e., `R1 >= R2` on the lattice) then `R1` must be in some universe that can name `'empty(Universe(R2))`, which requires that `Universe(R1) <= Universe(R2)`.
      
      ```
      static ----------+-----...------+       (greatest)
      |                |              |
      early-bound and  |              |
      free regions     |              |
      |                |              |
      scope regions    |              |
      |                |              |
      empty(root)   placeholder(U1)   |
      |            /                  |
      |           /         placeholder(Un)
      empty(U1) --         /
      |                   /
      ...                /
      |                 /
      empty(Un) --------                      (smallest)
      ```
      
      I also made what turned out to be a somewhat unrelated change to add a special region to represent `'empty(U0)`, which we use (somewhat hackily) to indicate well-formedness checks in some parts of the compiler. This fixes #68550.
      
      I did some investigation into fixing the error message situation. That's a bit trickier: the existing "nice region error" code around placeholders relies on having better error tracing than NLL currently provides, so that it knows (e.g.) that the constraint arose from applying a trait impl and things like that. I feel like I was hoping *not* to do such fine-grained tracing in NLL, and it seems like we...largely...got away with that. I'm not sure yet if we'll have to add more tracing information or if there is some sort of alternative.
      
      It's worth pointing out though that I've not kind of shifted my opinion on whose job it should be to enforce lifetimes: I tend to think we ought to be moving back towards *something like* the leak-check (just not the one we *had*). If we took that approach, it would actually resolve this aspect of the error message problem, because we would be resolving 'higher-ranked errors' in the trait solver itself, and hence we wouldn't have to thread as much causal information back to the region checker. I think it would also help us with removing the leak check while not breaking some of the existing crates out there.
      
      Regardless, I think it's worth landing this change, because it was relatively simple and it aligns the set of programs that NLL accepts with those that are accepted by the main region checker, and hence should at least *help* us in migration (though I guess we still also have to resolve the existing crates that rely on leak check for coherence).
      
      r? @matthewjasper
      09f3c908
  2. 30 4月, 2020 15 次提交