Commit Graph

634 Commits

Author SHA1 Message Date
Nilstrieb
cedaaa640e
Don't ICE on operator trait methods with generic methods
Emit a fatal error instead.
2022-11-09 22:01:58 +01:00
SLASHLogin
a8a8055cc7 Use LayoutError's implementation of IntoDiagnostic 2022-11-09 14:56:21 +01:00
SLASHLogin
9a1545861e Simplify existing Diagnostic implementations 2022-11-09 14:56:21 +01:00
SLASHLogin
3728e95596 Port diagnostics created by Handler 2022-11-09 14:56:21 +01:00
SLASHLogin
e9a5329a6f Correct tests to match errors 2022-11-09 14:56:21 +01:00
SLASHLogin
1c7a801bbc Fix CI
Add missing 'the' to the error en-US translation
2022-11-09 14:56:21 +01:00
SLASHLogin
185ef7b6de Port MissingFeatures and TargetFeatureDisableOrEnable 2022-11-09 14:56:21 +01:00
SLASHLogin
33ef16f291 Port UnknownArchiveKind 2022-11-09 14:56:21 +01:00
SLASHLogin
c01546fcd6 Port DlltoolFailImportLibrary and implement IntoDiagnosticArg for Cow<'a, str> 2022-11-09 14:56:21 +01:00
SLASHLogin
81f7a8d7f1 Port ErrorCallingDllTool 2022-11-09 14:56:21 +01:00
SLASHLogin
ddbb650289 Import ErrorWritingDEFFile 2022-11-09 14:56:21 +01:00
SLASHLogin
d32caf9ced Port ArchiveBuildFailure 2022-11-09 14:56:21 +01:00
SLASHLogin
978b5f73e4 Port SanitizerMemtagRequiresMte 2022-11-09 14:56:21 +01:00
SLASHLogin
60ee496c74 Port LinkageConstOrMutType error 2022-11-09 14:56:20 +01:00
SLASHLogin
5d79d3c4bb Port InvalidMinimumAlignment 2022-11-09 14:56:20 +01:00
SLASHLogin
39d363fd58 Port layout size overflow 2022-11-09 14:56:20 +01:00
SLASHLogin
f031823ecd Formatting 2022-11-09 14:56:20 +01:00
SLASHLogin
59b8aedf0e Port branch protection on aarch64 2022-11-09 14:56:20 +01:00
SLASHLogin
9f0c16576b Port symbol_already_defined error 2022-11-09 14:56:20 +01:00
SLASHLogin
4c625dc682 Port Instrument coverage requires llvm 12 to the new struct 2022-11-09 14:56:20 +01:00
SLASHLogin
05ae7ecb74 Import error creating import library 2022-11-09 14:56:20 +01:00
SLASHLogin
21b04265c1 Trailing whitespaces 2022-11-09 14:56:20 +01:00
SLASHLogin
1c4bd835ec locales formatting 2022-11-09 14:56:20 +01:00
SLASHLogin
575f6098da Port unknown feature diagnostic to the new framework 2022-11-09 14:56:20 +01:00
AndyJado
057d8e5c43 struct error E0505 2022-11-09 21:15:31 +08:00
AndyJado
abf259cc54 var_subdiag refinement
trim old
2022-11-09 21:15:29 +08:00
AndyJado
a0cee0ab90 remove old var_span_path_only
doc comment
2022-11-09 20:51:43 +08:00
Manish Goregaokar
7dfe1e1664
Rollup merge of #103559 - AndyJado:var_span_label, r=davidtwco
first move on a nested span_label

trying not to be smart this time.
2022-11-08 21:03:53 -05:00
yukang
9e7d2287cd use subdiagnostic for sugesting add let 2022-11-08 16:25:37 +08:00
yukang
667b15bb0e fix #103587, Recover from common if let syntax mistakes/typos 2022-11-08 14:10:04 +08:00
Matthias Krüger
58f5d57b5d
Rollup merge of #103012 - chenyukang:fix-102806, r=davidtwco,compiler-errors
Suggest use .. to fill in the rest of the fields of Struct

Fixes #102806
2022-11-06 08:35:26 +01:00
AndyJado
e49d10db14 first move on a nested span_label
Apply suggestions from code review

Co-authored-by: David Wood <agile.lion3441@fuligin.ink>
2022-11-05 19:43:48 +08:00
clubby789
2f882c014f Specify that break cannot be used outside of loop *or* labeled block 2022-11-05 01:12:58 +00:00
Matthias Krüger
1cb8684dde
Rollup merge of #103792 - JhonnyBillM:migrate-codegen-ssa-to-diagnostics-structs-pt2, r=davidtwco
Migrate `codegen_ssa` to diagnostics structs - [Part 2]

Completes migrating `link.rs` in `codegen_ssa` module.

_Part 1 - https://github.com/rust-lang/rust/pull/102612_

r? `@davidtwco`
2022-11-04 18:52:27 +01:00
Matthias Krüger
612bb7890c
Rollup merge of #103397 - crlf0710:port_dead_code_lint, r=davidtwco
Port `dead_code` lints to be translatable.

This adds an additional comma to lists with three or more items, to be consistent with list formatters like `icu4x`.

