Commit Graph

47 Commits

Author SHA1 Message Date
Bryanskiy
63447f2095 Delegation: allow foreign fns reuse 2025-03-13 14:13:07 +03:00
Manish Goregaokar
9d1b62c109 Rollup merge of #138407 - Bryanskiy:delegation-variadic, r=petrochenkov
Delegation: reject C-variadics

The explanation is contained in attached issues.

Fixes https://github.com/rust-lang/rust/issues/127443
Fixes https://github.com/rust-lang/rust/issues/127413

r? `@petrochenkov`
2025-03-12 10:19:34 -07:00
Bryanskiy
ccdba16f42 Delegation: reject C-variadics 2025-03-12 17:14:51 +03:00
Bryanskiy
7bfe2136e4 Delegation: one more ICE fix for MethodCall generation 2025-03-12 15:59:37 +03:00
Bryanskiy
61122d1829 Delegation: fix ICE with invalid MethodCall generation 2025-03-10 17:08:29 +03:00
lcnr
83a02619d5 fallout :skull_emoji: 2025-02-14 00:37:23 +01:00
Esteban Küber
dd52bfc76e Reword "crate not found" resolve message
```
error[E0432]: unresolved import `some_novel_crate`
 --> file.rs:1:5
  |
1 | use some_novel_crate::Type;
  |     ^^^^^^^^^^^^^^^^ use of unresolved module or unlinked crate `some_novel_crate`
```

On resolve errors where there might be a missing crate, mention `cargo add foo`:

```
error[E0433]: failed to resolve: use of unresolved module or unlinked crate `nope`
  --> $DIR/conflicting-impl-with-err.rs:4:11
   |
LL | impl From<nope::Thing> for Error {
   |           ^^^^ use of unresolved module or unlinked crate `nope`
   |
   = help: if you wanted to use a crate named `nope`, use `cargo add nope` to add it to your `Cargo.toml`
```
2025-01-24 01:19:50 +00:00
Mara Bos
585c9765a2 Update tests. 2025-01-07 16:04:14 +01:00
Maybe Lapkin
db0740446b Don't trigger never type lint in a delegation test 2024-11-12 22:23:01 +01:00
Michael Goulet
0b5ddf30eb Yeet effects feature 2024-11-03 18:59:31 +00:00
Michael Goulet
8b7b8e5f56 Hack out effects support for old solver 2024-10-28 21:42:14 +00:00
Michael Goulet
cde29b9ec9 Implement const effect predicate in new solver 2024-10-24 09:46:36 +00:00
Camille GILLOT
d9f15faf3a Bless ui tests. 2024-10-04 23:38:41 +00:00
bors
ec867f03bc Auto merge of #126161 - Bryanskiy:delegation-generics-4, r=petrochenkov
Delegation: support generics in associated delegation items

This is a continuation of https://github.com/rust-lang/rust/pull/125929.

