Urgau
c99f29b29f
Implement boolean lit support in cfg predicates
2024-10-01 10:01:33 +02:00
Urgau
57b9b1f974
Use ast::NestedMetaItem
when evaluating cfg predicate
2024-10-01 10:01:09 +02:00
Lukas Markeffsky
2fdeb3b8f4
rustdoc: inherit parent's stability where applicable
2024-09-24 20:18:36 +02:00
Michael Goulet
c682aa162b
Reformat using the new identifier sorting from rustfmt
2024-09-22 19:11:29 -04:00
Eduardo Sánchez Muñoz
0b20ffcb63
Remove needless returns detected by clippy in the compiler
2024-09-09 13:32:22 +02:00
Michael Goulet
25ff9b6bcb
Use bool in favor of Option<()> for diagnostics
2024-08-21 01:31:11 -04:00
Guillaume Gomez
ea74eff55c
Rollup merge of #128886 - GrigorenkoPV:untranslatable-diagnostic, r=nnethercote
...
Get rid of some `#[allow(rustc::untranslatable_diagnostic)]`
`@rustbot` label +A-translation
cc https://github.com/rust-lang/rust/issues/100717
2024-08-12 17:09:17 +02:00
Pavel Grigorenko
c36b21a4c8
rustc_attr: make "compact cfg(target(..))
is unstable" translatable
2024-08-10 14:32:55 +03:00
Pavel Grigorenko
f83b085a0c
rustc_attr: remove redundant #[allow(rustc::untranslatable_diagnostic)]
2024-08-10 14:32:55 +03:00
León Orell Valerian Liehr
c4c518d2d4
Use more slice patterns inside the compiler
2024-08-07 13:37:52 +02:00
Matthias Krüger
83734f2802
Rollup merge of #128341 - Alexendoo:parse-version-pub, r=compiler-errors
...
Make `rustc_attr::parse_version` pub
I'd like to use it in Clippy but I'll make those changes in the Clippy repo after the sync so it doesn't cause a conflict with https://github.com/rust-lang/rust-clippy/pull/13168
2024-07-29 17:46:44 +02:00
Alex Macleod
eb0e71620d
Make rustc_attr::parse_version
pub
2024-07-29 13:11:29 +00:00
Nicholas Nethercote
84ac80f192
Reformat use
declarations.
...
The previous commit updated `rustfmt.toml` appropriately. This commit is
the outcome of running `x fmt --all` with the new formatting options.
2024-07-29 08:26:52 +10:00
Oli Scherer
c91edc3888
Prefer dcx
methods over fields or fields' methods
2024-06-18 13:45:08 +00:00
Xiretza
98dd6c7e8f
Rename buffer_lint_with_diagnostic to buffer_lint
2024-05-21 20:16:39 +00:00
Xiretza
c227f35a9c
Generate lint diagnostic message from BuiltinLintDiag
...
Translation of the lint message happens when the actual diagnostic is
created, not when the lint is buffered. Generating the message from
BuiltinLintDiag ensures that all required data to construct the message
is preserved in the LintBuffer, eventually allowing the messages to be
moved to fluent.
Remove the `msg` field from BufferedEarlyLint, it is either generated
from the data in the BuiltinLintDiag or stored inside
BuiltinLintDiag::Normal.
2024-05-21 20:16:39 +00:00
Nicholas Nethercote
4814fd0a4b
Remove extern crate rustc_macros
from numerous crates.
2024-04-29 10:21:54 +10:00
Nicholas Nethercote
8d4655d9ec
Rename NestedMetaItem::name_value_literal
.
...
It's a highly misleading name, because it's completely different to
`MetaItem::name_value_literal`. Specifically, it doesn't match
`MetaItemKind::NameValue` (e.g. `#[foo = 3]`), it matches
`MetaItemKind::List` (e.g. `#[foo(3)]`).
2024-04-24 16:28:34 +10:00
beetrees
6e5f1dacf3
Use the Align
type when parsing alignment attributes
2024-04-01 03:05:55 +01:00
Nicholas Nethercote
b7d58eef4b
Rewrite the untranslatable_diagnostic
lint.
...
Currently it only checks calls to functions marked with
`#[rustc_lint_diagnostics]`. This commit changes it to check calls to
any function with an `impl Into<{D,Subd}iagMessage>` parameter. This
greatly improves its coverage and doesn't rely on people remembering to
add `#[rustc_lint_diagnostics]`.
The commit also adds `#[allow(rustc::untranslatable_diagnostic)`]
attributes to places that need it that are caught by the improved lint.
These places that might be easy to convert to translatable diagnostics.
Finally, it also:
- Expands and corrects some comments.
- Does some minor formatting improvements.
- Adds missing `DecorateLint` cases to
`tests/ui-fulldeps/internal-lints/diagnostics.rs`.
2024-03-06 14:19:01 +11:00
Nicholas Nethercote
7aa0eea19c
Rename BuiltinLintDiagnostics
as BuiltinLintDiag
.
...
Not the dropping of the trailing `s` -- this type describes a single
diagnostic and its name should be singular.
2024-03-05 12:15:10 +11:00
Matthias Krüger
13b971209a
Rollup merge of #121969 - nnethercote:ParseSess-cleanups, r=wesleywiser
...
`ParseSess` cleanups
The main change here is to rename all `ParseSess` values as `psess`. Plus a few other small cleanups.
r? `@wesleywiser`
2024-03-04 22:16:33 +01:00
Nicholas Nethercote
80d2bdb619
Rename all ParseSess
variables/fields/lifetimes as psess
.
...
Existing names for values of this type are `sess`, `parse_sess`,
`parse_session`, and `ps`. `sess` is particularly annoying because
that's also used for `Session` values, which are often co-located, and
it can be difficult to know which type a value named `sess` refers to.
(That annoyance is the main motivation for this change.) `psess` is nice
and short, which is good for a name used this much.
The commit also renames some `parse_sess_created` values as
`psess_created`.
2024-03-05 08:11:45 +11:00
yukang
53dba7fb55
fix spans of arguments in diagnostic
2024-03-03 10:48:40 +08:00
yukang
5a5c6dfb33
Fix misleading message when using a named constant as a struct alignment/pack
2024-03-02 23:15:39 +08:00
Markus Reiter
746a58d435
Use generic NonZero
internally.
2024-02-15 08:09:42 +01:00
Josh Stone
33e0422826
Pack the u128 in LitKind::Int
2024-01-19 20:10:39 -08:00
George-lewis
36a69e9d39
Add check for ui_testing via promoting parameters from ParseSess
to Session
2024-01-13 12:11:13 -05:00
Nicholas Nethercote
3c4f1d85af
Rename {create,emit}_warning
as {create,emit}_warn
.
...
For consistency with `warn`/`struct_warn`, and also `{create,emit}_err`,
all of which use an abbreviated form.
2024-01-10 07:33:06 +11:00
Nicholas Nethercote
99472c7049
Remove Session
methods that duplicate DiagCtxt
methods.
...
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier
access.
2023-12-24 08:05:28 +11:00
Nicholas Nethercote
d51db05d7e
Remove ParseSess
methods that duplicate DiagCtxt
methods.
...
Also add missing `#[track_caller]` attributes to `DiagCtxt` methods as
necessary to keep tests working.
2023-12-24 07:59:21 +11:00
Nicholas Nethercote
09af8a667c
Rename Session::span_diagnostic
as Session::dcx
.
2023-12-18 16:06:21 +11:00
Nicholas Nethercote
a179a53565
Use Session::diagnostic
in more places.
2023-12-02 09:01:35 +11:00
Nicholas Nethercote
5d1d384443
Rename HandlerInner::delay_span_bug
as HandlerInner::span_delayed_bug
.
...
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug`
follows the pattern used everywhere else: `span_err`, `span_warning`,
etc.
2023-12-02 09:01:19 +11:00
León Orell Valerian Liehr
16c164fea3
Detect and reject malformed repr(Rust) hints
2023-11-27 12:29:21 +01:00
Nilstrieb
21a870515b
Fix clippy::needless_borrow
in the compiler
...
`x clippy compiler -Aclippy::all -Wclippy::needless_borrow --fix`.
Then I had to remove a few unnecessary parens and muts that were exposed
now.
2023-11-21 20:13:40 +01:00
David Tolnay
8b8906b264
Add method for checking if deprecation is a rustc version
2023-10-30 17:13:38 -07:00
David Tolnay
dccf10e989
Descriptive variant name deprecation versions outside the standard library
2023-10-30 17:13:26 -07:00
David Tolnay
e8868af75b
Represent absence of 'since' attribute as a variant of DeprecatedSince
2023-10-30 16:46:02 -07:00
David Tolnay
c52367276d
Preserve deprecation attribute even if 'since' version is missing
2023-10-30 15:48:46 -07:00
David Tolnay
b106167673
Add a DeprecatedSince::Err variant for versions that fail to parse
2023-10-30 15:41:18 -07:00
David Tolnay
1e10fe9eb6
Move deprecation_in_effect to inherent method on Deprecation
2023-10-30 09:02:32 -07:00
David Tolnay
2fe7d17bd9
Store version of deprecated
attribute in structured form
2023-10-29 22:42:32 -07:00
David Tolnay
1e5b2da94b
Rename Since -> StableSince in preparation for a DeprecatedSince
2023-10-29 21:39:57 -07:00
David Tolnay
b7debe34e6
Parse rustc version at compile time
2023-10-26 18:55:05 -07:00
David Tolnay
ac4fa3f245
Pre-intern a symbol for env!("CFG_RELEASE")
2023-10-26 02:02:22 -07:00
David Tolnay
1a9ea1f1a5
Expose a non-Symbol way to access current rustc version string
2023-10-24 18:11:20 -07:00
David Tolnay
51f7fbab92
CFG_RELEASE is mandatory, no need for option_env
...
The same file already contains another env!("CFG_RELEASE") on line 632,
so it's impossible for this crate to compile without CFG_RELEASE set.
2023-10-24 18:04:47 -07:00
David Tolnay
6933a671d3
Handle structured stable attribute 'since' version in rustdoc
2023-10-24 17:34:59 -07:00
David Tolnay
ddcb1833ff
Keep track of #[stable] attribute even if version cannot be parsed
2023-10-24 15:50:23 -07:00