Commit Graph

236 Commits

Author SHA1 Message Date
Nathan Stocks
0d65819d52 respond to review feedback: mainly eliminate as many conversions as possible...
- ... when creating diagnostics in rustc_metadata
-  use the error_code! macro
- pass macro output to diag.code()
- use fluent from within manual implementation of SessionDiagnostic
- emit the untested errors in case they occur in the wild
- stop panicking in the probably-not-dead code, add fixme to write test
2022-08-31 10:56:42 -06:00
Nathan Stocks
d0ba1fbaa4 port of locator.rs to SessionDiagnostics, fix some of the errors
revealed by tests, manually add a panic to test for dead code
2022-08-31 10:56:42 -06:00
Nathan Stocks
bd8e312d73 port fs.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks
32e1823b22 port creader.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks
f7e462a6c7 port encoder.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks
3ed93107ff port native_libs.rs to SessionDiagnostics 2022-08-31 10:56:42 -06:00
Nathan Stocks
54645e880f set up rustc_metadata for SessionDiagnostics, port dependency_format.rs 2022-08-31 10:56:38 -06:00
Ralf Jung
59d2c1917a
Rollup merge of #100831 - JhonnyBillM:migrate-symbol-mangling-to-diagnostics-structs, r=davidtwco
Migrate `symbol_mangling` module to new diagnostics structs
2022-08-31 14:29:53 +02:00
Ralf Jung
24922b7a82
Rollup merge of #100753 - LuisCardosoOliveira:translation-migrate-session, r=davidtwco
translations(rustc_session): migrates `rustc_session` to use `SessionDiagnostic` - Pt. 1

## Description

This is the first PR for the migration of the module `rustc_session`. You can follow my progress [here](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883).

The PR migrates the files `cgu_reuse_tracker` and `parse.rs` to use `SessionDiagnostic `.
2022-08-31 14:29:52 +02:00
Ralf Jung
6c4bda6de4
Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwco
Migrate rustc_monomorphize to use SessionDiagnostic

### Description

- Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic`
- Adds an `impl IntoDiagnosticArg for PathBuf`

### TODO / Help!
- [x] I'm having trouble figuring out how to apply an optional note. 😕  Help!?
  - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files
- [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment.
  - Maybe I can switch after this is merged in? --> https://github.com/rust-lang/rust/pull/100694
  - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it?
- [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](8064a49508/compiler/rustc_monomorphize/src/collector.rs (L917-L927))?
- [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](0b79f758c9/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs (L83-L114)) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.
2022-08-31 14:29:51 +02:00
Matthias Krüger
78e5d05ea0
Rollup merge of #101049 - JeanCASPAR:remove-span_fatal-from-ast_lowering, r=davidtwco
Remove span fatal from ast lowering

Now the crate `rustc_ast_lowering` is fully migrated to `SessionDiagnostic`.

r? ``@davidtwco``
2022-08-31 07:57:59 +02:00
Jhonny Bill Mena
8f5fada86d ADD - migrate InvalidDefPath to new diagnostics infra 2022-08-30 14:27:42 -04:00
Jhonny Bill Mena
359002bbeb ADD - migrate InvalidTraitItem and AltInvalidTraitItem errors
Thought of doing this by having a struct and an enum with Default and Alt cases, but not sure if we wanted to have the text in code instead of having “demangling()” and “demangling-alt()” in the ftl file.

Don’t like the current way of having structs representing the same-ish and using long names to distinguish their expectations, instead of putting this in an enum and handling the different cases inside the type.

I am fine with whichever option the team prefers; also understand having them as separate structs keeps it simple.
2022-08-30 14:27:42 -04:00
Jhonny Bill Mena
86f8c4e8e3 ADD - InvalidSymbolName to migrate symbol-name({}) error to new diagnostics infraestructure
ADD - dependencies needed to port a module to new Diagnostics infra (rustc_macros, rustc_errors, errors file, and fluent file)
2022-08-30 14:27:42 -04:00
Nilstrieb
01acfef1a4 Migrate stable let_chains error to session diagnostics 2022-08-29 19:49:30 +02:00
Nilstrieb
d1ef8180f9 Revert let_chains stabilization
This reverts commit 3266460749.

This is the revert against master, the beta revert was already done in #100538.
2022-08-29 19:34:11 +02:00
Matthias Krüger
a3c965f5fe
Rollup merge of #100843 - IntQuant:issue-100717-infer, r=compiler-errors
Migrate part of rustc_infer to session diagnostic
2022-08-29 06:34:45 +02:00
Jean CASPAR
e89d4fcc7d remove span_fatal from ast_lowering 2022-08-27 09:15:55 +02:00
Michael Goulet
96ceadde76
Rollup merge of #100900 - AndyJado:diag-migrate, r=davidtwco
on `region_errors.rs`

`@rustbot` label +A-translation
2022-08-26 15:56:30 -07:00
Michael Goulet
e7d870b188
Rollup merge of #100890 - adriantombu:migrate_diagnostic_rustc_driver, r=davidtwco
Migrate rustc_driver to SessionDiagnostic

First timer noob here 👋🏽 I'm having a problem understanding how I can retrieve the span, and how to properly construct the error structs to avoid the current compilation errors.

Any help pointing me in the right direction would be much appreciated 🙌🏽
2022-08-26 15:56:29 -07:00
Michael Goulet
d97e616e21
Rollup merge of #100836 - hampuslidin:migrate-attr-crate-diagnostics, r=davidtwco
Migrate `rustc_attr` crate diagnostics

Hi!

This is my first PR to the rustc project, excited to be part of the development! This PR is part of the diagnostics effort, to make diagnostics translatable.

`@rustbot` label +A-translation
2022-08-26 15:56:28 -07:00
Michael Goulet
389dda149c
Rollup merge of #100776 - Rejyr:diagnostic-migration-rustc-lint, r=davidtwco
Migrate `rustc_lint` errors to `SessionDiagnostic`

Draft PR for migrating `rustc_lint` to `SessionDiagnostic`, as part of the [recent blog post](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html)
2022-08-26 15:56:25 -07:00
Michael Goulet
93b2acd88a
Rollup merge of #100744 - 5225225:migrate-rustc-mir-dataflow, r=davidtwco
Migrate rustc_mir_dataflow to diagnostic structs
2022-08-26 15:56:24 -07:00
Michael Goulet
b54344401a
Rollup merge of #100738 - nidnogg:diagnostics_migr_const_eval, r=davidtwco
Diagnostics migr const eval

This PR should eventually contain all diagnostic migrations for the `rustc_const_eval` crate.

r? `@davidtwco`
`@rustbot` label +A-translation
2022-08-26 15:56:23 -07:00
Michael Goulet
181b0410ec
Rollup merge of #100735 - Facel3ss1:ty-utils-translation, r=davidtwco
Migrate `rustc_ty_utils` to `SessionDiagnostic`

I have migrated the `rustc_ty_utils` crate to use `SessionDiagnostic`, motivated by the [recent blog post about the diagnostic translation effort](https://blog.rust-lang.org/inside-rust/2022/08/16/diagnostic-effort.html).

This is my first PR to the Rust repository, so if I have missed anything, or anything needs to be changed, please let me know! 😄

`@rustbot` label +A-translation
2022-08-26 15:56:22 -07:00
Michael Goulet
bc1d205e4c
Rollup merge of #100724 - JeanCASPAR:migrate-ast_lowering-to-session-diagnostic, r=davidtwco
Migrate ast lowering to session diagnostic

I migrated the whole rustc_ast_lowering crate to session diagnostic *except* the for the use of `span_fatal` at /compiler/rustc_ast_lowering/src/expr.rs#L1268 because `#[fatal(...)]` is not yet supported (see https://github.com/rust-lang/rust/pull/100694).
2022-08-26 15:56:21 -07:00
Luis Cardoso
2c77f3e9c5 translations(rustc_session): migrate check_expected_reuse
This commit migrates the errors in the function check_expected_reuse
to use the new SessionDiagnostic. It also does some small refactor
for the IncorrectCguReuseType to include the 'at least' word in the
fluent translation file
2022-08-26 16:10:11 +02:00
Luis Cardoso
d5262a9452 translations(rustc_session): migrate 80% of the file parse.rs
This commit migrates around 80% of the parse file to use SsessionDiagnostic
We still have to migrate struct_err and struct_warn.
2022-08-26 16:10:11 +02:00
Luis Cardoso
706452eba7 translations(rustc_session): migrate the file cgu_reuse_tracker
This commit migrates the errors that indicates an incorrect
CGU type and the fatal error that indicates that a CGU has
not been correctly recorded
2022-08-26 16:10:11 +02:00
Peter Medus
01c1616b25 Migrate rustc_ty_utils to use SessionDiagnostic 2022-08-26 14:36:51 +01:00
AndyJado
622217da59 diag-mig 2022-08-26 10:32:59 +08:00
Nathan Stocks
30c7506655 allow non-monomorphize modules to access hard-coded error message through new struct, use fluent message in monomorphize 2022-08-25 11:06:45 -06:00
Nathan Stocks
40f44736e8 replace some usages of [Span]FatalError with error-specific types 2022-08-25 11:06:45 -06:00
Nathan Stocks
137f20c112 rebased: convert rustc_monomorphize errors to SessionDiagnostic 2022-08-25 11:06:32 -06:00
Adrian Tombu
bf7ce6a1a6
Replace spaghetti with a simple errors enum 2022-08-25 18:06:12 +02:00
Adrian Tombu
3f883b850d
Start adding enum errors for deserialize_rlink 2022-08-25 18:06:12 +02:00
Adrian Tombu
1c575c5fe0
Use std::io::Error and remove useless to_string 2022-08-25 18:06:12 +02:00
Adrian Tombu
dbe39d835e
Start moving rustc_driver to SessionDiagnostic 2022-08-25 18:06:11 +02:00
Yuki Okushi
0fd4a74139
Rollup merge of #100808 - SkiFire13:migrate_diagnostics_rustc_interface, r=davidtwco
Migrate `rustc_interface` diagnostics

