]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoupdate clippy ui test 'future_not_send.stderr' to match
chaz-kiker [Fri, 23 Jul 2021 17:30:52 +0000 (12:30 -0500)]
update clippy ui test 'future_not_send.stderr' to match
the new diagnostic messages

2 years agoSquash all commits.
chaz-kiker [Tue, 20 Jul 2021 20:04:32 +0000 (15:04 -0500)]
Squash all commits.

add test for issue 86507

add stderr for issue 86507

update issue-86507 UI test

add comment for the expected error in UI test file

add proper 'refers to <ref_type>' in suggestion

update diagnostic phrasing; update test to match new phrasing; re-organize logic for checking T: Sync

evaluate additional obligation to figure out if T is Sync

run './x.py test tidy --bless'

incorporate changes from review; reorganize logic for readability

2 years agoAuto merge of #87310 - spastorino:update_miri, r=RalfJung
bors [Tue, 20 Jul 2021 13:37:02 +0000 (13:37 +0000)]
Auto merge of #87310 - spastorino:update_miri, r=RalfJung

Update MIRI

Fixes #87306

r? `@RalfJung`

2 years agoUpdate MIRI
Santiago Pastorino [Tue, 20 Jul 2021 12:52:19 +0000 (09:52 -0300)]
Update MIRI

2 years agoAuto merge of #87244 - jackh726:issue-71883, r=estebank
bors [Tue, 20 Jul 2021 10:56:08 +0000 (10:56 +0000)]
Auto merge of #87244 - jackh726:issue-71883, r=estebank

Better diagnostics with mismatched types due to implicit static lifetime

Fixes #78113

I think this is my first diagnostics PR...definitely happy to hear thoughts on the direction/implementation here.

I was originally just trying to solve the error above, where the lifetime on a GAT was causing a cryptic "mismatched types" error. But as I was writing this, I realized that this (unintentionally) also applied to a different case: `wf-in-foreign-fn-decls-issue-80468.rs`. I'm not sure if this diagnostic should get a new error code, or even reuse an existing one. And, there might be some ways to make this even more generalized. Also, the error is a bit more lengthy and verbose than probably needed. So thoughts there are welcome too.

This PR essentially ended up adding a new nice region error pass that triggers if a type doesn't match the self type of an impl which is selected because of a predicate because of an implicit static bound on that self type.

r? `@estebank`

2 years agoAuto merge of #87224 - RalfJung:miri-ptr-oob, r=oli-obk
bors [Tue, 20 Jul 2021 08:15:15 +0000 (08:15 +0000)]
Auto merge of #87224 - RalfJung:miri-ptr-oob, r=oli-obk

miri: better ptr-out-of-bounds errors

For offsets larger than `isize::MAX`, display them as negative offsets.

r? `@oli-obk`

2 years agoAuto merge of #87141 - spastorino:remove_impl_trait_in_bindings, r=oli-obk
bors [Tue, 20 Jul 2021 05:34:22 +0000 (05:34 +0000)]
Auto merge of #87141 - spastorino:remove_impl_trait_in_bindings, r=oli-obk

Remove impl trait in bindings

Closes #86729

r? `@oli-obk`

2 years agoBetter errors when we don't have implicit statics in trait objects
jackh726 [Tue, 20 Jul 2021 03:44:35 +0000 (23:44 -0400)]
Better errors when we don't have implicit statics in trait objects

2 years agoAuto merge of #84959 - camsteffen:lint-suggest-group, r=estebank
bors [Tue, 20 Jul 2021 02:11:55 +0000 (02:11 +0000)]
Auto merge of #84959 - camsteffen:lint-suggest-group, r=estebank

Suggest lint groups

Fixes rust-lang/rust-clippy#6986

2 years agoAuto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov
bors [Mon, 19 Jul 2021 23:50:23 +0000 (23:50 +0000)]
Auto merge of #87284 - Aaron1011:remove-paren-special, r=petrochenkov

Remove special case for `ExprKind::Paren` in `MutVisitor`

The special case breaks several useful invariants (`ExpnId`s are
globally unique, and never change). This special case
was added back in 2016 in https://github.com/rust-lang/rust/pull/34355

r? `@petrochenkov`

2 years agoRemove special case for `ExprKind::Paren` in `MutVisitor`
Aaron Hill [Mon, 19 Jul 2021 14:33:35 +0000 (09:33 -0500)]
Remove special case for `ExprKind::Paren` in `MutVisitor`

The special case breaks several useful invariants (`ExpnId`s are
globally unique, and never change). This special case
was added back in 2016 in https://github.com/rust-lang/rust/pull/34355

2 years agoBetter diagnostics when mismatched types due to implict static lifetime
jackh726 [Thu, 15 Jul 2021 14:03:39 +0000 (10:03 -0400)]
Better diagnostics when mismatched types due to implict static lifetime

2 years agoAuto merge of #87153 - michaelwoerister:debuginfo-names-dyn-trait-projection-bounds...
bors [Mon, 19 Jul 2021 21:25:43 +0000 (21:25 +0000)]
Auto merge of #87153 - michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser

[debuginfo] Emit associated type bindings in trait object type names.

