Commit Graph

124526 Commits

Author SHA1 Message Date
Yuki Okushi
4eb9253660
Rollup merge of #75083 - JohnTitor:follow-up-unused-braces, r=lcnr
Do not trigger `unused_braces` for `while let`

Follow-up for #75031
r? @lcnr
2020-08-04 09:27:04 +09:00
Yuki Okushi
c2bc733d99
Rollup merge of #75081 - jyn514:fix-logging, r=Mark-Simulacrum
Fix logging for rustdoc

https://github.com/rust-lang/rust/pull/74726#issuecomment-667765557
2020-08-04 09:27:03 +09:00
Yuki Okushi
485bfa7a75
Rollup merge of #75056 - Veykril:path_statements_lint, r=oli-obk
Lint path statements to suggest using drop when the type needs drop

Fixes #48852. With this change the current lint description doesn't really fit entirely anymore I think.
2020-08-04 09:27:01 +09:00
Yuki Okushi
262fce481d
Rollup merge of #75043 - petrochenkov:hasname, r=nnethercote
rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`

For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.

Replace all uses of `check_name` with `has_name` outside of rustc, only rustc needs to mark attributes as used.

cc https://github.com/rust-lang/rust/pull/74932
r? @nnethercote
2020-08-04 09:26:59 +09:00
Yuki Okushi
cc0ac7eece
Rollup merge of #74759 - carbotaniuman:uabs, r=shepmaster
add `unsigned_abs` to signed integers

Mentioned on rust-lang/rfcs#2914

This PR simply adds an `unsigned_abs` to signed integers function which returns the correct absolute value as a unsigned integer.
2020-08-04 09:26:58 +09:00
bors
d8cbd9caca Auto merge of #74526 - erikdesjardins:reftrack, r=Mark-Simulacrum
Add track_caller to RefCell::{borrow, borrow_mut}

So panic messages point at the offending borrow.

Fixes #74472
2020-08-03 21:43:27 +00:00
Vadim Petrochenkov
05f414b72a rustc_ast: More detailed docs for Attribute::check_name 2020-08-04 00:34:11 +03:00
Vadim Petrochenkov
0a88346be6 rustc_ast: (Nested)MetaItem::check_name -> has_name
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either.

Replace all uses of `check_name` with `has_name` outside of rustc
2020-08-04 00:34:11 +03:00
bors
829d69b9c6 Auto merge of #74827 - ssomers:btree_cleanup_insert, r=Mark-Simulacrum
Move bulk of BTreeMap::insert method down to new method on handle

Adjust the boundary between the map and node layers for insertion: do more in the node layer, keep root manipulation and pointer dereferencing separate. No change in undefined behaviour or performance.

r? @Mark-Simulacrum
2020-08-03 15:46:02 +00:00
bors
c186aed59a Auto merge of #75092 - kennytm:fix-75009, r=pietroalbini
Fix broken git commit in stdarch

Follow-up on #75009, point to the real master commit.
2020-08-03 09:34:06 +00:00
kennytm
fd7596c9a5
fix broken git commit in stdarch 2020-08-03 15:52:30 +08:00
bors
dbc2ef25fb Auto merge of #75076 - tmiasko:simplify-goto, r=oli-obk
Fix change detection in CfgSimplifier::collapse_goto_chain

Check that the old target is different from the new collapsed one, before concluding that anything changed.

Fixes #75074
Fixes #75051
2020-08-03 07:20:21 +00:00
bors
1b0ff9e7d0 Auto merge of #75068 - petrochenkov:ignore-debinfo, r=Mark-Simulacrum
tests: Ignore src/test/debuginfo/rc_arc.rs on Windows

It requires loading pretty-printers (`src\etc\gdb_load_rust_pretty_printers.py`), but GDB doesn't load them on Windows.

Not sure how this passes through CI, due to an old GDB version perhaps?
2020-08-03 05:25:03 +00:00
bors
7637cbb79b Auto merge of #75055 - cjgillot:clean-cache, r=oli-obk
Introduce an abstraction for EvaluationCache and SelectionCache

The small duplicated code has been moved to librustc_query_system.

The remaining changes are some cleanups of structural impls.
2020-08-03 03:37:33 +00:00
Yuki Okushi
2e5c50195a
Do not trigger unused_braces for while let 2020-08-03 12:18:10 +09:00
Joshua Nelson
e97e6fbe34 Fix logging for rustdoc 2020-08-02 22:24:54 -04:00
bors
8244b1b114 Auto merge of #74969 - nnethercote:rm-GCX_PTR, r=Mark-Simulacrum
Remove `GCX_PTR`.

We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows
implicit access to a `GlobalCtxt` and some other things.

We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same
`GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR`
is only used in the parallel compiler's `handle_deadlock()` function.

This commit does the following.
- It removes `GCX_PTR`.
- It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a
  `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now
  equivalent to the old `tls::enter_global()`.