``@rustbot`` label +A-translation

r? rust-lang/diagnostics
cc #100717
2022-08-25 08:50:58 +09:00
Yuki Okushi
2e4760c7e7
Rollup merge of #100780 - wonchulee:translation_save_analysis, r=davidtwco
save_analysis: Migrate diagnostic

* Migrate the `rustc_save_analysis` crate's diagnostic to translatable diagnostic structs.

Depends on https://github.com/rust-lang/rust/pull/100694 and https://github.com/rust-lang/rust/pull/100754 for #[fatal(..)] support, then aa68eb4179, f5219a3960, 7da52f694a can be removed. (I copied commits from https://github.com/rust-lang/rust/pull/100754)
2022-08-25 08:50:57 +09:00
Nikita Tomashevich
3fae3904b1
Use IntoDiagnosticArg where it makes sense 2022-08-24 15:46:29 +03:00
bors
87991d5f5d Auto merge of #100675 - Xiretza:fluent-mandate-crate-prefix, r=davidtwco
fluent: mandate slug names to be prefixed by crate name

This is currently only convention, but not actively checked for.

Additionally, improve error messages to highlight the path of the offending fluent file rather than the identifier preceding it.

This will conflict with #100671, so I'll leave it as draft until that's merged.
2022-08-23 22:30:07 +00:00
Wonchul Lee
9b95eef6ea
save_analysis: Migrate diagnostics 2022-08-24 06:50:16 +09:00
Dylan DPC
35f2d125ca
Rollup merge of #100768 - Facel3ss1:plugin-impl-translation, r=davidtwco
Migrate `rustc_plugin_impl` to `SessionDiagnostic`

Migration of the `rustc_plugin_impl` crate.
~Draft PR because it is blocked on #100694 for `#[fatal(...)]` support~ (this has been merged, and I've changed over to `#[diag(...)]` now too), but I would also like to know if what I did with `LoadPluginError` is okay, because all it does is display the error message from `libloading` ([See conversation on zulip](https://rust-lang.zulipchat.com/#narrow/stream/147480-t-compiler.2Fwg-diagnostics/topic/.23100717.20diagnostic.20translation/near/294327843)). This crate is apparently for a deprecated feature which is used by servo, so I don't know how much this matters anyway.
2022-08-23 20:40:04 +05:30
5225225
f20cc9ae4e Rename rustc_mir_dataflow diagnostic to mir_dataflow 2022-08-23 13:48:15 +01:00
Nikita Tomashevich
74f9973824
Fix formating in infer.ftl to make tidy happy 2022-08-23 15:33:06 +03:00
5225225
7f125ed7d5 Remove full stop in diagnostic message 2022-08-23 13:18:45 +01:00
Nikita Tomashevich
f50d1713fd
Migrate note_region_origin function 2022-08-23 14:47:08 +03:00
Nikita Tomashevich
313d474b35
Migrate OpaqueHiddenType, E0282, E0283, E0284, E0698 2022-08-23 14:47:07 +03:00
5225225
ee2b16100e Migrate rustc_mir_dataflow to diagnostic structs 2022-08-23 11:24:51 +01:00