about summary refs log tree commit diff
path: root/compiler
AgeCommit message (Collapse)AuthorLines
2025-08-14Deduplicate `-L` paths passed to rustcJakub Beránek-10/+21
2025-08-14Rollup merge of #145403 - shepmaster:grammar, r=estebankJakub Beránek-1/+1
Adjust error message grammar to be less awkward r? ``@estebank``
2025-08-14Rollup merge of #145401 - estebank:remove-useless-iter, r=compiler-errorsJakub Beránek-2/+2
cleanup: Remove useless `[T].iter().last()`
2025-08-14Rollup merge of #145398 - estebank:use-default-fields-resolver, r=petrochenkovJakub Beránek-30/+17
Use `default_field_values` in `Resolver` Change `Resolver` to use `feature(default_field_values)`. This change is non-exhaustive, as fields may have been added since I made this commit, and `Fx(Index/Hash)(Map/Set)` types would need to have a `const` constructable to change the majority of the fields left over. Using default field values should make it easier to review when we add or remove fields to `Resolver` in the future, and highlight which fields are run-time dependent in `Resolver::new`. r? ``@petrochenkov``
2025-08-14Rollup merge of #145233 - joshtriplett:cfg-select-expr, r=jieyouxuJakub Beránek-11/+19
cfg_select: Support unbraced expressions Tracking issue for `cfg_select`: rust-lang/rust#115585 When operating on expressions, `cfg_select!` can now handle expressions without braces. (It still requires braces for other things, such as items.) Expand the test coverage and documentation accordingly. --- I'm not sure whether deciding to extend `cfg_select!` in this way is T-lang or T-libs-api. I've labeled for both, with the request that both teams don't block on each other. :)
2025-08-14Rollup merge of #137872 - estebank:extra-vert, r=compiler-errorsJakub Beránek-13/+28
Include whitespace in "remove |" suggestion and make it hidden Tweak error rendering of patterns with an extra `|` on either end. Built on #137409. Only last commit is relevant. ? ``@compiler-errors``
2025-08-14Auto merge of #145085 - JonathanBrouwer:target_checking, r=jdonszelmannbors-1403/+993
Rework target checking for built-in attributes This is a refactoring of target checking for built-in attributes. This PR has the following goals: - Only refactor the 80% of the attributes that are simple to target check. More complicated ones like `#[repr]` will be in a future PR. Tho I have written the code in such a way that this will be possible to add in the future. - No breaking changes. - This part of the codebase is not very well tested though, we can do a crater run if we want to be sure. - I've spotted quite a few weird situations (like I don't think an impl block should be deprecated?). We can propose fixing these to in a future PR Fixes https://github.com/rust-lang/rust/issues/143780 Fixes https://github.com/rust-lang/rust/issues/138510 I've split it in commits and left a description on some of the commits to help review. r? `@jdonszelmann`
2025-08-14drive-by: fix typoWaffle Lapkin-1/+1
2025-08-14fixed diagnosticKivooeo-1/+10
2025-08-14Adjust error message grammar to be less awkwardJake Goulding-1/+1
2025-08-14Remove lto inline logicMarcelo Domínguez-79/+1
2025-08-14Remove inlining for autodiff handlingMarcelo Domínguez-19/+21
2025-08-14Complete functionality and general cleanupMarcelo Domínguez-794/+383
2025-08-14Basic implementation of `autodiff` intrinsicMarcelo Domínguez-245/+280
2025-08-14cleanup: Remove useless `[T].iter().last()`Esteban Küber-2/+2
2025-08-14Remove the old target checking logicJonathan Brouwer-1310/+138
2025-08-14Specify the list of allowed targets per attributeJonathan Brouwer-44/+361
2025-08-14Allow attribute parsers to specify a list of allowed targetsJonathan Brouwer-13/+303
Every acceptor gets an `ALLOWED_TARGETS` specification which can specify per target whether it is allowed, warned, or errored.
2025-08-14Pass the target type down to `parse_attribute_list`Jonathan Brouwer-25/+48
2025-08-14Improved `Target` typeJonathan Brouwer-11/+143
- Added a few more variants which are needed for various attributes - Previously a trait method with default block had the same target representation as a method in a `impl trait for` block, this has been changed (See `MethodKind`) - Added `plural_name` for more precision on the form of the name
2025-08-14Do not ICE on private type in field of unresolved structEsteban Küber-3/+3
2025-08-14resolve: Restructure `resolve_ident_in_lexical_scope` for better clarityVadim Petrochenkov-42/+37
2025-08-14resolve: Inline `with_mod_rib`Vadim Petrochenkov-26/+18
2025-08-14resolve: Introduce `RibKind::Block`Vadim Petrochenkov-24/+24
to avoid confusing module items, blocks with items, and blocks without items.
2025-08-14Use `default_field_values` in `Resolver`Esteban Küber-30/+17
2025-08-14it's not a borrow checker limitation :<lcnr-1/+1
2025-08-14add commentlcnr-1/+6
2025-08-14update commentlcnr-0/+12
2025-08-14Auto merge of #144542 - sayantn:stabilize-sse4a-tbm, r=Amanieu,traviscrossbors-4/+6
Stabilize `sse4a` and `tbm` target features This PR stabilizes the feature flag `sse4a_target_feature` and `tbm_target_feature` (tracking issue rust-lang/rust#44839). # Public API The 2 `x86` target features `sse4a` and `tbm` Also, these were added in LLVM2.6 and LLVM3.4-rc1, respectively, and as the minimum LLVM required for rustc is LLVM19, we are safe in that front too! As all of the required tasks have been done (adding the target features to rustc, implementing their runtime detection in std_detect and implementing the associated intrinsics in core_arch), these target features can be stabilized now. The intrinsics were stabilized *long* ago, in 1.27.0 Reference PR: - https://github.com/rust-lang/reference/pull/1949 cc `@rust-lang/lang` `@rustbot` label I-lang-nominated r? lang
2025-08-14Add FnContext in parser for diagnosticxizheyin-34/+94
Signed-off-by: xizheyin <xizheyin@smail.nju.edu.cn>
2025-08-14resolve prelude import at `build_reduced_graph` phaseLorrensP-2158466-24/+19
2025-08-14ignore head usages of ignored candidateslcnr-149/+374
2025-08-14coverage: Remove intermediate data structures from mapping creationZalathar-77/+31
2025-08-14Print regions in `type_name`.Nicholas Nethercote-45/+62
Currently they are skipped, which is a bit weird, and it sometimes causes malformed output like `Foo<>` and `dyn Bar<, A = u32>`. Most regions are erased by the time `type_name` does its work. So all regions are now printed as `'_` in non-optional places. Not perfect, but better than the status quo. `c_name` is updated to trim lifetimes from MIR pass names, so that the `PASS_NAMES` sanity check still works. It is also renamed as `simplify_pass_type_name` and made non-const, because it doesn't need to be const and the non-const implementation is much shorter. The commit also renames `should_print_region` as `should_print_optional_region`, which makes it clearer that it only applies to some regions. Fixes #145168.
2025-08-14Rollup merge of #145372 - petrochenkov:noresmacpath, r=jackh726Guillaume Gomez-94/+49
resolve: Miscellaneous cleanups See individual commits. All noticed when reviewing recent PRs to name resolution.
2025-08-14Rollup merge of #145361 - xizheyin:145294, r=compiler-errorsGuillaume Gomez-0/+9
Suppress wrapper suggestion when expected and actual ty are the same adt and the variant is unresolved Fixes rust-lang/rust#145294 I initially tried the desired suggestion in this issue, but since that suggestion occurs in the expected type, it is inappropriate to suggest for expected expressions (see other suggest methods in the same file). I believe that suppressing the incorrect suggestion is the more appropriate choice here. I opted for a slightly more general approach: when the expected type and actual type are the same ADT (e.g., both are Result in this example), we assume that code tend to compare the internal generic parameters(i.e. `Option<&str>` vs `Option<String>`, instead of `E = _` vs `Result<Option<String>>>`). When `E` is an unresolved infer type in the expected type (`_` in this example), we should not wrapp the actual type. Two commits show the difference. r? compiler
2025-08-14Rollup merge of #145323 - scrabsha:push-pqwvmznzzmpr, r=jdonszelmannGuillaume Gomez-100/+165
Port the `#[linkage]` attribute to the new attribute system r? `@jdonszelmann`
2025-08-14Rollup merge of #145266 - camsteffen:reduce-queries, r=petrochenkovGuillaume Gomez-64/+79
Reduce some queries around associated items
2025-08-14Rollup merge of #144727 - Stypox:add-tracing-to-resolve, r=RalfJungGuillaume Gomez-23/+41
Add tracing to resolve-related functions Resolve-related functions are not called often but still make up for ~3% of execution time for non-repetitive programs (as seen in the first table below, obtained from running the rust snippet at the bottom with `n=1`). On the other hand, for repetitive programs they become less relevant (I tested the same snippet but with `n=100` and got ~1.5%), and it appears that only `try_resolve` is called more often (see the last two tables). The first table was obtained by opening the trace file in https://ui.perfetto.dev and running the following query: ```sql select "TOTAL PROGRAM DURATION" as name, count(*), max(ts + dur) as "sum(dur)", 100.0 as "%", null as "min(dur)", null as "max(dur)", null as "avg(dur)", null as "stddev(dur)" from slices union select "TOTAL OVER ALL SPANS (excluding events)" as name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" and dur > 0 union select name, count(*), sum(dur), cast(cast(sum(dur) as float) / (select max(ts + dur) from slices) * 1000 as int) / 10.0 as "%", min(dur), max(dur), cast(avg(dur) as int) as "avg(dur)", cast(sqrt(avg(dur*dur)-avg(dur)*avg(dur)) as int) as "stddev(dur)" from slices where parent_id is null and name != "frame" and name != "step" group by name order by sum(dur) desc, count(*) desc ``` <img width="1687" height="242" alt="image" src="https://github.com/user-attachments/assets/4d4bd890-869b-40f3-a473-8e4c42b02da4" /> The following two tables show how many `resolve` spans there per subname/subcategory, and how much time is spent in each. The first is for `n=1` and the second for `n=100`. The query that was used is: ```sql select args.string_value as name, count(*), max(dur), avg(dur), sum(dur) from slices inner join args USING (arg_set_id) where args.key = "args." || slices.name and name = "resolve" group by args.string_value ``` <img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/a8749856-c099-492e-a86e-6d67b146af9c" /> <img width="1688" height="159" alt="image" src="https://github.com/user-attachments/assets/ce3ac1b5-5c06-47d9-85a6-9b921aea348e" /> The snippet I tested with Miri to obtain the above traces is: ```rust fn main() { let n: usize = std::env::args().nth(1).unwrap().parse().unwrap(); let mut v = (0..n).into_iter().collect::<Vec<_>>(); for i in &mut v { *i += 1; } } ```
2025-08-14Apply suggestions from code reviewRalf Jung-7/+7
Co-authored-by: Boxy <rust@boxyuwu.dev>
2025-08-14avoid unnecessary type sanity checksRalf Jung-15/+11
2025-08-14shrink TestBranch::Constant and PatRangeBoundary::FiniteRalf Jung-17/+23
2025-08-14change StrLit type to ty::Value as wellRalf Jung-5/+2
2025-08-14use ty::Value instead of manual pairs of types and valtreesRalf Jung-84/+82
2025-08-14pattern testing: store constants as valtreesRalf Jung-120/+104
2025-08-14PatKind: store constants as valtreesRalf Jung-76/+66
2025-08-14resolve: Improve code reuse in typo candidate collectionVadim Petrochenkov-40/+36
2025-08-14resolve: Do not show deprecated helper attributes in typo recommendationsVadim Petrochenkov-27/+1
Remove one FIXME, addressing it does not reduce the hacky-ness much, and the logic is going to be removed anyway together with the `legacy_derive_helpers` deprecation lint.
2025-08-14resolve: Do not call `resolve_macro_path` from late resolutionVadim Petrochenkov-28/+13
`maybe_resolve_path` is less precise in corner cases, but it's only used for diagnostics and error recovery, so it's good enough.
2025-08-14Sometimes skip over tokens in `parse_token_tree`.Nicholas Nethercote-6/+23
This sometimes avoids a lot of `bump` calls.