Commit Graph

169362 Commits

Author SHA1 Message Date
Camille GILLOT
64b6c32b21 Assert def_ident_span presence. 2022-06-10 20:16:37 +02:00
Camille GILLOT
06af25e4f1 Bless tests. 2022-06-10 20:16:35 +02:00
Camille GILLOT
871993f7a1 Encode def_ident_span using the query. 2022-06-10 20:16:32 +02:00
Camille GILLOT
df59705301 Call def_span inside span_if_local. 2022-06-10 20:15:17 +02:00
Camille GILLOT
16f9f7c7b1 Implement def_ident_span in rustc_middle. 2022-06-10 20:15:14 +02:00
bors
c3384ea35c Auto merge of #97717 - matthiaskrgr:rollup-lalaii2, r=matthiaskrgr
Rollup of 5 pull requests

Successful merges:

 - #97446 (Make hir().get_generics and generics_of consistent.)
 - #97656 (Add a suggestion to replace parentheses with angle brackets on associated trait constraint)
 - #97692 (Add `#T-types/nominated` zulip notification)
 - #97696 (Do not ICE when failing to normalize during inlining.)
 - #97702 (Remove useless LocalDefId in ImplTraitContext::Universal.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-04 02:10:35 +00:00
bors
f15370b4e4 Auto merge of #97670 - spastorino:simplify-universal-impl-trait-lowering2, r=Dylan-DPC
Make params be SmallVec as originally was

