Commit graph

151873 commits

Author SHA1 Message Date
Santiago Pastorino
75585b408f
Move mir_def_id inside eq_opaque_type_and_type 2021-07-18 09:30:11 -03:00
Santiago Pastorino
a002f4513b
Remove sub_types_or_anon 2021-07-18 09:30:11 -03:00
Santiago Pastorino
a0e1291c2d
Add sub_types docs 2021-07-18 09:30:11 -03:00
Santiago Pastorino
ba1e13fa66
Revert "structural_match: non-structural-match ty closures"
Reverts #73353
2021-07-18 09:30:10 -03:00
Santiago Pastorino
c34fb5167e
Remove origin field from TypeAliasesOpaqueTy 2021-07-18 09:30:10 -03:00
Santiago Pastorino
5cefdbdab5
Use == to compare OpaqueTyOrigin values 2021-07-18 09:30:10 -03:00
Santiago Pastorino
000b945cea
Remove OpaqueTyOrigin::Misc, use TyAlias instead 2021-07-18 09:30:10 -03:00
Santiago Pastorino
d98384595f
Removing unhandled region constraint error that is only for impl_trait_in_bindings 2021-07-18 09:30:09 -03:00
Santiago Pastorino
962ac8183d
Remove impl_trait_in_bindings handling on inference error reporting 2021-07-18 09:30:09 -03:00
Santiago Pastorino
4d2d90307d
Remove impl trait bindings handling on const AST lowering 2021-07-18 09:30:07 -03:00
Ralf Jung
0fcd59ad65 update Miri 2021-07-18 12:43:39 +02:00
bors
18073052d8 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.
2021-07-18 10:42:23 +00:00
Guillaume Gomez
57f7501b1d Add test to check width of item-info 2021-07-18 12:32:26 +02:00
robojumper
3dbe0cebd8 Fix implicit Sized relaxation when attempting to relax other, unsupported trait 2021-07-18 12:29:21 +02:00
Guillaume Gomez
d10703c616 Fix item info display 2021-07-18 12:25:49 +02:00
robojumper
4156473bca Add test for unsupported bound relaxation with incorrect behavior 2021-07-18 12:21:09 +02:00
Guillaume Gomez
d5e3294734 Add invalid rust code for test 2021-07-18 12:07:51 +02:00
Guillaume Gomez
6461cde51f Don't capture child process output at all when --no-capture is used 2021-07-18 11:54:40 +02:00
Guillaume Gomez
893e07e1b0 Add doc for --nocapture 2021-07-18 11:54:39 +02:00
Guillaume Gomez
111cca1fa7 Add test for rustdoc --nocapture option 2021-07-18 11:54:39 +02:00
Guillaume Gomez
6ca0e5ed39 Add --nocapture option to rustdoc 2021-07-18 11:54:39 +02:00
Camille GILLOT
5b921505ef Remove deadlock virtual call. 2021-07-18 11:14:08 +02:00
Camille GILLOT
81241cbf3a Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
Ralf Jung
bed3b965ae miri: better ptr-out-of-bounds errors 2021-07-18 10:38:00 +02:00
bors
5a8a44196b 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
2021-07-18 08:15:17 +00:00
jackh726
b9ee2fb6d8 When pretty printing, name placeholders as bound regions 2021-07-18 03:35:54 -04:00
inquisitivecrystal
10cb380766 Add tests for command line lint control 2021-07-17 23:13:59 -07:00
inquisitivecrystal
2f2db99432 Make --force-warns a normal lint level option 2021-07-17 23:13:59 -07:00
bors
3ab6b60337 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`
2021-07-18 05:58:16 +00:00
Yuki Okushi
810e47897a
Rollup merge of #87205 - matthiaskrgr:clippy_cln, r=oli-obk
rustc_middle: remove redundant clone

found while looking through some clippy lint warnings
2021-07-18 14:21:59 +09:00
Yuki Okushi
c1ee9a3a03
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``
2021-07-18 14:21:58 +09:00
Yuki Okushi
07faa2e32c
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`](ecf85f4bdc/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`
2021-07-18 14:21:57 +09:00
Yuki Okushi
81d0b70402
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.
2021-07-18 14:21:56 +09:00
Yuki Okushi
eef510865a
Rollup merge of #86889 - jyn514:crate-cleanup, r=camelid
rustdoc: Cleanup ExternalCrate

- Remove unnecessary CrateNum from Cache.externs
- Remove trival impl Clean for CrateNum
2021-07-18 14:21:55 +09:00
Yuki Okushi
783efd29ae
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`
2021-07-18 14:21:54 +09:00
Yuki Okushi
469935f7a4
Rollup merge of #86814 - Aaron1011:inner-doc-recover, r=estebank
Recover from a misplaced inner doc comment

Fixes #86781
2021-07-18 14:21:53 +09:00
Yuki Okushi
76300d52f7
Rollup merge of #86763 - JohnTitor:test-63355, r=oli-obk
Add a regression test for issue-63355

Closes #63355
r? ``@nikomatsakis``
2021-07-18 14:21:52 +09:00
Aaron Hill
1c1c7949ab
Add test for #[allow] for warnings on attribute macro 2021-07-17 23:03:58 -05:00
Aaron Hill
7ca089c6d2
Only use assign_id! for ast nodes that support attributes 2021-07-17 23:03:58 -05:00
Aaron Hill
d6e3c11101
Add additional missing lint handling logic 2021-07-17 23:03:58 -05:00
Aaron Hill
2bd15a25ef
Add missing visit_expr_field 2021-07-17 23:03:57 -05:00
Aaron Hill
ddd544856e
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.
2021-07-17 23:03:56 -05:00
bors
e93df0bef9 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
2021-07-18 03:32:31 +00:00
Santiago Pastorino
bc106ebb5a
Remove impl traits bindings error message handling on AST lowering 2021-07-17 23:14:23 -03:00
Santiago Pastorino
ac3a43b316
Fix TypeAliasesOpaqueTy origin docs 2021-07-17 23:14:23 -03:00
Santiago Pastorino
13287d8dd2
Rename OtherOpaqueTy to TypeAliasesOpaqueTy 2021-07-17 23:14:22 -03:00
Santiago Pastorino
66c9cd9e66
Remove OpaqueTyOrigin::Binding 2021-07-17 23:14:22 -03:00
bors
77d155973c Auto merge of #85686 - ptrojahn:loop_reinitialize, r=estebank
Add help on reinitialization between move and access

Fixes #83760
2021-07-18 02:13:12 +00:00
Cameron Steffen
98c500cf83 Factor BinOp utils 2021-07-17 20:49:19 -05:00
Dan Gohman
c3df0ae97f x.py fmt 2021-07-17 18:31:51 -07:00