This PR updates debuginfo type name generation for trait objects to include associated type bindings and auto trait bounds -- so that, for example, the debuginfo type name of `&dyn Iterator<Item=Foo>` and `&dyn Iterator<Item=Bar>` don't both map to just `&dyn Iterator` anymore.

The following table shows examples of debuginfo type names before and after the PR:
| type | before |  after |
|------|---------|-------|
| `&dyn Iterator<Item=u32>>` | `&dyn Iterator` | `&dyn Iterator<Item=u32>` |
| `&(dyn Iterator<Item=u32>> + Sync)` | `&dyn Iterator` | `&(dyn Iterator<Item=u32> + Sync)` |
| `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `&dyn SomeTrait<bool, i8>` | `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)`  |

For targets that need C++-like type names, we use `assoc$<Item,u32>` instead of `Item=u32`:
| type | before |  after |
|------|---------|-------|
| `&dyn Iterator<Item=u32>>` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> > > >` |
| `&(dyn Iterator<Item=u32>> + Sync)` | `ref$<dyn$<Iterator> >` | `ref$<dyn$<Iterator<assoc$<Item,u32> >,Sync> >` |
| `&(dyn SomeTrait<bool, i8, Bar=u32>> + Send)` | `ref$<dyn$<SomeTrait<bool, i8> > >` | `ref$<dyn$<SomeTrait<bool,i8,assoc$<Bar,u32> > >,Send> >`  |

