Josh Triplett
ba231db3f3
Detect and report macro kind mismatches early, and more precisely
...
This eliminates the case in `failed_to_match_macro` to check for a
function-like invocation of a macro with no function-like rules.
Instead, macro kind mismatches now result in an unresolved macro, and we
detect this case in `unresolved_macro_suggestions`, which now carefully
distinguishes between a kind mismatch and other errors.
This also handles cases of forward-referenced attributes and cyclic
attributes.
Expand test coverage to include all of these cases.
2025-08-12 09:24:45 -07:00
Josh Triplett
f0a5e70507
mbe: Fix error message for using a macro with no attr
rules as an attribute
...
Avoid saying "a declarative macro cannot be used as an attribute macro";
instead, say that the macro has no `attr` rules.
2025-08-08 11:01:12 -07:00
Jonathan Brouwer
a460b46d0f
Ports #[macro_use]
and #[macro_escape]
to the new attribute parsing infrastructure
2025-07-23 13:33:23 +02:00
xizheyin
e7c3703c53
Suggest use another lifetime specifier instead of underscore lifetime
...
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-07-01 19:58:27 +08:00
Martin Nordholts
4882ea4b3c
rustc_resolve: Improve resolve_const_param_in_non_trivial_anon_const
wording
...
In some contexts, const expressions are OK. Add a `here` to the error
message to clarify this.
2025-06-07 13:01:16 +02:00
Vadim Petrochenkov
3eee3dad5c
resolve: Support imports of associated types and glob imports from traits
2025-05-02 15:59:38 +03:00
Mara Bos
6c865c1e14
Allow builtin macros to be used more than once.
...
This removes E0773 "A builtin-macro was defined more than once."
2025-03-19 14:12:47 +01:00
Michael Goulet
42773bfcac
Disentangle ForwardGenericParamBan and ConstParamTy ribs
2025-03-12 16:56:26 +00:00
Boxy
df5b279ca9
Introduce feature(generic_const_parameter_types)
2025-02-28 20:43:15 +00:00
clubby789
4627db2a10
Diagnostic for using macro_rules macro as attr/derive
2024-11-22 16:49:10 +00:00
Alexander Cyon
00de006f22
chore: Fix typos in 'compiler' (batch 2)
2024-09-02 07:50:22 +02:00
Esteban Küber
cf09cba20c
When finding item gated behind a cfg
flat, point at it
...
Previously we would only mention that the item was gated out, and opportunisitically mention the feature flag name when possible. We now point to the place where the item was gated, which can be behind layers of macro indirection, or in different modules.
```
error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
--> $DIR/diagnostics-cross-crate.rs:18:23
|
LL | cfged_out::inner::doesnt_exist::hello();
| ^^^^^^^^^^^^ could not find `doesnt_exist` in `inner`
|
note: found an item that was configured out
--> $DIR/auxiliary/cfged_out.rs:6:13
|
LL | pub mod doesnt_exist {
| ^^^^^^^^^^^^
note: the item is gated here
--> $DIR/auxiliary/cfged_out.rs:5:5
|
LL | #[cfg(FALSE)]
| ^^^^^^^^^^^^^
```
2024-07-12 18:52:52 +00:00
Michael Goulet
ffd72b1700
Fix remaining cases
2024-06-21 19:00:18 -04:00
Michael Baikov
b70fb4159b
And more general error
2024-05-24 11:20:33 -04:00
Michael Baikov
d6e4fe569c
A custom error message for lending iterators
2024-05-24 07:23:30 -04:00
Jean CASPAR
992c505021
Reorder error messages
2024-04-13 15:11:09 +01:00
Jean CASPAR
cec9f7f716
Migrate more diagnostics
2024-04-13 14:50:25 +01:00
Jean CASPAR
4226dc2045
Migrate some diagnostics
2024-04-13 14:50:25 +01:00
JeanCASPAR
e4f4e58dc3
Port build_reduce_graph
2024-04-13 14:50:25 +01:00
Matthias Krüger
c620ae5be9
Rollup merge of #121130 - chenyukang:yukang-fix-121061-macro-later, r=matthiaskrgr
...
Suggest moving definition if non-found macro_rules! is defined later
Fixes #121061
2024-03-04 07:57:56 +01:00
r0cky
2064c19886
Remove unused fluent messages
2024-03-01 09:59:44 +08:00
yukang
97feb71254
Suggest moving if non-found macro_rules! is defined later
2024-02-29 19:01:45 +08:00
Matthias Krüger
3c52832375
Rollup merge of #119939 - clubby789:static-const-generic-note, r=compiler-errors
...
Improve 'generic param from outer item' error for `Self` and inside `static`/`const` items
Fixes #109596
Fixes #119936
2024-02-06 22:45:39 +01:00
León Orell Valerian Liehr
285d8c225d
Suggest [tail @ ..]
on [..tail]
and [...tail]
where tail
is unresolved
2024-02-04 22:16:21 +01:00
León Orell Valerian Liehr
5906237b32
Suggest changing ty to const params if appropriate
2024-02-02 03:25:04 +01:00
clubby789
2cfc81766c
Special case 'generic param from outer item' message for Self
2024-01-14 12:31:34 +00:00
clubby789
511bf6e1c7
Add note to resolve error about generics from inside static/const
2024-01-14 12:31:28 +00:00
Nadrieril
560beb1ad4
Check bindings around never patterns
2024-01-09 17:00:24 +01:00
bohan
0f14e8ea74
tip for define macro name after macro_rules!
2023-12-06 23:19:39 +08:00
bors
64d7e0d0b6
Auto merge of #115993 - bvanjoi:fix-115966, r=petrochenkov
...
vis note for no pub reexports glob import
Fixes #115966
Only trigger the `unused_import` lint when it's not being used.
r? `@petrochenkov`
2023-12-01 15:46:04 +00:00
bohan
d0941f92d7
vis note for no pub reexports glob import
2023-12-01 12:10:07 +08:00
Ralf Jung
1dbfe17f12
generic_const_exprs: suggest to add the feature, not use it
2023-11-30 20:59:51 +01:00
yukang
42a033affa
Cleanup unused messages in ftl files
2023-09-20 19:09:01 +08:00
Matthias Krüger
8b49731211
Rollup merge of #115744 - fmease:fix-e0401, r=compiler-errors
...
Improve diagnostic for generic params from outer items (E0401)
Generalize the wording of E0401 to talk about *outer items* instead of *outer functions* since the current phrasing is outdated. The outer item can be a function, constant, trait, ADT or impl block (see the new UI test for the more exotic examples).
Further, don't suggest introducing generic parameters to constant items unless the feature `generic_const_items` is enabled.
Lastly, make E0401 translatable while we're at it.
Fixes #115720 .
2023-09-11 17:03:32 +02:00
León Orell Valerian Liehr
9b36252477
Make E0401 translatable
2023-09-10 23:07:24 +02:00
bohan
7bad066f82
resolve: derive diag for undetermined macro resolution
2023-09-04 09:29:26 +08:00
Tom Martin
b7d6032082
Add translatable diagnostic for import resolution strings
...
Add translatable diagnostic for cannot be reexported error
also added for subdiagnostics
Add translatable diagnostics for resolve_glob_import errors
Add translatable diag for unable to determine import resolution
Add translatable diag for is not directly importable
2023-06-25 08:29:28 +01:00
Tom Martin
2027e989bc
Remove unreachable and untested suggestion for invalid span enum derive(Default)
2023-06-19 16:22:21 +01:00
Tom Martin
c07b50a213
Fix tidy
2023-06-18 14:16:37 +01:00
Tom Martin
4b5a5a4529
Add translatable diagnostic for various strings in resolve::unresolved_macro_suggestions
2023-06-18 12:32:40 +01:00
Tom Martin
355a689542
Add translatable diagnostic for cannot find in this scope
2023-06-18 12:28:17 +01:00
Tom Martin
50c971a0b7
Add translatable diagnostic for invalid imports
2023-06-18 12:28:17 +01:00
Tom Martin
8fa9003621
Add translatable diagnostic for changing import binding
2023-06-18 12:28:16 +01:00
clubby789
f97fddab91
Ensure Fluent messages are in alphabetical order
2023-05-25 23:49:35 +00:00
clubby789
3851a4bb91
Improve error for self: Box<self>
2023-05-11 13:21:10 +01:00
Boxy
73b3ce26ec
improve diagnostics and bless tests
2023-05-05 21:42:54 +01:00
clubby789
0138513635
Fix static string lints
2023-04-25 18:59:55 +01:00
Matthias Krüger
0f271619e4
Rollup merge of #110255 - clubby789:proc-macro-test-help, r=jackh726
...
Suggest using integration tests for test crate using own proc-macro
cc #110247
2023-04-24 07:53:23 +02:00
clubby789
f7581d8d21
Suggest using integration tests for proc-macros
2023-04-17 13:01:03 +01:00
Matthias Krüger
331e7c3659
Rollup merge of #110153 - DaniPopes:compiler-typos, r=Nilstrieb
...
Fix typos in compiler
I ran [`typos -w compiler`](https://github.com/crate-ci/typos ) to fix typos in the `compiler` directory.
Refs #110150
2023-04-12 20:56:21 +02:00