[design](https://github.com/Bryanskiy/posts/blob/master/delegation%20in%20generic%20contexts.md)

Generic parameters inheritance was implemented in all contexts. Generic arguments are not yet supported.

r? `@petrochenkov`
2024-09-07 18:12:05 +00:00
Bryanskiy
588dce1421 Delegation: support generics in associated delegation items 2024-09-05 16:04:50 +03:00
Bryanskiy
59885f5065 Delegation refactoring: add builders for generics inheritance 2024-09-03 15:38:39 +03:00
Trevor Gross
dfe7d5c31e Rollup merge of #128524 - chenyukang:yukang-fix-127930-invalid-outer-style-sugg, r=cjgillot
Don't suggest turning crate-level attributes into outer style

Fixes #127930
2024-08-24 21:03:31 -05:00
Boxy
ed6315b3fe Rewrite get_fn_id_for_return_block 2024-08-16 20:53:13 +01:00
Esteban Küber
860c8cdeaf Differentiate between methods and associated functions
Accurately refer to assoc fn without receiver as assoc fn instead of methods.
Add `AssocItem::descr` method to centralize where we call methods and associated functions.
2024-08-10 00:54:16 +00:00
yukang
22aa104bce don't suggest turning crate-level attributes into outer style 2024-08-04 00:11:16 +08:00
Bryanskiy
f2f9aab380 Delegation: support generics for delegation from free functions 2024-07-29 20:04:55 +03:00
Bryanskiy
7ee97f93da Delegation: support coercion for target expression 2024-07-16 18:03:15 +03: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
Bryanskiy
d30d85fd9e Delegation: ast lowering refactor 2024-06-25 16:44:51 +03:00
Vadim Petrochenkov
0a265957dd delegation: Do not crash on qpaths without a trait 2024-06-22 19:57:19 +03:00
许杰友 Jieyou Xu (Joe)
f8ce1cfbf5 Rollup merge of #124135 - petrochenkov:deleglob, r=fmease
delegation: Implement glob delegation

Support delegating to all trait methods in one go.
Overriding globs with explicit definitions is also supported.

The implementation is generally based on the design from https://github.com/rust-lang/rfcs/pull/3530#issuecomment-2020869823, but unlike with list delegation in https://github.com/rust-lang/rust/pull/123413 we cannot expand glob delegation eagerly.
We have to enqueue it into the queue of unexpanded macros (most other macros are processed this way too), and then a glob delegation waits in that queue until its trait path is resolved, and enough code expands to generate the identifier list produced from the glob.

Glob delegation is only allowed in impls, and can only point to traits.
Supporting it in other places gives very little practical benefit, but significantly raises the implementation complexity.

Part of https://github.com/rust-lang/rust/issues/118212.
2024-06-19 01:51:36 +01:00
Matthias Krüger
4265043aae Rollup merge of #126497 - petrochenkov:delehyg, r=compiler-errors
delegation: Fix hygiene for `self`

And fix diagnostics for `self` from a macro.

The missing rib caused `self` to be treated as a generic parameter and ignore `macro_rules` hygiene.

Addresses this comment https://github.com/rust-lang/rust/pull/124135#discussion_r1637492234.
2024-06-15 10:56:43 +02:00
Vadim Petrochenkov
cbc3bdbe01 delegation: Fix hygiene for self
And fix diagnostics for `self` from a macro.
2024-06-15 00:45:05 +03:00
Vadim Petrochenkov
22d0b1ee18 delegation: Implement glob delegation 2024-06-14 19:27:51 +03:00
Michael Goulet
fdd90db528 Point out exactly what obligation will fail 2024-06-13 21:47:43 -04:00
Waffle Lapkin
268b556393 Bless a test 2024-06-13 12:24:31 +02:00
许杰友 Jieyou Xu (Joe)
279d2b73f1 Rollup merge of #126236 - Bryanskiy:delegation-no-entry-ice-2, r=petrochenkov
Delegation: fix ICE on recursive delegation

fixes https://github.com/rust-lang/rust/issues/124347

r? `@petrochenkov`
2024-06-11 14:16:46 +01:00
Bryanskiy
6f78e6265a Delegation: fix ICE on recursive delegation 2024-06-10 21:27:25 +03:00
Bryanskiy
040791a9c5 Delegation: fix ICE on late diagnostics 2024-06-10 19:25:34 +03:00
Vadim Petrochenkov
c30b41012d delegation: Implement list delegation
```rust
reuse prefix::{a, b, c}
```
2024-05-15 02:32:59 +03: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
Vadim Petrochenkov
99b635eafa delegation: Support renaming 2024-04-23 22:38:16 +03:00
Bryanskiy
0cd9708de6 Delegation: fix ICE on wrong instantiation 2024-03-27 15:51:48 +03:00
Matthias Krüger
4d1fb9e98a Rollup merge of #123091 - Bryanskiy:delegation-fixes, r=petrochenkov
Delegation: fix ICE on wrong `self` resolution

fixes https://github.com/rust-lang/rust/issues/122874

Delegation item should be wrapped in a `rib` to behave like a regular function during name resolution.

r? `@petrochenkov`
2024-03-26 17:06:43 +01:00
Bryanskiy
17c6101864 Delegation: fix ICE on wrong self resolution 2024-03-26 14:00:51 +03:00
Bryanskiy
d1ba632f4f Delegation: fix ICE on bound_vars divergence 2024-03-22 17:24:41 +03:00
Bryanskiy
b2ed9d0911 Delegation: fix ICE on duplicated associative items 2024-03-16 21:03:36 +03:00
Oli Scherer
ae50e36dfa Merge collect_mod_item_types query into check_well_formed 2024-03-07 14:26:31 +00:00
Oli Scherer
ebf1b92417 Use the same collection order as check_mod_type_wf 2024-03-07 13:37:06 +00:00
许杰友 Jieyou Xu (Joe)
ec2cc761bc [AUTO-GENERATED] Migrate ui tests from // to //@ directives 2024-02-16 20:02:50 +00:00
r0cky
c7519d42c2 Update tests 2024-02-07 10:42:01 +08:00
Bryanskiy
d69cd6473c Delegation implementation: step 1 2024-01-12 14:11:16 +03:00