Commit Graph

1382 Commits

Author SHA1 Message Date
Michael Goulet
b4d3fa4829 Remove ParamMode::ExplicitNamed 2024-08-26 16:47:52 -04:00
Matthias Krüger
c0bedb9e5e
Rollup merge of #129246 - BoxyUwU:feature_gate_const_arg_path, r=cjgillot
Retroactively feature gate `ConstArgKind::Path`

This puts the lowering introduced by #125915 under a feature gate until we fix the regressions introduced by it. Alternative to whole sale reverting the PR since it didn't seem like a very clean revert and I think this is generally a step in the right direction and don't want to get stuck landing and reverting the PR over and over :)

cc #129137 ``@camelid,`` tests taken from there. beta is branching soon so I think it makes sense to not try and rush that fix through since it wont have much time to bake and if it has issues we can't simply revert it on beta.

Fixes #128016
2024-08-24 22:14:12 +02:00
Matthias Krüger
4137f3bc15
Rollup merge of #129345 - compiler-errors:scratch4, r=jieyouxu
Use shorthand field initialization syntax more aggressively in the compiler

Caught these when cleaning up #129344 and decided to run clippy to find the rest
2024-08-21 18:15:06 +02:00
Michael Goulet
0b2525c787 Simplify some redundant field names 2024-08-21 01:31:42 -04:00
Michael Goulet
25ff9b6bcb Use bool in favor of Option<()> for diagnostics 2024-08-21 01:31:11 -04:00
Boxy
b8eedfa3d2 Retroactively feature gate ConstArgKind::Path 2024-08-19 01:14:22 +01:00
Michael Goulet
833af65f38 Use FnSig instead of raw FnDecl for ForeignItemKind::Fn 2024-08-16 14:10:06 -04:00
Nicholas Nethercote
ea014b4d75 Add warn(unreachable_pub) to rustc_ast_lowering. 2024-08-16 08:46:33 +10:00
Folkert
8419c0956e stabilize asm_const 2024-08-13 23:18:31 +02:00
Guillaume Gomez
ea74eff55c
Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote
Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`

`@rustbot` label +A-translation
cc https://github.com/rust-lang/rust/issues/100717
2024-08-12 17:09:17 +02:00
Matthias Krüger
32e0fe129d
Rollup merge of #128762 - fmease:use-more-slice-pats, r=compiler-errors
Use more slice patterns inside the compiler

Nothing super noteworthy. Just replacing the common 'fragile' pattern of "length check followed by indexing or unwrap" with slice patterns for legibility and 'robustness'.

r? ghost
2024-08-11 07:51:51 +02:00
Pavel Grigorenko
67602980de rustc_ast_lowering: make asm-related unstability messages translatable 2024-08-10 14:32:55 +03:00
Pavel Grigorenko
290df4fa56 rustc_ast_lowering: make "yield syntax is experimental" translatable 2024-08-10 14:32:55 +03:00
Pavel Grigorenko
334a097137 rustc_ast_lowering: make "using _ for array lengths is unstable" translatable 2024-08-10 14:32:55 +03:00
León Orell Valerian Liehr
c4c518d2d4
Use more slice patterns inside the compiler 2024-08-07 13:37:52 +02:00
Deadbeef
ec77db83b2 minor effects cleanups 2024-07-31 03:29:10 +00:00
Bryanskiy
f2f9aab380 Delegation: support generics for delegation from free functions 2024-07-29 20:04:55 +03:00
Nicholas Nethercote
84ac80f192 Reformat use declarations.
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Trevor Gross
f1cf2f526a
Rollup merge of #128226 - oli-obk:option_vs_empty_slice, r=petrochenkov
Remove redundant option that was just encoding that a slice was empty

There is already a sanity check ensuring we don't put empty attribute lists into the HIR:

6ef11b81c2/compiler/rustc_ast_lowering/src/lib.rs (L661-L667)
2024-07-26 19:03:07 -04:00
Oli Scherer
33b98bf256 Remove redundant option that was just encoding that a slice was empty 2024-07-26 10:19:31 +00:00
Bryanskiy
2a73553513 Support ?Trait bounds in supertraits and dyn Trait under a feature gate 2024-07-25 20:53:33 +03:00
Michael Goulet
b82f878f03 Gate AsyncFn* under async_closure feature 2024-07-23 19:56:06 -04:00
Noah Lev
37ed7a4438 Add ConstArgKind::Path and make ConstArg its own HIR node
This is a very large commit since a lot needs to be changed in order to
make the tests pass. The salient changes are:

- `ConstArgKind` gets a new `Path` variant, and all const params are now
  represented using it. Non-param paths still use `ConstArgKind::Anon`
  to prevent this change from getting too large, but they will soon use
  the `Path` variant too.

- `ConstArg` gets a distinct `hir_id` field and its own variant in
  `hir::Node`. This affected many parts of the compiler that expected
  the parent of an `AnonConst` to be the containing context (e.g., an
  array repeat expression). They have been changed to check the
  "grandparent" where necessary.

- Some `ast::AnonConst`s now have their `DefId`s created in
  rustc_ast_lowering rather than `DefCollector`. This is because in some
  cases they will end up becoming a `ConstArgKind::Path` instead, which
  has no `DefId`. We have to solve this in a hacky way where we guess
  whether the `AnonConst` could end up as a path const since we can't
  know for sure until after name resolution (`N` could refer to a free
  const or a nullary struct). If it has no chance as being a const
  param, then we create a `DefId` in `DefCollector` -- otherwise we
  decide during ast_lowering. This will have to be updated once all path
  consts use `ConstArgKind::Path`.

- We explicitly use `ConstArgHasType` for array lengths, rather than
  implicitly relying on anon const type feeding -- this is due to the
  addition of `ConstArgKind::Path`.

- Some tests have their outputs changed, but the changes are for the
  most part minor (including removing duplicate or almost-duplicate
  errors). One test now ICEs, but it is for an incomplete, unstable
  feature and is now tracked at #127009.
2024-07-16 19:27:28 -07:00
Noah Lev
1c49d406b6 Use ConstArg for const param defaults
Now everything that actually affects the type system (i.e., excluding
const blocks, enum variant discriminants, etc.) *should* be using
`ConstArg`.
2024-07-16 19:27:28 -07:00
Noah Lev
67fccb7045 Use ConstArg for array lengths 2024-07-16 19:27:28 -07:00
Noah Lev
8818708a31 Use ConstArg for assoc item constraints 2024-07-16 19:27:28 -07:00
Noah Lev
7d7be2f0f6 Setup ast_lowering functions for ConstArg 2024-07-16 19:27:28 -07:00
Noah Lev
11b144aa98 hir: Create hir::ConstArgKind enum
This will allow lowering const params to a dedicated enum variant, rather
than to an `AnonConst` that is later examined during `ty` lowering.
2024-07-16 19:27:28 -07:00
Noah Lev
71f8aed510 Add current_def_id_parent to LoweringContext
This is needed to track anon const parents properly once we implement
`ConstArgKind::Path` (which requires moving anon const def-creation
outside of `DefCollector`):

    Why do we need this in addition to [`Self::current_hir_id_owner`]?

    Currently (as of June 2024), anonymous constants are not HIR owners;
    however, they do get their own DefIds. Some of these DefIds have to be
    created during AST lowering, rather than def collection, because we
    can't tell until after name resolution whether an anonymous constant
    will end up instead being a [`rustc_hir::ConstArgKind::Path`]. However,
    to compute which generics are available to an anonymous constant nested
    inside another, we need to make sure that the parent is recorded as the
    parent anon const, not the enclosing item. So we need to track parent
    defs differently from HIR owners, since they will be finer-grained in
    the case of anon consts.
2024-07-16 19:27:28 -07:00
Bryanskiy
7ee97f93da Delegation: support coercion for target expression 2024-07-16 18:03:15 +03:00
bors
5be2ec7245 Auto merge of #127200 - fee1-dead-contrib:trait_def_const_trait, r=compiler-errors
Add `constness` to `TraitDef`

Second attempt at fixing the regression @ https://github.com/rust-lang/rust/pull/120639#issuecomment-2198373716

r? project-const-traits
2024-07-09 06:51:35 +00:00
Matthias Krüger
33e9f25e91
Rollup merge of #127092 - compiler-errors:rtn-dots-redux, r=estebank
Change return-type-notation to use `(..)`

Aligns the syntax with the current wording of [RFC 3654](https://github.com/rust-lang/rfcs/pull/3654). Also implements rustfmt support (along with making a match exhaustive).

Tracking:
* https://github.com/rust-lang/rust/issues/109417
2024-07-03 23:30:07 +02:00
Deadbeef
46af987072 Add constness to TraitDef 2024-07-03 15:37:34 +00:00
Michael Goulet
82b4af7511 Make sure we deny unimplemented RTN on qpath segments 2024-06-28 14:20:44 -04:00
Michael Goulet
b1a0c0b123 Change RTN to use .. again 2024-06-28 14:20:43 -04:00
Deadbeef
72e8244e64 implement new effects desugaring 2024-06-28 10:57:35 +00:00
Michael Goulet
789ee88bd0 Tighten spans for async blocks 2024-06-27 15:19:08 -04:00
bors
31f8b70d2e Auto merge of #126951 - matthiaskrgr:rollup-xg0o4mc, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #126618 (Mark assoc tys live only if the corresponding trait is live)
 - #126746 (Deny `use<>` for RPITITs)
 - #126868 (not use offset when there is not ends with brace)
 - #126884 (Do not ICE when suggesting dereferencing closure arg)
 - #126893 (Eliminate the distinction between PREC_POSTFIX and PREC_PAREN precedence level)
 - #126915 (Don't suggest awaiting in closure patterns)
 - #126943 (De-duplicate all consecutive native libs regardless of their options)

r? `@ghost`
`@rustbot` modify labels: rollup
2024-06-25 23:29:58 +00:00
Matthias Krüger
4ebd69c063
Rollup merge of #126947 - Bryanskiy:delegation-lowering-refactoring, r=petrochenkov
Delegation: ast lowering refactor

refactoring changes for https://github.com/rust-lang/rust/pull/126699

r? ```@petrochenkov```
2024-06-25 21:33:45 +02:00
Matthias Krüger
8b72058985
Rollup merge of #126746 - compiler-errors:no-rpitit, r=oli-obk
Deny `use<>` for RPITITs

Precise capturing `use<>` syntax is currently a no-op on RPITITs, since GATs have no variance, so all captured lifetimes are captured invariantly.

We don't currently *need* to support `use<>` on RPITITs, since `use<>` is initially intended for migrating RPIT *overcaptures* from edition 2021->2024, but since RPITITs currently capture all in-scope lifetimes, we'll never need to write `use<>` on an RPITIT.

Eventually, though, it would be desirable to support precise capturing on RPITITs, since RPITITs overcapturing by default can be annoying to some folks. But let's separate that (which will likely require some delicate types team work for adding variances to GATs and adjusting the refinement rules) from the stabilization of the feature for edition 2024.

r? oli-obk cc ``@traviscross``

Tracking:

- https://github.com/rust-lang/rust/issues/123432
2024-06-25 18:02:58 +02:00
Bryanskiy
d30d85fd9e Delegation: ast lowering refactor 2024-06-25 16:44:51 +03:00
Michael Goulet
6521c3971d Deny use<> for RPITITs 2024-06-24 12:03:09 -04:00
Michael Goulet
ffd72b1700 Fix remaining cases 2024-06-21 19:00:18 -04:00
Michael Goulet
3e59f0c3c5 StaticForeignItem and StaticItem are the same 2024-06-20 19:51:09 -04:00
许杰友 Jieyou Xu (Joe)
8eb2e5f4c8
Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, r=estebank,davidtwco
Place tail expression behind terminating scope

This PR implements #123739 so that we can do further experiments in nightly.

A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following.
```rust
match into_async_iter($iter_expr) {
  ref mut iter => match unsafe { Pin::unchecked_new(iter) } {
    ...
  }
}
```
2024-06-19 01:51:38 +01:00
许杰友 Jieyou Xu (Joe)
c9a9d5cee7
Rollup merge of #125078 - linyihai:issue-124496, r=compiler-errors
fix: break inside async closure has incorrect span for enclosing closure

Fixes #124496
2024-06-19 01:51:38 +01:00
Oli Scherer
7ba82d61eb Use a dedicated type instead of a reference for the diagnostic context
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18 15:42:11 +00:00
Michael Goulet
227374714f Delay a bug and mark precise_capturing as not incomplete 2024-06-17 22:35:25 -04:00
Michael Goulet
2e03130e11 Detect duplicates 2024-06-17 22:35:25 -04:00
Michael Goulet
f66558d2bf Add tests for illegal use bound syntax 2024-06-17 22:35:25 -04:00
Michael Goulet
b1efe1ab5d Rework precise capturing syntax 2024-06-17 22:35:25 -04:00
Ding Xiang Fei
0f8c3f7882
tail expression behind terminating scope 2024-06-18 04:14:43 +08:00
Nicholas Nethercote
75b164d836 Use tidy to sort crate attributes for all compiler crates.
We already do this for a number of crates, e.g. `rustc_middle`,
`rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`.

For the ones we don't, in many cases the attributes are a mess.
- There is no consistency about order of attribute kinds (e.g.
  `allow`/`deny`/`feature`).
- Within attribute kind groups (e.g. the `feature` attributes),
  sometimes the order is alphabetical, and sometimes there is no
  particular order.
- Sometimes the attributes of a particular kind aren't even grouped
  all together, e.g. there might be a `feature`, then an `allow`, then
  another `feature`.

This commit extends the existing sorting to all compiler crates,
increasing consistency. If any new attribute line is added there is now
only one place it can go -- no need for arbitrary decisions.

Exceptions:
- `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`,
  because they have no crate attributes.
- `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's
  ignored in `rustfmt.toml`).
