Commit Graph

999 Commits

Author SHA1 Message Date
bors
3e97763872 Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obk
Move format_args!() into AST (and expand it during AST lowering)

Implements https://github.com/rust-lang/compiler-team/issues/541

This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier.

This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`.

This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.
2023-01-26 12:44:47 +00:00
Matthias Krüger
f3644ca64d
Rollup merge of #107085 - tmiasko:custom-mir-operators, r=oli-obk
Custom MIR: Support binary and unary operations

Lower binary and unary operations directly to corresponding unchecked MIR
operations. Ultimately this might not be syntax we want, but it allows for
experimentation in the meantime.

r? ````@oli-obk```` ````@JakobDegen````
2023-01-26 06:15:24 +01:00
Vincenzo Palazzo
7d2c1103d7 fix: use LocalDefId instead of HirId in trait res
use LocalDefId instead of HirId in trait resolution to simplify
the obligation clause resolution

Signed-off-by: Vincenzo Palazzo <vincenzopalazzodev@gmail.com>
2023-01-23 11:42:18 +00:00
bors
04a41f889f Auto merge of #107105 - matthiaskrgr:rollup-rkz9t7r, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #106783 (Recover labels written as identifiers)
 - #106973 (Don't treat closures from other crates as local)
 - #106979 (Document how to get the type of a default associated type)
 - #107053 (signal update string representation for haiku.)
 - #107058 (Recognise double-equals homoglyph)
 - #107067 (Custom MIR: Support storage statements)
 - #107076 (Added const-generic ui test case for issue #106419)
 - #107091 (Fix broken format strings in `infer.ftl`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2023-01-20 12:58:13 +00:00
bors
56ee85274e Auto merge of #106090 - WaffleLapkin:dereffffffffff, r=Nilstrieb
Remove some `ref` patterns from the compiler

Previous PR: https://github.com/rust-lang/rust/pull/105368

r? `@Nilstrieb`
2023-01-20 04:52:28 +00:00
Tomasz Miąsko
d3cfe97a8a Custom MIR: Support binary and unary operations 2023-01-19 22:00:33 +01:00
Tomasz Miąsko
ca3d55e32d Custom MIR: Support storage statements 2023-01-19 11:53:33 +01:00
Scott McMurray
7d57685682 Also remove #![feature(control_flow_enum)] where possible 2023-01-18 10:22:21 -08:00
Scott McMurray
925dc37313 Stop using BREAK & CONTINUE in compiler
Switching them to `Break(())` and `Continue(())` instead.

libs-api would like to remove these constants, so stop using them in compiler to make the removal PR later smaller.
2023-01-17 23:17:51 -08:00
Matthias Krüger
68f12338af
Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726
Remove double spaces after dots in comments

Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17 20:21:25 +01:00
Maybe Waffle
6a28fb42a8 Remove double spaces after dots in comments 2023-01-17 08:09:33 +00:00
Waffle Maybe
66751ea73e tidy
rustfmt, pleaaaaase, start supporting rust

Co-authored-by: nils <48135649+Nilstrieb@users.noreply.github.com>
2023-01-17 07:48:19 +00:00
Maybe Waffle
360e978437 Don't call closures immediately, use try{} blocks 2023-01-17 07:48:19 +00:00
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
Mara Bos
a4dbcb525b Expand format_args!() in rust_ast_lowering. 2023-01-12 00:25:45 +01: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