The PR also adds self-profiling measurements for debuginfo type name generation (re. https://github.com/rust-lang/rust/issues/86431). It looks like the compiler spends up to 0.5% of its time in that task, so the potential for optimizing it via caching seems limited.

However, the perf run also shows [the biggest regression](https://perf.rust-lang.org/detailed-query.html?commit=585e91c718b0b2c5319e1fffd0ff1e62aaf7ccc2&base_commit=b9197978a90be6f7570741eabe2da175fec75375&benchmark=tokio-webpush-simple-debug&run_name=incr-unchanged) in a test case that does not even invoke the code in question. This suggests that the length of the names we generate here can affect performance by influencing how much data the linker has to copy around.

Fixes https://github.com/rust-lang/rust/issues/86134.

2 years agoAuto merge of #87225 - estebank:cleanup, r=oli-obk
bors [Mon, 19 Jul 2021 18:44:27 +0000 (18:44 +0000)]
Auto merge of #87225 - estebank:cleanup, r=oli-obk

Various diagnostics clean ups/tweaks

* Always point at macros, including derive macros
* Point at non-local items that introduce a trait requirement
* On private associated item, point at definition

2 years agoAuto merge of #87271 - flip1995:clippyup, r=Manishearth
bors [Mon, 19 Jul 2021 16:03:35 +0000 (16:03 +0000)]
Auto merge of #87271 - flip1995:clippyup, r=Manishearth

Update Clippy

This is an out-of-cycle Clippy update, to fix 3 ICEs before the release (This should be merged before beta is branched):

rust-lang/rust-clippy#7470
rust-lang/rust-clippy#7471
rust-lang/rust-clippy#7473

cc `@jackh726` `@JohnTitor` rust-lang/rust-clippy#7470 was caused by #86867. I saw the same ICE in the last rustup for Clippy though, so this might be a more general problem. Is there something we should check before calling `layout_of`? Should we always check for `ty.has_escaping_bound_vars()` before calling `layout_of`? Or is this overkill?

r? `@Manishearth`

2 years agoVarious diagnostics clean ups/tweaks
Esteban Küber [Sat, 17 Jul 2021 18:13:50 +0000 (11:13 -0700)]
Various diagnostics clean ups/tweaks

* Always point at macros, including derive macros
* Point at non-local items that introduce a trait requirement
* On private associated item, point at definition

2 years ago[debuginfo] Adapt CDB tests after changes to whitespace usage in debuginfo type names.
Michael Woerister [Mon, 19 Jul 2021 09:00:21 +0000 (11:00 +0200)]
[debuginfo] Adapt CDB tests after changes to whitespace usage in debuginfo type names.

2 years agoImprove impl trait disallowed context error text
Santiago Pastorino [Mon, 19 Jul 2021 12:21:27 +0000 (09:21 -0300)]
Improve impl trait disallowed context error text

2 years agoAuto merge of #86970 - inquisitivecrystal:force-warn, r=davidtwco
bors [Mon, 19 Jul 2021 13:18:04 +0000 (13:18 +0000)]
Auto merge of #86970 - inquisitivecrystal:force-warn, r=davidtwco

Make `--force-warns` a normal lint level option

Now that `ForceWarn` is a lint level, there's no reason `--force-warns` should be treated differently from other options that set lint levels. This merges the `ForceWarn` handling in with the other lint level command line options. It also unifies all of the relevant selection logic in `compiler/rustc_lint/src/levels.rs`, rather than having some of it weirdly elsewhere.

Fixes #86958, which arose from the special-cased handling of `ForceWarn` having had an error in it.

2 years agoImprove impl_trait_in_bindings removed feature text
Santiago Pastorino [Mon, 19 Jul 2021 12:20:15 +0000 (09:20 -0300)]
Improve impl_trait_in_bindings removed feature text

2 years agoAuto merge of #87269 - GuillaumeGomez:rollup-qukedv0, r=GuillaumeGomez
bors [Mon, 19 Jul 2021 10:10:08 +0000 (10:10 +0000)]
Auto merge of #87269 - GuillaumeGomez:rollup-qukedv0, r=GuillaumeGomez

Rollup of 8 pull requests

Successful merges:

 - #86230 (Add --nocapture option to rustdoc)
 - #87210 (Rustdoc accessibility: make the sidebar headers actual headers)
 - #87227 (Move asm! and global_asm! to core::arch)
 - #87236 (Simplify command-line argument initialization on unix)
 - #87251 (Fix "item info" width)
 - #87256 (Extend HIR-based WF checking to associated type defaults)
 - #87259 (triagebot shortcut config)
 - #87268 (Don't create references to uninitialized data in `List::from_arena`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoMerge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup
flip1995 [Mon, 19 Jul 2021 09:52:05 +0000 (11:52 +0200)]
Merge commit '4c41a222ca5d1325fb4b6709395bd06e766cc042' into clippyup

2 years agoAuto merge of #7476 - flip1995:rustup, r=flip1995
bors [Mon, 19 Jul 2021 09:49:57 +0000 (09:49 +0000)]
Auto merge of #7476 - flip1995:rustup, r=flip1995

Rustup

r? `@ghost`

Out of cycle sync for 2 ICE fixes #7470 #7471 #7473

changelog: none

2 years agoBump nightly version -> 2021-07-19
flip1995 [Mon, 19 Jul 2021 09:49:03 +0000 (11:49 +0200)]
Bump nightly version -> 2021-07-19

2 years agoMerge remote-tracking branch 'upstream/master' into rustup
flip1995 [Mon, 19 Jul 2021 09:38:40 +0000 (11:38 +0200)]
Merge remote-tracking branch 'upstream/master' into rustup

2 years agoRollup merge of #87268 - SkiFire13:fix-uninit-ref-list, r=nagisa
Guillaume Gomez [Mon, 19 Jul 2021 09:37:49 +0000 (11:37 +0200)]
Rollup merge of #87268 - SkiFire13:fix-uninit-ref-list, r=nagisa

Don't create references to uninitialized data in `List::from_arena`

Previously `result` and `arena_slice` were references pointing to uninitialized data, which is technically UB. They may have been fine because the pointed data is `Copy` and and they were only written to, but the semantics of this aren't clearly defined yet, and since we have a sound way to do the same thing I don't think we should keep the possibly-unsound way.

2 years agoRollup merge of #87259 - Llandy3d:triagebot_shortcuts, r=nikomatsakis
Guillaume Gomez [Mon, 19 Jul 2021 09:37:48 +0000 (11:37 +0200)]
Rollup merge of #87259 - Llandy3d:triagebot_shortcuts, r=nikomatsakis

triagebot shortcut config

Enable the new triagebot shortcuts as per [#1381/triagebot](https://github.com/rust-lang/triagebot/pull/1381)

2 years agoRollup merge of #87256 - Aaron1011:hir-wf-assoc-default, r=oli-obk
Guillaume Gomez [Mon, 19 Jul 2021 09:37:47 +0000 (11:37 +0200)]
Rollup merge of #87256 - Aaron1011:hir-wf-assoc-default, r=oli-obk

Extend HIR-based WF checking to associated type defaults

Previously, we would only look at associated types in `impl` blocks.

2 years agoRollup merge of #87251 - GuillaumeGomez:item-info-width, r=notriddle
Guillaume Gomez [Mon, 19 Jul 2021 09:37:46 +0000 (11:37 +0200)]
Rollup merge of #87251 - GuillaumeGomez:item-info-width, r=notriddle

Fix "item info" width

Fixes #87202.

It now looks again like this:

![Screenshot from 2021-07-18 12-33-27](https://user-images.githubusercontent.com/3050060/126064005-013acabc-7f17-4436-8dfc-cb6b9bc24413.png)

cc `@jyn514`

r? `@notriddle`

2 years agoRollup merge of #87236 - sunfishcode:avoid-locking-args, r=joshtriplett
Guillaume Gomez [Mon, 19 Jul 2021 09:37:45 +0000 (11:37 +0200)]
Rollup merge of #87236 - sunfishcode:avoid-locking-args, r=joshtriplett

Simplify command-line argument initialization on unix

Simplify Rust's command-line argument initialization code on unix:
 - The cleanup code isn't needed, because it was just zeroing out non-owning variables at runtime cleanup time. After 91c3eee1735ad72b579f99cbb6919c3471747d94, Rust's command-line initialization code on unix no longer allocates `CString`s and a `Vec` at startup time.
 - The `Mutex` isn't needed; if there's somehow a call to `args()` before argument initialization has happened, the code returns return an empty list, which we can do with a null check.

With these changes, a simple cdylib that doesn't use threads avoids getting `pthread_mutex_lock`/`pthread_mutex_unlock` in its symbol table.

2 years agoRollup merge of #87227 - bstrie:asm2arch, r=Amanieu
Guillaume Gomez [Mon, 19 Jul 2021 09:37:44 +0000 (11:37 +0200)]
Rollup merge of #87227 - bstrie:asm2arch, r=Amanieu

Move asm! and global_asm! to core::arch

Follow-up to https://github.com/rust-lang/stdarch/pull/1183 .

Implements the libs-api team decision from rust-lang/rust#84019 (comment) .

In order to not break nightly users, this PR also adds the newly-moved items to the prelude. However, a decision will need to be made before stabilization as to whether these items should remain in the prelude. I will file an issue for this separately.

Fixes #84019 .

r? `@Amanieu`

2 years agoRollup merge of #87210 - notriddle:notriddle/rustdoc-sidebar-headers, r=GuillaumeGomez
Guillaume Gomez [Mon, 19 Jul 2021 09:37:42 +0000 (11:37 +0200)]
Rollup merge of #87210 - notriddle:notriddle/rustdoc-sidebar-headers, r=GuillaumeGomez

Rustdoc accessibility: make the sidebar headers actual headers

Part of #87059

Preview it at: https://notriddle.com/notriddle-rustdoc-test/rustdoc-sidebar-header/std/index.html

2 years agoRollup merge of #86230 - GuillaumeGomez:nocapture, r=camelid
Guillaume Gomez [Mon, 19 Jul 2021 09:37:41 +0000 (11:37 +0200)]
Rollup merge of #86230 - GuillaumeGomez:nocapture, r=camelid

Add --nocapture option to rustdoc

Fixes https://github.com/rust-lang/rust/issues/26309.
Fixes #45724.

Once this PR is merged, I'll send a PR to cargo to also pass `--nocapture` to rustdoc.

cc `@jyn514`
r? `@camelid`

2 years agoAuto merge of #7470 - DevinR528:fix-ice7447, r=flip1995
bors [Mon, 19 Jul 2021 09:22:34 +0000 (09:22 +0000)]
Auto merge of #7470 - DevinR528:fix-ice7447, r=flip1995

Add check if ty has_escaping_bound_vars in zero_sized_map_values lint

Fixes: #7447
changelog: fix ICE in [`zero_sized_map_values`]

2 years agoDon't create references to uninitialized data in List::from_arena
Giacomo Stevanato [Mon, 19 Jul 2021 08:47:45 +0000 (10:47 +0200)]
Don't create references to uninitialized data in List::from_arena

2 years agoAuto merge of #87196 - oxalica:option-insert-must-use, r=joshtriplett
bors [Mon, 19 Jul 2021 07:03:36 +0000 (07:03 +0000)]
Auto merge of #87196 - oxalica:option-insert-must-use, r=joshtriplett

Mark `Option::insert` as must_use

Some people seems misled by the function name and use it in case where a simple assignment just works.
If the return value is not used, `option = Some(value);` should be preferred instead of `option.insert(value);`

2 years agoAuto merge of #7403 - Anthuang:redundant-method-names, r=Manishearth
bors [Mon, 19 Jul 2021 06:49:51 +0000 (06:49 +0000)]
Auto merge of #7403 - Anthuang:redundant-method-names, r=Manishearth

New lint: [`self_named_constructor`]

Adds the `self_named_constructor` lint for detecting when an implemented method has the same name as the type it is implemented for.

changelog: [`self_named_constructor`]

closes: #7142

2 years agoRun bless
Anthony Huang [Mon, 19 Jul 2021 05:21:06 +0000 (01:21 -0400)]
Run bless

2 years agoAuto merge of #87146 - Aaron1011:better-macro-lint, r=petrochenkov
bors [Mon, 19 Jul 2021 04:22:51 +0000 (04:22 +0000)]
Auto merge of #87146 - Aaron1011:better-macro-lint, r=petrochenkov

Compute a better `lint_node_id` during expansion

When we need to emit a lint at a macro invocation, we currently use the
`NodeId` of its parent definition (e.g. the enclosing function). This
means that any `#[allow]` / `#[deny]` attributes placed 'closer' to the
macro (e.g. on an enclosing block or statement) will have no effect.

This commit computes a better `lint_node_id` in `InvocationCollector`.
When we visit/flat_map an AST node, we assign it a `NodeId` (earlier
than we normally would), and store than `NodeId` in current
`ExpansionData`. When we collect a macro invocation, the current
`lint_node_id` gets cloned along with our `ExpansionData`, allowing it
to be used if we need to emit a lint later on.

This improves the handling of `#[allow]` / `#[deny]` for
`SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` and some `asm!`-related lints.
The 'legacy derive helpers' lint retains its current behavior
(I've inlined the now-removed `lint_node_id` function), since
there isn't an `ExpansionData` readily available.

2 years agoAuto merge of #86848 - notriddle:notriddle/drop-dyn, r=varkor
bors [Mon, 19 Jul 2021 01:41:54 +0000 (01:41 +0000)]
Auto merge of #86848 - notriddle:notriddle/drop-dyn, r=varkor

feat(rustc_lint): add `dyn_drop`

Based on the conversation in #86747.

Explanation
-----------

A trait object bound of the form `dyn Drop` is most likely misleading and not what the programmer intended.

`Drop` bounds do not actually indicate whether a type can be trivially dropped or not, because a composite type containing `Drop` types does not necessarily implement `Drop` itself. Naïvely, one might be tempted to write a deferred drop system, to pull cleaning up memory out of a latency-sensitive code path, using `dyn Drop` trait objects. However, this breaks down e.g. when `T` is `String`, which does not implement `Drop`, but should probably be accepted.

To write a trait object bound that accepts anything, use a placeholder trait with a blanket implementation.

```rust
trait Placeholder {}
impl<T> Placeholder for T {}
fn foo(_x: Box<dyn Placeholder>) {}
```

2 years agoAuto merge of #87004 - JamieCunliffe:pgo-gc-sections, r=Mark-Simulacrum
bors [Sun, 18 Jul 2021 23:14:31 +0000 (23:14 +0000)]
Auto merge of #87004 - JamieCunliffe:pgo-gc-sections, r=Mark-Simulacrum

Don't use gc-sections with profile-generate.

When building with profile-generate don't call gc_sections as this can
can sometimes strip out profile data. This missing information in the
prof files can then result in missing functions when using the profile
information.

#78226

r? `@Mark-Simulacrum`

2 years agoMove asm! and global_asm! to core::arch
bstrie [Sat, 17 Jul 2021 18:48:00 +0000 (14:48 -0400)]
Move asm! and global_asm! to core::arch

2 years agoAuto merge of #86950 - tmiasko:personality, r=nagisa
bors [Sun, 18 Jul 2021 20:33:23 +0000 (20:33 +0000)]
Auto merge of #86950 - tmiasko:personality, r=nagisa

Use existing declaration of rust_eh_personality

If crate declares `rust_eh_personality`, re-use existing declaration
as otherwise attempts to set function attributes that follow the
declaration will fail (unless it happens to have exactly the same
type signature as the one predefined in the compiler).

Fixes #70117.
Fixes https://github.com/rust-lang/rust/pull/81469#issuecomment-809428126; probably.

2 years agotriagebot shortcut config
Llandy Riveron Del Risco [Sun, 18 Jul 2021 19:52:18 +0000 (21:52 +0200)]
triagebot shortcut config

2 years agoAuto merge of #7474 - camsteffen:binop, r=Manishearth
bors [Sun, 18 Jul 2021 15:52:49 +0000 (15:52 +0000)]
Auto merge of #7474 - camsteffen:binop, r=Manishearth

Use lang items for BinOp lints

changelog: none

2 years agoExtend HIR-based WF checking to associated type defaults
Aaron Hill [Sun, 18 Jul 2021 15:36:07 +0000 (10:36 -0500)]
Extend HIR-based WF checking to associated type defaults

Previously, we would only look at associated types in `impl` blocks.

2 years agofix(clippy): add missing allow(dyn_drop)
Michael Howell [Sun, 18 Jul 2021 14:57:03 +0000 (07:57 -0700)]
fix(clippy): add missing allow(dyn_drop)

2 years agoAdd `#![allow(dyn_drop)]` to test cases with `dyn Drop` in them
Michael Howell [Sat, 3 Jul 2021 18:52:19 +0000 (11:52 -0700)]
Add `#![allow(dyn_drop)]` to test cases with `dyn Drop` in them

These are all testing corner-cases in the compiler.
Adding a new warning broke these test cases, but --cap-lints stops
it from actually breaking things in production.

2 years agofeat(rustc_lint): add `dyn_drop`
Michael Howell [Sat, 3 Jul 2021 18:20:01 +0000 (11:20 -0700)]
feat(rustc_lint): add `dyn_drop`

Based on the conversation in #86747.

Explanation
-----------

A trait object bound of the form `dyn Drop` is most likely misleading
and not what the programmer intended.

`Drop` bounds do not actually indicate whether a type can be trivially
dropped or not, because a composite type containing `Drop` types does
not necessarily implement `Drop` itself. Naïvely, one might be tempted
to write a deferred drop system, to pull cleaning up memory out of a
latency-sensitive code path, using `dyn Drop` trait objects. However,
this breaks down e.g. when `T` is `String`, which does not implement
`Drop`, but should probably be accepted.

To write a trait object bound that accepts anything, use a placeholder
trait with a blanket implementation.

```rust
trait Placeholder {}
impl<T> Placeholder for T {}
fn foo(_x: Box<dyn Placeholder>) {}
```

2 years agoAuto merge of #87252 - RalfJung:miri, r=RalfJung
bors [Sun, 18 Jul 2021 13:11:39 +0000 (13:11 +0000)]
Auto merge of #87252 - RalfJung:miri, r=RalfJung

update Miri

Fixes https://github.com/rust-lang/rust/issues/87222
Cc `@rust-lang/miri` r? `@ghost`

2 years agoRemove impl_trait_in_bindings feature flag
Santiago Pastorino [Fri, 16 Jul 2021 13:06:26 +0000 (10:06 -0300)]
Remove impl_trait_in_bindings feature flag

2 years agoMove mir_def_id inside `eq_opaque_type_and_type`
Santiago Pastorino [Thu, 15 Jul 2021 12:55:13 +0000 (09:55 -0300)]
Move mir_def_id inside `eq_opaque_type_and_type`

2 years agoRemove `sub_types_or_anon`
Santiago Pastorino [Thu, 15 Jul 2021 12:48:14 +0000 (09:48 -0300)]
Remove `sub_types_or_anon`

2 years agoAdd `sub_types` docs
Santiago Pastorino [Thu, 15 Jul 2021 12:47:33 +0000 (09:47 -0300)]
Add `sub_types` docs

2 years agoRevert "structural_match: non-structural-match ty closures"
Santiago Pastorino [Wed, 14 Jul 2021 22:00:48 +0000 (19:00 -0300)]
Revert "structural_match: non-structural-match ty closures"

Reverts #73353

2 years agoRemove origin field from TypeAliasesOpaqueTy
Santiago Pastorino [Thu, 15 Jul 2021 15:43:54 +0000 (12:43 -0300)]
Remove origin field from TypeAliasesOpaqueTy

2 years agoUse == to compare OpaqueTyOrigin values
Santiago Pastorino [Thu, 15 Jul 2021 15:42:18 +0000 (12:42 -0300)]
Use == to compare OpaqueTyOrigin values

2 years agoRemove OpaqueTyOrigin::Misc, use TyAlias instead
Santiago Pastorino [Wed, 14 Jul 2021 21:23:36 +0000 (18:23 -0300)]
Remove OpaqueTyOrigin::Misc, use TyAlias instead

2 years agoRemoving unhandled region constraint error that is only for impl_trait_in_bindings
Santiago Pastorino [Wed, 14 Jul 2021 20:12:34 +0000 (17:12 -0300)]
Removing unhandled region constraint error that is only for impl_trait_in_bindings

2 years agoRemove impl_trait_in_bindings handling on inference error reporting
Santiago Pastorino [Wed, 14 Jul 2021 19:55:31 +0000 (16:55 -0300)]
Remove impl_trait_in_bindings handling on inference error reporting

2 years agoRemove impl trait bindings handling on const AST lowering
Santiago Pastorino [Wed, 14 Jul 2021 19:17:56 +0000 (16:17 -0300)]
Remove impl trait bindings handling on const AST lowering

2 years agoupdate Miri
Ralf Jung [Sun, 18 Jul 2021 10:43:39 +0000 (12:43 +0200)]
update Miri

2 years agoAuto merge of #86698 - cjgillot:modc, r=estebank
bors [Sun, 18 Jul 2021 10:42:23 +0000 (10:42 +0000)]
Auto merge of #86698 - cjgillot:modc, r=estebank

Move OnDiskCache to rustc_query_impl.

This should be the last remnant of the query implementation that was still in rustc_middle.

2 years agoAdd test to check width of item-info
Guillaume Gomez [Sun, 18 Jul 2021 10:32:26 +0000 (12:32 +0200)]
Add test to check width of item-info

2 years agoFix item info display
Guillaume Gomez [Sun, 18 Jul 2021 10:25:49 +0000 (12:25 +0200)]
Fix item info display

2 years agoAdd invalid rust code for test
Guillaume Gomez [Fri, 9 Jul 2021 09:06:20 +0000 (11:06 +0200)]
Add invalid rust code for test

2 years agoDon't capture child process output at all when --no-capture is used
Guillaume Gomez [Fri, 9 Jul 2021 08:58:02 +0000 (10:58 +0200)]
Don't capture child process output at all when --no-capture is used

2 years agoAdd doc for --nocapture
Guillaume Gomez [Fri, 11 Jun 2021 20:20:40 +0000 (22:20 +0200)]
Add doc for --nocapture

2 years agoAdd test for rustdoc --nocapture option
Guillaume Gomez [Fri, 11 Jun 2021 20:11:35 +0000 (22:11 +0200)]
Add test for rustdoc --nocapture option

2 years agoAdd --nocapture option to rustdoc
Guillaume Gomez [Fri, 11 Jun 2021 14:53:32 +0000 (16:53 +0200)]
Add --nocapture option to rustdoc

2 years agoRemove deadlock virtual call.
Camille GILLOT [Mon, 28 Jun 2021 19:33:47 +0000 (21:33 +0200)]
Remove deadlock virtual call.

2 years agoMove OnDiskCache to rustc_query_impl.
Camille GILLOT [Mon, 28 Jun 2021 19:12:01 +0000 (21:12 +0200)]
Move OnDiskCache to rustc_query_impl.

2 years agomiri: better ptr-out-of-bounds errors
Ralf Jung [Sat, 17 Jul 2021 18:12:28 +0000 (20:12 +0200)]
miri: better ptr-out-of-bounds errors

2 years agoAuto merge of #87242 - JohnTitor:rollup-t9rmwpo, r=JohnTitor
bors [Sun, 18 Jul 2021 08:15:17 +0000 (08:15 +0000)]
Auto merge of #87242 - JohnTitor:rollup-t9rmwpo, r=JohnTitor

Rollup of 8 pull requests

Successful merges:

 - #86763 (Add a regression test for issue-63355)
 - #86814 (Recover from a misplaced inner doc comment)
 - #86843 (Check that const parameters of trait methods have compatible types)
 - #86889 (rustdoc: Cleanup ExternalCrate)
 - #87092 (Remove nondeterminism in multiple-definitions test)
 - #87170 (Add diagnostic items for Clippy)
 - #87183 (fix typo in compile_fail doctest)
 - #87205 (rustc_middle: remove redundant clone)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup

2 years agoAdd tests for command line lint control
inquisitivecrystal [Fri, 9 Jul 2021 04:35:26 +0000 (21:35 -0700)]
Add tests for command line lint control

2 years agoMake `--force-warns` a normal lint level option
inquisitivecrystal [Thu, 8 Jul 2021 07:05:38 +0000 (00:05 -0700)]
Make `--force-warns` a normal lint level option

2 years agoAuto merge of #87071 - inquisitivecrystal:inclusive-range, r=estebank
bors [Sun, 18 Jul 2021 05:58:16 +0000 (05:58 +0000)]
Auto merge of #87071 - inquisitivecrystal:inclusive-range, r=estebank

Add diagnostics for mistyped inclusive range

Inclusive ranges are correctly typed as `..=`. However, it's quite easy to think of it as being like `==`, and type `..==` instead. This PR adds helpful diagnostics for this case.

Resolves #86395 (there are some other cases there, but I think those should probably have separate issues).

r? `@estebank`

2 years agoRollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk
Yuki Okushi [Sun, 18 Jul 2021 05:21:59 +0000 (14:21 +0900)]
Rollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk

rustc_middle: remove redundant clone

found while looking through some clippy lint warnings

2 years agoRollup merge of #87183 - RalfJung:option-doctest, r=jyn514
Yuki Okushi [Sun, 18 Jul 2021 05:21:58 +0000 (14:21 +0900)]
Rollup merge of #87183 - RalfJung:option-doctest, r=jyn514

fix typo in compile_fail doctest

Fixes a typo introduced by https://github.com/rust-lang/rust/pull/86211. For some reason this typo makes Miri go all crazy when running libcore doctests (https://github.com/rust-lang/miri/issues/1852). Kudos to ``@hyd-dev`` for noticing the typo.

Cc ``@tlyu`` ``@joshtriplett``

2 years agoRollup merge of #87170 - xFrednet:clippy-5393-add-diagnostic-items, r=Manishearth...
Yuki Okushi [Sun, 18 Jul 2021 05:21:57 +0000 (14:21 +0900)]
Rollup merge of #87170 - xFrednet:clippy-5393-add-diagnostic-items, r=Manishearth,oli-obk

Add diagnostic items for Clippy

This adds a bunch of diagnostic items to `std`/`core`/`alloc` functions, structs and traits used in Clippy. The actual refactorings in Clippy to use these items will be done in a different PR in Clippy after the next sync.

This PR doesn't include all paths Clippy uses, I've only gone through the first 85 lines of Clippy's [`paths.rs`](https://github.com/rust-lang/rust-clippy/blob/ecf85f4bdc319f9d9d853d1fff68a8a25e64c7a8/clippy_utils/src/paths.rs) (after rust-lang/rust-clippy#7466) to get some feedback early on. I've also decided against adding diagnostic items to methods, as it would be nicer and more scalable to access them in a nicer fashion, like adding a `is_diagnostic_assoc_item(did, sym::Iterator, sym::map)` function or something similar (Suggested by `@camsteffen` [on Zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/Diagnostic.20Item.20Naming.20Convention.3F/near/225024603))

There seems to be some different naming conventions when it comes to diagnostic items, some use UpperCamelCase (`BinaryHeap`) and some snake_case (`hashmap_type`). This PR uses UpperCamelCase for structs and traits and snake_case with the module name as a prefix for functions. Any feedback on is this welcome.

cc: rust-lang/rust-clippy#5393

r? `@Manishearth`

2 years agoRollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, r=petrochenkov
Yuki Okushi [Sun, 18 Jul 2021 05:21:56 +0000 (14:21 +0900)]
Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, r=petrochenkov

Remove nondeterminism in multiple-definitions test

Compare all fields in `DllImport` when sorting to avoid nondeterminism in the error for multiple inconsistent definitions of an extern function.  Restore the multiple-definitions test.

Resolves #87084.

2 years agoRollup merge of #86889 - jyn514:crate-cleanup, r=camelid
Yuki Okushi [Sun, 18 Jul 2021 05:21:55 +0000 (14:21 +0900)]
Rollup merge of #86889 - jyn514:crate-cleanup, r=camelid

rustdoc: Cleanup ExternalCrate

- Remove unnecessary CrateNum from Cache.externs
- Remove trival impl Clean for CrateNum

2 years agoRollup merge of #86843 - FabianWolff:issue-86820, r=lcnr
Yuki Okushi [Sun, 18 Jul 2021 05:21:54 +0000 (14:21 +0900)]
Rollup merge of #86843 - FabianWolff:issue-86820, r=lcnr

Check that const parameters of trait methods have compatible types

This PR fixes #86820. The problem is that this currently passes the type checker:
```rust
trait Tr {
    fn foo<const N: u8>(self) -> u8;
}

impl Tr for f32 {
    fn foo<const N: bool>(self) -> u8 { 42 }
}
```
i.e. the type checker fails to check whether const parameters in `impl` methods have the same type as the corresponding declaration in the trait. With my changes, I get, for the above code:
```
error[E0053]: method `foo` has an incompatible const parameter type for trait
 --> test.rs:6:18
  |
6 |     fn foo<const N: bool>(self) -> u8 { 42 }
  |                  ^
  |
note: the const parameter `N` has type `bool`, but the declaration in trait `Tr::foo` has type `u8`
 --> test.rs:2:18
  |
2 |     fn foo<const N: u8>(self) -> u8;
  |                  ^

error: aborting due to previous error
```
This fixes #86820, where an ICE happens later on because the trait method is declared with a const parameter of type `u8`, but the `impl` uses one of type `usize`:
> `expected int of size 8, but got size 1`

2 years agoRollup merge of #86814 - Aaron1011:inner-doc-recover, r=estebank
Yuki Okushi [Sun, 18 Jul 2021 05:21:53 +0000 (14:21 +0900)]
Rollup merge of #86814 - Aaron1011:inner-doc-recover, r=estebank

Recover from a misplaced inner doc comment

Fixes #86781

2 years agoRollup merge of #86763 - JohnTitor:test-63355, r=oli-obk
Yuki Okushi [Sun, 18 Jul 2021 05:21:52 +0000 (14:21 +0900)]
Rollup merge of #86763 - JohnTitor:test-63355, r=oli-obk

Add a regression test for issue-63355

Closes #63355
r? ``@nikomatsakis``

2 years agoAdd test for `#[allow]` for warnings on attribute macro
Aaron Hill [Sat, 17 Jul 2021 13:31:13 +0000 (08:31 -0500)]
Add test for `#[allow]` for warnings on attribute macro

2 years agoOnly use `assign_id!` for ast nodes that support attributes
Aaron Hill [Sat, 17 Jul 2021 13:22:09 +0000 (08:22 -0500)]
Only use `assign_id!` for ast nodes that support attributes

2 years agoAdd additional missing lint handling logic
Aaron Hill [Thu, 15 Jul 2021 19:26:27 +0000 (14:26 -0500)]
Add additional missing lint handling logic

2 years agoAdd missing `visit_expr_field`
Aaron Hill [Thu, 15 Jul 2021 01:07:56 +0000 (20:07 -0500)]
Add missing `visit_expr_field`

2 years agoCompute a better `lint_node_id` during expansion
Aaron Hill [Wed, 14 Jul 2021 23:24:12 +0000 (18:24 -0500)]
Compute a better `lint_node_id` during expansion

When we need to emit a lint at a macro invocation, we currently use the
`NodeId` of its parent definition (e.g. the enclosing function). This
means that any `#[allow]` / `#[deny]` attributes placed 'closer' to the
macro (e.g. on an enclosing block or statement) will have no effect.

This commit computes a better `lint_node_id` in `InvocationCollector`.
When we visit/flat_map an AST node, we assign it a `NodeId` (earlier
than we normally would), and store than `NodeId` in current
`ExpansionData`. When we collect a macro invocation, the current
`lint_node_id` gets cloned along with our `ExpansionData`, allowing it
to be used if we need to emit a lint later on.

This improves the handling of `#[allow]` / `#[deny]` for
`SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` and some `asm!`-related lints.
The 'legacy derive helpers' lint retains its current behavior
(I've inlined the now-removed `lint_node_id` function), since
there isn't an `ExpansionData` readily available.

2 years agoAuto merge of #7473 - Jarcho:ice_7340, r=Manishearth
bors [Sun, 18 Jul 2021 03:32:31 +0000 (03:32 +0000)]
Auto merge of #7473 - Jarcho:ice_7340, r=Manishearth

Fix ICE in `is_integer_const`

fixes: #7340
changelog: Fix ICE in `modulo_one` in const contexts

2 years agoRemove impl traits bindings error message handling on AST lowering
Santiago Pastorino [Wed, 14 Jul 2021 18:48:33 +0000 (15:48 -0300)]
Remove impl traits bindings error message handling on AST lowering

2 years agoFix TypeAliasesOpaqueTy origin docs
Santiago Pastorino [Wed, 14 Jul 2021 18:45:24 +0000 (15:45 -0300)]
Fix TypeAliasesOpaqueTy origin docs

2 years agoRename OtherOpaqueTy to TypeAliasesOpaqueTy
Santiago Pastorino [Wed, 14 Jul 2021 18:06:02 +0000 (15:06 -0300)]
Rename OtherOpaqueTy to TypeAliasesOpaqueTy

2 years agoRemove OpaqueTyOrigin::Binding
Santiago Pastorino [Wed, 14 Jul 2021 15:31:58 +0000 (12:31 -0300)]
Remove OpaqueTyOrigin::Binding

2 years agoAuto merge of #85686 - ptrojahn:loop_reinitialize, r=estebank
bors [Sun, 18 Jul 2021 02:13:12 +0000 (02:13 +0000)]
Auto merge of #85686 - ptrojahn:loop_reinitialize, r=estebank

Add help on reinitialization between move and access

Fixes #83760

2 years agoFactor BinOp utils
Cameron Steffen [Fri, 16 Jul 2021 19:41:19 +0000 (14:41 -0500)]
Factor BinOp utils

2 years agox.py fmt
Dan Gohman [Sun, 18 Jul 2021 01:31:51 +0000 (18:31 -0700)]
x.py fmt

2 years agoUse From to convert BinOpKind
Cameron Steffen [Mon, 28 Jun 2021 19:05:48 +0000 (14:05 -0500)]
Use From to convert BinOpKind

2 years agoFix ICE in `is_integer_const` when the expression is inside an `AnonConst` body
Jason Newcomb [Sat, 17 Jul 2021 23:01:19 +0000 (19:01 -0400)]
Fix ICE in `is_integer_const` when the expression is inside an `AnonConst` body