about summary refs log tree commit diff
path: root/compiler/rustc_ast_lowering/src/lib.rs
AgeCommit message (Collapse)AuthorLines
2023-08-06lower impl const to bind to host effect paramDeadbeef-8/+77
2023-08-05Consolidate opaque ty and async fn lowering codeMichael Goulet-414/+181
2023-07-21Auto merge of #113847 - SparrowLii:path_clone, r=cjgillotbors-10/+0
avoid clone path prefix when lowering to hir Found this while trying to parallelize `lower_to_hir`. When lowering to hir, `Nested` paths in `ast` will be split and the prefix segments will be cloned. This could be omited, since the only consequence is that the prefix segments in `Path`s in hir will have the same `HirId`s, and it seems harmless. This simplifies the process of lowering to hir and avoids re-modification of `ResolverAstLowering`. r? `@Aaron1011` cc #99292
2023-07-19avoid clone path prefix when lowering to hirSparrowLii-10/+0
Signed-off-by: SparrowLii <liyuan179@huawei.com>
2023-07-17Properly document lifetime_mapping in OpaqueTyMichael Goulet-10/+14
2023-06-29Do not generate lifetime_mapping for RPIT no in_traitSantiago Pastorino-12/+32
2023-06-29Add bidirectional where clauses on RPITIT synthesized GATsSantiago Pastorino-22/+28
2023-06-29Intern OpaqueTy on ItemKind::OpaqueTySantiago Pastorino-1/+1
2023-06-29Reorganize opaque lowering codeSantiago Pastorino-43/+50
2023-05-25Don't print newlines in APITsMichael Goulet-1/+10
2023-05-16Turn debugger_visualizers from feed- into regular query.Michael Woerister-1/+2
2023-05-12Require `impl Trait` in associated types to appear in method signaturesOli Scherer-16/+20
2023-05-09Rollup merge of #111215 - BoxyUwU:resolve_anon_consts_differently, r=cjgillotMatthias Krüger-3/+5
Various changes to name resolution of anon consts Sorry this PR is kind of all over the place ^^' Fixes #111012 - Rewrites anon const nameres to all go through `fn resolve_anon_const` explicitly instead of `visit_anon_const` to ensure that we do not accidentally resolve anon consts as if they are allowed to use generics when they aren't. Also means that we dont have bits of code for resolving anon consts that will get out of sync (i.e. legacy const generics and resolving path consts that were parsed as type arguments) - Renames two of the `LifetimeRibKind`, `AnonConst -> ConcreteAnonConst` and `ConstGeneric -> ConstParamTy` - Noticed while doing this that under `generic_const_exprs` all lifetimes currently get resolved to errors without any error being emitted which was causing a bunch of tests to pass without their bugs having been fixed, incidentally fixed that in this PR and marked those tests as `// known-bug:`. I'm fine to break those since `generic_const_exprs` is a very unstable incomplete feature and this PR _does_ make generic_const_exprs "less broken" as a whole, also I can't be assed to figure out what the underlying causes of all of them are. This PR reopens #77357 #83993 - Changed `generics_of` to stop providing generics and predicates to enum variant discriminant anon consts since those are not allowed to use generic parameters - Updated the error for non 'static lifetime in const arguments and the error for non 'static lifetime in const param tys to use `derive(Diagnostic)` I have a vague idea why const-arg-in-const-arg.rs, in-closure.rs and simple.rs have started failing which is unfortunate since these were deliberately made to work, I think lifetime resolution being broken just means this regressed at some point and nobody noticed because the tests were not testing anything :( I'm fine breaking these too for the same reason as the tests for #77357 #83993. I couldn't get `// known-bug` to work for these ICEs and just kept getting different stderr between CI and local `--bless` so I just removed them and will create an issue to track re-adding (and fixing) the bugs if this PR lands. r? `@cjgillot` cc `@compiler-errors`
2023-05-08Auto merge of #106621 - ozkanonur:enable-elided-lifetimes-for-doctests, ↵bors-2/+4
r=Mark-Simulacrum enable `rust_2018_idioms` lint group for doctests With this change, `rust_2018_idioms` lint group will be enabled for compiler/libstd doctests. Resolves #106086 Resolves #99144 Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-07enable `rust_2018_idioms` for doctestsozkanonur-2/+4
Signed-off-by: ozkanonur <work@onurozkan.dev>
2023-05-05misc nameres changes for anon constsBoxy-3/+5
2023-05-02Implement negative boundsMichael Goulet-2/+15
2023-04-26IntoFuture::into_future is no longer unstableMichael Goulet-1/+0
2023-04-24Split `{Idx, IndexVec, IndexSlice}` into their own modulesMaybe Waffle-1/+1
2023-04-21offset_ofDrMeepster-0/+2
2023-04-19Auto merge of #110407 - Nilstrieb:fluent-macro, r=davidtwcobors-1/+1
Add `rustc_fluent_macro` to decouple fluent from `rustc_macros` Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-18Add `rustc_fluent_macro` to decouple fluent from `rustc_macros`Nilstrieb-1/+1
Fluent, with all the icu4x it brings in, takes quite some time to compile. `fluent_messages!` is only needed in further downstream rustc crates, but is blocking more upstream crates like `rustc_index`. By splitting it out, we allow `rustc_macros` to be compiled earlier, which speeds up `x check compiler` by about 5 seconds (and even more after the needless dependency on `serde_json` is removed from `rustc_data_structures`).
2023-04-17Make `IndexVec::ensure_contains_elem` return a reference to the elementMaybe Waffle-8/+7
2023-04-16use matches! macro in more placesMatthias Krüger-4/+1
2023-04-10Remove `..` from return type notationMichael Goulet-11/+16
2023-04-02Use `&IndexSlice` instead of `&IndexVec` where possibleScott McMurray-2/+2
All the same reasons as for `[T]`: more general, less pointer chasing, and `&mut IndexSlice` emphasizes that it doesn't change *length*.
2023-03-28Add `(..)` syntax for RTNMichael Goulet-30/+55
2023-03-28Add tests and error messagesMichael Goulet-5/+12
2023-03-28RTNMichael Goulet-0/+12
2023-03-28ParenthesizedGenericArgs::{Ok -> ParenSugar}Michael Goulet-1/+1
2023-03-22rustc: Remove unused `Session` argument from some attribute functionsVadim Petrochenkov-1/+1
2023-03-12Auto merge of #108820 - cjgillot:ensure-on-disk, r=oli-obkbors-2/+3
Ensure value is on the on-disk cache before returning from `ensure()`. The current logic for `ensure()` a query just checks that the node is green in the dependency graph. However, a lot of places use `ensure()` to prevent the query from being called later. This is the case before stealing a query result. If the query is actually green but the value is not available in the on-disk cache, `ensure` would return, but a subsequent call to the full query would run the code, and attempt to read from a stolen value. This PR conforms the query system to the usage by checking whether the queried value is loadable from disk before returning. Sadly, I can't manage to craft a proper test... Should fix all instances of "attempted to read from stolen value".
2023-03-12Auto merge of #108794 - nnethercote:avoid-unnecessary-hashing, r=cjgillotbors-31/+24
Avoid unnecessary hashing I noticed some stable hashing being done in a non-incremental build. It turns out that some of this is necessary to compute the crate hash, but some of it is not. Removing the unnecessary hashing is a perf win. r? `@cjgillot`
2023-03-11Use ensure_with_value in a few more places.Camille GILLOT-2/+3
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-11Rollup merge of #108806 - cjgillot:query-lints, r=davidtwcoMatthias Krüger-0/+1
Querify register_tools and post-expansion early lints The 2 extra queries correspond to code that happen before and after macro expansion, and don't need the resolver to exist.
2023-03-08Only compute the crate hash when necessary.Nicholas Nethercote-31/+24
The crate hash is needed: - if debug assertions are enabled, or - if incr. comp. is enabled, or - if metadata is being generated, or - if `-C instrumentation-coverage` is enabled. This commit avoids computing the crate hash when these conditions are all false, such as when doing a release build of a binary crate. It uses `Option` to store the hashes when needed, rather than computing them on demand, because some of them are needed in multiple places and computing them on demand would make compilation slower. The commit also removes `Owner::hash_without_bodies`. There is no benefit to pre-computing that one, it can just be done in the normal fashion.
2023-03-06Querify early_lint_checks.Camille GILLOT-0/+1
2023-03-03Match unmatched backticks in compiler/ that are part of rustdocest31-1/+1
2023-02-28Only look for param in generics if it actually comes from genericsMichael Goulet-9/+30
2023-02-25Add ErrorGuaranteed to HIR TyKind::ErrMichael Goulet-9/+13
2023-02-22pluralize stuffMichael Goulet-31/+25
2023-02-22Suppress duplicated errors for associated type bounds in object typesMichael Goulet-33/+46
2023-02-22Move associated type bounds check to ast loweringMichael Goulet-3/+7
This makes the check for when associated type bounds more accurate
2023-02-22errors: generate typed identifiers in each crateDavid Wood-3/+10
Instead of loading the Fluent resources for every crate in `rustc_error_messages`, each crate generates typed identifiers for its own diagnostics and creates a static which are pulled together in the `rustc_driver` crate and provided to the diagnostic emitter. Signed-off-by: David Wood <david.wood@huawei.com>
2023-02-21Use `ThinVec` in `ast::Generics` and related types.Nicholas Nethercote-2/+2
2023-02-14Better label for illegal impl trait typesMichael Goulet-4/+22
2023-01-28Remove `HirId -> LocalDefId` map from HIR.Camille GILLOT-12/+1
2023-01-26Auto merge of #106812 - oli-obk:output_filenames, r=petrochenkovbors-0/+1
make `output_filenames` a real query part of #105462 This may be a perf regression and is not obviously the right way forward. We may store this information in the resolver after freezing it for example.
2023-01-26Auto merge of #106745 - m-ou-se:format-args-ast, r=oli-obkbors-0/+1
Move format_args!() into AST (and expand it during AST lowering) Implements https://github.com/rust-lang/compiler-team/issues/541 This moves FormatArgs from rustc_builtin_macros to rustc_ast_lowering. For now, the end result is the same. But this allows for future changes to do smarter things with format_args!(). It also allows Clippy to directly access the ast::FormatArgs, making things a lot easier. This change turns the format args types into lang items. The builtin macro used to refer to them by their path. After this change, the path is no longer relevant, making it easier to make changes in `core`. This updates clippy to use the new language items, but this doesn't yet make clippy use the ast::FormatArgs structure that's now available. That should be done after this is merged.