summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/asm.rs
AgeCommit message (Collapse)AuthorLines
2024-08-24Rollup merge of #129246 - BoxyUwU:feature_gate_const_arg_path, r=cjgillotMatthias Krüger-1/+3
Retroactively feature gate `ConstArgKind::Path` This puts the lowering introduced by #125915 under a feature gate until we fix the regressions introduced by it. Alternative to whole sale reverting the PR since it didn't seem like a very clean revert and I think this is generally a step in the right direction and don't want to get stuck landing and reverting the PR over and over :) cc #129137 ``@camelid,`` tests taken from there. beta is branching soon so I think it makes sense to not try and rush that fix through since it wont have much time to bake and if it has issues we can't simply revert it on beta. Fixes #128016
2024-08-21Use bool in favor of Option<()> for diagnosticsMichael Goulet-3/+2
2024-08-19Retroactively feature gate `ConstArgKind::Path`Boxy-1/+3
2024-08-13stabilize `asm_const`Folkert-14/+3
2024-08-10rustc_ast_lowering: make asm-related unstability messages translatablePavel Grigorenko-7/+14
2024-07-29Reformat `use` declarations.Nicholas Nethercote-12/+12
The previous commit updated `rustfmt.toml` appropriately. This commit is the outcome of running `x fmt --all` with the new formatting options.
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-7/+10
This is a very large commit since a lot needs to be changed in order to make the tests pass. The salient changes are: - `ConstArgKind` gets a new `Path` variant, and all const params are now represented using it. Non-param paths still use `ConstArgKind::Anon` to prevent this change from getting too large, but they will soon use the `Path` variant too. - `ConstArg` gets a distinct `hir_id` field and its own variant in `hir::Node`. This affected many parts of the compiler that expected the parent of an `AnonConst` to be the containing context (e.g., an array repeat expression). They have been changed to check the "grandparent" where necessary. - Some `ast::AnonConst`s now have their `DefId`s created in rustc_ast_lowering rather than `DefCollector`. This is because in some cases they will end up becoming a `ConstArgKind::Path` instead, which has no `DefId`. We have to solve this in a hacky way where we guess whether the `AnonConst` could end up as a path const since we can't know for sure until after name resolution (`N` could refer to a free const or a nullary struct). If it has no chance as being a const param, then we create a `DefId` in `DefCollector` -- otherwise we decide during ast_lowering. This will have to be updated once all path consts use `ConstArgKind::Path`. - We explicitly use `ConstArgHasType` for array lengths, rather than implicitly relying on anon const type feeding -- this is due to the addition of `ConstArgKind::Path`. - Some tests have their outputs changed, but the changes are for the most part minor (including removing duplicate or almost-duplicate errors). One test now ICEs, but it is for an incomplete, unstable feature and is now tracked at #127009.
2024-07-16Setup ast_lowering functions for `ConstArg`Noah Lev-2/+2
2024-07-16Add `current_def_id_parent` to `LoweringContext`Noah Lev-2/+2
This is needed to track anon const parents properly once we implement `ConstArgKind::Path` (which requires moving anon const def-creation outside of `DefCollector`): Why do we need this in addition to [`Self::current_hir_id_owner`]? Currently (as of June 2024), anonymous constants are not HIR owners; however, they do get their own DefIds. Some of these DefIds have to be created during AST lowering, rather than def collection, because we can't tell until after name resolution whether an anonymous constant will end up instead being a [`rustc_hir::ConstArgKind::Path`]. However, to compute which generics are available to an anonymous constant nested inside another, we need to make sure that the parent is recorded as the parent anon const, not the enclosing item. So we need to track parent defs differently from HIR owners, since they will be finer-grained in the case of anon consts.
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-1/+1
2024-03-08Rollup merge of #119365 - nbdd0121:asm-goto, r=AmanieuMatthias Krüger-4/+23
Add asm goto support to `asm!` Tracking issue: #119364 This PR implements asm-goto support, using the syntax described in "future possibilities" section of [RFC2873](https://rust-lang.github.io/rfcs/2873-inline-asm.html#asm-goto). Currently I have only implemented the `label` part, not the `fallthrough` part (i.e. fallthrough is implicit). This doesn't reduce the expressive though, since you can use label-break to get arbitrary control flow or simply set a value and rely on jump threading optimisation to get the desired control flow. I can add that later if deemed necessary. r? ``@Amanieu`` cc ``@ojeda``
2024-03-06Rewrite the `untranslatable_diagnostic` lint.Nicholas Nethercote-0/+1
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-02-24Add asm label support to AST and HIRGary Guo-4/+23
2024-02-07No need to take ImplTraitContext by refMichael Goulet-1/+1
2024-01-13Add check for ui_testing via promoting parameters from `ParseSess` to `Session`George-lewis-9/+4
2023-12-24Remove `Session` methods that duplicate `DiagCtxt` methods.Nicholas Nethercote-12/+16
Also add some `dcx` methods to types that wrap `TyCtxt`, for easier access.
2023-12-15Annotate some more bugsMichael Goulet-2/+2
2023-12-03rustc: Harmonize `DefKind` and `DefPathData`Vadim Petrochenkov-2/+2
`DefPathData::(ClosureExpr,ImplTrait)` are renamed to match `DefKind::(Closure,OpaqueTy)`. `DefPathData::ImplTraitAssocTy` is replaced with `DefPathData::TypeNS(kw::Empty)` because both correspond to `DefKind::AssocTy`. It's possible that introducing `(DefKind,DefPathData)::AssocOpaqueTy` could be a better solution, but that would be a much more invasive change. Const generic parameters introduced for effects are moved from `DefPathData::TypeNS` to `DefPathData::ValueNS`, because constants are values. `DefPathData` is no longer passed to `create_def` functions to avoid redundancy.
2023-12-02Avoid per-register closure expansionsMark Rousskov-58/+63
2023-12-02Auto merge of #117912 - GeorgeWort:master, r=petrochenkovbors-6/+15
Name explicit registers in conflict register errors for inline assembly
2023-11-28resolve: Feed the `def_kind` query immediately on `DefId` creationVadim Petrochenkov-0/+1
2023-11-28Name explicit registers in conflict register errors for inline assemblyGeorge Wort-6/+15
2023-08-06lower impl const to bind to host effect paramDeadbeef-0/+1
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-3/+4
2023-05-08asm: Stabilize loongarch64WANG Rui-0/+1
2023-01-05Fix `uninlined_format_args` for some compiler cratesnils-2/+2
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-01Fill in `def_span` when creating def ids.Oli Scherer-1/+6
This makes sure that ICEing because of def ids created outside of ast lowering will be able to produce a query backtrace and not cause a double panic because of trying to call the `def_span` query
2022-11-22`rustc_ast_lowering`: remove `ref` patternsMaybe Waffle-17/+15
2022-11-15Make clobber_abis use an FxIndexMapCastilloDel-2/+2
It seems to be used more for lookup than iteration, so this could be a perf hit
2022-10-17Stabilize asm_symAmanieu d'Antras-10/+0
2022-10-11rustc_hir: Less error-prone methods for accessing `PartialRes` resolutionVadim Petrochenkov-7/+4
2022-09-24separate definitions and `HIR` ownersTakayuki Maeda-1/+1
fix a ui test use `into` fix clippy ui test fix a run-make-fulldeps test implement `IntoQueryParam<DefId>` for `OwnerId` use `OwnerId` for more queries change the type of `ParentOwnerIterator::Item` to `(OwnerId, OwnerNode)`
2022-09-14Pass ImplTraitContext as &, there's no need for that to be &mutSantiago Pastorino-1/+1
2022-09-06Pass ImplTraitContext as &mut to avoid the need of ↵Santiago Pastorino-1/+1
ImplTraitContext::reborrow later on
2022-08-29Use `&'hir Expr` everywhere.Nicholas Nethercote-5/+5
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-22Changes made in response to feedbackJean CASPAR-8/+14
2022-08-22Migrate ast_lowering::ast to SessionDiagnosticJean CASPAR-99/+62
2022-07-20Remove unused StableMap and StableSet types from rustc_data_structuresMichael Woerister-2/+1
2022-07-18avoid `Symbol` to `&str` conversionsTakayuki Maeda-2/+2
2022-07-06Remove `sess` field from LoweringContext.Camille GILLOT-23/+31
2022-06-14Separate `source_span` and `expn_that_defined` from `Definitions`.Camille GILLOT-8/+2
2022-06-14Do not modify the resolver outputs.Camille GILLOT-1/+1
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-2/+2
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-1/+5
2022-04-14Reimplement lowering of sym operands for asm! so that it also works with ↵Amanieu d'Antras-5/+60
global_asm!
2022-02-21Take CodegenFnAttrs into account when validating asm! register operandsAmanieu d'Antras-21/+7
Checking of asm! register operands now properly takes function attributes such as #[target_feature] and #[instruction_set] into account.
2022-02-21On ARM, use relocation_model to detect whether r9 should be reservedAmanieu d'Antras-0/+2
The previous approach of checking for the reserve-r9 target feature didn't actually work because LLVM only sets this feature very late when initializing the per-function subtarget.
2022-02-20Rollup merge of #94146 - est31:let_else, r=cjgillotMatthias Krüger-3/+2
Adopt let else in more places Continuation of #89933, #91018, #91481, #93046, #93590, #94011. I have extended my clippy lint to also recognize tuple passing and match statements. The diff caused by fixing it is way above 1 thousand lines. Thus, I split it up into multiple pull requests to make reviewing easier. This is the biggest of these PRs and handles the changes outside of rustdoc, rustc_typeck, rustc_const_eval, rustc_trait_selection, which were handled in PRs #94139, #94142, #94143, #94144.
2022-02-19Adopt let else in more placesest31-3/+2
2022-02-18asm: Allow the use of r8-r14 as clobbers on Thumb1Amanieu d'Antras-5/+6
Previously these were entirely disallowed, except for r11 which was allowed by accident.