Commit graph

154548 commits

Author SHA1 Message Date
Noah Lev
5321b35a5a Fix redundant arguments in external_path()
If the path is for a trait, it is always true that `trait_did ==
Some(did)`, so instead, `external_path()` now takes an `is_trait`
boolean.
2021-09-11 15:43:44 -07:00
bors
8c2b6ea37d Auto merge of #78780 - cjgillot:req, r=Mark-Simulacrum
Refactor query forcing

The control flow in those functions was very complex, with several layers of continuations.

I tried to simplify the implementation, while keeping essentially the same logic.
Now, all code paths go through `try_execute_query` for the actual query execution.
Communication with the `dep_graph` and the live caches are the only difference between query getting/ensuring/forcing.
2021-09-11 20:39:47 +00:00
Noah Lev
c2207f5a48 Remove unused hir_id parameter from resolve_type 2021-09-11 11:24:54 -07:00
Noah Lev
6a84d34784 Create a valid Res in external_path()
The order of the `where` bounds on auto trait impls changed because
rustdoc currently sorts auto trait `where` bounds based on the `Debug`
output for the bound. Now that the bounds have an actual `Res`, they are
being unintentionally sorted by their `DefId` rather than their path.
So, I had to update a test for the change in ordering of the rendered
bounds.
2021-09-11 11:24:53 -07:00
Noah Lev
0bb1c285af rustdoc: Get symbol for TyParam directly 2021-09-11 11:24:53 -07:00
Noah Lev
df281ee57b Only take tcx when it's all that's needed 2021-09-11 11:24:53 -07:00
lcnr
03f9fe2f2f explicitly link to external ena docs 2021-09-11 20:24:46 +02:00
bors
43769af69e Auto merge of #88857 - workingjubilee:rollup-zrtvspt, r=workingjubilee
Rollup of 10 pull requests

Successful merges:

 - #87904 (Reword description of automatic impls of `Unsize`.)
 - #88147 (Fix non-capturing closure return type coercion)
 - #88209 (Improve error message when _ is used for in/inout asm operands)
 - #88668 (Change more x64 size checks to not apply to x32.)
 - #88733 (Fix ICE for functions with more than 65535 arguments)
 - #88757 (Suggest wapping expr in parentheses on invalid unary negation)
 - #88779 (Use more accurate spans for "unused delimiter" lint)
 - #88830 (Add help for E0463)
 - #88849 (don't clone types that are Copy (clippy::clone_on_copy))
 - #88850 (don't convert types into identical types)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-11 17:48:48 +00:00
Ralf Jung
07b64bfd3a interpreter PointerArithmetic: use new Size helper methods 2021-09-11 12:21:10 -04:00
Camille GILLOT
7842b80478 Rebase fallout. 2021-09-11 17:52:39 +02:00
Jubilee
2a8ad06689
Rollup merge of #88850 - matthiaskrgr:identical_conv, r=jackh726
don't convert types into identical types

example: let x: String = String::new().into();
2021-09-11 08:23:46 -07:00
Jubilee
c2e1097f44
Rollup merge of #88849 - matthiaskrgr:clony_on_copy, r=petrochenkov
don't clone types that are Copy (clippy::clone_on_copy)
2021-09-11 08:23:45 -07:00
Jubilee
2cfafa6a8d
Rollup merge of #88830 - GuillaumeGomez:help-e0463, r=estebank
Add help for E0463

Fixes #87871.

r? ```@estebank```
2021-09-11 08:23:44 -07:00
Jubilee
5648859e50
Rollup merge of #88779 - estebank:unused-delims, r=davidtwco
Use more accurate spans for "unused delimiter" lint
2021-09-11 08:23:43 -07:00
Jubilee
08cbb7dbe1
Rollup merge of #88757 - andrewhickman:master, r=jackh726
Suggest wapping expr in parentheses on invalid unary negation

Fixes #88701
2021-09-11 08:23:42 -07:00
Jubilee
746eb1d84d
Rollup merge of #88733 - Noble-Mushtak:88577, r=estebank
Fix ICE for functions with more than 65535 arguments

This pull request fixes #88577 by changing the `param_idx` field in the `Param` variant of `WellFormedLoc` from `u16` to `u32`, thus allowing for more than 65,535 arguments in a function. Note that I also added a regression test, but needed to add `// ignore-tidy-filelength` because the test is more than 8000 lines long.
2021-09-11 08:23:41 -07:00
Jubilee
7b514cdcfe
Rollup merge of #88668 - hvdijk:x32, r=joshtriplett
Change more x64 size checks to not apply to x32.

