about summary refs log tree commit diff
path: root/tests/ui/stats
AgeCommit message (Collapse)AuthorLines
2025-01-01Fix ICE when opaque captures a duplicated/invalid lifetimeMichael Goulet-6/+6
2024-12-17Fix `-Z inputs-stats` ordering.Nicholas Nethercote-17/+17
In #129533 the main hash function changed and the order of `-Z input-stats` output changed, which showed that it is dependent on the hash function, even though it is sorted. That's because entries with the same cumulative size are ordered in a way that depends on the hash function. This commit fixes that by using the entry label as the secondary ordering key.
2024-12-09Introduce `default_field_values` featureEsteban Küber-18/+18
Initial implementation of `#[feature(default_field_values]`, proposed in https://github.com/rust-lang/rfcs/pull/3681. Support default fields in enum struct variant Allow default values in an enum struct variant definition: ```rust pub enum Bar { Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Allow using `..` without a base on an enum struct variant ```rust Bar::Foo { .. } ``` `#[derive(Default)]` doesn't account for these as it is still gating `#[default]` only being allowed on unit variants. Support `#[derive(Default)]` on enum struct variants with all defaulted fields ```rust pub enum Bar { #[default] Foo { bar: S = S, baz: i32 = 42 + 3, } } ``` Check for missing fields in typeck instead of mir_build. Expand test with `const` param case (needs `generic_const_exprs` enabled). Properly instantiate MIR const The following works: ```rust struct S<A> { a: Vec<A> = Vec::new(), } S::<i32> { .. } ``` Add lint for default fields that will always fail const-eval We *allow* this to happen for API writers that might want to rely on users' getting a compile error when using the default field, different to the error that they would get when the field isn't default. We could change this to *always* error instead of being a lint, if we wanted. This will *not* catch errors for partially evaluated consts, like when the expression relies on a const parameter. Suggestions when encountering `Foo { .. }` without `#[feature(default_field_values)]`: - Suggest adding a base expression if there are missing fields. - Suggest enabling the feature if all the missing fields have optional values. - Suggest removing `..` if there are no missing fields.
2024-11-25Refactor `where` predicates, and reserve for attributes supportFrank King-23/+23
2024-11-21Implement the unsafe-fields RFC.Luca Versari-15/+15
Co-Authored-By: Jacob Pratt <jacob@jhpratt.dev>
2024-11-15Merge `-Zhir-stats` into `-Zinput-stats`Sam Estep-2/+2
2024-11-15Print total node count in `-Z hir-stats`Sam Estep-4/+4
2024-10-22Represent TraitBoundModifiers as distinct parts in HIRMichael Goulet-8/+8
2024-10-20Stop relying on hashmap iteration for hir stat printingNoratrieb-23/+23
Just because the code says it's OK does not mean that it actually is OK. Nodes with the same total size were not sorted, their order relied on hashmap iteration.
2024-08-31ignore/fix layout-sensitive testsThe 8472-0/+3
2024-07-16Add `ConstArgKind::Path` and make `ConstArg` its own HIR nodeNoah Lev-6/+6
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-06-26ast: Standardize visiting orderVadim Petrochenkov-31/+31
Id, attributes, inner nodes in source order if possible, tokens, span. Also always use exhaustive matching in visiting infra, and visit some missing nodes.
2024-05-04Auto merge of #124401 - oli-obk:some_hir_cleanups, r=cjgillotbors-13/+13
Some hir cleanups It seemed odd to not put `AnonConst` in the arena, compared with the other types that we did put into an arena. This way we can also give it a `Span` without growing a lot of other HIR data structures because of the extra field. r? compiler
2024-04-29Add StaticForeignItem and use it on ForeignItemKindSantiago Pastorino-10/+10
2024-04-29Bless ui testsOli Scherer-13/+13
2024-03-14Update `tests/ui/stats/hir-stats.stderr` outputGuillaume Gomez-3/+3
2024-03-01Detect more cases of `=` to `:` typoEsteban Küber-10/+10
When a `Local` is fully parsed, but not followed by a `;`, keep the `:` span arround and mention it. If the type could continue being parsed as an expression, suggest replacing the `:` with a `=`. ``` error: expected one of `!`, `+`, `->`, `::`, `;`, or `=`, found `.` --> file.rs:2:32 | 2 | let _: std::env::temp_dir().join("foo"); | - ^ expected one of `!`, `+`, `->`, `::`, `;`, or `=` | | | while parsing the type for `_` | help: use `=` if you meant to assign ``` Fix #119665.
2024-02-16[AUTO-GENERATED] Migrate ui tests from `//` to `//@` directives许杰友 Jieyou Xu (Joe)-6/+6
2024-01-31Add async bound modifier to enable async Fn boundsMichael Goulet-26/+26
2024-01-05Remove `hir::Guard`Matthew Jasper-4/+4
Use Expr instead. Use `ExprKind::Let` to represent if let guards.
2023-12-25Make closures carry their own ClosureKind, rather than deducing what it is ↵Michael Goulet-4/+4
from movability
2023-12-20Refactor AST trait bound modifiersLeón Orell Valerian Liehr-17/+17
2023-11-24Add `Span` to `TraitBoundModifier`Deadbeef-29/+29
2023-09-22Rollup merge of #116067 - saethlin:meta-stats-ice, r=WaffleLapkinMatthias Krüger-0/+7
Open the FileEncoder file for reading and writing Maybe I just don't know `File` well enough, but the previous comment didn't make it clear enough to me that we can't use `File::create`. This one does. Fixes https://github.com/rust-lang/rust/issues/116055 r? `@WaffleLapkin`
2023-09-22Open the FileEncoder file for reading and writingBen Kimock-0/+7
2023-09-21Record asyncness span in HIRMichael Goulet-16/+16
2023-04-04Rename `ast::Static` to `ast::StaticItem` to match `ast::ConstItem`Oli Scherer-43/+43
2023-02-21Use `ThinVec` in a few more AST types.Nicholas Nethercote-44/+44
2023-02-21Use `ThinVec` in `ast::PatKind::Struct`.Nicholas Nethercote-51/+51
2023-02-21Use `ThinVec` in `ast::Block`.Nicholas Nethercote-40/+40
2023-02-21Use `ThinVec` in various AST types.Nicholas Nethercote-76/+76
This commit changes the sequence parsers to produce `ThinVec`, which triggers numerous conversions.
2023-02-21Use `ThinVec` in `ast::WhereClause`.Nicholas Nethercote-63/+63
2023-02-21Use `ThinVec` in `ast::Generics` and related types.Nicholas Nethercote-52/+52
2023-02-02Reinstate the `hir-stats.rs` tests on stage 1.Nicholas Nethercote-1/+5
2023-01-11Move /src/test to /testsAlbert Larsan-0/+220