Commit Graph

106232 Commits

Author SHA1 Message Date
Dylan DPC
a25ce40bc9
Rollup merge of #68818 - matthiaskrgr:misc_perf, r=Mark-Simulacrum
fix couple of perf related clippy warnings

librustc: don't clone a type that is copy
librustc_incremental: use faster vector initialization
librustc_typeck: don't clone a type that is copy
librustdoc: don't create a vector where a slice will do
2020-02-04 21:51:56 +01:00
Dylan DPC
3fe4c0ddf9
Rollup merge of #68815 - matthiaskrgr:redundant_imports, r=alexcrichton
remove redundant imports (clippy::single_component_path_imports)
2020-02-04 21:51:55 +01:00
Dylan DPC
94d6a96189
Rollup merge of #68810 - ollie27:once_with_copy, r=Dylan-DPC
Remove Copy impl from OnceWith

Iterators typically don't implement `Copy` and this shouldn't be an exception.
2020-02-04 21:51:53 +01:00
Dylan DPC
4d6e2d81b8
Rollup merge of #68805 - matthiaskrgr:cleanup_bootstrap, r=Mark-Simulacrum
bootstrap: fix clippy warnings

r? @oli-obk
2020-02-04 21:51:52 +01:00
Dylan DPC
48ea0fa416
Rollup merge of #68758 - daboross:fix-59191, r=petrochenkov
Fix 59191 - ICE when macro replaces crate root with non-module item

Hi,

This should fix #59191! My friend and I are working on learning the rustc codebase through contributions, so please feel free to mention anything amiss or that could be done better.

The code adds an explicit case for when a macro applied to the crate root (via an inner attribute) replaces it with something nonsensical, like a function. The crate root must be a module, and the error message reflects this.

---

I should note that there are a few other weird edge cases here, like if they do output a module, it succeeds but uses that module's name as a prefix for all names in the crate. I'm assuming that's an issue for stabilizing #54726, though.
2020-02-04 21:51:50 +01:00
Dylan DPC
1921fc0994
Rollup merge of #68282 - tmiasko:sanitizer-example, r=steveklabnik
Instrument C / C++ in MemorySanitizer example

Modify the example to instrument C / C++ in addition to Rust, since it
will be generally required (e.g., when using libbacktrace for symbolication).
2020-02-04 21:51:48 +01:00
bors
5b0caef54a Auto merge of #68377 - estebank:fn-obligations-spans, r=oli-obk
Tweak obligation error output

