about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/path.rs
AgeCommit message (Collapse)AuthorLines
2023-12-18Auto merge of #119069 - matthiaskrgr:rollup-xxk4m30, r=matthiaskrgrbors-1/+4
Rollup of 5 pull requests Successful merges: - #118852 (coverage: Skip instrumenting a function if no spans were extracted from MIR) - #118905 ([AIX] Fix XCOFF metadata) - #118967 (Add better ICE messages for some undescriptive panics) - #119051 (Replace `FileAllocationInfo` with `FileEndOfFileInfo`) - #119059 (Deny `~const` trait bounds in inherent impl headers) r? `@ghost` `@rustbot` modify labels: rollup
2023-12-18Rename `Session::span_diagnostic` as `Session::dcx`.Nicholas Nethercote-1/+1
2023-12-15Add better ICE messages for some undescriptive panicsRoss Smyth-1/+4
2023-12-08Support async gen fnMichael Goulet-1/+1
2023-12-04Address code review feedbackEric Holk-3/+3
2023-12-04Lower return types for gen fn to impl IteratorEric Holk-4/+5
2023-12-02Inline and remove `LoweringContext::handler()`.Nicholas Nethercote-1/+1
It has a single call site.
2023-11-21Fix `clippy::needless_borrow` in the compilerNilstrieb-3/+3
`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-08-06lower impl const to bind to host effect paramDeadbeef-1/+12
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-10Remove `..` from return type notationMichael Goulet-13/+0
2023-03-28Add `(..)` syntax for RTNMichael Goulet-5/+25
2023-03-28ParenthesizedGenericArgs::{Ok -> ParenSugar}Michael Goulet-4/+4
2022-12-06Add help for `#![feature(impl_trait_in_fn_trait_return)]`Josh Stone-6/+13
This adds a new variant `ImplTraitContext::FeatureGated`, so we can generalize the help for `return_position_impl_trait_in_trait` to also work for `impl_trait_in_fn_trait_return`.
2022-12-01rustc_hir: Change representation of import paths to support multiple resolutionsVadim Petrochenkov-16/+5
2022-11-24Use kw::Empty for elided lifetimes in path.Camille GILLOT-1/+1
2022-11-22`rustc_ast_lowering`: remove `ref` patternsMaybe Waffle-4/+4
2022-11-17Box `ExprKind::{Closure,MethodCall}`, and `QSelf` in expressions, types, and ↵Nicholas Nethercote-1/+1
patterns.
2022-10-25adopt to compiler changesMaybe Waffle-1/+1
2022-10-25Feature gate `impl_trait_in_fn_trait_return`Maybe Waffle-1/+4
2022-10-25Allow `impl Fn() -> impl Trait` in return positionMaybe Waffle-1/+12
This allows writing the following function signatures: ```rust fn f0() -> impl Fn() -> impl Trait; fn f3() -> &'static dyn Fn() -> impl Trait; ``` These signatures were already allowed for common traits and associated types, there is no reason why `Fn*` traits should be special in this regard.
2022-10-11rustc_hir: Less error-prone methods for accessing `PartialRes` resolutionVadim Petrochenkov-4/+6
2022-09-14Pass ImplTraitContext as &, there's no need for that to be &mutSantiago Pastorino-10/+8
2022-09-06Pass ImplTraitContext as &mut to avoid the need of ↵Santiago Pastorino-8/+10
ImplTraitContext::reborrow later on
2022-09-05Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkovbors-4/+4
Simplify `hir::PathSegment` r? `@petrochenkov`
2022-09-05Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwcoDylan DPC-1/+1
Improve HIR stats #100398 improve the AST stats collection done by `-Zhir-stats`. This PR does the same for HIR stats collection. r? `@davidtwco`
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-3/+3
2022-09-05Make `hir::PathSegment::res` non-optional.Nicholas Nethercote-1/+1
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+0
by module
2022-08-29Use `&'hir Ty` everywhere.Nicholas Nethercote-1/+1
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-22Migrate ast_lowering::path to SessionDiagnosticJean CASPAR-15/+8
2022-07-06Remove `sess` field from LoweringContext.Camille GILLOT-2/+2
2022-06-21Always create parameters for functions-like types.Camille GILLOT-29/+22
2022-06-17Auto merge of #98106 - cjgillot:split-definitions, r=michaelwoeristerbors-0/+1
Split up `Definitions` and `ResolverAstLowering`. Split off https://github.com/rust-lang/rust/pull/95573 r? `@michaelwoerister`
2022-06-15Refactor path segment parameter errorEdwinRy-19/+26
2022-06-14Make ResolverAstLowering a struct.Camille GILLOT-0/+1
2022-06-07Instrument important fns in AST loweringSantiago Pastorino-1/+1
2022-05-31Remove ImplTraitContext::reborrowSantiago Pastorino-9/+7
2022-05-31Move defs and bounds from Universal to LoweringContextSantiago Pastorino-3/+3
2022-05-20Remove `crate` visibility usage in compilerJacob Pratt-5/+5
2022-04-27Create a specific struct for lifetime capture.Camille GILLOT-27/+25
2022-04-27Use LifetimeRes during lowering.Camille GILLOT-91/+85
2022-04-17Lint elided lifetimes in path on the AST.Camille GILLOT-35/+4
2022-02-17Add more information to `impl Trait` deny errorMichael Goulet-5/+11
2022-01-17Use Term in ProjectionPredicatekadmin-1/+1
ProjectionPredicate should be able to handle both associated types and consts so this adds the first step of that. It mainly just pipes types all the way down, not entirely sure how to handle consts, but hopefully that'll come with time.
2021-12-27Tighten span when suggesting lifetime on pathMichael Goulet-1/+3
2021-12-03Rollup merge of #91273 - Badel2:ice-index-str, r=estebankMatthias Krüger-9/+13
Fix ICE #91268 by checking that the snippet ends with a `)` Fix #91268 Previously it was assumed that the last character of `snippet` will be a `)`, so using `snippet.len() - 1` as an index should be safe. However as we see in the test, it is possible to enter that branch without a closing `)`, and it will trigger the panic if the last character happens to be multibyte. The fix is to ensure that the snippet ends with `)`, and skip the suggestion otherwise.
2021-11-30Simplify lowering.Camille GILLOT-37/+31
2021-11-30Lint elided lifetimes in path during lifetime resolution.Camille GILLOT-19/+3
2021-11-26Fix ICE #91268 by checking that the snippet ends with a `)`Badel2-9/+13