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