2024-06-12 15:49:10 +10:00
Bryanskiy
6f78e6265a Delegation: fix ICE on recursive delegation 2024-06-10 21:27:25 +03:00
Matthias Krüger
6e534c73c3
Rollup merge of #124214 - carbotaniuman:parse_unsafe_attrs, r=michaelwoerister
Parse unsafe attributes

Initial parse implementation for #123757

This is the initial work to parse unsafe attributes, which is represented as an extra `unsafety` field in `MetaItem` and `AttrItem`. There's two areas in the code where it appears that parsing is done manually and not using the parser stuff, and I'm not sure how I'm supposed to thread the change there.
2024-06-07 20:14:28 +02:00
Oli Scherer
cbee17d502 Revert "Create const block DefIds in typeck instead of ast lowering"
This reverts commit ddc5f9b6c1.
2024-06-07 08:33:58 +00:00
Oli Scherer
92c54db22f Revert "Cache whether a body has inline consts"
This reverts commit eae5031ecb.
2024-06-07 08:33:58 +00:00
carbotaniuman
87be1bae73 Fix build 2024-06-06 20:27:25 -05:00
carbotaniuman
67f5dd1ef1 Parse unsafe attributes 2024-06-06 20:26:27 -05:00
Lin Yihai
05b7b46e65 fix: break inside async closure has incorrect span for enclosing closure 2024-06-05 19:22:50 +08:00
Santiago Pastorino
bac72cf7cf
Add safe/unsafe to static inside extern blocks 2024-06-04 14:19:43 -03:00
Santiago Pastorino
2a377122dd
Handle safety keyword for extern block inner items 2024-06-04 14:19:42 -03:00
Matthias Krüger
c11e057989
Rollup merge of #125790 - WaffleLapkin:no-tail-recomputation-in-lower-stmts, r=lcnr
Don't recompute `tail` in `lower_stmts`