r? `@davidtwco`
2022-11-04 18:52:26 +01:00
Jhonny Bill Mena
2678765d08 FIX - Migrate missing errors in link.rs 2022-11-04 01:17:02 -04:00
Jhonny Bill Mena
1f4c5a624f ADD - ExtractBundledLibsError. Migrated extract_bundled_libs to translatable diagnostics 2022-11-04 01:17:02 -04:00
Jhonny Bill Mena
4c80f50fc6 UPDATE - Complete link.rs migration to new diagnostics infraestructure 2022-11-04 01:17:02 -04:00
yukang
1e25882944 fix #102806, suggest use .. to fill in the rest of the fields of Struct 2022-11-04 10:35:36 +08:00
Charles Lew
a777c46dff Use derive(Subdiagnostic) for ChangeFieldsToBeOfUnitType. 2022-11-04 03:02:09 +08:00
Amanieu d'Antras
f5e0b760d0 Stabilize default_alloc_error_handler
Closes #66741
2022-11-03 07:12:58 +00:00
Dylan DPC
43634675f6
Rollup merge of #103061 - Amanieu:rewrite_alloc_error_handler, r=bjorn3
Rewrite implementation of `#[alloc_error_handler]`

The new implementation doesn't use weak lang items and instead changes `#[alloc_error_handler]` to an attribute macro just like `#[global_allocator]`.

The attribute will generate the `__rg_oom` function which is called by the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom` function is defined in any crate then the compiler shim will call `__rdl_oom` in the alloc crate which will simply panic.

This also fixes link errors with `-C link-dead-code` with `default_alloc_error_handler`: `__rg_oom` was previously defined in the alloc crate and would attempt to reference the `oom` lang item, even if it didn't exist. This worked as long as `__rg_oom` was excluded from linking since it was not called.

This is a prerequisite for the stabilization of `default_alloc_error_handler` (#102318).
2022-11-01 14:12:25 +05:30
Yuki Okushi
5bf9d617cb
Rollup merge of #103772 - compiler-errors:better-strict-coherence-err, r=davidtwco
better error for `rustc_strict_coherence` misuse

Fixes #103753
2022-11-01 12:03:42 +09:00
Amanieu d'Antras
56074b5231 Rewrite implementation of #[alloc_error_handler]
The new implementation doesn't use weak lang items and instead changes
`#[alloc_error_handler]` to an attribute macro just like
`#[global_allocator]`.

The attribute will generate the `__rg_oom` function which is called by
the compiler-generated `__rust_alloc_error_handler`. If no `__rg_oom`
function is defined in any crate then the compiler shim will call
`__rdl_oom` in the alloc crate which will simply panic.

This also fixes link errors with `-C link-dead-code` with
`default_alloc_error_handler`: `__rg_oom` was previously defined in the
alloc crate and would attempt to reference the `oom` lang item, even if
it didn't exist. This worked as long as `__rg_oom` was excluded from
linking since it was not called.