r? `@cjgillot`
It was originally a [`SmallVec`](https://github.com/rust-lang/rust/pull/97598/files#diff-0a61b538a3cec072c76fecae4635af6a12ec3256860029ac70549c2aa53ab394L1497), I've mistakenly changed it [here](https://github.com/rust-lang/rust/pull/97598/files#diff-0a61b538a3cec072c76fecae4635af6a12ec3256860029ac70549c2aa53ab394R1377) to a `Vec`
2022-06-03 23:29:30 +00:00
Matthias Krüger
a88d94b072
Rollup merge of #97702 - cjgillot:no-universal-did, r=spastorino
Remove useless LocalDefId in ImplTraitContext::Universal.
2022-06-04 00:42:52 +02:00
Matthias Krüger
74f0bcc9c7
Rollup merge of #97696 - cjgillot:normalize-inline, r=compiler-errors
Do not ICE when failing to normalize during inlining.

Fixes https://github.com/rust-lang/rust/issues/97695
2022-06-04 00:42:51 +02:00
Matthias Krüger
8971235e58
Rollup merge of #97692 - compiler-errors:types-nominated, r=Mark-Simulacrum
Add `#T-types/nominated` zulip notification

Add rule to create topic in aforementioned stream when `I-types-nominated` tag is added
2022-06-04 00:42:50 +02:00
Matthias Krüger
401be78f2c
Rollup merge of #97656 - EdwinRy:error_ast_low_type_contraint_parentheses, r=cjgillot
Add a suggestion to replace parentheses with angle brackets on associated trait constraint

This implements a requested suggestion FIXME in [`compiler/rustc_ast_lowering/src/lib.rs` ](9598b4b594/compiler/rustc_ast_lowering/src/lib.rs (L921))

The suggestion asks for the parentheses to either be replaced with angle brackets or removed completely depending on whether there are arguments provided within.

![image](https://user-images.githubusercontent.com/20026256/171770414-ab60bfe2-ae27-44b0-964d-9ffcc32a7475.png)

![image](https://user-images.githubusercontent.com/20026256/171770383-ca8a2766-b3aa-43e3-8ba4-ae18874886ce.png)

r? `@oli-obk`
2022-06-04 00:42:50 +02:00
Matthias Krüger
e33c6edfc0
Rollup merge of #97446 - cjgillot:get-generics, r=michaelwoerister
Make hir().get_generics and generics_of consistent.

Fetching generics from a HIR node is currently implemented differently in 4 different places.
This PR makes the 4 implementations call the single `hir::Node::generics`, which implements the more general version from `generics_of` query.
2022-06-04 00:42:49 +02:00
Camille GILLOT
623ea5f5d2 Make hir().get_generics and generics_of consistent. 2022-06-03 23:07:04 +02:00
bors
a6b8c69548 Auto merge of #95833 - notriddle:notriddle/human-readable-signals, r=yaahc
std: `<ExitStatus as Display>::fmt` name the signal it died from

Related to #95601
2022-06-03 20:18:14 +00:00
Camille GILLOT
4120080d66 Remove useless LocalDefId in ImplTraitContext::Universal. 2022-06-03 20:17:12 +02:00
bors
7e9b92cb43 Auto merge of #85993 - bjorn3:serde_json, r=wesleywiser
Remove all json handling from rustc_serialize

Json is now handled using serde_json. Where appropriate I have replaced json usage with binary serialization (rmeta files) or manual string formatting (emcc linker arg generation).

This allowed for removing and simplifying a lot of code, which hopefully results in faster serialization/deserialization and faster compiles of rustc itself.

Where sensible we now use serde. Metadata and incr cache serialization keeps using a heavily modified (compared to crates.io) rustc-serialize version that in the future could probably be extended with zero-copy deserialization or other perf tricks that serde can't support due to supporting more than one serialization format.

Note that I had to remove `-Zast-json` and `-Zast-json-noexpand` as the relevant AST types don't implement `serde::Serialize`.

Fixes #40177

See also https://github.com/rust-lang/compiler-team/issues/418
2022-06-03 17:55:02 +00:00
Camille GILLOT
2e301c89c7 Do not ICE when failing to normalize during inlining. 2022-06-03 19:03:18 +02:00
bjorn3
5cc3593c17 Fix emscripten linker invocation 2022-06-03 17:02:14 +00:00
bjorn3
606848a61e Fix all tests 2022-06-03 17:02:14 +00:00
bjorn3
7381ea019c Remove emit_unit
It doesn't do anything for all encoders
2022-06-03 17:02:14 +00:00
bjorn3
22e8d5f80e Inline many methods of Encoder
They aren't overridden anyway
2022-06-03 17:01:53 +00:00
bjorn3
5cd29225a5 Remove all names from Encoder
They aren't used anymore now that the json format has been removed
2022-06-03 16:56:17 +00:00
bjorn3
ede5ac251c Remove json support from rustc_serialize 2022-06-03 16:46:20 +00:00
bjorn3
15e0d8bdb1 Remove support for -Zast-json and -Zast-json-noexpand 2022-06-03 16:46:20 +00:00
bjorn3
a2591639ec Avoid rustc_serialize in linker.rs 2022-06-03 16:46:20 +00:00
bjorn3
62a4f91a5a Use serde_json for json error messages 2022-06-03 16:46:19 +00:00
bjorn3
fc1df4ff17 Use serde_json for target spec json 2022-06-03 16:46:19 +00:00
bjorn3
fc2abe6952 Remove a couple of unused Encodable and Decodable derives 2022-06-03 16:46:19 +00:00
EdwinRy
cd03fe18d8 Suggest replace parentheses with angle brackets 2022-06-03 16:48:59 +01:00
bors
9a74608543 Auto merge of #97694 - Dylan-DPC:rollup-2yxo7ce, r=Dylan-DPC
Rollup of 3 pull requests

Successful merges:

 - #97415 (Compute `is_late_bound_map` query separately from lifetime resolution)
 - #97471 (Provide more context when denying invalid type params )
 - #97681 (Add more eslint checks)

Failed merges:

 - #97446 (Make hir().get_generics and generics_of consistent.)

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-03 15:26:06 +00:00
Dylan DPC
5549d50ccf
Rollup merge of #97681 - GuillaumeGomez:more-eslint, r=Dylan-DPC
Add more eslint checks

A new batch of eslint rules:

 * [no-fallthrough](https://eslint.org/docs/rules/no-fallthrough)
 * [no-invalid-regexp](https://eslint.org/docs/rules/no-invalid-regexp)
 * [no-import-assign](https://eslint.org/docs/rules/no-import-assign)
 * [no-self-compare](https://eslint.org/docs/rules/no-self-compare)
 * [no-template-curly-in-string](https://eslint.org/docs/rules/no-template-curly-in-string)
 * [block-scoped-var](https://eslint.org/docs/rules/block-scoped-var)
 * [guard-for-in](https://eslint.org/docs/rules/guard-for-in)
 * [no-alert](https://eslint.org/docs/rules/no-alert)

r? ``@notriddle``
2022-06-03 17:10:53 +02:00
Dylan DPC
6b80b151b9
Rollup merge of #97471 - estebank:prohibit-generics, r=cjgillot
Provide more context when denying invalid type params
2022-06-03 17:10:52 +02:00
Dylan DPC
53ab3b2e6e
Rollup merge of #97415 - cjgillot:is-late-bound-solo, r=estebank
Compute `is_late_bound_map` query separately from lifetime resolution

This query is actually very simple, and is only useful for functions and method.  It can be computed directly by fetching the HIR, with no need to embed it within the lifetime resolution visitor.

Based on https://github.com/rust-lang/rust/pull/96296
2022-06-03 17:10:51 +02:00
Michael Goulet
7b6f25a2fa Add #T-types/nominated zulip notification 2022-06-03 07:08:17 -07:00
bors
e40d5e83dc Auto merge of #89862 - lcnr:path-generics-diagnostics, r=estebank
rewrite error handling for unresolved inference vars

Pretty much completely rewrites `fn emit_inference_failure_err`.

This new setup should hopefully be easier to extend and is already a lot better when looking for generic arguments.
Because this is a rewrite there are still some parts which are lacking, these are tracked in #94483 and will be fixed in later PRs.

r? `@estebank` `@petrochenkov`
2022-06-03 12:37:16 +00:00
Camille GILLOT
ba40fe99c3 Compute is_late_bound in a separate query.
The computation is actually much simpler, and can be done by directly
fetching the HIR for the `FnDecl` and its generics.
2022-06-03 12:05:04 +02:00
Camille GILLOT
b1294e86bb Manipulate lifetimes by LocalDefId for region resolution. 2022-06-03 12:03:20 +02:00
bors
72f7e3144a Auto merge of #97679 - Dylan-DPC:rollup-nswmgmx, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #97366 (Stabilize `{slice,array}::from_ref`)
 - #97653 (add cast kind of from_exposed_addr (int-to-ptr casts))
 - #97663 (take back half-baked noaliasing check in Assignment)
 - #97664 (On E0204 suggest missing type param bounds)
 - #97668 (rustdoc: clean up primitive.slice.html links)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-06-03 09:56:21 +00:00
Guillaume Gomez
6ce2e052e1 Add "no-alert" eslint rule 2022-06-03 11:29:49 +02:00
Guillaume Gomez
7db2b00be3 Add "guard-for-in" eslint rule 2022-06-03 11:28:34 +02:00
Guillaume Gomez
1e4a149823 Add "block-scoped-var" eslint rule 2022-06-03 11:20:46 +02:00
Dylan DPC
d6f35b3454
Rollup merge of #97668 - notriddle:notriddle/slice-link, r=jsha
rustdoc: clean up primitive.slice.html links

Before: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[</a>T<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">]</a>&gt;

After: <a href="https://doc.rust-lang.org/stable/std/boxed/struct.Box.html">Box</a>&lt;<a href="https://doc.rust-lang.org/stable/std/primitive.slice.html">[T]</a>&gt;
2022-06-03 11:18:27 +02:00
Dylan DPC
b71ddd6861
Rollup merge of #97664 - estebank:suggest-bound-derive-copy, r=compiler-errors
On E0204 suggest missing type param bounds

```
error[E0204]: the trait `Copy` may not be implemented for this type
  --> f42.rs:9:17
   |
9  | #[derive(Debug, Copy, Clone)]
   |                 ^^^^
10 | pub struct AABB<K>{
11 |     pub loc: Vector2<K>,
   |     ------------------- this field does not implement `Copy`
12 |     pub size: Vector2<K>
   |     -------------------- this field does not implement `Copy`
   |
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
  --> f42.rs:11:5
   |
11 |     pub loc: Vector2<K>,
   |     ^^^^^^^^^^^^^^^^^^^
note: the `Copy` impl for `Vector2<K>` requires that `K: Debug`
  --> f42.rs:12:5
   |
12 |     pub size: Vector2<K>
   |     ^^^^^^^^^^^^^^^^^^^^
   = note: this error originates in the derive macro `Copy` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider restricting type parameter `K`
   |
10 | pub struct AABB<K: Debug>{
   |                  +++++++
```

Fix #89137.
2022-06-03 11:18:26 +02:00
Dylan DPC
a6d7939855
Rollup merge of #97663 - RalfJung:keine-halben-sachen, r=oli-obk
take back half-baked noaliasing check in Assignment

Doing an aliasing check in `copy_op` does not make a ton of sense. We have to eventually do something in the `Assignment` statement handling instead.
2022-06-03 11:18:25 +02:00
Dylan DPC
f116dd76ed
Rollup merge of #97653 - RalfJung:int-to-ptr, r=oli-obk
add cast kind of from_exposed_addr (int-to-ptr casts)

This is basically the dual to https://github.com/rust-lang/rust/pull/97582, for int2ptr casts.

Cc `@tmiasko` https://github.com/rust-lang/rust/issues/97649
2022-06-03 11:18:24 +02:00
Dylan DPC
025cf96615
Rollup merge of #97366 - WaffleLapkin:stabilize_array_slice_from_ref, r=dtolnay
Stabilize `{slice,array}::from_ref`

This PR stabilizes the following APIs as `const` functions in Rust `1.63`:
```rust
// core::array
pub const fn from_ref<T>(s: &T) -> &[T; 1];

// core::slice
pub const fn from_ref<T>(s: &T) -> &[T];
```

Note that the `mut` versions are not stabilized as unique references (`&mut _`) are [unstable in const context].

FCP: https://github.com/rust-lang/rust/issues/90206#issuecomment-1134586665

r? rust-lang/libs-api `@rustbot` label +T-libs-api -T-libs

[unstable in const context]: https://github.com/rust-lang/rust/issues/57349
2022-06-03 11:18:23 +02:00
Guillaume Gomez
72bd8e4996 Add "no-template-curly-in-string" eslint rule 2022-06-03 11:16:23 +02:00
Guillaume Gomez
584eec6c26 Add "no-self-compare" eslint rule 2022-06-03 11:14:07 +02:00
Guillaume Gomez
e7d1b5a952 Add "no-import-assign" eslint rule 2022-06-03 11:13:42 +02:00
Guillaume Gomez
fe503adf4c Add "no-invalid-regexp" eslint rule 2022-06-03 11:11:33 +02:00