Commit Graph

985 Commits

Author SHA1 Message Date
Ezra Shaw
1babece1e8
suggest fix for attempted integer identifier in patterns 2023-01-14 12:51:20 +13:00
Michael Goulet
83d3b76ac2
Rollup merge of #106097 - mejrs:mir_build2, r=oli-obk
Migrate mir_build diagnostics 2 of 3

The first three commits are fairly boring, however I've made some changes to the output of the match checking diagnostics.
2023-01-11 22:25:47 -08:00
mejrs
372ac9c1a2
Translate Overlap eagerly 2023-01-11 14:40:13 -08:00
mejrs
3d260fa63c
Some cleanup, oops 2023-01-11 14:40:10 -08:00
mejrs
8476c517c0
Don't recommend if let if let else works 2023-01-11 14:40:07 -08:00
mejrs
31c20210b9
Migrate pattern matching 2023-01-11 14:40:02 -08:00
mejrs
ef33072890
Migrate usefulness.rs 2023-01-11 14:39:59 -08:00
mejrs
5d2b9a9ed0
Migrate deconstruct_pat.rs 2023-01-11 14:39:49 -08:00
mejrs
519b1abd19
Translate const_to_pat.rs 2023-01-11 14:39:27 -08:00
Esteban Küber
52d534ef63 Detect out of bounds range pattern value
Fix #68972.
2023-01-11 16:50:55 +00:00
Michael Goulet
5ce6311f34
Rollup merge of #106403 - compiler-errors:rename-hir-methods, r=cjgillot
Rename `hir::Map::{get_,find_}parent_node` to `hir::Map::{,opt_}parent_id`, and add `hir::Map::{get,find}_parent`

The `hir::Map::get_parent_node` function doesn't return a `Node`, and I think that's quite confusing. Let's rename it to something that sounds more like something that gets the parent hir id => `hir::Map::parent_id`. Same with `find_parent_node` => `opt_parent_id`.

Also, combine `hir.get(hir.parent_id(hir_id))` and similar `hir.find(hir.parent_id(hir_id))` function into new functions that actually retrieve the parent node in one call. This last commit is the only one that might need to be looked at closely.
2023-01-04 20:36:28 -08:00
Michael Goulet
a313ef05a7 rename get_parent_node to parent_id 2023-01-04 00:43:13 +00:00
Léo Lanteri Thauvin
2a7d559970 Don't trim path for unsafe_op_in_unsafe_fn lints 2023-01-03 00:28:54 +01:00
Matthias Krüger
d23cb738d2
Rollup merge of #105975 - jeremystucki:rustc-remove-needless-lifetimes, r=eholk
rustc: Remove needless lifetimes
2022-12-24 00:31:41 +01:00
Tomasz Miąsko
898b702695 Fix the issue number in comment for as_local_call_operand 2022-12-22 20:06:53 +01:00
Matthias Krüger
d0d0ccdca2
Rollup merge of #106012 - JakobDegen:retag-raw, r=RalfJung
Clarify that raw retags are not permitted in Mir

Not sure when this changed, but documentation and the validator needed to be updated. This also removes raw retags from custom mir.

cc rust-lang/miri#2735

r? `@RalfJung`
2022-12-22 01:01:15 +01:00
Jakob Degen
cb2c7bb833 Clarify that raw retags are not permitted in Mir 2022-12-21 10:32:01 -08:00
Jeremy Stucki
3dde32ca97
rustc: Remove needless lifetimes 2022-12-20 22:10:40 +01:00
Oli Scherer
e405dabf7d Some style nits 2022-12-20 13:43:11 +00:00
bors
eb9e5e711d Auto merge of #105880 - Nilstrieb:make-newtypes-less-not-rust, r=oli-obk
Improve syntax of `newtype_index`

This makes it more like proper Rust and also makes the implementation a lot simpler.

Mostly just turns weird flags in the body into proper attributes.

It should probably also be converted to an attribute macro instead of function-like, but that can be done in a future PR.
2022-12-20 07:27:01 +00:00
Rémy Rakic
8275d115fb Revert "Auto merge of #103880 - b-naber:field-ty-mir, r=lcnr"
This reverts commit 03770f0e2b, reversing
changes made to 01ef4b21dc.
2022-12-19 15:31:20 +00:00
Matthias Krüger
ebe3563764
Rollup merge of #105873 - matthiaskrgr:clippy_fmt, r=Nilstrieb
use &str / String literals instead of format!()
2022-12-18 23:03:07 +01:00
Nilstrieb
8bfd6450c7 A few small cleanups for newtype_index
Remove the `..` from the body, only a few invocations used it and it's
inconsistent with rust syntax.

