about summary refs log tree commit diff
path: root/compiler/rustc_passes
AgeCommit message (Collapse)AuthorLines
2023-12-22Auto merge of #119097 - nnethercote:fix-EmissionGuarantee, r=compiler-errorsbors-46/+28
Fix `EmissionGuarantee` There are some problems with the `DiagCtxt` API related to `EmissionGuarantee`. This PR fixes them. r? `@compiler-errors`
2023-12-19Add `level` arg to `into_diagnostic`.Nicholas Nethercote-46/+28
And make all hand-written `IntoDiagnostic` impls generic, by using `DiagnosticBuilder::new(dcx, level, ...)` instead of e.g. `dcx.struct_err(...)`. This means the `create_*` functions are the source of the error level. This change will let us remove `struct_diagnostic`. Note: `#[rustc_lint_diagnostics]` is added to `DiagnosticBuilder::new`, it's necessary to pass diagnostics tests now that it's used in `into_diagnostic` functions.
2023-12-18Replace some instances of FxHashMap/FxHashSet with stable alternatives ↵Michael Woerister-3/+0
(mostly in rustc_hir and rustc_ast_lowering) Part of https://github.com/rust-lang/compiler-team/issues/533
2023-12-18Rename many `DiagCtxt` arguments.Nicholas Nethercote-10/+10
2023-12-18Rename `Handler` as `DiagCtxt`.Nicholas Nethercote-5/+5
2023-12-15Fix enforcement of generics for associated itemsMichael Goulet-19/+27
2023-12-15banish hir::GenericBound::LangItemTraitMichael Goulet-1/+1
2023-12-15Collect lang items from ASTMichael Goulet-155/+245
2023-12-13Auto merge of #118870 - Enselic:rustc_passes-query-stability, r=compiler-errorsbors-1/+10
rustc_passes: Enforce `rustc::potential_query_instability` lint Stop allowing `rustc::potential_query_instability` in all of `rustc_passes` and instead allow it on a case-by-case basis if it is safe. In this case, all instances of the lint are safe to allow. Part of https://github.com/rust-lang/rust/issues/84447 which is E-help-wanted.
2023-12-12Move some methods from `tcx.hir()` to `tcx`zetanumbers-22/+21
Renamings: - find -> opt_hir_node - get -> hir_node - find_by_def_id -> opt_hir_node_by_def_id - get_by_def_id -> hir_node_by_def_id Fix rebase changes using removed methods Use `tcx.hir_node_by_def_id()` whenever possible in compiler Fix clippy errors Fix compiler Apply suggestions from code review Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com> Add FIXME for `tcx.hir()` returned type about its removal Simplify with with `tcx.hir_node_by_def_id`
2023-12-12rustc_passes: Enforce `rustc::potential_query_instability` lintMartin Nordholts-1/+10
Stop allowing `rustc::potential_query_instability` in all of `rustc_passes` and instead allow it on a case-by-case basis if it is safe. In this case, all instances of the lint are safe to allow.
2023-12-05Remove `#[rustc_host]`, use internal desugaringDeadbeef-2/+7
2023-12-02Rename `HandlerInner::delay_span_bug` as `HandlerInner::span_delayed_bug`.Nicholas Nethercote-2/+2
Because the corresponding `Level` is `DelayedBug` and `span_delayed_bug` follows the pattern used everywhere else: `span_err`, `span_warning`, etc.
2023-11-29Rollup merge of #118157 - Nadrieril:never_pat-feature-gate, r=compiler-errorsMatthias Krüger-1/+16
Add `never_patterns` feature gate This PR adds the feature gate and most basic parsing for the experimental `never_patterns` feature. See the tracking issue (https://github.com/rust-lang/rust/issues/118155) for details on the experiment. `@scottmcm` has agreed to be my lang-team liaison for this experiment.
2023-11-29Add `never_patterns` feature gateNadrieril-1/+16
2023-11-28Yeet E0744Michael Goulet-14/+4
2023-11-26rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` ↵Vadim Petrochenkov-14/+12
cleanup
2023-11-26Use `rustc_fluent_macro::fluent_messages!` directly.Nicholas Nethercote-2/+1
Currently we always do this: ``` use rustc_fluent_macro::fluent_messages; ... fluent_messages! { "./example.ftl" } ``` But there is no need, we can just do this everywhere: ``` rustc_fluent_macro::fluent_messages! { "./example.ftl" } ``` which is shorter.
2023-11-26Avoid need for `{D,Subd}iagnosticMessage` imports.Nicholas Nethercote-1/+0
The `fluent_messages!` macro produces uses of `crate::{D,Subd}iagnosticMessage`, which means that every crate using the macro must have this import: ``` use rustc_errors::{DiagnosticMessage, SubdiagnosticMessage}; ``` This commit changes the macro to instead use `rustc_errors::{D,Subd}iagnosticMessage`, which avoids the need for the imports.
2023-11-22Replace `custom_encodable` with `encodable`.Nicholas Nethercote-1/+0
By default, `newtype_index!` types get a default `Encodable`/`Decodable` impl. You can opt out of this with `custom_encodable`. Opting out is the opposite to how Rust normally works with autogenerated (derived) impls. This commit inverts the behaviour, replacing `custom_encodable` with `encodable` which opts into the default `Encodable`/`Decodable` impl. Only 23 of the 59 `newtype_index!` occurrences need `encodable`. Even better, there were eight crates with a dependency on `rustc_serialize` just from unused default `Encodable`/`Decodable` impls. This commit removes that dependency from those eight crates.
2023-11-22Auto merge of #117928 - nnethercote:rustc_ast_pretty, r=fee1-deadbors-1/+1
`rustc_ast_pretty` cleanups Some improvements I found while looking at this code. r? `@fee1-dead`
2023-11-22Update itertools to 0.11.Nicholas Nethercote-1/+1
Because the API for `with_position` improved in 0.11 and I want to use it.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-104/+104
`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-20Store feature stability un-splitMichael Goulet-31/+23
2023-11-20Unify defined_lib_features and lib_features queriesMichael Goulet-44/+48
2023-11-15Re-format code with new rustfmtMark Rousskov-1/+4
2023-11-15Bump cfg(bootstrap)sMark Rousskov-3/+3
2023-11-14Fix some typoscui fliter-1/+1
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-11-04Remove support for compiler plugins.Nicholas Nethercote-19/+0
They've been deprecated for four years. This commit includes the following changes. - It eliminates the `rustc_plugin_impl` crate. - It changes the language used for lints in `compiler/rustc_driver_impl/src/lib.rs` and `compiler/rustc_lint/src/context.rs`. External lints are now called "loaded" lints, rather than "plugins" to avoid confusion with the old plugins. This only has a tiny effect on the output of `-W help`. - E0457 and E0498 are no longer used. - E0463 is narrowed, now only relating to unfound crates, not plugins. - The `plugin` feature was moved from "active" to "removed". - It removes the entire plugins chapter from the unstable book. - It removes quite a few tests, mostly all of those in `tests/ui-fulldeps/plugin/`. Closes #29597.
2023-10-31Enums in offset_of: update based on est31, scottmcm & llogiq reviewGeorge Bateman-20/+5
2023-10-31Support enum variants in offset_of!George Bateman-7/+22
2023-10-31Auto merge of #117377 - dtolnay:deprecatedsince, r=cjgillotbors-55/+15
Store #[deprecated] attribute's `since` value in parsed form This PR implements the first followup bullet listed in https://github.com/rust-lang/rust/pull/117148#issue-1960240108. We centralize error handling to the attribute parsing code in `compiler/rustc_attr/src/builtin.rs`, and thereby remove some awkward error codepaths from later phases of compilation that had to make sense of these #\[deprecated\] attributes, namely `compiler/rustc_passes/src/stability.rs` and `compiler/rustc_middle/src/middle/stability.rs`.
2023-10-30Add method for checking if deprecation is a rustc versionDavid Tolnay-8/+2
2023-10-30Represent absence of 'since' attribute as a variant of DeprecatedSinceDavid Tolnay-2/+2
2023-10-30Rollup merge of #117390 - chenyukang:yukang-fix-117284-unused-macro, r=estebankGuillaume Gomez-11/+38
Fix unused variables lint issue for args in macro Fixes #117284 r? ````@estebank````
2023-10-30Fix #117284, Fix unused variables lint issue for args in macroyukang-11/+38
2023-10-29Delete unused InvalidDeprecationVersion diagnosticDavid Tolnay-15/+0
2023-10-29Store version of `deprecated` attribute in structured formDavid Tolnay-34/+15
2023-10-29Rename Since -> StableSince in preparation for a DeprecatedSinceDavid Tolnay-4/+4
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-9/+11
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-29Auto merge of #116447 - oli-obk:gen_fn, r=compiler-errorsbors-2/+2
Implement `gen` blocks in the 2024 edition Coroutines tracking issue https://github.com/rust-lang/rust/issues/43122 `gen` block tracking issue https://github.com/rust-lang/rust/issues/117078 This PR implements `gen` blocks that implement `Iterator`. Most of the logic with `async` blocks is shared, and thus I renamed various types that were referring to `async` specifically. An example usage of `gen` blocks is ```rust fn foo() -> impl Iterator<Item = i32> { gen { yield 42; for i in 5..18 { if i.is_even() { continue } yield i * 2; } } } ``` The limitations (to be resolved) of the implementation are listed in the tracking issue
2023-10-27Add gen blocks to ast and do some broken ast loweringOli Scherer-2/+2
2023-10-27Rollup merge of #116868 - estebank:suggestion, r=petrochenkovMatthias Krüger-6/+39
Tweak suggestion span for outer attr and point at item following invalid inner attr After: ``` error: `unix_sigpipe` attribute cannot be used at crate level --> $DIR/unix_sigpipe-crate.rs:2:1 | LL | #![unix_sigpipe = "inherit"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ LL | LL | fn main() {} | ------------ the inner attribute doesn't annotate this function | help: perhaps you meant to use an outer attribute | LL - #![unix_sigpipe = "inherit"] LL + #[unix_sigpipe = "inherit"] | ``` Before: ``` error: `unix_sigpipe` attribute cannot be used at crate level --> $DIR/unix_sigpipe-crate.rs:2:1 | LL | #![unix_sigpipe = "inherit"] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | help: perhaps you meant to use an outer attribute | LL | #[unix_sigpipe = "inherit"] | ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` CC #89566.
2023-10-26Tweak suggestion spans for invalid crate-level inner attributeEsteban Küber-6/+39
CC #89566.
2023-10-26Pre-intern a symbol for env!("CFG_RELEASE")David Tolnay-5/+5
2023-10-24Keep track of #[stable] attribute even if version cannot be parsedDavid Tolnay-0/+4
2023-10-24Store 'since' attribute as parsed VersionDavid Tolnay-44/+31
2023-10-20s/generator/coroutine/Oli Scherer-1/+1
2023-10-20s/Generator/Coroutine/Oli Scherer-2/+2
2023-10-19Rollup merge of #116829 - fmease:rust-aint-c, r=compiler-errorsLeón Orell Valerian Liehr-4/+18
Make `#[repr(Rust)]` incompatible with other (non-modifier) representation hints like `C` and `simd` Read more about this change here: https://github.com/rust-lang/rust/pull/116829#issuecomment-1768618240. Fixes [after backport] #116825.