about summary refs log tree commit diff
path: root/compiler/rustc_attr/src
AgeCommit message (Collapse)AuthorLines
2023-07-29Allow explicit `#[repr(Rust)]`Catherine Flores-0/+2
2023-07-16Add infrastructure `#[rustc_confusables]` attribute to allow targeted许杰友 Jieyou Xu (Joe)-0/+17
"no method" errors on standard library types The standard library developer can annotate methods on e.g. `BTreeSet::push` with `#[rustc_confusables("insert")]`. When the user mistypes `btreeset.push()`, `BTreeSet::insert` will be suggested if there are no other candidates to suggest.
2023-05-17Only depend on CFG_VERSION in rustc_interfacejyn-2/+1
this avoids having to rebuild the whole compiler on each commit when `omit-git-hash = false`.
2023-05-05Improve check-cfg diagnostics (part 2)Urgau-2/+5
2023-05-05Improve check-cfg diagnostics (part 1)Urgau-1/+1
2023-05-05Improve internal representation of check-cfgUrgau-18/+16
This is done to simplify to relationship between names() and values() but also make thing clearer (having an Any to represent that any values are allowed) but also to allow the (none) + values expected cases that wasn't possible before.
2023-05-03Restrict `From<S>` for `{D,Subd}iagnosticMessage`.Nicholas Nethercote-1/+1
Currently a `{D,Subd}iagnosticMessage` can be created from any type that impls `Into<String>`. That includes `&str`, `String`, and `Cow<'static, str>`, which are reasonable. It also includes `&String`, which is pretty weird, and results in many places making unnecessary allocations for patterns like this: ``` self.fatal(&format!(...)) ``` This creates a string with `format!`, takes a reference, passes the reference to `fatal`, which does an `into()`, which clones the reference, doing a second allocation. Two allocations for a single string, bleh. This commit changes the `From` impls so that you can only create a `{D,Subd}iagnosticMessage` from `&str`, `String`, or `Cow<'static, str>`. This requires changing all the places that currently create one from a `&String`. Most of these are of the `&format!(...)` form described above; each one removes an unnecessary static `&`, plus an allocation when executed. There are also a few places where the existing use of `&String` was more reasonable; these now just use `clone()` at the call site. As well as making the code nicer and more efficient, this is a step towards possibly using `Cow<'static, str>` in `{D,Subd}iagnosticMessage::{Str,Eager}`. That would require changing the `From<&'a str>` impls to `From<&'static str>`, which is doable, but I'm not yet sure if it's worthwhile.
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-03-27Bless tidyMaybe Waffle-2/+2
2023-03-24Adjust documentation.Camille GILLOT-14/+18
2023-03-23Separate find_*_stability.Camille GILLOT-113/+93
2023-03-23Extract parse_stability and parse_unstability.Camille GILLOT-205/+224
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-4/+4
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-02-22errors: generate typed identifiers in each crateDavid Wood-9/+15
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-16Add feature gate for non_lifetime_bindersMichael Goulet-1/+1
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-3/+3
Convert all the crates that have had their diagnostic migration completed (except save_analysis because that will be deleted soon and apfloat because of the licensing problem).
2022-12-06`rustc_attr` remove `ref` patternsMaybe Waffle-65/+69
...and some if-let-elses too :P
2022-11-28Rename `NestedMetaItem::[Ll]iteral` as `NestedMetaItem::[Ll]it`.Nicholas Nethercote-8/+6
We already use a mix of `Literal` and `Lit`. The latter is better because it is shorter without causing any ambiguity.
2022-11-28Rename `ast::Lit` as `ast::MetaItemLit`.Nicholas Nethercote-5/+7
2022-11-27Prefer doc comments over `//`-comments in compilerMaybe Waffle-2/+2
2022-10-23Migrate all diagnosticsNilstrieb-47/+43
2022-09-26remove cfg(bootstrap)Pietro Albini-1/+0
2022-09-21FIX - adopt new Diagnostic naming in newly migrated modulesJhonny Bill Mena-2/+1
FIX - ambiguous Diagnostic link in docs UPDATE - rename diagnostic_items to IntoDiagnostic and AddToDiagnostic [Gardening] FIX - formatting via `x fmt` FIX - rebase conflicts. NOTE: Confirm wheather or not we want to handle TargetDataLayoutErrorsWrapper this way DELETE - unneeded allow attributes in Handler method FIX - broken test FIX - Rebase conflict UPDATE - rename residual _SessionDiagnostic and fix LintDiag link
2022-09-21UPDATE - rename SessionSubdiagnostic macro to SubdiagnosticJhonny Bill Mena-2/+2
Also renames: - sym::AddSubdiagnostic to sym:: Subdiagnostic - rustc_diagnostic_item = "AddSubdiagnostic" to rustc_diagnostic_item = "Subdiagnostic"
2022-09-21UPDATE - rename DiagnosticHandler macro to DiagnosticJhonny Bill Mena-30/+30
2022-09-21UPDATE - rename DiagnosticHandler trait to IntoDiagnosticJhonny Bill Mena-34/+34
2022-09-21UPDATE - move SessionDiagnostic from rustc_session to rustc_errorsJhonny Bill Mena-1/+1
2022-09-15Only enable the let_else feature on bootstrapest31-1/+1
On later stages, the feature is already stable. Result of running: rg -l "feature.let_else" compiler/ src/librustdoc/ library/ | xargs sed -s -i "s#\\[feature.let_else#\\[cfg_attr\\(bootstrap, feature\\(let_else\\)#"
2022-09-14Also replace the placeholder for the stable_features lintest31-3/+7
2022-09-07Rollup merge of #101486 - asquared31415:invalid_repr_list, r=estebankYuki Okushi-12/+10
Add list of recognized repr attributes to the unrecognized repr error
2022-09-06add list of recognized repr attributes to the unrecognized repr errorasquared31415-12/+10
2022-09-05UPDATE - accept start_point and snippet instead of SourceMapJhonny Bill Mena-6/+6
2022-09-05[Gardening] UPDATE - tidy fixesJhonny Bill Mena-2/+7
2022-09-05UPDATE - avoid exposing source_map methods from HandlerJhonny Bill Mena-7/+6
2022-09-05UPDATE - into_diagnostic to take a Handler instead of a ParseSessJhonny Bill Mena-7/+11
Suggested by the team in this Zulip Topic https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/.23100717.20SessionDiagnostic.20on.20Handler Handler already has almost all the capabilities of ParseSess when it comes to diagnostic emission, in this migration we only needed to add the ability to access source_map from the emitter in order to get a Snippet and the start_point. Not sure if this is the best way to address this gap
2022-09-02Also replace the version placeholder in rustc_attrest31-0/+12
This fixes rustdoc not showing the current version as stabilization version for recently stabilized lang features.
2022-08-29Revert let_chains stabilizationNilstrieb-0/+1
This reverts commit 326646074940222d602f3683d0559088690830f4. This is the revert against master, the beta revert was already done in #100538.
2022-08-27use smaller span for suggestionsTakayuki Maeda-8/+6
2022-08-22Move `LitKind` logic to `session_diagnostics` moduleHampus Lidin-18/+22
2022-08-22Change to `diag` attributesHampus Lidin-29/+30
2022-08-22Reorder diagnostics in code order, then alphabetical orderHampus Lidin-113/+233
2022-08-22Refactor remaining diagnosticsHampus Lidin-102/+63
2022-08-22Refactor additional diagnostics in `rustc_attr`Hampus Lidin-38/+80
2022-08-22Add internal diagnistics lintsHampus Lidin-0/+2
2022-08-22Refactor more diagnostics in `rustc_attr`Hampus Lidin-48/+21
2022-08-22Refactor diagnostics in `handle_errors` functionHampus Lidin-31/+224
2022-08-12Adjust cfgsMark Rousskov-1/+0
2022-07-31Panic when checking an unknown stability attributeMaybe Waffle-1/+3
2022-07-26Implement `#[rustc_default_body_unstable]`Maybe Waffle-5/+26
This attribute allows to mark default body of a trait function as unstable. This means that implementing the trait without implementing the function will require enabling unstable feature. This is useful in conjunction with `#[rustc_must_implement_one_of]`, we may want to relax requirements for a trait, for example allowing implementing either of `PartialEq::{eq, ne}`, but do so in a safe way -- making implementation of only `PartialEq::ne` unstable.