Commit Graph

154810 Commits

Author SHA1 Message Date
Wesley Wiser
e156df2a1c Fix debuginfo tests for the latest version of the Windows SDK.
- Cdb now correctly visualizes enums.
- Cdb doesn't render emoji characters in `OSStr` anymore.
- Cdb doesn't always render `str` correctly (#88840)
2021-09-10 21:46:40 -04:00
Michael Howell
e5c2412e52 Add the corrections stuff to the 88803 test case 2021-09-10 18:34:51 -07:00
Michael Howell
5dab3c5cf5 feat(rustc_typeck): suggest removing bad parens in (recv.method)()
Fixes #88803
2021-09-10 18:28:44 -07:00
Wesley Wiser
f1f5108ca3 Revert "Temporarily ignore some debuginfo tests on windows."
This reverts commit 8059bc1069.
2021-09-10 20:52:29 -04: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
Patrick Walton
79bc53870f Introduce a fast path that avoids the debug_tuple abstraction when deriving
Debug for unit-like enum variants.

The intent here is to allow LLVM to remove the switch entirely in favor of an
indexed load from a table of constant strings, which is likely what the
programmer would write in C. Unfortunately, LLVM currently doesn't perform this
optimization due to a bug, but there is [a
patch](https://reviews.llvm.org/D109565) that fixes this issue. I've verified
that, with that patch applied on top of this commit, Debug for unit-like tuple
variants becomes a load, reducing the O(n) code bloat to O(1).

Note that inlining `DebugTuple::finish()` wasn't enough to allow LLVM to
optimize the code properly; I had to avoid the abstraction entirely. Not using
the abstraction is likely better for compile time anyway.

Part of #88793.
2021-09-10 12:07:03 -07: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
Manish Goregaokar
130e2e1edf
Rollup merge of #88742 - GuillaumeGomez:fix-table-in-docblocks, r=nbdd0121
Fix table in docblocks

"Overwrite" of #88702.

Instead of adding a z-index to the sidebar (which only hides the issue, doesn't fix it), I wrap `<table>` elements inside a `<div>` and limit all chidren of `.docblock` elements' width to prevent having the scrollbar on the whole doc block.

![Screenshot from 2021-09-08 15-11-24](https://user-images.githubusercontent.com/3050060/132515740-71796515-e74f-429f-ba98-2596bdbf781c.png)

Thanks `@nbdd0121` for `overflow-x: auto;`. ;)

r? `@notriddle`
2021-09-10 08:23:24 -07:00
Manish Goregaokar
1c091e4f63
Rollup merge of #88732 - durin42:llvm-14-attrs-2, r=nikic
RustWrapper: avoid deleted unclear attribute methods

These were deleted in https://reviews.llvm.org/D108614, and in C++ I
definitely see the argument for their removal. I didn't try and
propagate the changes up into higher layers of rustc in this change
because my initial goal was to get rustc working against LLVM HEAD
promptly, but I'm happy to follow up with some refactoring to make the
API on the Rust side match the LLVM API more directly (though the way
the enum works in Rust makes the API less scary IMO).

r? ``@nagisa`` cc ``@nikic``
2021-09-10 08:23:23 -07:00
Manish Goregaokar
e0e3d85ec3
Rollup merge of #88720 - GuillaumeGomez:rustdoc-coverage-fields-count, r=Manishearth
Rustdoc coverage fields count

Follow-up of #88688.

Instead of requiring enum tuple variant fields and tuple struct fields to be documented, we count them if they are documented, otherwise we don't include them in the count.

r? `@Manishearth`
2021-09-10 08:23:22 -07:00
Manish Goregaokar
8368af060d
Rollup merge of #88667 - kraktus:patch-1, r=dtolnay
Tweak `write_fmt` doc.

Found this weird sentence while reading the docs.
2021-09-10 08:23:21 -07:00
Manish Goregaokar
04380482b9
Rollup merge of #88639 - Emilgardis:fix-issue-88600, r=GuillaumeGomez
rustdoc: Fix ICE with `doc(hidden)` on tuple variant fields

Fixes #88600.

```rust
pub struct H;
pub struct S;

pub enum FooEnum {
    HiddenTupleItem(#[doc(hidden)] H),
    MultipleHidden(#[doc(hidden)] H, #[doc(hidden)] H),
    MixedHiddenFirst(#[doc(hidden)] H, S),
    MixedHiddenLast(S, #[doc(hidden)] H),
    HiddenStruct {
        #[doc(hidden)]
        h: H,
        s: S,
    },
}
```

Generates
![image](https://user-images.githubusercontent.com/1502855/132259152-382f9517-c2a0-41d8-acd0-64e5993931fc.png)
2021-09-10 08:23:20 -07:00
Manish Goregaokar
1043549185
Rollup merge of #88632 - camelid:md-opts, r=CraftSpider
Fix issues with Markdown summary options

- Use `summary_opts()` for Markdown summaries
- Enable all main body Markdown options for summaries
2021-09-10 08:23:19 -07:00
Manish Goregaokar
257f5adf0e
Rollup merge of #88578 - notriddle:notriddle/suggest-add-reference-to-for-loop-iter, r=nagisa
fix(rustc): suggest `items` be borrowed in `for i in items[x..]`

Fixes #87994
2021-09-10 08:23:18 -07:00
Manish Goregaokar
dc003dd49e
Rollup merge of #88546 - scrabsha:scrabsha/closure-missing-braces, r=estebank
Emit proper errors when on missing closure braces

This commit focuses on emitting clean errors for the following syntax
error:

```
Some(42).map(|a|
    dbg!(a);
    a
);
```

Previous implementation tried to recover after parsing the closure body
(the `dbg` expression) by replacing the next `;` with a `,`, which made
the next expression belong to the next function argument. As such, the
following errors were emitted (among others):
  - the semicolon token was not expected,
  - a is not in scope,
  - Option::map is supposed to take one argument, not two.

This commit allows us to gracefully handle this situation by adding
giving the parser the ability to remember when it has just parsed a
closure body inside a function call. When this happens, we can treat the
unexpected `;` specifically and try to parse as much statements as
possible in order to eat the whole block. When we can't parse statements
anymore, we generate a clean error indicating that the braces are
missing, and return an ExprKind::Err.

Closes #88065.

r? `@estebank`
2021-09-10 08:23:17 -07:00
Manish Goregaokar
358a018292
Rollup merge of #87441 - ibraheemdev:i-86865, r=cjgillot
Emit suggestion when passing byte literal to format macro

Closes #86865
2021-09-10 08:23:15 -07:00
Manish Goregaokar
e422612f8e
Rollup merge of #87088 - FabianWolff:issue-87060, r=estebank
Fix stray notes when the source code is not available

Fixes #87060. To reproduce it with a local build of rustc, you have to copy the compiler (e.g. `build/x86_64-unknown-linux-gnu/stage1/`) somewhere and then rename the compiler source directory (maybe there is a smarter way as well). Then, rustc won't find the standard library sources and report stray notes such as
```
note: deref defined here
```
with no location for "here". Another example I've found is this:
```rust
use std::ops::Add;

fn foo<T: Add<Output=()>>(x: T) {
    x + x;
}

fn main() {}
```
```
error[E0382]: use of moved value: `x`
  --> binop.rs:4:9
   |
3  | fn foo<T: Add<Output=()>>(x: T) {
   |                           - move occurs because `x` has type `T`, which does not implement the `Copy` trait
4  |     x + x;
   |     ----^
   |     |   |
   |     |   value used here after move
   |     `x` moved due to usage in operator
   |
note: calling this operator moves the left-hand side
help: consider further restricting this bound
   |
3  | fn foo<T: Add<Output=()> + Copy>(x: T) {
   |                          ^^^^^^

error: aborting due to previous error
```
where, again, the note is supposed to point somewhere but doesn't. I have fixed this by checking whether the corresponding source code is actually available before emitting the note.
2021-09-10 08:23:15 -07:00
Manish Goregaokar
000dbd27f1
Rollup merge of #86165 - m-ou-se:proc-macro-span-shrink, r=dtolnay
Add proc_macro::Span::{before, after}.

This adds `proc_macro::Span::before()` and `proc_macro::Span::after()` to get a zero width span at the start or end of the span.

These are equivalent to rustc's `Span::shrink_to_lo()` and `Span::shrink_to_hi()` but with a less cryptic name. They are useful when generating diagnostlics like "missing \<thing\> after \<thing\>".

E.g.

```rust
syn::Error::new(ident.span().after(), "missing `:` after field name").into_compile_error()
```
2021-09-10 08:23:14 -07:00
Manish Goregaokar
acfe7c4141
Rollup merge of #85200 - FabianWolff:issue-84647, r=nikomatsakis
Ignore derived Clone and Debug implementations during dead code analysis

This pull request fixes #84647. Derived implementations of `Clone` and `Debug` always trivially read all fields, so "field is never read" dead code warnings are never triggered. Arguably, though, a user most likely will only be interested in whether _their_ code ever reads those fields, which is the behavior I have implemented here.

Note that implementations of `Clone` and `Debug` are only ignored if they are `#[derive(...)]`d; a custom `impl Clone/Debug for ...` will still be analyzed normally (i.e. if a custom `Clone` implementation uses all fields of the struct, this will continue to suppress dead code warnings about unused fields); this seemed like the least intrusive change to me (although it would be easy to change — just drop the `&& [impl_]item.span.in_derive_expansion()` in the if conditions).

The only thing that I am slightly unsure about is that in #84647, `@matklad` said
> Doesn't seem easy to fix though :(

However, it _was_ pretty straightforward to fix, so did I perhaps overlook something obvious? `@matklad,` could you weigh in on this?
2021-09-10 08:23:13 -07:00
hyd-dev
50be5aebbf
Update Miri 2021-09-10 22:17:57 +08:00
Amanieu d'Antras
8c7a05a23f Treat drop_in_place as nounwind with -Z panic-in-drop=abort
The AbortUnwindCalls MIR pass will eliminate any unnecessary cleanups
and will prevent any unwinds from leaking out by forcing an abort.
2021-09-10 14:18:15 +01:00
bors
7bf0736e13 Auto merge of #88797 - m-ou-se:uhhhh, r=pietroalbini
Work around CI issue with windows sdk 10.0.20348.0.

See https://github.com/rust-lang/rust/issues/88796#issuecomment-916844522
2021-09-10 12:26:55 +00:00
Mara Bos
8059bc1069 Temporarily ignore some debuginfo tests on windows. 2021-09-10 14:08:19 +02:00
Mara Bos
4ab3c117d0 Work around CI issue with windows sdk 10.0.20348.0. 2021-09-10 13:46:15 +02:00
Guillaume Gomez
eda4cfb132 Add test for enum tuple variants and tuple struct doc count 2021-09-10 10:49:42 +02:00
Guillaume Gomez
64344cce14 Don't require documentation for fields in an enum tuple variant or for tuple struct fields. 2021-09-10 10:49:42 +02:00
Gerd Zellweger
5d4d3bdc74
Fix typo option -> options. 2021-09-10 00:36:35 -07:00
jackh726
47035e4d08 Use FxHashMap 2021-09-09 23:28:20 -04:00
Jesse Ruderman
81ff53fd3e
Fix typo in docs for iterators 2021-09-09 19:21:56 -07:00
Noah Lev
44e6f2e90f Remove unnecessary Cache.*_did fields
They can be obtained by accessing the `TyCtxt` where they are needed.
2021-09-09 19:17:38 -07:00
jackh726
0a3c6bb887 In relate_tys, when creating new universes, insert missing universes as other 2021-09-09 18:04:59 -04:00
Fabian Wolff
57fcb2e2d6 Fix two uses of span_note when the source is not available 2021-09-09 21:17:05 +02:00