Commit 95e096d6 changed a bunch of size checks already, but more have
been added, so this fixes the new ones the same way: the various size
checks that are conditional on target_arch = "x86_64" were not intended
to apply to x86_64-unknown-linux-gnux32, so add
target_pointer_width = "64" to the conditions.
2021-09-11 08:23:41 -07:00
Jubilee
3af42a897f
Rollup merge of #88209 - Amanieu:asm_in_underscore, r=nagisa
Improve error message when _ is used for in/inout asm operands

As suggested by ```@Commeownist``` in https://github.com/rust-lang/rust/issues/72016#issuecomment-903102415.
2021-09-11 08:23:40 -07:00
Jubilee
94cbefb52a
Rollup merge of #88147 - FabianWolff:issue-88097, r=jackh726
Fix non-capturing closure return type coercion

Fixes #88097. For the example given there:
```rust
fn peculiar() -> impl Fn(u8) -> u8 {
    return |x| x + 1
}
```
which incorrectly reports an error, I noticed something weird in the debug log:
```
DEBUG rustc_typeck::check::coercion coercion::try_find_coercion_lub([closure@test.rs:2:12: 2:21], [closure@test.rs:2:12: 2:21], exprs=1 exprs)
```
Apparently, `try_find_coercion_lub()` thinks that the LUB for two closure types always has to be a function pointer (which explains the `expected closure, found fn pointer` error in #88097). There is one corner case where that isn't true, though — namely, when the two closure types are equal, in which case the trivial LUB is the type itself. This PR fixes this by inserting an explicit check for type equality in `try_find_coercion_lub()`.
2021-09-11 08:23:39 -07:00
Jubilee
95b50eb662
Rollup merge of #87904 - kpreid:unsize, r=jyn514
Reword description of automatic impls of `Unsize`.

The existing documentation felt a little unhelpfully concise, so this change tries to improve it by using longer sentences, each of which specifies which kinds of types it applies to as early as possible. In particular, the third item starts with “Structs ...” instead of saying “Foo is a struct” later.

Also, the previous list items “Only the last field has a type involving `T`” and “`T` is not part of the type of any other fields” are, as far as I see, redundant with each other, so I removed the latter.

I have no particular knowledge of `Unsize`; I have attempted to leave the meaning entirely unchanged but may have missed a nuance.

Markdown preview of the edited documentation:

> All implementations of `Unsize` are provided automatically by the compiler.
> Those implementations are:
>
> - Arrays `[T; N]` implement `Unsize<[T]>`.
> - Types implementing a trait `Trait` also implement `Unsize<dyn Trait>`.
> - Structs `Foo<..., T, ...>` implement `Unsize<Foo<..., U, ...>>` if all of these conditions
>   are met:
>   - `T: Unsize<U>`.
>   - Only the last field of `Foo` has a type involving `T`.
>   - `Bar<T>: Unsize<Bar<U>>`, where `Bar<T>` stands for the actual type of that last field.
2021-09-11 08:23:38 -07:00
Amanieu d'Antras
5862a0004a Add test for -Z panic-in-drop=abort 2021-09-11 16:13:30 +01:00
Amanieu d'Antras
a149bed3bd Ensure that crates are linked with compatible panic-in-drop settings 2021-09-11 16:13:30 +01:00
Amanieu d'Antras
007bd17a68 Apply noreturn and nounwind LLVM attributes to callsites 2021-09-11 16:13:30 +01:00
bors
641e02f388 Auto merge of #88327 - bonega:scalar_refactor, r=eddyb
`WrappingRange` (#88242) follow-up (`is_full_for`, `Scalar: Copy`, etc.)

Some changes related to feedback during #88242
r? `@RalfJung`
2021-09-11 10:18:05 +00:00
Deadbeef
a0b83f542f
Fix duplicate bounds for const_trait_impl 2021-09-11 09:40:19 +00:00
Andrew Hickman
43b79d8ef5 Add comment pointing to test 2021-09-11 10:17:06 +01:00
Matthias Krüger
545d8d675c don't convert types into identical types
example: let x: String = String::new().into();
2021-09-11 10:32:38 +02:00
Matthias Krüger
c1e96085d3 don't clone types that are Copy (clippy::clone_on_copy) 2021-09-11 10:18:56 +02:00
bors
4e880f8cbc Auto merge of #88214 - notriddle:notriddle/for-loop-span-drop-temps-mut, r=nagisa
rustc: use more correct span data in for loop desugaring

Fixes #82462

Before:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     for x in DroppingSlice(&*v).iter(); {
         |                                       +

After:

      help: consider adding semicolon after the expression so its temporaries are dropped sooner, before the local variables declared by the block are dropped
         |
      LL |     };
         |      +

This seems like a reasonable fix: since the desugared "expr_drop_temps_mut" contains the entire desugared loop construct, its span should contain the entire loop construct as well.
2021-09-11 07:11:01 +00:00
bors
22719efcc5 Auto merge of #88824 - Manishearth:rollup-7bzk9h6, r=Manishearth
Rollup of 15 pull requests

Successful merges:

 - #85200 (Ignore derived Clone and Debug implementations during dead code analysis)
 - #86165 (Add proc_macro::Span::{before, after}.)
 - #87088 (Fix stray notes when the source code is not available)
 - #87441 (Emit suggestion when passing byte literal to format macro)
 - #88546 (Emit proper errors when on missing closure braces)
 - #88578 (fix(rustc): suggest `items` be borrowed in `for i in items[x..]`)
 - #88632 (Fix issues with Markdown summary options)
 - #88639 (rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields)
 - #88667 (Tweak `write_fmt` doc.)
 - #88720 (Rustdoc coverage fields count)
 - #88732 (RustWrapper: avoid deleted unclear attribute methods)
 - #88742 (Fix table in docblocks)
 - #88776 (Workaround blink/chromium grid layout limitation of 1000 rows)
 - #88807 (Fix typo in docs for iterators)
 - #88812 (Fix typo `option` -> `options`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2021-09-11 03:30:55 +00:00
Mitchell Kember
8bfd8724e5 Update LLVM submodule
This merges upstream `release/13.x` changes to our fork. In particular,
this includes the bugfix https://reviews.llvm.org/D108608 (see also
https://bugs.llvm.org/show_bug.cgi?id=51637).
2021-09-11 00:15:38 +02:00
Waffle Lapkin
2c30162380
Fill in the tracking issue for #![feature(const_unsafecell_get_mut)] 2021-09-11 00:07:14 +03:00
Vadim Petrochenkov
294510e1bb rustc: Remove local variable IDs from Exports
Local variables can never be exported.
2021-09-10 23:41:48 +03:00
Guillaume Gomez
c9a56cdc58 Add help for E0463 2021-09-10 21:36:09 +02:00
Meziu
e07ae3ca26 ARMV6K 3DS: Removed useless parameters in target spec 2021-09-10 20:20:12 +02:00
Camille GILLOT
11a999e634 Duplicate tests for incremental spans mode. 2021-09-10 20:19:38 +02:00
Camille GILLOT
2e37ed87fc Record call_site parent for macros. 2021-09-10 20:19:25 +02:00
Camille GILLOT
5e026eacb1 Remove some span tracking. 2021-09-10 20:19:07 +02:00
Camille GILLOT
f84856cbb0 Give spans their parent item during lowering.
We only do this operation when incremental compilation is enabled. This
avoids pessimizing the span handling for non-incremental compilation.
2021-09-10 20:18:36 +02:00
Camille GILLOT
6f782c4e11 Add actual spans to the crate hash.
Now that we encode spans relative to the items, the item's own span is
never actually hashed as part of the HIR.
In consequence, we explicitly include it in the crate hash to avoid
missing cross-crate invalidations.
2021-09-10 20:18:31 +02:00
Camille GILLOT
fb5ced0fbd Add sanity check.
We force the relative span's parent to be absolute. This avoids having to
handle long dependency chains.
2021-09-10 20:18:26 +02:00
Camille GILLOT
940fa9251e Rename decode to data_untracked. 2021-09-10 20:18:22 +02:00
Camille GILLOT
b19ae20aad Track span dependency using a callback. 2021-09-10 20:18:18 +02:00
Camille GILLOT
e85ddeb474 Encode spans relative to their parent. 2021-09-10 20:18:11 +02:00
Camille GILLOT
00485e0c0e Keep a parent LocalDefId in SpanData. 2021-09-10 20:17:33 +02:00
Camille GILLOT
06f7ca307d Keep def_spans collected by resolution. 2021-09-10 20:17:08 +02:00
bors
b69fe57261 Auto merge of #88823 - hyd-dev:miri, r=RalfJung
Update Miri

Fixes #88768.

r? `@RalfJung`
2021-09-10 15:51:58 +00:00
Manish Goregaokar
f77311bc2b
Rollup merge of #88812 - gz:patch-1, r=ehuss
Fix typo `option` -> `options`.
2021-09-10 08:23:27 -07:00
Manish Goregaokar
00553034db
Rollup merge of #88807 - jruderman:which_reverses, r=joshtriplett
Fix typo in docs for iterators
2021-09-10 08:23:26 -07:00
Manish Goregaokar
3aaec559a1
Rollup merge of #88776 - dns2utf8:rustdoc_workaround_1000_elements_grid_bug, r=GuillaumeGomez
Workaround blink/chromium grid layout limitation of 1000 rows

I made this in case we don't come up with a better solution in time.

See https://github.com/rust-lang/rust/issues/88545 for more details.

A rendered version of the standard library is hosted here:
https://data.estada.ch/rustdoc-nightly_497ee321af_2021-09-09/core/arch/arm/index.html

r? `@GuillaumeGomez` `@jsha`
2021-09-10 08:23:25 -07:00