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
David Wood
e88916cc92
lint: port default hash types diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
fd57269e8c
lint: port hidden unicode codepoints diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
a0624eb6c9
lint: port expectation diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
2a69640eb2
lint: port enum intrinsics diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:21 +01:00
David Wood
0f4c4c5e18
lint: port array-into-iter diagnostics
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-30 08:59:19 +01:00
Michael Goulet
98af1bfecc
Migrate some rustc_borrowck diagnostics to SessionDiagnostic
2022-06-28 22:41:56 +00:00
David Wood
74f3a965f4
privacy: port "in public interface" diag
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-27 08:53:42 +01:00
David Wood
0557d02a9d
privacy: port unnamed "item is private" diag
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-27 08:53:42 +01:00
David Wood
cb90a4f30c
privacy: port "item is private" diag
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-27 08:53:42 +01:00
David Wood
be9ebfdbce
privacy: port "field is private" diag
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-27 08:53:42 +01:00
David Wood
99bc979403
macros: use typed identifiers in diag derive
...
Using typed identifiers instead of strings with the Fluent identifier
enables the diagnostic derive to benefit from the compile-time
validation that comes with typed identifiers - use of a non-existent
Fluent identifier will not compile.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-06-24 09:08:25 +01:00
beetrees
be5337cde5
Migrate builtin-macros-expected-one-cfg-pattern
to SessionDiagnostic
2022-06-21 20:20:00 +01:00
beetrees
6264ffbfef
Migrate builtin-macros-requires-cfg-pattern
to SessionDiagnostic
2022-06-21 20:10:31 +01:00
Nick Cameron
640a461388
Deactivate feature gate explicit_generic_args_with_impl_trait
...
Signed-off-by: Nick Cameron <nrc@ncameron.org>
2022-06-06 12:21:49 +01:00
Christian Poveda
e1d63d1d7c
migrate check_for_for_in_in_typo
diagnostic
2022-05-31 16:28:05 -05:00
Christian Poveda
9ce04e3783
merge diagnostics about incorrect uses of .await
2022-05-31 15:07:44 -05:00
Christian Poveda
a06ba45487
migrate error_on_incorrect_await
diagnostic
2022-05-31 14:32:07 -05:00
Christian Poveda
93a427e3ca
migrate recover_from_await_method_call
diagnostic
2022-05-31 12:33:35 -05:00
Christian Poveda
29ed9a56e3
migrate maybe_consume_incorrect_semicolon
diagnostic
2022-05-31 11:45:44 -05:00
Christian Poveda
bd4d1cd7a2
migrate maybe_recover_from_bad_qpath_stage_2
diagnostic
2022-05-31 11:22:26 -05:00
Christian Poveda
7e8517df61
migrate maybe_recover_from_bad_type_plus
diagnostic
2022-05-16 17:16:27 -05:00
David Wood
47582471c6
typeck: port "no resolve overridden impl substs"
...
Port "could not resolve substs on overridden impl" diagnostic to use the
diagnostic derive.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12 07:21:51 +01:00
David Wood
664733efd5
typeck: port "manual implementations"
...
Port the "manual implementations of `X` are experimental" diagnostic to
use the diagnostic derive.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12 07:21:51 +01:00
David Wood
78cc331bd7
typeck: port "missing type params"
...
Port the "the type parameter `T` must be explicitly specified"
diagnostic to using a diagnostic struct.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12 07:21:51 +01:00
David Wood
5685abc96b
typeck: simplify error type using ()
field
...
Using new support for spanless subdiagnostics from `()` fields in the
diagnostic derive, simplify the "explicit generic args with impl trait"
diagnostic's struct.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-12 07:21:51 +01:00
bors
362010d6be
Auto merge of #96715 - cjgillot:trait-alias-loop, r=compiler-errors
...
Fortify handing of where bounds on trait & trait alias definitions
Closes https://github.com/rust-lang/rust/issues/96664
Closes https://github.com/rust-lang/rust/issues/96665
Since https://github.com/rust-lang/rust/pull/93803 , when listing all bounds and predicates we now need to account for the possible presence of predicates on any of the generic parameters. Both bugs were hidden by the special handling of bounds at the generic parameter declaration position.
Trait alias expansion used to confuse predicates on `Self` and where predicates.
Exiting too late when listing all the bounds caused a cycle error.
2022-05-10 00:40:57 +00:00
Camille GILLOT
e947fad68c
Point to the empty trait alias.
2022-05-09 19:03:37 +02:00
David Wood
af47257c0d
typeck: port "explicit generic args w/ impl trait"
...
Port the "explicit generic arguments with impl trait" diagnostic to
using the diagnostic derive.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-06 03:46:12 +01:00
David Wood
3dac70fcc0
typeck: port "unconstrained opaque type" diag
...
Port the "unconstrained opaque type" diagnostic to using the diagnostic
derive.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-05-06 03:04:30 +01:00
David Wood
49ec909ca7
macros: subdiagnostic derive
...
Add a new derive, `#[derive(SessionSubdiagnostic)]`, which enables
deriving structs for labels, notes, helps and suggestions.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-29 02:05:20 +01:00
Christian Poveda
1e35bab104
separate messages by a newline
2022-04-26 11:13:23 +02:00
Christian Poveda
519dd8e9de
migrate ambiguous plus diagnostic
2022-04-25 22:55:15 +02:00
David Wood
9bfe0e39e4
errors: lazily load fallback fluent bundle
...
Loading the fallback bundle in compilation sessions that won't go on to
emit any errors unnecessarily degrades compile time performance, so
lazily create the Fluent bundle when it is first required.
Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-13 02:44:59 +01:00
Maybe Waffle
d5440926e2
Suggest replacing typeof(...) with an actual type
...
This commit suggests replacing typeof(...) with an actual type of "...",
for example in case of `typeof(1)` we suggest replacing it with `i32`.
If the expression
- Is not const (`{ let a = 1; let _: typeof(a); }`)
- Can't be found (`let _: typeof(this_variable_does_not_exist)`)
- Or has non-suggestable type (closure, generator, error, etc)
we don't suggest anything.
2022-04-07 23:40:32 +04:00
David Wood
d0fd8d7880
macros: translatable struct attrs and warnings
...
Signed-off-by: David Wood <david.wood@huawei.com>
2022-04-05 07:01:03 +01:00
David Wood
7f91697b50
errors: implement fallback diagnostic translation
...
This commit updates the signatures of all diagnostic functions to accept
types that can be converted into a `DiagnosticMessage`. This enables
existing diagnostic calls to continue to work as before and Fluent
identifiers to be provided. The `SessionDiagnostic` derive just
generates normal diagnostic calls, so these APIs had to be modified to
accept Fluent identifiers.
In addition, loading of the "fallback" Fluent bundle, which contains the
built-in English messages, has been implemented.
Each diagnostic now has "arguments" which correspond to variables in the
Fluent messages (necessary to render a Fluent message) but no API for
adding arguments has been added yet. Therefore, diagnostics (that do not
require interpolation) can be converted to use Fluent identifiers and
will be output as before.
2022-04-05 07:01:02 +01:00