about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src
AgeCommit message (Collapse)AuthorLines
2024-04-23delegation: Support async, const, extern "ABI" and C-variadic functionsVadim Petrochenkov-42/+77
Also allow `impl Trait` in delegated functions. The delegation item will refer to the original opaque type from the callee, fresh opaque type won't be created.
2024-04-21Pass translation closure to add_to_diag_with() as referenceXiretza-1/+1
2024-04-18Rollup merge of #123935 - tstsrt:fix-115423, r=oli-obkJubilee-77/+117
Don't inline integer literals when they overflow - new attempt Basically #116633 but I implemented the suggested changes. Fixes #115423. Fixes #116631. This is my first contribution to this repo so please let me know if I'm supposed to change something :)
2024-04-17Rename `BindingAnnotation` to `BindingMode`Jules Bertholet-18/+13
2024-04-17Rollup merge of #122813 - nnethercote:nicer-quals, r=compiler-errorsMatthias Krüger-27/+21
Qualifier tweaking Adding and removing qualifiers in some cases that make things nicer. Details in individual commits. r? `@compiler-errors`
2024-04-16Avoid lots of `hir::HirId{,Map,Set}` qualifiers.Nicholas Nethercote-27/+21
Because they're a bit redundant.
2024-04-15Use a path instead of an ident (and stop manually resolving)Michael Goulet-4/+7
2024-04-15Add hir::Node::PreciseCapturingNonLifetimeArgMichael Goulet-2/+23
2024-04-15Validation and other thingsMichael Goulet-5/+11
2024-04-15Lower and resolve precise captures in HIRMichael Goulet-16/+46
2024-04-15Use dedicated PreciseCapturingArg for representing what goes in use<>Michael Goulet-46/+43
2024-04-15Begin AST lowering for precise capturesMichael Goulet-29/+50
2024-04-15Parsing , pre-lowering support for precise capturesMichael Goulet-1/+2
2024-04-15Improve semantics of int_ty_max functionsninad-34/+26
2024-04-14store the span of the nested part of the use tree in the astPietro Albini-3/+3
2024-04-14Fix formattingninad-1/+3
2024-04-14Don't inline integer literals when out of rangeninad-77/+123
2024-04-08Actually create ranged int types in the type system.Oli Scherer-0/+4
2024-04-08Thread pattern types through the HIROli Scherer-1/+1
2024-04-08Add pattern types to astOli Scherer-1/+4
2024-04-04hir: Use `ItemLocalId` in a couple more placesVadim Petrochenkov-6/+5
2024-04-03Auto merge of #123429 - matthiaskrgr:rollup-4emw4e9, r=matthiaskrgrbors-8/+8
Rollup of 8 pull requests Successful merges: - #121595 (Better reporting on generic argument mismatchs) - #122619 (Fix some unsoundness with PassMode::Cast ABI) - #122964 (Rename `expose_addr` to `expose_provenance`) - #123291 (Move some tests) - #123301 (pattern analysis: fix union handling) - #123395 (More postfix match fixes) - #123419 (rustc_index: Add a `ZERO` constant to index types) - #123421 (Fix target name in NetBSD platform-support doc) r? `@ghost` `@rustbot` modify labels: rollup
2024-04-03rustc_index: Add a `ZERO` constant to index typesVadim Petrochenkov-8/+8
It is commonly used.
2024-04-03hir: Drop owner's own item-local id (zero) from parenting tablesVadim Petrochenkov-1/+3
2024-03-27Implement `mut ref`/`mut ref mut`Jules Bertholet-2/+2
2024-03-22Rename `hir::Node::Local` into `hir::Node::LetStmt`Guillaume Gomez-1/+1
2024-03-22Rename `hir::Local` into `hir::LetStmt`Guillaume Gomez-4/+4
2024-03-22Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgrbors-2/+5
Rollup of 9 pull requests Successful merges: - #121619 (Experimental feature postfix match) - #122370 (Gracefully handle `AnonConst` in `diagnostic_hir_wf_check()`) - #122537 (interpret/allocation: fix aliasing issue in interpreter and refactor getters a bit) - #122542 (coverage: Clean up marker statements that aren't needed later) - #122800 (Add `NonNull::<[T]>::is_empty`.) - #122820 (Stop using `<DefId as Ord>` in various diagnostic situations) - #122847 (Suggest `RUST_MIN_STACK` workaround on overflow) - #122855 (Fix Itanium mangling usizes) - #122863 (add more ice tests ) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-22Rollup merge of #121619 - RossSmyth:pfix_match, r=petrochenkovMatthias Krüger-2/+5
Experimental feature postfix match This has a basic experimental implementation for the RFC postfix match (rust-lang/rfcs#3295, #121618). [Liaison is](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/Postfix.20Match.20Liaison/near/423301844) ```@scottmcm``` with the lang team's [experimental feature gate process](https://github.com/rust-lang/lang-team/blob/master/src/how_to/experiment.md). This feature has had an RFC for a while, and there has been discussion on it for a while. It would probably be valuable to see it out in the field rather than continue discussing it. This feature also allows to see how popular postfix expressions like this are for the postfix macros RFC, as those will take more time to implement. It is entirely implemented in the parser, so it should be relatively easy to remove if needed. This PR is split in to 5 commits to ease review. 1. The implementation of the feature & gating. 2. Add a MatchKind field, fix uses, fix pretty. 3. Basic rustfmt impl, as rustfmt crashes upon seeing this syntax without a fix. 4. Add new MatchSource to HIR for Clippy & other HIR consumers
2024-03-22Update (doc) commentsLeón Orell Valerian Liehr-5/+6
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-0/+3
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.
2024-03-21Auto merge of #121587 - ShoyuVanilla:fix-issue-121267, r=TaKO8Kibors-27/+36
Fix bad span for explicit lifetime suggestions Fixes #121267 Current explicit lifetime suggestions are not showing correct spans for some lifetimes - e.g. elided lifetime generic parameters; This should be done correctly regarding elided lifetime kind like the following code https://github.com/rust-lang/rust/blob/43fdd4916d19f4004e23d422b5547637ad67ab21/compiler/rustc_resolve/src/late/diagnostics.rs#L3015-L3044
2024-03-21Fix bad span for explicit lifetime suggestionShoyu Vanilla-27/+36
Move verbose logic to a function Minor renaming
2024-03-20Rename `hir::Let` into `hir::LetExpr`Guillaume Gomez-1/+1
2024-03-19The AssocOpaqueTy HIR node is not actually needed to differentiate from ↵Oli Scherer-1/+1
other hir nodes that were fed
2024-03-18do not eat nested exprs result in format args visitorRémy Rakic-2/+1
2024-03-16Rollup merge of #122564 - Bryanskiy:delegation-fixes, r=compiler-errorsLeón Orell Valerian Liehr-8/+6
Delegation: fix ICE on duplicated associative items Currently, functions delegation is only supported for delegation items with early resolved paths e.g. free functions and trait methods. During name resolution, information about function signatures is collected, including the number of parameters and whether there are self arguments. This information is then used when lowering from a delegation item into a regular function(`rustc_ast_lowering/src/delegation.rs`). The signature is usually inherited from path resolution id(`path_id`). However, in the case of trait impls `path_id` and `item_id` may be different: ```rust trait Trait { fn foo(&self) -> u32 { 0 } } struct S; mod to_reuse { use crate::S; pub fn foo(_: &S) -> u32 { 0 } } impl Trait for S { reuse to_reuse::foo { self } //~^ The signature should be inherited from item id instead of resolution id } ``` Let's now consider an example from [issue](https://github.com/rust-lang/rust/issues/119920). Due to duplicated associative elements partial resolution for one of them will not be recorded: https://github.com/rust-lang/rust/blob/9023f908cfbe7a475f369717a61cb8eb865cfd25/compiler/rustc_resolve/src/late.rs#L3153-L3162 Which leads to an incorrect `is_in_trait_impl` https://github.com/rust-lang/rust/blob/9023f908cfbe7a475f369717a61cb8eb865cfd25/compiler/rustc_ast_lowering/src/item.rs#L981-L986 Which leads to an incorrect id for signature inheritance https://github.com/rust-lang/rust/blob/9023f908cfbe7a475f369717a61cb8eb865cfd25/compiler/rustc_ast_lowering/src/delegation.rs#L99-L105 Which lead to an ICE from original issue. This patch fixes wrong `is_in_trait_impl` calculation. fixes https://github.com/rust-lang/rust/issues/119920
2024-03-16Delegation: fix ICE on duplicated associative itemsBryanskiy-8/+6
2024-03-15Auto merge of #122517 - petrochenkov:bodihash, r=oli-obkbors-17/+2
Fill in HIR hash for associated opaque types Fixes https://github.com/rust-lang/rust/issues/122508
2024-03-14Fill in HIR hash for associated opaque typesVadim Petrochenkov-17/+2
2024-03-14Rollup merge of #122487 - GuillaumeGomez:rename-stmtkind-local, r=oli-obkMatthias Krüger-3/+3
Rename `StmtKind::Local` variant into `StmtKind::Let` It comes from this [discussion](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F). Starting point was: > I often end up looking at [ExprKind::Let](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/enum.ExprKind.html#variant.Let) instead of Local because of the name. I think renaming it (both the `ExprKind` variant and the Let struct) to `LetPattern` or LetPat could improve the situation as I'm not sure I'm not the only one encountering this issue. And then it evolved into: > It's already `Expr::Let` instead of `StmtKind::Local`. Counterproposal: rename `StmtKind::Local` to `StmtKind::Let`. The goal here is to clear this confusion. r? `@oli-obk`
2024-03-14Rename `hir::StmtKind::Local` into `hir::StmtKind::Let`Guillaume Gomez-2/+2
2024-03-14Rename `ast::StmtKind::Local` into `ast::StmtKind::Let`Guillaume Gomez-1/+1
2024-03-13Create some minimal HIR for associated opaque typesVadim Petrochenkov-0/+1
2024-03-12Change `DefKind::Static` to a struct variantOli Scherer-1/+1
2024-03-11Rename `AddToDiagnostic` as `Subdiagnostic`.Nicholas Nethercote-3/+3
To match `derive(Subdiagnostic)`. Also rename `add_to_diagnostic{,_with}` as `add_to_diag{,_with}`.
2024-03-11Remove unused impls from some subdiagnostics.Nicholas Nethercote-2/+2
2024-03-11Remove unused impls for some diagnostics.Nicholas Nethercote-26/+26
2024-03-08Rollup merge of #121563 - Jarcho:use_cf, r=petrochenkovMatthias Krüger-8/+11
Use `ControlFlow` in visitors. Follow up to #121256 This does have a few small behaviour changes in some diagnostic output where the visitor will now find the first match rather than the last match. The change in `find_anon_types.rs` has the only affected test. I don't see this being an issue as the last occurrence isn't any better of a choice than the first.
2024-03-08Rollup merge of #122103 - compiler-errors:taits-capture-everything, r=oli-obkMatthias Krüger-36/+40
Make TAITs and ATPITs capture late-bound lifetimes in scope This generalizes the behavior that RPITs have, where they duplicate their in-scope lifetimes so that they will always *reify* late-bound lifetimes that they capture. This allows TAITs and ATPITs to properly error when they capture in-scope late-bound lifetimes. r? `@oli-obk` cc `@aliemjay` Fixes #122093 and therefore https://github.com/rust-lang/rust/pull/120700#issuecomment-1981213868