Does not really matter, but this is slightly nicer.

`@bors` rollup
2024-05-31 08:50:24 +02:00
Matthias Krüger
379233242b
Rollup merge of #125635 - fmease:mv-type-binding-assoc-item-constraint, r=compiler-errors
Rename HIR `TypeBinding` to `AssocItemConstraint` and related cleanup

Rename `hir::TypeBinding` and `ast::AssocConstraint` to `AssocItemConstraint` and update all items and locals using the old terminology.

Motivation: The terminology *type binding* is extremely outdated. "Type bindings" not only include constraints on associated *types* but also on associated *constants* (feature `associated_const_equality`) and on RPITITs of associated *functions* (feature `return_type_notation`). Hence the word *item* in the new name. Furthermore, the word *binding* commonly refers to a mapping from a binder/identifier to a "value" for some definition of "value". Its use in "type binding" made sense when equality constraints (e.g., `AssocTy = Ty`) were the only kind of associated item constraint. Nowadays however, we also have *associated type bounds* (e.g., `AssocTy: Bound`) for which the term *binding* doesn't make sense.

---

Old terminology (HIR, rustdoc):

```
`TypeBinding`: (associated) type binding
├── `Constraint`: associated type bound
└── `Equality`: (associated) equality constraint (?)
    ├── `Ty`: (associated) type binding
    └── `Const`: associated const equality (constraint)
```

