Rejyr
d197c1eb5b
migrate: UnknownTool
error to SessionDiagnostic
2022-08-22 08:24:14 -04:00
Giacomo Stevanato
b411adec2a
Move rustc_interface diagnostics to struct SessionDiagnostic derives
2022-08-22 13:22:00 +02:00
Xiretza
c9b1a5874d
fluent: mandate slug names to be prefixed by crate name
2022-08-22 08:42:44 +02:00
Dylan DPC
57e521e0e5
Rollup merge of #100694 - finalchild:ast-passes-diag, r=TaKO8Ki
...
Migrate rustc_ast_passes diagnostics to `SessionDiagnostic` and translatable messages (first part)
Doing a full migration of the `rustc_ast_passes` crate.
Making a draft here since there's not yet a tracking issue for the migrations going on.
`@rustbot` label +A-translation
2022-08-22 11:45:44 +05:30
bors
d0ea1d7679
Auto merge of #100671 - Xiretza:tidy-fluent-files, r=davidtwco
...
tidy: check fluent files for style
Inspired by https://github.com/rust-lang/rust/pull/100651#discussion_r947600576
There were a lot of line length violations, so I've excepted that lint - I'm not sure if fluent files can be formatted to avoid long lines at all.
2022-08-22 03:02:50 +00:00
nidnogg
0a58b26e8a
Hotfix ftl err name, added check for err.code in create_feature_err
2022-08-21 23:22:55 -03:00
nidnogg
4c82845b3a
Fixed failing tests (missing labels), added automatic error code in create_feature_err() builder
2022-08-21 23:22:55 -03:00
nidnogg
d1f14ee1b0
Added several more migrations under ops.rs, failing some tests though
2022-08-21 23:22:54 -03:00
nidnogg
33e8aaf830
Migration on ops.rs for unstable const functions
2022-08-21 23:22:53 -03:00
nidnogg
70ea98633e
Migrated Unallowed function pointer calls in interpreter/ops
2022-08-21 23:22:51 -03:00
nidnogg
6af8e46a9a
Finished const_eval module migration, moving onto sibling folders
2022-08-21 23:22:50 -03:00
finalchild
e331ae57df
Migrate forbidden_default and *_without_body
2022-08-22 01:11:59 +09:00
finalchild
bfefefbcfa
Migrate fn_param_forbidden_self and rename others to have prefix fn_param_
2022-08-22 00:57:22 +09:00
finalchild
07e0bc9600
Rename c_var_args_without_named_arg to c_var_args_is_sole_param
2022-08-22 00:57:22 +09:00
finalchild
c6903c04b1
Migrate doc_comment_on_fn_param, forbidden_attr_on_fn_param
2022-08-22 00:57:21 +09:00
finalchild
269c85390c
Migrate forbidden_lifetime_bound, forbidden_non_lifetime_param, too_many_params, c_var_args_without_named_arg, c_var_args_not_last
2022-08-22 00:57:21 +09:00
finalchild
8d042f4483
Migrate trait_fn_const
2022-08-22 00:57:21 +09:00
finalchild
e3d4c4039a
Migrate trait_fn_async
2022-08-22 00:57:21 +09:00
finalchild
e144a2367a
Migrate deprecated_where_clause_location, forbidden_assoc_constraint, keyword_lifetime, invalid_label, invalid_visibility
2022-08-22 00:57:21 +09:00
finalchild
d6fdf14eb7
Migrate forbidden_let
2022-08-22 00:57:21 +09:00
Xiretza
ffcaa0dee2
Migrate diagnostics in parser/expr to SessionDiagnostic
2022-08-21 14:54:05 +02:00
Matthias Krüger
67f77f5a55
Rollup merge of #100709 - JhonnyBillM:port-expected-used-symbol-diagnostic, r=compiler-errors
...
Migrate typeck's `used` expected symbol diagnostic to `SessionDiagnostic`
r? ``@davidtwco``
2022-08-20 07:09:02 +02:00
Matthias Krüger
eacbe5437e
Rollup merge of #100667 - Xiretza:diag-structs-parser-ivd, r=davidtwco
...
Migrate "invalid variable declaration" errors to SessionDiagnostic
After seeing the great blog post on Inside Rust, I decided to try my hand at this. Just one diagnostic for now to get used to the workflow and to check if this is the way to do it or if there are any problems.
2022-08-20 07:09:01 +02:00
Dylan DPC
078844283c
Rollup merge of #99576 - compiler-errors:foreign-fundamental-drop-is-bad, r=TaKO8Ki
...
Do not allow `Drop` impl on foreign fundamental types
`Drop` should not be implemented on `Pin<T>` even if `T` is local.
This does not trigger regular orphan rules is because `Pin` is `#[fundamental]`... but we don't allow specialized `Drop` impls anyways, so these rules are not sufficient to prevent this impl on stable. Let's just choose even stricter rules, since we shouldn't be implementing `Drop` on a foreign ADT ever.
Fixes #99575
2022-08-19 12:26:38 +05:30
Jhonny Bill Mena
af4f66ef93
ADD - ExpectedUsedSymbol diagnostic to port used() diagnostic
2022-08-18 08:18:26 -04:00
Xiretza
295457192d
fluent: fix slug name for borrowck::generic_does_not_live_long_enough
2022-08-18 12:34:11 +02:00
Xiretza
00fec76ab5
tidy: check fluent files for style
2022-08-18 12:34:11 +02:00
Matthias Krüger
3de034d401
Rollup merge of #100674 - PragmaTwice:mig-typeck-unused-crate-diag, r=davidtwco
...
Migrate lint reports in typeck::check_unused to LintDiagnostic
In this PR, I migrate two lint reports in `typeck::check_unused` by `LintDiagnostic`, all of which is about extern crates.
```@rustbot``` label +A-translation
r? rust-lang/diagnostics
2022-08-18 05:10:50 +02:00
Matthias Krüger
8b180ed3c0
Rollup merge of #100651 - nidnogg:diagnostics_migration_expand_transcribe, r=davidtwco
...
Migrations for rustc_expand transcribe.rs
This PR includes some migrations to the new diagnostics API for the `rustc_expand` module.
r? ```@davidtwco```
2022-08-18 05:10:47 +02:00
Xiretza
e8499cfadc
Migrate "invalid variable declaration" errors to SessionDiagnostic
2022-08-17 19:08:37 +02:00
nidnogg
c6f9a9c410
Moved structs to rustc_expand::errors, added several more migrations, fixed slug name
2022-08-17 11:18:19 -03:00
PragmaTwice
98fb65eff9
Migrate lint reports in typeck::check_unused to LintDiagnostic
2022-08-17 17:47:44 +08:00
nidnogg
be18a9bf75
Migrated more diagnostics under transcribe.rs
2022-08-16 19:02:51 -03:00
nidnogg
7e15fbab75
Added first migration for repeated expressions without syntax vars
2022-08-16 18:34:13 -03:00
finalchild
c1a98416e3
Migrate emoji identifier diagnostics to SessionDiagnostic
2022-08-17 05:07:47 +09:00
Michael Goulet
fd934c99bc
Do not allow Drop impl on foreign fundamental types
2022-08-16 00:59:06 +00:00
est31
cc6cff564f
Replace - with _ in ftl slugs for better grepability
...
Having to replace - with _ (and vice versa) makes the slugs less greppable
and thus constitutes a contributor roadblock.
Result of running this repeatedly up until reaching a fixpoint:
find compiler/rustc_error_messages/locales/en-US/ -type f -exec sed -i 's/\(.+\)-\(.*\)=/\1_\2=/' {} \;
Plus some fixes to update usages of slugs leading with -.
2022-08-12 22:22:55 +02:00
yukang
e614bbcd30
link_ordinal is available for foreign static
2022-08-04 09:28:59 +08:00
yukang
0d1b832667
check link ordinal make sure target is foreign function
2022-08-03 11:30:27 +08:00
David Wood
7bab769b58
lint: add bad opt access internal lint
...
Some command-line options accessible through `sess.opts` are best
accessed through wrapper functions on `Session`, `TyCtxt` or otherwise,
rather than through field access on the option struct in the `Session`.
Adds a new lint which triggers on those options that should be accessed
through a wrapper function so that this is prohibited. Options are
annotated with a new attribute `rustc_lint_opt_deny_field_access` which
can specify the error message (i.e. "use this other function instead")
to be emitted.
A simpler alternative would be to simply rename the options in the
option type so that it is clear they should not be used, however this
doesn't prevent uses, just discourages them. Another alternative would
be to make the option fields private, and adding accessor functions on
the option types, however the wrapper functions sometimes rely on
additional state from `Session` or `TyCtxt` which wouldn't be available
in an function on the option type, so the accessor would simply make the
field available and its use would be discouraged too.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-27 11:24:27 +01:00
David Wood
76cf6bd03e
passes: port more of check_attr
module
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-25 15:11:22 +01:00
bors
9a7b7d5e50
Auto merge of #98180 - notriddle:notriddle/rustdoc-fn, r=petrochenkov,GuillaumeGomez
...
Improve the function pointer docs
This is #97842 but for function pointers instead of tuples. The concept is basically the same.
* Reduce duplicate impls; show `fn (T₁, T₂, …, Tₙ)` and include a sentence saying that there exists up to twelve of them.
* Show `Copy` and `Clone`.
* Show auto traits like `Send` and `Sync`, and blanket impls like `Any`.
https://notriddle.com/notriddle-rustdoc-test/std/primitive.fn.html
2022-07-19 19:36:57 +00:00
Tomasz Miąsko
45afc214af
Update invalid atomic ordering lint
...
The restriction that success ordering must be at least as strong as its
failure ordering in compare-exchange operations was lifted in #98383 .
2022-07-18 12:02:11 +02:00
Michael Howell
1169832f2f
rustdoc: extend #[doc(tuple_variadic)]
to fn pointers
...
The attribute is also renamed `fake_variadic`.
2022-07-17 16:32:06 -07:00
David Wood
78b19a90b7
passes: migrate half of check_attr
...
Migrate half of the `rustc_passes::check_attr` diagnostics to using
diagnostic derives and being translatable.
2022-07-15 16:13:49 +01:00
David Wood
c3fdf74885
errors: lint on LintDiagnosticBuilder::build
...
Apply the `#[rustc_lint_diagnostics]` attribute to
`LintDiagnosticBuilder::build` so that diagnostic migration lints will
trigger for it.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-07-15 16:13:47 +01:00
Michael Goulet
d2e5a929b9
use subdiagnostic for message
2022-07-10 23:43:46 +00:00
Michael Goulet
2058333780
simplify plurals in fluent messages using hir::ConstContext
2022-07-08 03:48:10 +00:00
Michael Goulet
f97f2a47ff
Migrate MutDeref, TransientMutBorrow diagnostics
2022-07-08 03:48:10 +00:00
Michael Goulet
584e5d4c4f
Migrate PanicNonStr, RawPtrComparison, RawPtrToInt diagnostics
2022-07-08 03:47:59 +00:00
Michael Goulet
c48f482813
Migrate StaticAccess diagnostic
2022-07-08 03:47:46 +00:00
Michael Goulet
1c4afbd1de
Migrate NonConstOp diagnostic
2022-07-08 03:47:28 +00:00
Michael Goulet
934079fd9e
Migrate unstable-in-stable diagnostic
2022-07-08 03:39:08 +00:00
Michael Goulet
34d6f08f4d
Use dashes instead of underscores in fluent names
2022-07-08 03:37:36 +00:00
David Wood
fedd4c63f8
lint: port asm labels diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
5524ca1a1d
lint: port deref nullptr diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
2e563a4a3e
lint: port clashing extern diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
bd8fe82138
lint: port incomplete features diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
acea23e796
lint: port explicit outlives diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
10676418fa
lint: port keyword idents diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
10f2d3f566
lint: port test items diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
3a498a7436
lint: port ...
range pattern diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
3c9bda5b20
lint: port trivial bounds diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
01a64af4dd
lint: port type alias bounds diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
dbced105db
lint: port unreachable pub
diagnostic
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
23ee3e0914
lint: port unstable feature diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
d071f504f8
lint: port mutable transmutes diagnostic
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
dbdbdb6874
lint: port no-mangle diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
a13b70ea83
lint: port unused doc comment diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
e151d66343
lint: port deprecated attr diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
18a48c1d6c
lint: port anonymous parameter diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
284ec37810
lint: port missing debug impl diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
28655bc955
lint: port missing copy impl diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
82bd2c23e5
lint: port missing documentation diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
7dffd14b96
lint: port unsafe diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
4c63a2145c
lint: port non-shorthand pattern diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
d433c9a446
lint: port box pointers diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
588977b350
lint: port while true diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
4f7b10f484
lint: port unused allocation diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
e24833869f
lint: port unused import braces diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
fc4f8d9bc2
lint: port unused delimiter diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
2829f519a0
lint: port path statement diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:22 +01:00
David Wood
1999a4c421
lint: port unused diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
0602729c71
lint: port atomic ordering diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
14c3016583
lint: port variant size difference diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
e5f2e0e16c
lint: port improper ctypes diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
7a9bef4d83
lint: port overflowing literals diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
7ef610c003
lint: port drop trait/glue diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
8e836566f0
lint: port redundant semicolons diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
37588d6d4e
lint: port pass-by-value diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
855f23773b
lint: port no-op method call diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
096a69dd19
lint: port non-standard style diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
7ee4aa7003
lint: port non-fmt-panic diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
48e4bf115f
lint: port non-ascii-idents diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
c29e05e745
lint: port CString
ptr diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
4f35c7993b
lint: port translation migration diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
674ac60d5a
lint: port non-existant doc keyword diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
1c3a3e0711
lint: port impl LintPass
by hand diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
0996a7ab5c
lint: port ty diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
8139542598
lint: port query instability diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00