- Point at arguments or output when fn obligations come from them, or ident when they don't
- Point at `Sized` bound (fix #47990)
- When object unsafe trait uses itself in associated item suggest using `Self` (fix #66424, fix #33375, partially address #38376, cc #61525)
-  Point at reason in object unsafe trait with `Self` in supertraits or `where`-clause (cc #40533, cc #68377)
- On implicit type parameter `Sized` obligations, suggest `?Sized` (fix #57744, fix #46683)
2020-02-04 17:17:55 +00:00
bors
126ad2b813 Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbini
Step stage0 to bootstrap from 1.42

This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
2020-02-04 14:16:18 +00:00
Mark Rousskov
dbc9894095 Drop unused extern crates 2020-02-04 08:14:08 -05:00
bors
bae3d0dfc7 Auto merge of #68804 - ecstatic-morse:qualif-cursor-lazy, r=estebank
Always use lazy qualif getters during const-checking

`has_mut_interior_eager_seek` was needed to work around an overly restrictive bound on the `per_local` argument to the `Qualif` trait. This PR makes that bound `FnMut` instead of `Fn` so we can seek cursors inside of it, resolving a FIXME in the const-checking code.
2020-02-04 10:58:45 +00:00
bors
fc07615c49 Auto merge of #68601 - 0dvictor:split, r=tmandry
Split `join_codegen_and_link()` into two steps

`join_codegen_and_link()` is split to `join_codegen()` and `link()`.
2020-02-04 05:48:54 +00:00
Matthias Krüger
fe1314dbc4 fix couple of perf related clipyp warnings
librustc: don't clone a type that is copy
librustc_incremental: use faster vector initialization
librustc_typeck: don't clone a type that is copy
librustdoc: don't create a vector where a slice will do
2020-02-04 02:35:56 +01:00
Victor Ding
ae51d2ba32 Split join_codegen_and_link() into two steps
`join_codegen_and_link()` is split to `join_codegen()` and `link()`.
2020-02-04 11:09:50 +11:00
Matthias Krüger
697ef95c9f remove redundant imports (clippy::single_component_path_imports) 2020-02-04 01:05:45 +01:00
Oliver Middleton
5f689fe466 Remove Copy impl from OnceWith
Iterators typically don't implement `Copy` and this shouldn't be an exception.
2020-02-03 22:30:17 +00:00
bors
42a0bd2091 Auto merge of #67668 - matthewjasper:or-patterns, r=pnkfelix
Implement MIR lowering for or-patterns

This is the last thing needed to get meaningful run-pass tests for or-patterns. There probably need to be more tests before stabilizing this, but the most important cases should have been covered.

Note: we can generate exponentially large MIR CFGs when using or-patterns containing bindings, type ascriptions, or that are for a match arm with a guard. `src/test/mir-opt/exponential-or.rs` shows the best case for what we currently do.

cc #54883
closes #60350
closes #67514

cc @Centril
r? @pnkfelix
2020-02-03 22:02:26 +00:00
Matthew Jasper
8dbbe4d144 Avoid scheduling repeated StorageDeads
Also add some comments
2020-02-03 19:42:15 +00:00
Matthew Jasper
9b9dafb2c8 Make use of Place: Copy 2020-02-03 19:42:15 +00:00
matthewjasper
1d90ed6370 Apply suggestions from code review
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-03 19:42:15 +00:00
Matthew Jasper
89e52e2ca9 Address review comments 2020-02-03 19:42:15 +00:00
Matthew Jasper
5f90dbd5e8 Make Candidate private 2020-02-03 19:42:15 +00:00
Matthew Jasper
c7e6f88926 Add more tests for or-patterns 2020-02-03 19:42:15 +00:00
Matthias Krüger
5f979e9afa bootstrap: fix clippy warnings 2020-02-03 20:26:36 +01:00
Esteban Küber
0e584114c6 Change wording for object unsafe because of assoc const 2020-02-03 10:54:16 -08:00
bors
8417d68de5 Auto merge of #68803 - Dylan-DPC:rollup-b4x6ghj, r=Dylan-DPC
Rollup of 8 pull requests

Successful merges:

 - #68678 (Install robots.txt into rust-docs tarballs)
 - #68711 (Added upper bound of what vecs and boxes can allocate)
 - #68744 (Do not ICE in `type-alias-impl-trait` with save-analysis)
 - #68777 (Clean up E0263 explanation)
 - #68787 (Optimize core::ptr::align_offset (part 1))
 - #68797 (Fix links to types instead of modules)
 - #68798 (Test that `#[track_caller]` as `fn()` respects RT / CTFE equivalence)
 - #68800 (Stabilize `core::iter::once_with()`)

Failed merges:

r? @ghost
2020-02-03 18:40:54 +00:00
Dylan MacKenzie
21a040e7ac Treat Rvalue::AddressOf the same as Rvalue::Ref 2020-02-03 10:38:32 -08:00
Dylan MacKenzie
110a7e25b6 Eliminate "eager" qualif getter
All qualif getters are now lazy
2020-02-03 10:33:33 -08:00
Dylan MacKenzie
4c5ca44b92 Pass correct closure type to Qualif methods 2020-02-03 10:32:54 -08:00
Dylan MacKenzie
49ef3dac69 Take FnMut instead of Fn in Qualif methods 2020-02-03 10:27:38 -08:00
Dylan DPC
af3c315daf
Rollup merge of #68800 - JohnTitor:stabilize-once-with, r=Centril
Stabilize `core::iter::once_with()`

Fixes #57581

FCP: https://github.com/rust-lang/rust/issues/57581#issuecomment-576178031

r? @SimonSapin
2020-02-03 18:58:37 +01:00
Dylan DPC
f17f97d36a
Rollup merge of #68798 - Centril:caller-loc-ctfe-rt-equiv, r=RalfJung
Test that `#[track_caller]` as `fn()` respects RT / CTFE equivalence

r? @RalfJung cc @anp @eddyb
2020-02-03 18:58:36 +01:00
Dylan DPC
1028978e8f
Rollup merge of #68797 - GuillaumeGomez:link-to-types, r=Dylan-DPC
Fix links to types instead of modules

r? @Dylan-DPC
2020-02-03 18:58:35 +01:00
Dylan DPC
370fd8c1b7
Rollup merge of #68787 - amosonn:patch-1, r=nagisa
Optimize core::ptr::align_offset (part 1)

r? @nagisa
See #68616 for main discussion.
2020-02-03 18:58:33 +01:00
Dylan DPC
51c6c25575
Rollup merge of #68777 - GuillaumeGomez:clean-up-e0263, r=Dylan-DPC
Clean up E0263 explanation

r? @Dylan-DPC
2020-02-03 18:58:32 +01:00
Dylan DPC
95d1f6ffcd
Rollup merge of #68744 - JohnTitor:fix-ice-save-analysis, r=cramertj
Do not ICE in `type-alias-impl-trait` with save-analysis

FIxes #68621
Fixes #68750
2020-02-03 18:58:30 +01:00
Dylan DPC
5e561c2135
Rollup merge of #68711 - hman523:fix-68593, r=Dylan-DPC
Added upper bound of what vecs and boxes can allocate

Fixed issue #68593
I added a line of documentation to these two files to reflect that vectors and boxes ensure that they never allocate more than `isize::MAX` bytes.
r? @steveklabnik
2020-02-03 18:58:27 +01:00
Dylan DPC
95df2bcaeb
Rollup merge of #68678 - Mark-Simulacrum:robots, r=pietroalbini
Install robots.txt into rust-docs tarballs

Fixes #68677.

I believe this might just work out from the central-station perspective, but even if it doesn't, this is a prerequisite step anyway.
2020-02-03 18:58:23 +01:00
Yuki Okushi
7e2d7e0bbc Stabilize core::iter::once_with() 2020-02-04 00:47:04 +09:00
Mazdak Farrokhzad
f0eec88581 track_caller test caller_location ctfe/rt equivalence wrt. fnptrs 2020-02-03 16:15:30 +01:00
Guillaume Gomez
46f6dad101 Fix links to types instead of modules 2020-02-03 16:12:35 +01:00
bors
bdd946df3a Auto merge of #68665 - eddyb:debuginfo-early-create-var, r=nagisa
codegen: create DIVariables ahead of using them with llvm.dbg.declare.

Instead of having `rustc_codegen_llvm` bundle creation of a `DIVariable` and `llvm.dbg.declare` into a single operation, they are now two separate methods, and the `DIVariable` is created earlier, specifically when `mir::VarDebugInfo`s are being partitioned into locals.

While this isn't currently needed, it's a prerequisite for #48300, which adds fragmented debuginfo, where one `mir::VarDebugInfo` has multiple parts of itself mapped to different `mir::Place`s.
For debuggers to see one composite variable instead of several ones with the same name, we need to create a single `DIVariable` and share it between multiple `llvm.dbg.declare` calls, which are likely pointing to different MIR locals.
That makes the `per_local_var_debug_info` partitioning a good spot to do this in, as we can create *exactly* one `DIVariable` per `mir::VarDebugInfo`, and refer to it as many things as needed.

I'm opening this PR separately because I want to test its perf impact in isolation (see https://github.com/rust-lang/rust/pull/48300#issuecomment-580121438).

r? @nagisa or @oli-obk cc @michaelwoerister @nikomatsakis
2020-02-03 13:06:44 +00:00
Eduard-Mihai Burtescu
e35dfad5b8 rustc_codegen_llvm: avoid redundant calls to span_start. 2020-02-03 12:14:22 +02:00
Eduard-Mihai Burtescu
f4b74773c7 rustc_codegen_ssa: convert mir::VarDebugInfo into a custom PerLocalVarDebugInfo. 2020-02-03 12:14:22 +02:00
Eduard-Mihai Burtescu
0b633c82f0 rustc_codegen_ssa: split declare_local into create_dbg_var and dbg_var_addr. 2020-02-03 12:14:21 +02:00
bors
c58e09f138 Auto merge of #68778 - RalfJung:raw-addr-of, r=eddyb
add raw-addr-of variant to mir_raw_fat_ptr

As suggested at https://github.com/rust-lang/rust/pull/48300#discussion_r372520388

r? @eddyb
2020-02-03 09:54:09 +00:00
bors
0d34a87722 Auto merge of #68772 - matthewjasper:relate-opt, r=davidtwco
Avoid exponential behaviour when relating types

When equating bound types we check subtyping in both directions. Since closures are invariant in their substs, we end up comparing the two types an exponential number of times. If there are no bound variables this isn't needed.

Closes #68061
2020-02-03 06:38:34 +00:00
David
152811d8bf Change expansion error to be non-fatal
Changes the error handler for inner attributes that replace the root
with a non-module. Previously it would emit a fatal error. It now emits
an empty expasion and a non-fatal error like the existing handler for a
failed expansion.
2020-02-02 21:03:38 -08:00
bors
a2e80300cd Auto merge of #68756 - JohnTitor:fix-ice-save-analysis-2, r=davidtwco
Fix ICE with save-analysis

Fixes #68749

It should be fine since it's the same way as `visit_expr`.
2020-02-03 03:28:08 +00:00
bors
01db581942 Auto merge of #68735 - JohnTitor:fix-ice-0202, r=estebank
Use `next_point` to avoid ICE

Fixes #68730

r? @estebank (I think you're familiar with that)
2020-02-03 00:04:16 +00:00
Amos Onn
22b263ae18 Optimize core::ptr::align_offset
- As explained in the comment inside mod_inv, it is valid to work mod
  `usize::max_value()` right until the end.
2020-02-03 01:03:33 +01:00