summary refs log tree commit diff
path: root/compiler/rustc_middle/src/middle
AgeCommit message (Collapse)AuthorLines
2024-12-19Make DependencyList an IndexVecbjorn3-3/+3
2024-12-19Rename Scope.id to Scope.local_id, remove trivial accessorMichael Goulet-21/+11
2024-12-18Re-export more `rustc_span::symbol` things from `rustc_span`.Nicholas Nethercote-6/+4
`rustc_span::symbol` defines some things that are re-exported from `rustc_span`, such as `Symbol` and `sym`. But it doesn't re-export some closely related things such as `Ident` and `kw`. So you can do `use rustc_span::{Symbol, sym}` but you have to do `use rustc_span::symbol::{Ident, kw}`, which is inconsistent for no good reason. This commit re-exports `Ident`, `kw`, and `MacroRulesNormalizedIdent`, and changes many `rustc_span::symbol::` qualifiers in `compiler/` to `rustc_span::`. This is a 200+ net line of code reduction, mostly because many files with two `use rustc_span` items can be reduced to one.
2024-12-16rename rustc_attr to rustc_attr_parsing and create rustc_attr_data_structuresJonathan Dönszelmann-2/+2
2024-12-16split attributesJonathan Dönszelmann-2/+2
2024-12-15Add hir::AttributeJonathan Dönszelmann-12/+20
2024-12-13Make dependency_formats an FxIndexMap rather than a list of tuplesbjorn3-1/+2
It is treated as a map already. This is using FxIndexMap rather than UnordMap because the latter doesn't provide an api to pick a single value iff all values are equal, which each_linked_rlib depends on.
2024-11-22Pretty print AsyncFn traits tooMichael Goulet-0/+11
2024-11-20reduce false positives of tail-expr-drop-order from consumed valuesDing Xiang Fei-0/+5
take 2 open up coroutines tweak the wordings the lint works up until 2021 We were missing one case, for ADTs, which was causing `Result` to yield incorrect results. only include field spans with significant types deduplicate and eliminate field spans switch to emit spans to impl Drops Co-authored-by: Niko Matsakis <nikomat@amazon.com> collect drops instead of taking liveness diff apply some suggestions and add explantory notes small fix on the cache let the query recurse through coroutine new suggestion format with extracted variable name fine-tune the drop span and messages bugfix on runtime borrows tweak message wording filter out ecosystem types earlier apply suggestions clippy check lint level at session level further restrict applicability of the lint translate bid into nop for stable mir detect cycle in type structure
2024-11-18stability: remove skip_stability_check_due_to_privacyRalf Jung-28/+1
2024-11-04Rollup merge of #132544 - dianne:unstable-library-feature-backticks, ↵Matthias Krüger-2/+2
r=compiler-errors Use backticks instead of single quotes for library feature names in diagnostics This PR changes the text of library feature errors for using unstable or body-unstable items. Displaying library feature names in backticks is consistent with other diagnostics (e.g. those from `rustc_passes`) and with the `reason`s on unstable attributes in the library. Additionally, this simplifies diagnostics when supporting multiple unstable attributes on items (see #131824) since `DiagSymbolList` also displays symbols using backticks.
2024-11-03use backticks instead of single quotes when reporting "use of unstable ↵dianne-2/+2
library feature" This is consistent with all other diagnostics I could find containing features and enables the use of `DiagSymbolList` for generalizing diagnostics for unstable library features to multiple features.
2024-11-03compiler: Directly use rustc_abi in metadata and middleJubilee Young-1/+1
Stop reexporting ReprOptions from middle::ty
2024-10-30Remap impl-trait lifetimes on HIR instead of AST lowering.Camille GILLOT-1/+3
2024-10-28fix clippy::clone_on_ref_ptr for compilerklensy-1/+1
2024-10-22terminology: #[feature] *enables* a feature (instead of "declaring" or ↵Ralf Jung-4/+4
"activating" it)
2024-10-04Simplify bound var resolution.Camille GILLOT-5/+5
2024-09-29cleanup: don't clone types that are CopyMatthias Krüger-1/+1
2024-09-22Reformat using the new identifier sorting from rustfmtMichael Goulet-7/+7
2024-09-21remove `#[cmse_nonsecure_entry]`Folkert-3/+1
2024-09-13Auto merge of #107251 - dingxiangfei2009:let-chain-rescope, r=jieyouxubors-0/+6
Rescope temp lifetime in if-let into IfElse with migration lint Tracking issue #124085 This PR shortens the temporary lifetime to cover only the pattern matching and consequent branch of a `if let`. At the expression location, means that the lifetime is shortened from previously the deepest enclosing block or statement in Edition 2021. This warrants an Edition change. Coming with the Edition change, this patch also implements an edition lint to warn about the change and a safe rewrite suggestion to preserve the 2021 semantics in most cases. Related to #103108. Related crater runs: https://github.com/rust-lang/rust/pull/129466.
2024-09-11Simplify some nested if statementsMichael Goulet-4/+5
2024-09-11rescope temp lifetime in let-chain into IfElseDing Xiang Fei-0/+6
apply rules by span edition
2024-09-01Revert "Auto merge of #127537 - veluca93:struct_tf, r=BoxyUwU"Jakub Beránek-4/+4
This reverts commit acb4e8b6251f1d8da36f08e7a70fa23fc581839e, reversing changes made to 100fde5246bf56f22fb5cc85374dd841296fce0e.
2024-08-28Implement RFC 3525.Luca Versari-4/+4
2024-08-22Use a LocalDefId in ResolvedArg.Camille GILLOT-4/+4
2024-08-07Hide implicit target features from diagnostics when possibleCaleb Zulawski-1/+10
2024-07-29Reformat `use` declarations.Nicholas Nethercote-22/+29
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-19Avoid ref when using format! in compilerYuri Astrakhan-1/+1
Clean up a few minor refs in `format!` macro, as it has a performance cost. Apparently the compiler is unable to inline `format!("{}", &variable)`, and does a run-time double-reference instead (format macro already does one level referencing). Inlining format args prevents accidental `&` misuse.
2024-07-05Rollup merge of #124290 - klensy:dep-format, r=jieyouxuGuillaume Gomez-3/+3
DependencyList: removed outdated comment Comment was outdated. Didn't updated description, as `Linkage` enum have descriptive names. Also added fixme about moving this file to rustc_metadata.
2024-07-03Rollup merge of #127145 - compiler-errors:as_lang_item, r=lcnrMatthias Krüger-0/+4
Add `as_lang_item` to `LanguageItems`, new trait solver Add `as_lang_item` which turns `DefId` into a `TraitSolverLangItem` in the new trait solver, so we can turn the large chain of if statements in `assemble_builtin_impl_candidates` into a match instead. r? lcnr
2024-07-02add TyCtxt::as_lang_item, use in new solverMichael Goulet-0/+4
2024-07-02Re-implement a type-size based limitMichael Goulet-1/+1
2024-06-28Rollup merge of #124741 - nebulark:patchable-function-entries-pr, ↵Matthias Krüger-0/+27
r=estebank,workingjubilee patchable-function-entry: Add unstable compiler flag and attribute Tracking issue: #123115 Add the -Z patchable-function-entry compiler flag and the #[patchable_function_entry(prefix_nops = m, entry_nops = n)] attribute. Rebased and adjusted the canditate implementation to match changes in the RFC.
2024-06-26coverage: Detach `#[coverage(..)]` from codegen attribute handlingZalathar-4/+1
2024-06-25Support `#[patchable_function_entries]`Matthew Maurer-0/+4
See [RFC](https://github.com/maurer/rust-rfcs/blob/patchable-function-entry/text/0000-patchable-function-entry.md) (yet to be numbered) TODO before submission: * Needs an RFC * Improve error reporting for malformed attributes
2024-06-25Support for -Z patchable-function-entryMatthew Maurer-0/+23
`-Z patchable-function-entry` works like `-fpatchable-function-entry` on clang/gcc. The arguments are total nop count and function offset. See MCP rust-lang/compiler-team#704
2024-06-20Add blank lines after module-level `//!` comments.Nicholas Nethercote-0/+1
Most modules have such a blank line, but some don't. Inserting the blank line makes it clearer that the `//!` comments are describing the entire module, rather than the `use` declaration(s) that immediately follows.
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-1/+1
2024-06-16Rename InstanceDef -> InstanceKindMichael Goulet-1/+1
2024-06-14Add TyCtxt::is_lang_itemMichael Goulet-0/+4
2024-05-27Auto merge of #125410 - fmease:adj-lint-diag-api, r=nnethercotebors-11/+10
[perf] Delay the construction of early lint diag structs Attacks some of the perf regressions from https://github.com/rust-lang/rust/pull/124417#issuecomment-2123700666. See individual commits for details. The first three commits are not strictly necessary. However, the 2nd one (06bc4fc67145e3a7be9b5a2cf2b5968cef36e587, *Remove `LintDiagnostic::msg`*) makes the main change way nicer to implement. It's also pretty sweet on its own if I may say so myself.
2024-05-23Remove `#[macro_use] extern crate tracing` from `rustc_middle`.Nicholas Nethercote-0/+2
2024-05-23Remove `LintDiagnostic::msg`León Orell Valerian Liehr-11/+10
* instead simply set the primary message inside the lint decorator functions * it used to be this way before [#]101986 which introduced `msg` to prevent good path delayed bugs (which no longer exist) from firing under certain circumstances when lints were suppressed / silenced * this is no longer necessary for various reasons I presume * it shaves off complexity and makes further changes easier to implement
2024-05-21Rename buffer_lint_with_diagnostic to buffer_lintXiretza-1/+1
2024-05-21Make early lints translatableXiretza-14/+7
2024-05-21Port DeprecatedMacro to diag structsXiretza-85/+103
2024-05-21Generate lint diagnostic message from BuiltinLintDiagXiretza-2/+2
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-01add fixmeklensy-0/+3
2024-05-01DependencyList: remove outdated commentklensy-3/+0