Old terminology (AST, abbrev.):

```
`AssocConstraint`
├── `Bound`
└── `Equality`
    ├── `Ty`
    └── `Const`
```

New terminology (AST, HIR, rustdoc):

```
`AssocItemConstraint`: associated item constraint
├── `Bound`: associated type bound
└── `Equality`: associated item equality constraint OR associated item binding (for short)
    ├── `Ty`: associated type equality constraint OR associated type binding (for short)
    └── `Const`: associated const equality constraint OR associated const binding (for short)
```

r? compiler-errors
2024-05-31 08:50:22 +02:00
Waffle Maybe
86afea97fd
Don't recompute tail in lower_stmts 2024-05-31 00:46:07 +02:00
León Orell Valerian Liehr
34c56c45cf
Rename HIR TypeBinding to AssocItemConstraint and related cleanup 2024-05-30 22:52:33 +02:00
Oli Scherer
eae5031ecb Cache whether a body has inline consts 2024-05-28 13:38:43 +00:00
Oli Scherer
ddc5f9b6c1 Create const block DefIds in typeck instead of ast lowering 2024-05-28 13:38:43 +00:00
Santiago Pastorino
6b46a919e1
Rename Unsafe to Safety 2024-05-17 18:33:37 -03:00
Vadim Petrochenkov
c30b41012d delegation: Implement list delegation
```rust
reuse prefix::{a, b, c}
```
2024-05-15 02:32:59 +03:00
Michael Goulet
1529c661e4 Warn against redundant use<...> 2024-05-13 23:57:56 -04:00
Nicholas Nethercote
fd91925bce Add ErrorGuaranteed to Recovered::Yes and use it more.
The starting point for this was identical comments on two different
fields, in `ast::VariantData::Struct` and `hir::VariantData::Struct`:
```
    // FIXME: investigate making this a `Option<ErrorGuaranteed>`
    recovered: bool
```
I tried that, and then found that I needed to add an `ErrorGuaranteed`
to `Recovered::Yes`. Then I ended up using `Recovered` instead of
`Option<ErrorGuaranteed>` for these two places and elsewhere, which
required moving `ErrorGuaranteed` from `rustc_parse` to `rustc_ast`.