This is a prerequisite for the stabilization of
`default_alloc_error_handler` (#102318).
2022-10-31 16:32:57 +00:00
Michael Goulet
953727f574 better error for rustc_strict_coherence misuse 2022-10-30 19:11:55 +00:00
Cameron Steffen
88d71504dd Use tcx.require_lang_item 2022-10-29 16:09:15 -05:00
Matthias Krüger
790a716420
Rollup merge of #103383 - compiler-errors:tait-scope, r=oli-obk
Note scope of TAIT more accurately

This maybe explains why the person was confused in #101897, since we say "same module" but really should've said "same impl".

r? ``@oli-obk``
2022-10-29 08:57:35 +02:00
Boxy
b3425587a6 tidy + move logic to fn 2022-10-27 22:29:16 +01:00
Boxy
ca5a6e43dd use proper spans 2022-10-27 22:18:26 +01:00
Boxy
c00ff9c4d0 DoIt 2022-10-27 21:48:47 +01:00
Oli Scherer
1c26a278f3 Split diagnostic details out into a separate function and fluent files 2022-10-25 18:28:04 +00:00
Charles Lew
113e8dfb72 Port dead_code lints to be translatable. 2022-10-24 17:02:31 +08:00
Jakub Beránek
c5c86806c8
Introduce dedicated -Zdylib-lto flag for enabling LTO on dylibs 2022-10-23 13:48:03 +02:00
Michael Goulet
4accf838f6 Note scope of TAIT more accurately 2022-10-22 03:09:49 +00:00
Dylan DPC
e11511dfa6
Rollup merge of #103051 - davidtwco:translation-tidying-up, r=compiler-errors
translation: doc comments with derives, subdiagnostic-less enum variants, more derive use

- Adds support for `doc` attributes in the diagnostic derives so that documentation comments don't result in the derive failing.
- Adds support for enum variants in the subdiagnostic derive to not actually correspond to an addition to a diagnostic.
- Made use of the derive in more places in the `rustc_ast_lowering`, `rustc_ast_passes`, `rustc_lint`, `rustc_session`, `rustc_infer` - taking advantage of recent additions like eager subdiagnostics, multispan suggestions, etc.

cc #100717
2022-10-21 17:29:58 +05:30
Matthias Krüger
66de34b035
Rollup merge of #102454 - chenyukang:fix-102396-missing-parentheses, r=lcnr
Suggest parentheses for possible range method calling

Fixes #102396
2022-10-17 17:15:49 +02:00
David Wood
913f597402 infer: use derive more
Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-17 09:54:24 +01:00
David Wood
f8b628bce4 session: use derive more
Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-17 09:54:24 +01:00
yukang
151001c1cb trivial fix for comments feedback 2022-10-17 08:32:08 +08:00
Guillaume Gomez
f528414e40 Add missing checks for doc(cfg_hide(...)) attribute 2022-10-14 11:29:54 +02:00
bors
1755c85302 Auto merge of #102684 - JhonnyBillM:delete-target-data-layout-errors-wrapper, r=davidtwco
Move `IntoDiagnostic` conformance for `TargetDataLayoutErrors` into `rustc_errors`

Addressed this suggestion https://github.com/rust-lang/rust/pull/101558#issuecomment-1243830009.

This way we comply with the Coherence rule given that `IntoDiagnostic` trait is defined in `rustc_errors`, and almost all other crates depend on it.
2022-10-14 04:35:22 +00:00
Wesley Wiser
097b6d3baf Add suggestion to the "missing native library" error
If we fail to locate a native library that we are linking with, it could
be the case the user entered a complete file name like `foo.lib` or
`libfoo.a` when we expect them to simply provide `foo`.

In this situation, we now detect that case and suggest the user only
provide the library name itself.
2022-10-13 07:35:36 -04:00
Jhonny Bill Mena
5645cd5b09 ADD - IntoDiagnostic conformance for TargetDataLayoutErrors in rustc_errors
This way we comply with the Coherence rule given that IntoDiagnostic trait is defined in rustc_errors, and almost all other crates depend on it.
2022-10-12 16:54:25 -04:00
Dylan DPC
40deecef03
Rollup merge of #102719 - Nilstrieb:tidy-alphabetical, r=jackh726
Enforce alphabetical sorting with tidy

We have many places where things are supposed to be sorted alphabetically. For the smaller and more recent size assertions, this is mostly upheld, but in other more... alive places it's very messy.

This introduces a new tidy directive to check that a section of code is sorted alphabetically and fixes all places where sorting has gone wrong.
2022-10-12 22:13:24 +05:30
Dylan DPC
dc9f6f3243
Rollup merge of #102623 - davidtwco:translation-eager, r=compiler-errors
translation: eager translation

Part of #100717. See [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20lists!/near/295010720) for additional context.

- **Store diagnostic arguments in a `HashMap`**: Eager translation will enable subdiagnostics to be translated multiple times with different arguments - this requires the ability to replace the value of one argument with a new value, which is better suited to a `HashMap` than the previous storage, a `Vec`.
- **Add `AddToDiagnostic::add_to_diagnostic_with`**: `AddToDiagnostic::add_to_diagnostic_with` is similar to the previous `AddToDiagnostic::add_to_diagnostic` but takes a function that can be used by the caller to modify diagnostic messages originating from the subdiagnostic (such as performing translation eagerly). `add_to_diagnostic` now just calls `add_to_diagnostic_with` with an empty closure.
- **Add `DiagnosticMessage::Eager`**: Add variant of `DiagnosticMessage` for eagerly translated messages
(messages in the target language which don't need translated by the emitter during emission). Also adds `eager_subdiagnostic` function which is intended to be invoked by the diagnostic derive for subdiagnostic fields which are marked as needing eager translation.
- **Support `#[subdiagnostic(eager)]`**: Add support for `eager` argument to the `subdiagnostic` attribute which generates a call to `eager_subdiagnostic`.
- **Finish migrating `rustc_query_system`**: Using eager translation, migrate the remaining repeated cycle stack diagnostic.
- **Split formatting initialization and use in diagnostic derives**: Diagnostic derives have previously had to take special care when ordering the generated code so that fields were not used after a move.

  This is unlikely for most fields because a field is either annotated with a subdiagnostic attribute and is thus likely a `Span` and copiable, or is a argument, in which case it is only used once by `set_arg`
anyway.

  However, format strings for code in suggestions can result in fields being used after being moved if not ordered carefully. As a result, the derive currently puts `set_arg` calls last (just before emission), such as:

      let diag = { /* create diagnostic */ };

      diag.span_suggestion_with_style(
          span,
          fluent::crate::slug,
          format!("{}", __binding_0),
          Applicability::Unknown,
          SuggestionStyle::ShowAlways
      );
      /* + other subdiagnostic additions */

      diag.set_arg("foo", __binding_0);
      /* + other `set_arg` calls */

      diag.emit();

  For eager translation, this doesn't work, as the message being translated eagerly can assume that all arguments are available - so arguments _must_ be set first.

  Format strings for suggestion code are now separated into two parts - an initialization line that performs the formatting into a variable, and a usage in the subdiagnostic addition.

  By separating these parts, the initialization can happen before arguments are set, preserving the desired order so that code compiles, while still enabling arguments to be set before subdiagnostics are added.

      let diag = { /* create diagnostic */ };

      let __code_0 = format!("{}", __binding_0);
      /* + other formatting */

      diag.set_arg("foo", __binding_0);
      /* + other `set_arg` calls */

      diag.span_suggestion_with_style(
          span,
          fluent::crate::slug,
          __code_0,
          Applicability::Unknown,
          SuggestionStyle::ShowAlways
      );
      /* + other subdiagnostic additions */

      diag.emit();

- **Remove field ordering logic in diagnostic derive:** Following the approach taken in earlier commits to separate formatting initialization from use in the subdiagnostic derive, simplify the diagnostic derive by removing the field-ordering logic that previously solved this problem.

r? ```@compiler-errors```
2022-10-12 22:13:23 +05:30
Nilstrieb
7bfef19844 Use tidy-alphabetical in the compiler 2022-10-12 17:49:10 +05:30
Dylan DPC
32471a7035
Rollup merge of #102110 - CleanCut:migrate_rustc_passes_diagnostics, r=davidtwco
Migrate rustc_passes diagnostics

Picks up abandoned work from https://github.com/rust-lang/rust/pull/100870

I would like to do this collaboratively, as there is a lot of work! Here's the process:

- Comment below that you are willing to help and I will add you as a collaborator to my `rust` fork (that gives you write access)
- Indicate which file/task you would like to work on (so we don't duplicate work) from the list below
- Do the work, push up a commit, comment that you're done with that file/task
- Repeat until done 😄

### Files to Migrate (in `compiler/rustc_passes/src/`)

- [x] check_attr.rs ``@CleanCut``
- [x] check_const.rs ``@CleanCut``
- [x] dead.rs ``@CleanCut``
- [x] debugger_visualizer.rs ``@CleanCut``
- [x] diagnostic_items.rs ``@CleanCut``
- [x] entry.rs ``@CleanCut``
- [x] lang_items.rs ``@CleanCut``
- [x] layout_test.rs ``@CleanCut``
- [x] lib_features.rs ``@CleanCut``
- [x] ~liveness.rs~ ``@CleanCut`` Nothing to do
- [x] loops.rs ``@CleanCut``
- [x] naked_functions.rs ``@CleanCut``
- [x] stability.rs ``@CleanCut``
- [x] weak_lang_items.rs ``@CleanCut``

### Tasks

- [x] Rebase on current `master` ``@CleanCut``
- [x] Review work from [the earlier PR](https://github.com/rust-lang/rust/pull/100870) and make sure it all looks good
  - [x] compiler/rustc_error_messages/locales/en-US/passes.ftl ``@CleanCut``
  - [x] compiler/rustc_passes/src/check_attr.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/errors.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/lang_items.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/lib.rs ``@CleanCut``
  - [x] compiler/rustc_passes/src/weak_lang_items.rs ``@CleanCut``
2022-10-12 11:11:23 +05:30
Matthias Krüger
a13c7da23e
Rollup merge of #102893 - TaKO8Ki:fix-102878, r=davidtwco
Fix ICE #102878

Fixes #102878
2022-10-11 18:59:50 +02:00
Takayuki Maeda
68260289b5 fix #102878 2022-10-11 02:43:36 +09:00
David Wood
113e94369c query_system: finish migration
Using eager translation, migrate the remaining repeated cycle stack
diagnostic.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
David Wood
540b203bf9 errors: DiagnosticMessage::Eager
Add variant of `DiagnosticMessage` for eagerly translated messages
(messages in the target language which don't need translated by the
emitter during emission). Also adds `eager_subdiagnostic` function which
is intended to be invoked by the diagnostic derive for subdiagnostic
fields which are marked as needing eager translation.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-10 14:20:16 +01:00
Nathan Stocks
31c269ae75 avoid string dispatch in fluent 2022-10-07 14:39:09 -06:00
Nathan Stocks
57eba4f535 avoid string dispatch in fluent 2022-10-07 13:19:28 -06:00
Nathan Stocks
965dbf6c28 First batch of review feedback changes from #102110 2022-10-07 13:19:28 -06:00
Nathan Stocks
be4059dd3e migrate stability.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
3fe8e004e9 migrate the rest of check_attr.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
a7aa1850b2 migrate dead.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
f0afb88302 migrate lang_items.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
b17ec43637 migrate entry.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
96f92eab68 migrate naked_functions.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
69766e4f16 migrate loops.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
572f3414b7 migrate check_const.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
c457abee2e migrate lib_features.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
40d5f00e16 migrate layout_test.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
0609c0f1da migrate diagnostic_items.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Nathan Stocks
3a748330af use cherry-picked commit from #100754 to emit note without error 2022-10-07 13:19:27 -06:00
Nathan Stocks
c103c3059f migrate the rest of weak_lang_items.rs to translateable diagnostics 2022-10-07 13:19:27 -06:00
Diego de Oliveira
1222541cfd resolve merge conflict from cherry-picking 6a47326a04 2022-10-07 13:19:27 -06:00
Nathan Stocks
c24a87315a always put ftl message on next line, resolve all but 1 output comparison error 2022-10-07 13:19:27 -06:00
rdvdev2
2c3351c9a6 Migrate InvalidAttrAtCrateLevel
Co-authored-by: Nathan Stocks <cleancut@github.com>
Co-authored-by: rdvdev2 <rdvdev2@gmail.com>
2022-10-07 13:19:27 -06:00
rdvdev2
0315d7c9db Migrate derivable diagnostics in check_attr.rs 2022-10-07 13:19:27 -06:00
rdvdev2
17a4a68ab0 Migrate derivable diagnostics in lang_items.rs 2022-10-07 13:19:27 -06:00
rdvdev2
2f74d1d14f Migrate weak_lang_items.rs 2022-10-07 13:19:26 -06:00
Jhonny Bill Mena
13d4f27c82 ADD - implement IntoDiagnostic for thorin::Error wrapper 2022-10-07 10:03:45 -04:00
Jhonny Bill Mena
a25f939170 Address PR comments
- UPDATE - revert migration of logs

- UPDATE - use derive on LinkRlibError enum

- [Gardening] UPDATE - alphabetically sort fluent_messages

- UPDATE - use PathBuf and unify both AddNativeLibrary to use Display (which is what PathBuf uses when conforming to IntoDiagnosticArg)

- UPDATE - fluent messages sort after rebase
2022-10-07 10:03:45 -04:00
Jhonny Bill Mena
12aa84bdf3 ADD - initial port of link.rs 2022-10-07 10:03:45 -04:00
Jhonny Bill Mena
0f97d4a141 DELETE - unused error after PR# 100101 was merged 2022-10-07 10:03:45 -04:00
Jhonny Bill Mena
d9197dbbcd UPDATE - migrate write.rs to new diagnostics infra 2022-10-07 10:03:45 -04:00
Jhonny Bill Mena
086e70f13e UPDATE - migrate linker.rs to new diagnostics infra 2022-10-07 10:03:45 -04:00
Jhonny Bill Mena
0a2d7f83cb UPDATE - LibDefWriteFailure to accept type instead of formatted string
This follows team’s suggestions in this thread https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20diag.20translation/near/295305249
2022-10-07 10:00:32 -04:00
Jhonny Bill Mena
4e0de5319c ADD - migrate lib.def write fatal error
This diagnostic has no UI test 🤔 Should we add some? If so, how?
2022-10-07 10:00:32 -04:00
Jhonny Bill Mena
b0b072d747 ADD - codegen_ssa initial diags translations machinery
ADD - migrate MissingNativeStaticLibrary fatal error
2022-10-07 10:00:32 -04:00
Matthias Krüger
045fc18cde
Rollup merge of #102718 - compiler-errors:opaque-bound-lint-ice, r=fee1-dead
Fix `opaque_hidden_inferred_bound` lint ICE

Fixes #102705
2022-10-06 16:29:44 +02:00
bors
0152393048 Auto merge of #99324 - reez12g:issue-99144, r=jyn514
Enable doctests in compiler/ crates

Helps with https://github.com/rust-lang/rust/issues/99144
2022-10-06 03:01:57 +00:00
Michael Goulet
8e7783bd13 Fix opaque_hidden_inferred_bound lint ICE 2022-10-05 19:47:19 +00:00
yukang
e747201ad8 find the correct lang item for ranges 2022-10-04 21:02:07 +08:00
Dylan DPC
35f92ed1bf
Rollup merge of #102568 - compiler-errors:lint-unsatisfied-opaques, r=oli-obk
Lint against nested opaque types that don't satisfy associated type bounds

See the test failures for examples of places where this lint would fire.

r? `@oli-obk`
2022-10-04 16:11:02 +05:30
yukang
5dd44d4d4c fix #102396, suggest parentheses for possible range methods 2022-10-04 17:30:52 +08:00
bors
d9f8b4b985 Auto merge of #102395 - davidtwco:translation-rename-typeck, r=compiler-errors
errors: rename `typeck.ftl` to `hir_analysis.ftl`

In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the diagnostic resources were not renamed - which is what this pull request changes.
2022-10-04 03:57:50 +00:00
pierwill
b9c0467e0c Add diagnostic struct for const eval error in rustc_middle
Co-authored-by: Michael Goulet <michael@errs.io>
2022-10-03 12:29:49 -05:00
David Wood
c4418e1940 errors: rename typeck.ftl to hir_analysis.ftl
In #102306, `rustc_typeck` was renamed to `rustc_hir_analysis` but the
diagnostic resources were not renamed - which is what this commit
changes.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-10-03 13:52:17 +01:00
Michael Goulet
426424b320 Make it a lint for all opaque types 2022-10-02 19:50:19 +00:00
Michael Goulet
d0d6af9146 Lint for unsatisfied nested opaques 2022-10-02 19:50:19 +00:00
bors
744e397d88 Auto merge of #101986 - WaffleLapkin:move_lint_note_to_the_bottom, r=estebank
Move lint level source explanation to the bottom

So, uhhhhh

r? `@estebank`

## User-facing change

"note: `#[warn(...)]` on by default" and such are moved to the bottom of the diagnostic:
```diff
-   = note: `#[warn(unsupported_calling_conventions)]` on by default
   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
   = note: for more information, see issue #87678 <https://github.com/rust-lang/rust/issues/87678>
+   = note: `#[warn(unsupported_calling_conventions)]` on by default
```

Why warning is enabled is the least important thing, so it shouldn't be the first note the user reads, IMO.

## Developer-facing change

`struct_span_lint` and similar methods have a different signature.

Before: `..., impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>)`
After: `..., impl Into<DiagnosticMessage>, impl for<'a, 'b> FnOnce(&'b mut DiagnosticBuilder<'a, ()>) -> &'b mut DiagnosticBuilder<'a, ()>`

The reason for this is that `struct_span_lint` needs to edit the diagnostic _after_ `decorate` closure is called. This also makes lint code a little bit nicer in my opinion.

Another option is to use `impl for<'a> FnOnce(LintDiagnosticBuilder<'a, ()>) -> DiagnosticBuilder<'a, ()>` altough I don't _really_ see reasons to do `let lint = lint.build(message)` everywhere.

## Subtle problem

By moving the message outside of the closure (that may not be called if the lint is disabled) `format!(...)` is executed earlier, possibly formatting `Ty` which may call a query that trims paths that crashes the compiler if there were no warnings...

I don't think it's that big of a deal, considering that we move from `format!(...)` to `fluent` (which is lazy by-default) anyway, however this required adding a workaround which is unfortunate.

## P.S.

I'm sorry, I do not how to make this PR smaller/easier to review. Changes to the lint API affect SO MUCH 😢
2022-10-01 10:44:25 +00:00
Maybe Waffle
a8f7e244b7 Refactor rustc lint API 2022-10-01 10:03:06 +00:00
Matthias Krüger
25017f8bce
Rollup merge of #101075 - ellishg:rustc_codegen_gcc_diagnostics, r=davidtwco
Migrate rustc_codegen_gcc to SessionDiagnostics

As part of #100717 this pr migrates diagnostics to `SessionDiagnostics` for the `rustc_codegen_gcc` crate.

``@rustbot`` label +A-translation
2022-09-30 10:22:36 +02:00
reez12g
9a4c5abe45 Remove from compiler/ crates 2022-09-29 16:49:04 +09:00
Rageking8
2ee2ffa9a7 improve E0585 help 2022-09-29 00:34:31 +08:00
Xiretza
d7c64574e0 Implement IntoDiagnosticArg for rustc_ast::token::Token(Kind) 2022-09-27 20:29:19 +02:00
Xiretza
37fdcb4b36 Don't unnecessarily stringify paths in diagnostics 2022-09-27 20:29:19 +02:00
Xiretza
00f95468c4 Migrate even more diagnostics in rustc_parse to diagnostic structs 2022-09-27 20:29:19 +02:00
Xiretza
ba10f2c0f2 Migrate "expected semicolon" diagnostics to diagnostic structs 2022-09-27 20:29:19 +02:00
Xiretza
7507ee29fc Migrate "expected identifier" diagnostics to diagnostic structs 2022-09-27 20:29:19 +02:00
Xiretza
21b5194a3a Rework "inner attribute not permitted" errors 2022-09-27 20:29:19 +02:00
Xiretza
e1b1d7b029 Migrate more rustc_parse diagnostics to diagnostic structs 2022-09-27 20:29:18 +02:00
Xiretza
6ae7a30927 Migrate "invalid literal suffix" diagnostic to diagnostic structs 2022-09-27 20:29:18 +02:00
Xiretza
ab7c7dc7ce Migrate more diagnostics in rustc_parse to diagnostic structs 2022-09-27 20:29:18 +02:00
Xiretza
495e271883 Migrate rustc_session::expr_parentheses_needed to Subdiagnostic struct 2022-09-27 20:29:18 +02:00
Ellis Hoag
6d01c6d9c8 lint and remove unused diagnostic 2022-09-26 19:57:40 -07:00
Michael Goulet
4d0d688a3c Recover some items that expect braces and don't take semicolons 2022-09-25 22:34:25 +00:00
Ellis Hoag
249e46bfba Add monomorphization errors 2022-09-24 10:24:48 -07:00
Ellis Hoag
5e0c53a679 Add LayoutSizeOverflow 2022-09-24 10:24:48 -07:00
Ellis Hoag
d0b7e71918 Add LTONotSupported 2022-09-24 10:24:48 -07:00
Ellis Hoag
d9aa635969 Add UnwindingInlineAsm 2022-09-24 10:24:48 -07:00
Ellis Hoag
7e00a48305 Add LinkageConstOrMutType 2022-09-24 10:24:48 -07:00
Ellis Hoag
9363f0fda5 Add RanlibFailure 2022-09-24 10:24:48 -07:00
bors
4d44e09cb1 Auto merge of #102165 - matthiaskrgr:rollup-n5oquhe, r=matthiaskrgr
Rollup of 8 pull requests

Successful merges:

 - #100734 (Split out async_fn_in_trait into a separate feature)
 - #101664 (Note if mismatched types have a similar name)
 - #101815 (Migrated the rustc_passes annotation without effect diagnostic infrastructure)
 - #102042 (Distribute rust-docs-json via rustup.)
 - #102066 (rustdoc: remove unnecessary `max-width` on headers)
 - #102095 (Deduplicate two functions that would soon have been three)
 - #102104 (Set 'exec-env:RUST_BACKTRACE=0' in const-eval-select tests)
 - #102112 (Allow full relro on powerpc64-unknown-linux-gnu)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-23 09:33:23 +00:00
Matthias Krüger
695b708311
Rollup merge of #101815 - diegooliveira:master, r=davidtwco
Migrated the rustc_passes annotation without effect diagnostic infrastructure

Small change to move the validation for annotations to the new diagnostic infrastructure.
2022-09-23 04:29:16 +02:00
khyperia
9a206a78eb Improve the help message for an invalid calling convention 2022-09-22 22:18:30 +02:00
Jhonny Bill Mena
5f91719f75 UPDATE - rename SessionSubdiagnostic macro to Subdiagnostic
Also renames:
- sym::AddSubdiagnostic to sym:: Subdiagnostic
- rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21 11:39:53 -04:00
Jhonny Bill Mena
191fac6826 UPDATE - rename AddSubdiagnostic trait to AddToDiagnostic 2022-09-21 11:39:53 -04:00
Jhonny Bill Mena
19b348fed4 UPDATE - rename DiagnosticHandler trait to IntoDiagnostic 2022-09-21 11:39:52 -04:00
bors
b79b7d8b4e Auto merge of #101846 - chenyukang:fix-101793, r=davidtwco
Fix the wording of help msg for bitwise not

Fixes #101793
2022-09-21 12:32:54 +00:00
bors
efa717bc2d Auto merge of #101924 - jackh726:revert-static-hrtb-error, r=compiler-errors
Re-add HRTB implied static bug note

r? `@compiler-errors` since you reviewed it previously

I deleted a `normalize` call and forgot about it. Whoops.
2022-09-19 04:56:14 +00:00
bors
5253b0a0a1 Auto merge of #101949 - matthiaskrgr:rollup-xu5cqnd, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #101093 (Initial version of 1.64 release notes)
 - #101713 (change AccessLevels representation)
 - #101821 (Bump Unicode to version 15.0.0, regenerate tables)
 - #101826 (Enforce "joined()" and "joined_with_noop()" test)
 - #101835 (Allow using vendoring when running bootstrap from outside the source root)
 - #101942 (Revert "Copy stage0 binaries into stage0-sysroot")
 - #101943 (rustdoc: remove unused CSS `.non-exhaustive { margin-bottom }`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-17 22:04:28 +00:00
Matthias Krüger
a6b34cd928
Rollup merge of #101713 - Bryanskiy:AccessLevels, r=petrochenkov
change AccessLevels representation

Part of RFC (https://github.com/rust-lang/rust/issues/48054). This patch implements effective visibility table with basic methods and change AccessLevels table representation according to it.

r? ``@petrochenkov``
2022-09-17 23:30:49 +02:00
Matthias Krüger
4757d2d57e
Rollup merge of #101801 - SparrowLii:query_depth_note, r=estebank
add note for `layout_of` when query depth overflows

Fixes #101747
Added `try_find_layout_root` function to add a note for `layout_of` when query depth overflows. This would make the error in #101747 look like this:
```
error: queries overflow the depth limit!
   |
note: Query depth increased by 66 when computing layout of `core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<core::option::Option<alloc::boxed::Box<alloc::string::String>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>`!
  --> D:\rust-backup\parallel_rust\query_depth.rs:40:1
   |
40 | fn main() {
   | ^^^^^^^^^

error: aborting due to previous error
```

cc ``@semicoleon``
2022-09-17 19:27:06 +02:00
Michael Howell
d6534317c7
Rollup merge of #101782 - JhonnyBillM:refactor-symbol-mangling-diags-migration, r=davidtwco
Update `symbol_mangling` diagnostics migration

Addresses comments raised in #100831.

r? `@eddyb` `@davidtwco`
2022-09-16 20:37:15 -07:00
Jack Huey
9929c0ac76 Add AscribeUserTypeProvePredicate 2022-09-16 17:20:11 -04:00
Jack Huey
92b759f517 Revert "Better errors for implied static bound"
This reverts commit c75817b0a7.
2022-09-16 09:47:07 -04:00
yukang
484b612909 use subdiagnostic for logical negation, bitwise not 2022-09-16 14:41:42 +08:00
yukang
f43562b95b more tweak on diagnostic messages 2022-09-15 22:39:16 +08:00
yukang
2194fc957a fix 101793, fix the wording of help msg for bitwise not 2022-09-15 17:33:28 +08:00
SparrowLii
89fd6ae458 correct span, add help message and add UI test when query depth overflows 2022-09-15 16:05:44 +08:00
SparrowLii
44506f38e0 add note for layout_of when query depth overflows 2022-09-15 16:05:00 +08:00
Diego de Oliveira
6a47326a04 Migrated the rustc_passes lint for annotations without effect to the new diagnostic infrastructure 2022-09-14 15:05:59 -03:00
Bryanskiy
d7b9221405 change AccessLevels representation 2022-09-14 18:11:00 +03:00
Jack Huey
c75817b0a7 Better errors for implied static bound 2022-09-13 20:18:04 -04:00
Matthias Krüger
bc8ec5e5fa
Rollup merge of #101266 - LuisCardosoOliveira:translation-rustcsession-pt3, r=davidtwco
translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Final

# Description
This is the final part of the rustc_session https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883.

Please only review this [commit](a545347037). The other ones are from the PR https://github.com/rust-lang/rust/pull/101041# that is not yet merged.

In this PR, we migrate the file `output.rs`
2022-09-13 22:25:34 +02:00
Jhonny Bill Mena
c846ba6e53 UPDATE - merge and avoid translations for symbol mangling test output 2022-09-13 16:19:32 -04:00
bors
9da4644d56 Auto merge of #100101 - BelovDV:issue-99429, r=petrochenkov
change rlib format to distinguish native dependencies

Another one method to solve problem mentioned in #99429.

Changed .rlib format, it contains all bundled native libraries as archieves.
At link time rlib is unpacked and native dependencies linked separately.
New behavior hidden under separate_native_rlib_dependencies flag.
2022-09-13 04:00:24 +00:00
bors
0df1ddc185 Auto merge of #99556 - davidtwco:collapse-debuginfo, r=wesleywiser
ssa: implement `#[collapse_debuginfo]`

cc #39153 rust-lang/compiler-team#386

Debuginfo line information for macro invocations are collapsed by default - line information are replaced by the line of the outermost expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour is reversed so that debuginfo is not collapsed by default. In addition, the `#[collapse_debuginfo]` attribute is available and can be applied to macro definitions which will then have their line information collapsed.

r? rust-lang/wg-debugging
2022-09-13 01:19:05 +00:00
Daniil Belov
ffa83596fe change rlib format to discern native dependencies 2022-09-12 16:45:03 +03:00
Luis Cardoso
329d5014b6 translations(rustc_session): migrate output.rs 2022-09-10 08:19:17 +02:00
Michael Goulet
5be30f9d79 Make async fn in traits work 2022-09-09 01:31:45 +00:00
Dylan DPC
8d2a492d73
Rollup merge of #101515 - chenyukang:fix-101477, r=fee1-dead
Recover from typo where == is used in place of =

Fixes #101477
2022-09-08 20:48:37 +05:30
Dylan DPC
1561922a12
Rollup merge of #101041 - LuisCardosoOliveira:translation-rename-attr-warning-pt2, r=davidtwco
translations(rustc_session): migrates rustc_session to use SessionDiagnostic - Pt. 2

# Description

This is the second part of the `rustc_session` [migration](https://github.com/rust-lang/rust/issues/100717#issuecomment-1220279883).

**Please only review this [commit](5018581957) that belongs to the part 2. The other ones are from the PR [#100753](https://github.com/rust-lang/rust/pull/100753) that is not yet merged.**

In this PR, we migrate the files `session.rs` and `config.rs`.

Please not that we have to `allow` the lints rules in some functions from `session.rs` because they are (at least I believe) part of the diagnostic machinery.
2022-09-08 20:48:34 +05:30
Luis Cardoso
0e497a714e translations(rustc_session): migrates two diagnostics in session.rs 2022-09-08 12:22:51 +02:00
yukang
ddb225f1f5 fixes #101477: Recover from typo where == is used in place of = 2022-09-08 15:14:18 +08:00
Luis Cardoso
24de9435e2 translations(rustc_session): remove lint allow rule to the methods marked with rustc_lint_diagnostic
This commit removes the allows rules for the SessionDiagnostic lint
that were being used in the session.rs file.

Thanks to the PR #101230 we do not need to annotate the methods with
the allow rule as they are part of the diagnostic machinery.
2022-09-08 08:30:57 +02:00
Luis Cardoso
0f06320c24 translations(rustc_session): migrate TargetDataLayout::parse 2022-09-08 08:30:57 +02:00
Luis Cardoso
60b49581c4 translations(rustc_session): migrates session.rs and config.rs 2022-09-08 08:30:57 +02:00
David Wood
38958aa8bd ssa: implement #[collapse_debuginfo]
Debuginfo line information for macro invocations are collapsed by
default - line information are replaced by the line of the outermost
expansion site. Using `-Zdebug-macros` disables this behaviour.

When the `collapse_debuginfo` feature is enabled, the default behaviour
is reversed so that debuginfo is not collapsed by default. In addition,
the `#[collapse_debuginfo]` attribute is available and can be applied to
macro definitions which will then have their line information collapsed.

Signed-off-by: David Wood <david.wood@huawei.com>
2022-09-07 13:54:51 +01:00
Nikita Tomashevich
e0e9b21c78
Mugrate mismatched_static_lifetime.rs 2022-09-06 18:41:08 +03:00
Nikita Tomashevich
af3343ae29
Migrate E0623 2022-09-06 18:41:08 +03:00
bors
3c72788461 Auto merge of #101479 - Dylan-DPC:rollup-v8ite0y, r=Dylan-DPC
Rollup of 5 pull requests

Successful merges:

 - #100658 (TyCtxt::get_attr should check that no duplicates are allowed)
 - #101021 (Migrate ``rustc_middle`` diagnostic)
 - #101287 (Document eager evaluation of `bool::then_some` argument)
 - #101412 (Some more cleanup in `core`)
 - #101427 (Fix ICE, generalize 'move generics to trait' suggestion for >0 non-rcvr arguments)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
2022-09-06 11:16:02 +00:00
Dylan DPC
36144f2b3d
Rollup merge of #101021 - MingyuChen1:diagnostic, r=davidtwco
Migrate ``rustc_middle`` diagnostic

Part of #100717
2022-09-06 16:34:42 +05:30
bors
a594044533 Auto merge of #101362 - compiler-errors:unnecessary-let, r=cjgillot
Suggest removing unnecessary prefix let in patterns

Helps with #101291, though I think `@estebank` probably wants this:

> Finally, I think it'd be nice if we could detect that we don't know for sure and "just" swallow the rest of the expression (find the next ; accounting for nested braces) or the end of the item (easier).

... to be implemented before we close that issue out completely.
2022-09-06 08:49:54 +00:00
111
a42c0d79da fix comment 2022-09-05 23:18:18 +08:00
bors
47d1cdb0bc Auto merge of #100574 - Urgau:check-cfg-warn-cfg, r=petrochenkov
Add warning against unexpected --cfg with --check-cfg

This PR adds a warning when an unexpected `--cfg` is specified but not in the specified list of `--check-cfg`.

This is the follow-up PR I mentioned in https://github.com/rust-lang/rust/pull/99519.

r? `@petrochenkov`
2022-09-03 12:02:14 +00:00
Michael Goulet
91674cc56c Suggest removing unnecessary prefix let in patterns 2022-09-03 05:39:46 +00:00
Dylan DPC
a0056795da
Rollup merge of #100928 - CleanCut:rustc_metadata_diagnostics, r=davidtwco
Migrate rustc_metadata to SessionDiagnostics

Migrate rustc_metadata to SessionDiagnostics.

Part of https://github.com/rust-lang/rust/issues/100717
2022-09-03 10:33:05 +05:30
Matthias Krüger
c8749f0453
Rollup merge of #100814 - gabrielBusta:port_trait_selection_diagnostics, r=davidtwco
Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1

``@rustbot`` label +A-translation

r? rust-lang/diagnostics
cc #100717
2022-09-02 18:22:00 +02:00
Urgau
eccdccf4eb Add warning against unexpected --cfg with --check-cfg 2022-09-02 12:51:48 +02:00
Guillaume Gomez
1aaf9aec95
Rollup merge of #100147 - Bryanskiy:private-in-public, r=petrochenkov
optimization of access level table construction

Refactoring which was mentioned in #87487
2022-09-02 11:34:48 +02:00
Gabriel Bustamante
8e82200277 Porting 'compiler/rustc_trait_selection' to translatable diagnostics - Part 1 2022-09-01 12:54:50 -05:00
111
b37e645d80 Migrate limit error 2022-09-01 23:35:38 +08:00
111
00cd965046 Migrate OpaqueHiddenType mismatch 2022-09-01 23:35:38 +08:00
111
3e834a7a62 Migrate DropCheckOverflow 2022-09-01 23:35:38 +08:00
Oli Scherer
ee3c835018 Always import all tracing macros for the entire crate instead of piecemeal by module 2022-09-01 14:54:27 +00:00
Matthias Krüger
22c5c83a68
Rollup merge of #100844 - evopen:migrate-diag, r=davidtwco
migrate rustc_query_system to use SessionDiagnostic

issues:
* variable list is not supported in fluent
* ~~cannot have two sub diagnostic with the same tag (eg. 2 .note or 2 .help)~~

allow multiple tag with SessionSubdiagnostic derive
2022-08-31 21:30:09 +02:00
Matthias Krüger
6438f4addc
Rollup merge of #100787 - chenyukang:fix-100770-pretty-crash, r=petrochenkov
Pretty printing give proper error message without panic

Fixes #100770
2022-08-31 21:30:07 +02:00
Nathan Stocks
30adfd6a17 port 5 new diagnostics that appeared in master 2022-08-31 10:56:42 -06:00
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
Li Yuanheng
7ce59ebf49 SessionDiagnostic for QueryOverflow error 2022-08-31 19:43:23 +08:00
Yuanheng Li
ac638c1f5f use derive proc macro to impl SessionDiagnostic
fixes `SessionSubdiagnostic` to accept multiple attributes
emitting list of fluent message remains unresolved
2022-08-31 19:43:12 +08:00
Yuanheng Li
b8075e4550 migrate rustc_query_system to use SessionDiagnostic
with manual impl SessionDiagnostic
2022-08-31 19:33:51 +08:00
Bryanskiy
0111fb00da add TestReachabilityVisitor 2022-08-31 14:23:07 +03: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
yukang
77eb1aef52 add UI test for unpretty 2022-08-30 09:31:52 +08: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
Hampus Lidin
1c28006bf6 Reorder diagnostics in code order, then alphabetical order 2022-08-22 20:19:19 +02:00
Hampus Lidin
c4f59605d2 Refactor remaining diagnostics 2022-08-22 20:19:19 +02:00