- Makes `tls::get_tlv()` public for the parallel compiler, because it's
  now used in `handle_deadlock()`.

r? @petrochenkov
2020-08-03 01:50:25 +00:00
bors
19ecce332e Auto merge of #74948 - lzutao:stalize-result-as-deref, r=dtolnay
Stabilize `Result::as_deref` and `as_deref_mut`

FCP completed in https://github.com/rust-lang/rust/issues/50264#issuecomment-645681400.

This PR stabilizes two new APIs for `std::result::Result`:
```rust
fn as_deref(&self) -> Result<&T::Target, &E> where T: Deref;
fn as_deref_mut(&mut self) -> Result<&mut T::Target, &mut E> where T: DerefMut;
```

This PR also removes two rarely used unstable APIs from `Result`:
```rust
fn as_deref_err(&self) -> Result<&T, &E::Target> where E: Deref;
fn as_deref_mut_err(&mut self) -> Result<&mut T, &mut E::Target> where E: DerefMut;
```

Closes #50264
2020-08-02 23:55:12 +00:00
Nicholas Nethercote
8c78fd234b Use more appropriate tls::with_* methods in some places. 2020-08-03 09:40:44 +10:00
Nicholas Nethercote
d93277b915 Remove GCX_PTR.
We store an `ImplicitCtxt` pointer in a thread-local value (TLV). This allows
implicit access to a `GlobalCtxt` and some other things.

We also store a `GlobalCtxt` pointer in `GCX_PTR`. This is always the same
`GlobalCtxt` as the one within the `ImplicitCtxt` pointer in TLV. `GCX_PTR`
is only used in the parallel compiler's `handle_deadlock()` function.

This commit does the following.
- It removes `GCX_PTR`.
- It also adds `ImplicitCtxt::new()`, which constructs an `ImplicitCtxt` from a
  `GlobalCtxt`. `ImplicitCtxt::new()` + `tls::enter_context()` is now
  equivalent to the old `tls::enter_global()`.
- Makes `tls::get_tlv()` public for the parallel compiler, because it's
  now used in `handle_deadlock()`.
2020-08-03 09:40:41 +10:00
Tomasz Miąsko
7f9f2ff9f4 Remove redundant assignment from CfgSimplifier 2020-08-03 00:40:53 +02:00
Tomasz Miąsko
82651db9b2 Fix change detection in CfgSimplifier::collapse_goto_chain
Check that the old target is different from the new collapsed one,
before concluding that anything changed.
2020-08-03 00:39:53 +02:00
bors
81e754c359 Auto merge of #75070 - Manishearth:rollup-2kgcaw5, r=Manishearth
Rollup of 5 pull requests

Successful merges:

 - #74980 (pprust: adjust mixed comment printing and add regression test for #74745)
 - #75009 (Document the discrepancy in the mask type for _mm_shuffle_ps)
 - #75031 (Do not trigger `unused_{braces,parens}` lints with `yield`)
 - #75059 (fix typos)
 - #75064 (compiletest: Support ignoring tests requiring missing LLVM components)

