Commit Graph

44 Commits

Author SHA1 Message Date
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
bors
194a0bb5d6 Auto merge of #109638 - NotStirred:suggest/non-derive, r=davidtwco
Add suggestion to remove `derive()` if invoked macro is non-derive

Adds to the existing `expected derive macro, found {}` error message:
```
help: remove the surrounding "derive()":
  --> $DIR/macro-path-prelude-fail-4.rs:1:3
   |
LL | #[derive(inline)]
   |   ^^^^^^^      ^
```

This suggestion will either fix the issue, in the case that the macro was valid, or provide a better error message if not

Not ready for merge yet, as the highlighted span is only valid for trivial formatting. Is there a nice way to get the parent span of the macro path within `smart_resolve_macro_path`?

Closes #109589
2023-04-10 21:50:46 +00:00
DaniPopes
677357d32b
Fix typos in compiler 2023-04-10 22:02:52 +02:00
Tom Martin
18388c9f73
Rewrite added diagnostics as translatable
Start messages with lowercase
2023-04-07 08:33:56 +01:00
clubby789
ebde2ab363 Deny useing tool paths 2023-04-04 14:10:13 +01:00
est31
7e2ecb3cd8 Simplify message paths
This makes it easier to open the messages file while developing on features.

The commit was the result of automatted changes:

for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done

for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11 22:51:57 +01:00