This makes things more consistent, because `Recovered` is used in more
places, and there are fewer uses of `bool` and
`Option<ErrorGuaranteed>`. And safer, because it's difficult/impossible
to set `recovered` to `Recovered::Yes` without having emitted an error.
2024-05-09 20:12:07 +10:00
Matthias Krüger
d30af5e168
Rollup merge of #123344 - pietroalbini:pa-unused-imports, r=Nilstrieb
Remove braces when fixing a nested use tree into a single item

[Back in 2019](https://github.com/rust-lang/rust/pull/56645) I added rustfix support for the `unused_imports` lint, to automatically remove them when running `cargo fix`. For the most part this worked great, but when removing all but one childs of a nested use tree it turned `use foo::{Unused, Used}` into `use foo::{Used}`. This is slightly annoying, because it then requires you to run `rustfmt` to get `use foo::Used`.

This PR automatically removes braces and the surrouding whitespace when all but one child of a nested use tree are unused. To get it done I had to add the span of the nested use tree to the AST, and refactor a bit the code I wrote back then.

A thing I noticed is, there doesn't seem to be any `//@ run-rustfix` test for fixing the `unused_imports` lint. I created a test in `tests/suggestions` (is that the right directory?) that for now tests just what I added in the PR. I can followup in a separate PR to add more tests for fixing `unused_lints`.

This PR is best reviewed commit-by-commit.
2024-05-08 23:33:24 +02:00
Nadrieril
57e8aebb6c Lower never patterns to Unreachable in mir 2024-05-04 16:30:01 +02:00
bors
09cd00fea4 Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillot
Some hir cleanups

It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field.

r? compiler
2024-05-04 00:32:27 +00:00
Matthias Krüger
784316eadc
Rollup merge of #124511 - nnethercote:rm-extern-crates, r=fee1-dead
Remove many `#[macro_use] extern crate foo` items

This requires the addition of more `use` items, which often make the code more verbose. But they also make the code easier to read, because `#[macro_use]` obscures where macros are defined.

r? `@fee1-dead`
2024-04-30 15:04:08 +02:00
Nicholas Nethercote
6341935a13 Remove extern crate tracing from numerous crates. 2024-04-30 16:47:49 +10:00
Matthias Krüger
ea3d99eaa8
Rollup merge of #124524 - spastorino:make-foreign-static-use-struct, r=oli-obk
Add StaticForeignItem and use it on ForeignItemKind

This is in preparation for unsafe extern blocks that adds a safe variant for functions inside extern blocks.

r? `@oli-obk`
cc `@compiler-errors`
2024-04-30 06:43:42 +02:00
Matthias Krüger
42ab090be9
Rollup merge of #124488 - est31:arbitrary_expressions_error, r=pnkfelix
Add a note to the ArbitraryExpressionInPattern error

The current "arbitrary expressions aren't allowed in patterns" error is confusing, as it fires for code where it *looks* like a pattern but the compiler still treats it as an expression. That this is due to the `:expr` fragment specifier forcing the expression-ness property on the code.

In the test suite, the "arbitrary expressions aren't allowed in patterns" error can only be found in combination with macro_rules macros that force expression-ness of their content, namely via `:expr` metavariables. I also can't come up with cases where there would be an expression instead of a pattern, so I think it's always coming from an `:expr`.

In order to make the error less confusing, this adds a note explaining the weird `:expr` fragment behaviour.

Fixes #99380
2024-04-29 22:37:51 +02:00
Santiago Pastorino
f06e0f7837
Add StaticForeignItem and use it on ForeignItemKind 2024-04-29 13:15:51 -03:00
est31
c6e946d0f0 Change wording 2024-04-29 14:53:38 +02:00
est31
4284bca720 Add a note to the ArbitraryExpressionInPattern error 2024-04-28 21:27:26 +02:00
Oli Scherer
e4f8b93454 Spans are already 64 bit, just like references, so stop putting them behind indirections 2024-04-26 13:09:04 +00:00
Oli Scherer
4a19711b25 Move ConstArg::span to AnonConst::span 2024-04-26 13:05:00 +00:00
Oli Scherer
4dc46f7f17 put hir::AnonConst on the hir arena 2024-04-26 12:57:02 +00:00
Vadim Petrochenkov
5be9fdd636 ast: Generalize item kind visiting
And avoid duplicating logic for visiting `Item`s with different kinds (regular, associated, foreign).
2024-04-25 22:49:58 +03:00
bors
5557f8c9d0 Auto merge of #122500 - petrochenkov:deleg, r=fmease
delegation: Support renaming, and async, const, extern "ABI" and C-variadic functions

Also allow delegating to functions with opaque types (`impl Trait`).
The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created, which seems like a reasonable behavior.
(Such delegation items will cause query cycles when used in trait impls, but it can be fixed later.)

Part of https://github.com/rust-lang/rust/issues/118212.
2024-04-24 11:57:35 +00:00
Oli Scherer
aef0f4024a Error on using yield without also using #[coroutine] on the closure
And suggest adding the `#[coroutine]` to the closure
2024-04-24 08:05:29 +00:00
Oli Scherer
a589632dad Add explicit syntax for coroutines instead of relying on closures having yield expressions 2024-04-24 07:54:21 +00:00
Vadim Petrochenkov
7b7c26f09b delegation: Support async, const, extern "ABI" and C-variadic functions
Also allow `impl Trait` in delegated functions.
The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
2024-04-23 23:05:39 +03:00
Xiretza
5646b65cf5 Pass translation closure to add_to_diag_with() as reference 2024-04-21 07:45:03 +00:00
Jubilee
f174c310ae
Rollup merge of #123935 - tstsrt:fix-115423, r=oli-obk
Don't inline integer literals when they overflow - new attempt

Basically #116633 but I implemented the suggested changes.
Fixes #115423. Fixes #116631.

This is my first contribution to this repo so please let me know if I'm supposed to change something :)
2024-04-18 21:38:55 -07:00
Jules Bertholet
2a4624ddd1
Rename BindingAnnotation to BindingMode 2024-04-17 09:34:39 -04:00
Matthias Krüger
45940fe6d8
Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errors
Qualifier tweaking

Adding and removing qualifiers in some cases that make things nicer. Details in individual commits.

r? `@compiler-errors`
2024-04-17 05:44:52 +02:00
Nicholas Nethercote
4b27cc8b7a Avoid lots of hir::HirId{,Map,Set} qualifiers.
Because they're a bit redundant.
2024-04-16 16:29:15 +10:00
Michael Goulet
52c6b101ea Use a path instead of an ident (and stop manually resolving) 2024-04-15 16:45:26 -04:00
Michael Goulet
02d7317af2 Add hir::Node::PreciseCapturingNonLifetimeArg 2024-04-15 16:45:25 -04:00
Michael Goulet
42ba57c013 Validation and other things 2024-04-15 16:45:01 -04:00
Michael Goulet
41cf87b71b Lower and resolve precise captures in HIR 2024-04-15 16:45:01 -04:00
Michael Goulet
fc9e344874 Use dedicated PreciseCapturingArg for representing what goes in use<> 2024-04-15 16:45:01 -04:00