Failed merges:

r? @ghost
2020-08-02 22:07:32 +00:00
Manish Goregaokar
0bf2dcf059
Rollup merge of #75064 - petrochenkov:llvmtarg, r=Mark-Simulacrum
compiletest: Support ignoring tests requiring missing LLVM components

This PR implements a more principled solution to the problem described in https://github.com/rust-lang/rust/pull/66084.

Builds of LLVM backends take a lot of time and disk space.
So it usually makes sense to build rustc with
```toml
[llvm]
targets = "X86"
experimental-targets = ""
```
unless you are working on some target-specific tasks.

A few tests, however, require non-x86 backends to be built.
A new test directive `// needs-llvm-components: component1 component2 component3` makes such tests to be automatically ignored if one of the listed components is missing in the provided LLVM (this is determined through `llvm-config --components`).

As a result, the test suite now fully passes with LLVM built only with the x86 backend. The component list in this case is
```
aggressiveinstcombine all all-targets analysis asmparser asmprinter binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mirparser native nativecodegen objcarcopts object objectyaml option orcerror orcjit passes profiledata remarks runtimedyld scalaropts selectiondag support symbolize tablegen target textapi transformutils vectorize windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray
```

(With the default target list it's much larger.)
```
aarch64 aarch64asmparser aarch64codegen aarch64desc aarch64disassembler aarch64info aarch64utils aggressiveinstcombine all all-targets analysis arm armasmparser armcodegen armdesc armdisassembler arminfo armutils asmparser asmprinter avr avrasmparser avrcodegen avrdesc avrdisassembler avrinfo binaryformat bitreader bitstreamreader bitwriter cfguard codegen core coroutines coverage debuginfocodeview debuginfodwarf debuginfogsym debuginfomsf debuginfopdb demangle dlltooldriver dwarflinker engine executionengine frontendopenmp fuzzmutate globalisel hexagon hexagonasmparser hexagoncodegen hexagondesc hexagondisassembler hexagoninfo instcombine instrumentation interpreter ipo irreader jitlink libdriver lineeditor linker lto mc mca mcdisassembler mcjit mcparser mips mipsasmparser mipscodegen mipsdesc mipsdisassembler mipsinfo mirparser msp430 msp430asmparser msp430codegen msp430desc msp430disassembler msp430info native nativecodegen nvptx nvptxcodegen nvptxdesc nvptxinfo objcarcopts object objectyaml option orcerror orcjit passes powerpc powerpcasmparser powerpccodegen powerpcdesc powerpcdisassembler powerpcinfo profiledata remarks riscv riscvasmparser riscvcodegen riscvdesc riscvdisassembler riscvinfo riscvutils runtimedyld scalaropts selectiondag sparc sparcasmparser sparccodegen sparcdesc sparcdisassembler sparcinfo support symbolize systemz systemzasmparser systemzcodegen systemzdesc systemzdisassembler systemzinfo tablegen target textapi transformutils vectorize webassembly webassemblyasmparser webassemblycodegen webassemblydesc webassemblydisassembler webassemblyinfo windowsmanifest x86 x86asmparser x86codegen x86desc x86disassembler x86info x86utils xray
```

https://github.com/rust-lang/rust/pull/66084 is also reverted now.

r? @Mark-Simulacrum
2020-08-02 13:08:48 -07:00
Manish Goregaokar
9471ab068c
Rollup merge of #75059 - shengsheng:typos, r=Dylan-DPC
fix typos

Fix common misspellings with https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
2020-08-02 13:08:47 -07:00
Manish Goregaokar
db3e10f9cb
Rollup merge of #75031 - JohnTitor:unused-parens-braces-yield, r=lcnr
Do not trigger `unused_{braces,parens}` lints with `yield`

Fixes #74883
r? @lcnr
2020-08-02 13:08:45 -07:00
Manish Goregaokar
1b350ecb60
Rollup merge of #75009 - georgio:master, r=kennytm
Document the discrepancy in the mask type for _mm_shuffle_ps

This Pull Request updates the `stdarch` submodule in order to resolve #62490
2020-08-02 13:08:43 -07:00
Manish Goregaokar
bf4a37d961
Rollup merge of #74980 - davidtwco:issue-74745-pprust-regression-test, r=petrochenkov
pprust: adjust mixed comment printing and add regression test for #74745

Fixes #74745.

This PR adds a regression test for #74745. While a `ignore-tidy-trailing-lines` header is required, this doesn't stop the test from reproducing, so long as there is no newline at the end of the file.

However, adding the header comments made the test fail due to a bug in pprust - so this PR also  adjusts the pretty printing of mixed comments so that the initial zero-break isn't emitted at the beginning of the line. Through this, the `block-comment-wchar` test can have the `pp-exact` file removed, as it no longer converges from pretty printing of the source.
2020-08-02 13:08:42 -07:00
bors
f042d749b0 Auto merge of #74826 - matklad:mbe-fragment, r=petrochenkov
Introduce NonterminalKind for more type-safe mbe parsing

It encapsulate the (part of) the interface between the parser and
macro by example (macro_rules) parser.

The second bit is somewhat more general `parse_ast_fragment`, which is
the reason why we keep some `parse_xxx` functions as public.
2020-08-02 19:48:44 +00:00
Vadim Petrochenkov
0eacf02f01 tests: Ignore src/test/debuginfo/rc_arc.rs on Windows
It requires loading pretty-printers, but GDB doesn't load them on Windows
2020-08-02 22:20:48 +03:00
Lukas Wirth
35d6a2ef2b Lint path statements to use drop for drop types 2020-08-02 20:22:17 +02:00
Stein Somers
f5c47fa44d Move bulk of BTreeMap::insert method down to new method on handle 2020-08-02 20:20:42 +02:00
bors
19cefa6864 Auto merge of #74963 - JohnTitor:ptn-ice, r=petrochenkov
Fix ICEs with `@ ..` binding

This reverts #74557 and introduces an alternative fix while ensuring that #74954 is not broken.
The diagnostics are verbose though, it fixes three related issues.
cc #74954, #74539, and #74702
2020-08-02 18:01:27 +00:00
Vadim Petrochenkov
d3277b927a compiletest: Support ignoring tests requiring missing LLVM components 2020-08-02 20:35:24 +03:00
Yuki Okushi
2e7ba785b3
Recover strictness for yield 2020-08-03 01:34:18 +09:00
bors
a99ae95c72 Auto merge of #75060 - JohnTitor:rollup-aq8sfxf, r=JohnTitor
Rollup of 10 pull requests

Successful merges:

 - #74686 (BTreeMap: remove into_slices and its unsafe block)
 - #74762 (BTreeMap::drain_filter should not touch the root during iteration)
 - #74781 (Clean up E0733 explanation)
 - #74874 (BTreeMap: define forget_type only when relevant)
 - #74974 (Make tests faster in Miri)
 - #75010 (Update elasticlunr-rs and ammonia transitive deps)
 - #75041 (Replaced log with tracing crate)
 - #75044 (Clean up E0744 explanation)
 - #75054 (Rename rustc_middle::cstore::DepKind to CrateDepKind)
 - #75057 (Avoid dumping rustc invocations to stdout)

Failed merges:

 - #74827 (Move bulk of BTreeMap::insert method down to new method on handle)

r? @ghost
2020-08-02 16:06:54 +00:00
Yuki Okushi
50f2b5d9a0
Rollup merge of #75057 - Mark-Simulacrum:avoid-long-print, r=alexcrichton
Avoid dumping rustc invocations to stdout

These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
2020-08-03 01:05:28 +09:00
Yuki Okushi
595a2f5c6b
Rollup merge of #75054 - cjgillot:rename-depkind, r=petrochenkov
Rename rustc_middle::cstore::DepKind to CrateDepKind

It is ambiguous with DepGraph's own DepKind.
2020-08-03 01:05:27 +09:00
Yuki Okushi
d4cc6d8394
Rollup merge of #75044 - GuillaumeGomez:cleanup-e0744, r=pickfire
Clean up E0744 explanation

r? @Dylan-DPC
2020-08-03 01:05:25 +09:00
Yuki Okushi
e7288486df
Rollup merge of #75041 - pawanbisht62:feature/replace-log-with-tracing, r=oli-obk
Replaced log with tracing crate

Issue #74747
2020-08-03 01:05:23 +09:00
Yuki Okushi
21ebf6900d
Rollup merge of #75010 - Aaron1011:feature/remove-old-deps, r=Mark-Simulacrum
Update elasticlunr-rs and ammonia transitive deps

This removes all dependencies on pre-1.0 proc-macro ecosystem crates
(syn, quote, and proc-macro2)
2020-08-03 01:05:22 +09:00
Yuki Okushi
7d18040b0c
Rollup merge of #74974 - RalfJung:miri-tests, r=Mark-Simulacrum
Make tests faster in Miri

Reduce some test iteration counts in Miri.
2020-08-03 01:05:20 +09:00
Yuki Okushi
1033c74665
Rollup merge of #74874 - ssomers:btree_cleanup_8, r=Mark-Simulacrum
BTreeMap: define forget_type only when relevant

Similar to `forget_node_type` for handles.
No effect on generated code, apart maybe from the superfluous calls that might not have been optimized away.

r? @Mark-Simulacrum
2020-08-03 01:05:18 +09:00
Yuki Okushi
5323b9fd9c
Rollup merge of #74781 - GuillaumeGomez:cleanup-e0733, r=jyn514
Clean up E0733 explanation

r? @Dylan-DPC
2020-08-03 01:05:15 +09:00
Yuki Okushi
814b31eb2e
Rollup merge of #74762 - ssomers:btree_no_root_in_remove_kv_tracking, r=Mark-Simulacrum
BTreeMap::drain_filter should not touch the root during iteration

Although Miri doesn't point it out, I believe there is undefined behaviour using `drain_filter` when draining the 11th-last element from a tree that was larger. When this happens, the last remaining child nodes are merged, the root becomes empty and is popped from the tree. That last step establishes a mutable reference to the node elected root and writes a pointer in `node::Root`, while iteration continues to visit the same node.

This is mostly code from #74437, slightly adapted.
2020-08-03 01:05:13 +09:00
Yuki Okushi
8c331ee470
Rollup merge of #74686 - ssomers:btree_cleanup_3, r=Mark-Simulacrum
BTreeMap: remove into_slices and its unsafe block

A small tweak to make BTreeMap code shorter and less unsafe.

r? @Mark-Simulacrum
2020-08-03 01:05:12 +09:00
Georgio Nicolas
1e2ce28ec0 Document the discrepancy in the mask type for _mm_shuffle_ps 2020-08-02 18:22:26 +03:00
liuzhenyu
3b4151c9f3 fix typos 2020-08-02 23:20:00 +08:00
Mark Rousskov
cc7abc7563 Avoid dumping rustc invocations to stdout
These are quite long, usually, and in most cases not interesting. On smaller
terminals they can take up more than a full page of output, hiding the error
diagnostics emitted.
2020-08-02 10:54:13 -04:00
David Wood
1530563bd7
compiletest: print diff for pretty tests
This commit modifies compiletest so that a diff of actual and expected
output is shown for pretty tests. This makes it far easier to work out
what has changed.

Signed-off-by: David Wood <david@davidtw.co>
2020-08-02 15:33:07 +01:00