Use `;` instead of `,` between consts. As the Rust syntax gods inteded.
2022-12-18 21:47:28 +01:00
Matthias Krüger
22379779b5
Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obk
don't destuct references just to reborrow
2022-12-18 18:57:05 +01:00
Matthias Krüger
a108d55ce6 don't restuct references just to reborrow 2022-12-18 17:04:32 +01:00
Matthias Krüger
0aa4cde747 avoid .into() conversion to identical types 2022-12-18 16:20:32 +01:00
Matthias Krüger
3af7df91fc use &str / String literals instead of format!() 2022-12-18 16:17:46 +01:00
bors
35a99eef32 Auto merge of #104417 - mejrs:mir_build, r=davidtwco
Migrate rustc_mir_build diagnostics

Rebases https://github.com/rust-lang/rust/pull/100854

~~The remaining issue is how to better resolve 72bea68af4~~

~~The diagnostic macros seems to generate a broken diagnostic, and I couldn't figure out how to manually format the fluent message, so I hardcoded the format string for now. I'd like pointers to a better fix for this.~~

Also, I'm not 100% sure I didn't mess up a rebase somewhere 🙂

r? `@davidtwco`
2022-12-18 08:53:49 +00:00
Matthias Krüger
eaf2f26ecc
Rollup merge of #105814 - JakobDegen:custom-mir-terms, r=oli-obk
Support call and drop terminators in custom mir

The only caveat with this change is that cleanup blocks are not supported. I would like to add them, but it's not quite clear to me what the best way to do that is, so I'll have to think about it some more.

r? ``@oli-obk``
2022-12-17 23:44:28 +01:00
mejrs
f7e894c000 Try to fix ICE 2022-12-17 20:11:25 +01:00
mejrs
6749ee4d7b Remove (eager) 2022-12-17 19:20:44 +01:00
mejrs
1bdf112529 Resolve various merge conflicts 2022-12-17 19:08:25 +01:00
TheOddGarlic
e71a722fa6 Migrate multiple mut borrows diagnostic 2022-12-17 19:08:25 +01:00
TheOddGarlic
3a9a06311d Migrate borrow of moved value diagnostic 2022-12-17 19:08:25 +01:00
TheOddGarlic
eeef05b318 Migrate irrefutable let pattern diagnostics 2022-12-17 19:08:25 +01:00
TheOddGarlic
e1c5073c07 Migrate pattern bindings with variant name lint 2022-12-17 19:08:25 +01:00
TheOddGarlic
6f82a00aa1 Migrate leading/trailing irrefutable let pattern diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
4b70784176 Migrate lower range bound diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
513e3995e0 Migrate "could not evaluate const pattern" diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
d5f821eeb0 Migrate "constant pattern depends on generic parameter" diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
b694e6649e Migrate unreachable pattern diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
98442b6905 Migrate pattern inlining error diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
c7bfd00719 Migrate "non-exhaustive patterns: type is non-empty" diagnostic 2022-12-17 19:08:24 +01:00
TheOddGarlic
71a9cb9b7e Migrate "unused unsafe" lint 2022-12-17 19:08:24 +01:00
TheOddGarlic
64f3e4f195 Migrate "requires unsafe" diagnostics 2022-12-17 19:08:24 +01:00
TheOddGarlic
71fe52fed0 Migrate "unsafe_op_in_unsafe_fn" lints 2022-12-17 19:08:24 +01:00
TheOddGarlic
82f05446a5 Migrate "function cannot return without recursing" diagnostic 2022-12-17 19:08:24 +01:00
Jakob Degen
3d849ae44c Support call and drop terminators in custom mir 2022-12-16 22:26:33 -08:00
bors
03770f0e2b Auto merge of #103880 - b-naber:field-ty-mir, r=lcnr
Use non-ascribed type as field's type in mir

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

r? `@lcnr`
2022-12-16 12:47:49 +00:00
bors
ec56537c43 Auto merge of #105356 - JakobDegen:more-custom-mir, r=oli-obk
Custom MIR: Many more improvements

Commits are each atomic changes, best reviewed one at a time, with the exception that the last commit includes all the documentation.

### First commit

Unsafetyck was not correctly disabled before for `dialect = "built"` custom MIR. This is fixed and a regression test is added.

### Second commit

Implements `Discriminant`, `SetDiscriminant`, and `SwitchInt`.

### Third commit

Implements indexing, field, and variant projections.

### Fourth commit

Documents the previous commits and everything else.

There is some amount of weirdness here due to having to beat Rust syntax into cooperating with MIR concepts, but it hopefully should not be too much. All of it is documented.

r? `@oli-obk`
2022-12-15 19:59:48 +00:00