about summary refs log tree commit diff
path: root/compiler/rustc_hir
AgeCommit message (Collapse)AuthorLines
2022-09-08update `ParamKindOrd`lcnr-3/+3
2022-09-08Introduce `DotDotPos`.Nicholas Nethercote-8/+37
This shrinks `hir::Pat` from 88 to 72 bytes.
2022-09-08Arena-allocate `hir::Lifetime`.Nicholas Nethercote-9/+9
This shrinks `hir::Ty` from 72 to 48 bytes. `visit_lifetime` is added to the HIR stats collector because these types are now stored in memory on their own, instead of being within other types.
2022-09-08Generator return doesn't need to be a lang itemMichael Goulet-1/+0
2022-09-08remove unnecessary `PartialOrd` and `Ord`Takayuki Maeda-1/+1
2022-09-07Use niche-filling optimization even when multiple variants have data.Michael Benfield-5/+10
Fixes #46213
2022-09-07suggest adding array lengths to references to arraysTakayuki Maeda-0/+8
2022-09-06change stdlib circular dependencies handlingDaniil Belov-0/+6
2022-09-06Auto merge of #101241 - camsteffen:refactor-binding-annotations, r=cjgillotbors-34/+5
`BindingAnnotation` refactor * `ast::BindingMode` is deleted and replaced with `hir::BindingAnnotation` (which is moved to `ast`) * `BindingAnnotation` is changed from an enum to a tuple struct e.g. `BindingAnnotation(ByRef::No, Mutability::Mut)` * Associated constants added for convenience `BindingAnnotation::{NONE, REF, MUT, REF_MUT}` One goal is to make it more clear that `BindingAnnotation` merely represents syntax `ref mut` and not the actual binding mode. This was especially confusing since we had `ast::BindingMode`->`hir::BindingAnnotation`->`thir::BindingMode`. I wish there were more symmetry between `ByRef` and `Mutability` (variant) naming (maybe `Mutable::Yes`?), and I also don't love how long the name `BindingAnnotation` is, but this seems like the best compromise. Ideas welcome.
2022-09-05Auto merge of #101261 - TaKO8Ki:separate-receiver-from-arguments-in-hir, ↵bors-7/+8
r=cjgillot Separate the receiver from arguments in HIR Related to #100232 cc `@cjgillot`
2022-09-05use `propagate_through_exprs` instead of `propagate_through_expr`Takayuki Maeda-1/+1
fix `ExprKind` static_assert_size fix hir-stats
2022-09-05Auto merge of #101228 - nnethercote:simplify-hir-PathSegment, r=petrochenkovbors-12/+14
Simplify `hir::PathSegment` r? `@petrochenkov`
2022-09-05refactor: remove unnecessary variablesTakayuki Maeda-3/+3
2022-09-05separate the receiver from arguments in HIRTakayuki Maeda-3/+4
2022-09-05Rollup merge of #101420 - kraktus:doc_hir_local, r=cjgillotDylan DPC-1/+1
Fix `hir::Local` doc to match with the variable name used: `init`
2022-09-05Rollup merge of #101142 - nnethercote:improve-hir-stats, r=davidtwcoDylan DPC-20/+36
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-05Address review comments.Nicholas Nethercote-4/+2
2022-09-05Make `hir::PathSegment::hir_id` non-optional.Nicholas Nethercote-5/+8
2022-09-05Make `hir::PathSegment::res` non-optional.Nicholas Nethercote-9/+6
2022-09-05Add some blank lines to the definition of `Res`.Nicholas Nethercote-1/+5
To make the spacing consistent. Also shorten an overly long comment line.
2022-09-04Fix `hir::Local` doc to match with the variable name used: `init`kraktus-1/+1
2022-09-04Make `const_eval_select` a real intrinsicDeadbeef-2/+0
2022-09-04Auto merge of #100726 - jswrenn:transmute, r=oli-obkbors-1/+2
safe transmute: use `Assume` struct to provide analysis options This task was left as a TODO in #92268; resolving it brings [`BikeshedIntrinsicFrom`](https://doc.rust-lang.org/nightly/core/mem/trait.BikeshedIntrinsicFrom.html) more in line with the API defined in [MCP411](https://github.com/rust-lang/compiler-team/issues/411). **Before:** ```rust pub unsafe trait BikeshedIntrinsicFrom< Src, Context, const ASSUME_ALIGNMENT: bool, const ASSUME_LIFETIMES: bool, const ASSUME_VALIDITY: bool, const ASSUME_VISIBILITY: bool, > where Src: ?Sized, {} ``` **After:** ```rust pub unsafe trait BikeshedIntrinsicFrom<Src, Context, const ASSUME: Assume = { Assume::NOTHING }> where Src: ?Sized, {} ``` `Assume::visibility` has also been renamed to `Assume::safety`, as library safety invariants are what's actually being assumed; visibility is just the mechanism by which it is currently checked (and that may change). r? `@oli-obk` --- Related: - https://github.com/rust-lang/compiler-team/issues/411 - https://github.com/rust-lang/rust/issues/99571
2022-09-02Refactor and re-use BindingAnnotationCameron Steffen-34/+5
2022-09-01Always import all tracing macros for the entire crate instead of piecemeal ↵Oli Scherer-1/+3
by module
2022-08-31Rollup merge of #100730 - CleanCut:diagnostics-rustc_monomorphize, r=davidtwcoRalf Jung-3/+15
Migrate rustc_monomorphize to use SessionDiagnostic ### Description - Migrates diagnostics in `rustc_monomorphize` to use `SessionDiagnostic` - Adds an `impl IntoDiagnosticArg for PathBuf` ### TODO / Help! - [x] I'm having trouble figuring out how to apply an optional note. 😕 Help!? - Resolved. It was bad docs. Fixed in https://github.com/rust-lang/rustc-dev-guide/pull/1437/files - [x] `errors:RecursionLimit` should be `#[fatal ...]`, but that doesn't exist so it's `#[error ...]` at the moment. - Maybe I can switch after this is merged in? --> https://github.com/rust-lang/rust/pull/100694 - Or maybe I need to manually implement `SessionDiagnostic` instead of deriving it? - [x] How does one go about converting an error inside of [a call to struct_span_lint_hir](https://github.com/rust-lang/rust/blob/8064a495086c2e63c0ef77e8e82fe3b9b5dc535f/compiler/rustc_monomorphize/src/collector.rs#L917-L927)? - [x] ~What placeholder do you use in the fluent template to refer to the value in a vector? It seems like [this code](https://github.com/rust-lang/rust/blob/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_macros/src/diagnostics/diagnostic_builder.rs#L83-L114) ought to have the answer (or something near it)...but I can't figure it out.~ You can't. Punted.
2022-08-29Rename `GenericArg::id` as `GenericArg::hir_id`.Nicholas Nethercote-1/+1
Because `hir_id` is the standard name for methods that return a `HirId` from a HIR node.
2022-08-29Use `&'hir Mod` everywhere.Nicholas Nethercote-1/+1
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-29Use `&'hir Ty` everywhere.Nicholas Nethercote-2/+2
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-29Use `&'hir Expr` everywhere.Nicholas Nethercote-7/+7
For consistency, and because it makes HIR measurement simpler and more accurate.
2022-08-29Expand the HIR (and AST) size assertions.Nicholas Nethercote-11/+27
2022-08-28Remove `register_attr` featureYuki Okushi-8/+2
Signed-off-by: Yuki Okushi <jtitor@2k36.org>
2022-08-26Merge implementations of HIR fn_decl and fn_sig.Camille GILLOT-4/+5
2022-08-25have LangItemError derive everything LangItem doesNathan Stocks-0/+1
2022-08-25allow non-monomorphize modules to access hard-coded error message through ↵Nathan Stocks-3/+14
new struct, use fluent message in monomorphize
2022-08-22safe transmute: use `Assume` struct to provide analysis optionsJack Wrenn-1/+2
This was left as a TODO in #92268, and brings the trait more in line with what was defined in MCP411. `Assume::visibility` has been renamed to `Assume::safety`, as library safety is what's actually being assumed; visibility is just the mechanism by which it is currently checked (this may change). ref: https://github.com/rust-lang/compiler-team/issues/411 ref: https://github.com/rust-lang/rust/issues/99571
2022-08-18Add diagnostic translation lints to crates that don't emit them5225225-0/+2
2022-08-16Rollup merge of #100610 - nnethercote:ast-and-parser-tweaks, r=spastorinoDylan DPC-5/+1
Ast and parser tweaks r? `@spastorino`
2022-08-16Auto merge of #100237 - cjgillot:no-special-hash-hir, r=nagisabors-18/+3
Remove manual implementations of HashStable for hir::Expr and hir::Ty. We do not need to force hashing HIR bodies inside those nodes. The contents of bodies are not accessible from the `hir_owner` query which used `hash_without_bodies`. When the content of a body is required, the access is still done using `hir_owner_nodes`, which continues hashing HIR bodies.
2022-08-16Remove `{ast,hir}::WhereEqPredicate::id`.Nicholas Nethercote-5/+1
These fields are unused.
2022-08-11Add visitors for PatField and ExprField.Eric Huss-10/+20
This helps simplify the code. It also fixes it to use the correct parent when lowering. One consequence is the `non_snake_case` lint needed to change the way it looked for parent nodes in a struct pattern. This also includes a small fix to use the correct `Target` for expression field attribute validation.
2022-08-11Check attributes on struct expression fields.Eric Huss-0/+4
Attributes on struct expression fields were not being checked for validity. This adds the fields as HIR nodes so that `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Check attributes on pattern fields.Eric Huss-0/+4
Attributes on pattern struct fields were not being checked for validity. This adds the fields as HIR nodes so that the `CheckAttrVisitor` can visit those nodes to check their attributes.
2022-08-11Rollup merge of #100392 - nnethercote:simplify-visitors, r=cjgillotMatthias Krüger-41/+10
Simplify visitors By removing some unused arguments. r? `@cjgillot`
2022-08-11Simplify `rustc_hir::intravisit::Visitor::visit_enum_def`.Nicholas Nethercote-2/+2
It is passed an argument that is never used.
2022-08-11Simplify `rustc_hir::intravisit::Visitor::visit_variant_data`.Nicholas Nethercote-41/+10
It has four arguments that are never used. This avoids lots of argument passing in functions that feed into `visit_variant_data`.
2022-08-10Avoid repeating qualifiers on `static_assert_size` calls.Nicholas Nethercote-12/+12
Some of these don't need a `use` statement because there is already a `#[macro_use] extern crate rustc_data_structures` item in the crate.
2022-08-07Add Tuple marker traitMichael Goulet-0/+2
2022-08-07Derive HashStable for HIR Expr and Ty.Camille GILLOT-18/+3
2022-08-03Rollup merge of #100029 - hdelc:master, r=cjgillotMatthias Krüger-45/+45
Prevent ICE for `doc_alias` on match arm, statement, expression Fixes #99777. This is a pretty minimal fix that should be safe, since rustdoc doesn't generate documentation for match arms, statements, or expressions. I mentioned in the linked issue that the `doc_alias` target checking should probably be improved to avoid future ICEs, but as a new contributor, I'm not confident enough with the HIR types to make a larger change.