about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2024-04-02Don't create an FnDef of a DefKind::Variant, use the ctor def idMichael Goulet-2/+2
2024-04-02t plit astconv's error report code in check functions to mod errors.surechen-342/+448
Move some error report codes to mod `astconv/errors.rs`
2024-04-01Make sure to insert Sized bound first into clauses listMichael Goulet-2/+8
2024-04-01Auto merge of #122972 - beetrees:use-align-type, r=fee1-deadbors-1/+1
Use the `Align` type when parsing alignment attributes Use the `Align` type in `rustc_attr::parse_alignment`, removing the need to call `Align::from_bytes(...).unwrap()` later in the compilation process.
2024-04-01Use the `Align` type when parsing alignment attributesbeetrees-1/+1
2024-03-30Stop calling visitors VMichael Goulet-3/+5
2024-03-30De-LLVM the unchecked shifts [MCP#693]Scott McMurray-3/+2
This is just one part of the MCP, but it's the one that IMHO removes the most noise from the standard library code. Seems net simpler this way, since MIR already supported heterogeneous shifts anyway, and thus it's not more work for backends than before.
2024-03-29Stop doing so much to handle subdiagnosticsMichael Goulet-137/+69
2024-03-29Stop removing substs from Adt type in coherenceMichael Goulet-13/+30
2024-03-29Auto merge of #123080 - Jules-Bertholet:mut-ref-mut, r=Nadrierilbors-26/+18
Match ergonomics 2024: implement mutable by-reference bindings Implements the mutable by-reference bindings portion of match ergonomics 2024 (#123076), with the `mut ref`/`mut ref mut` syntax, under feature gate `mut_ref`. r? `@Nadrieril` `@rustbot` label A-patterns A-edition-2024
2024-03-28Auto merge of #122832 - oli-obk:no_ord_def_id3, r=michaelwoeristerbors-2/+2
Remove `DefId`'s `Partial/Ord` impls work towards https://github.com/rust-lang/rust/issues/90317 based on https://github.com/rust-lang/rust/pull/122824 and https://github.com/rust-lang/rust/pull/122820 r? `@michaelwoerister`
2024-03-27Rollup merge of #123133 - xiaoxiangxianzi:master, r=fmeaseMatthias Krüger-1/+1
chore: fix some comments
2024-03-27chore: fix some commentsxiaoxiangxianzi-1/+1
Signed-off-by: xiaoxiangxianzi <zhaoyizheng@outlook.com>
2024-03-27Use FxIndexMap instead of BTreeMap to avoid sorting `DefId`sOli Scherer-2/+2
2024-03-27Implement `mut ref`/`mut ref mut`Jules Bertholet-26/+18
2024-03-27Delegation: fix ICE on wrong instantiationBryanskiy-0/+11
2024-03-26Rollup merge of #122120 - fmease:sugg-assoc-ty-bound-on-eq-bound, ↵Matthias Krüger-64/+109
r=compiler-errors Suggest associated type bounds on problematic associated equality bounds Fixes #105056. TL;DR: Suggest `Trait<Ty: Bound>` on `Trait<Ty = Bound>` in Rust >=2021. ~~Blocked on #122055 (stabilization of `associated_type_bounds`), I'd say.~~ (merged)
2024-03-26Auto merge of #121387 - oli-obk:eager_const_failures_regression, r=lcnrbors-2/+8
Avoid some unnecessary query invocations. Specifically this inlines `const_eval_poly` and avoids computing the generic params, the param env, normalizing the param env and erasing lifetimes on everything. should fix the perf regression from https://github.com/rust-lang/rust/pull/121087
2024-03-25Rollup merge of #122881 - Bryanskiy:delegation-fixes-2, r=petrochenkovMatthias Krüger-8/+10
Delegation: fix ICE on `bound_vars` divergence Fixes https://github.com/rust-lang/rust/issues/122550. Bug was caused by divergence between lowered type and corresponding `bound_vars` in `late_bound_vars_map`. In this patch `bound_vars` calculation for delegation item is moved from `lower_fn_ty` to `resolve_bound_vars` query. r? `@petrochenkov`
2024-03-23Add+Use `mir::BinOp::Cmp`Scott McMurray-0/+5
2024-03-23Rollup merge of #121940 - veera-sivarajan:bugfix-121593, r=fmeaseJubilee-7/+15
Mention Register Size in `#[warn(asm_sub_register)]` Fixes #121593 Displays the register size information obtained from `suggest_modifier()` and `default_modifier()`.
2024-03-23also rename the SIMD intrinsicRalf Jung-1/+1
2024-03-23Auto merge of #122629 - RalfJung:assert-unsafe-precondition, r=saethlinbors-3/+2
refactor check_{lang,library}_ub: use a single intrinsic This enacts the plan I laid out [here](https://github.com/rust-lang/rust/pull/122282#issuecomment-1996917998): use a single intrinsic, called `ub_checks` (in aniticpation of https://github.com/rust-lang/compiler-team/issues/725), that just exposes the value of `debug_assertions` (consistently implemented in both codegen and the interpreter). Put the language vs library UB logic into the library. This makes it easier to do something like https://github.com/rust-lang/rust/pull/122282 in the future: that just slightly alters the semantics of `ub_checks` (making it more approximating when crates built with different flags are mixed), but it no longer affects whether these checks can happen in Miri or compile-time. The first commit just moves things around; I don't think these macros and functions belong into `intrinsics.rs` as they are not intrinsics. r? `@saethlin`
2024-03-23refactor check_{lang,library}_ub: use a single intrinsic, put policy into ↵Ralf Jung-3/+2
library
2024-03-23Auto merge of #122947 - matthiaskrgr:rollup-10j7orh, r=matthiaskrgrbors-7/+6
Rollup of 11 pull requests Successful merges: - #120577 (Stabilize slice_split_at_unchecked) - #122698 (Cancel `cargo update` job if there's no updates) - #122780 (Rename `hir::Local` into `hir::LetStmt`) - #122915 (Delay a bug if no RPITITs were found) - #122916 (docs(sync): normalize dot in fn summaries) - #122921 (Enable more mir-opt tests in debug builds) - #122922 (-Zprint-type-sizes: print the types of awaitees and unnamed coroutine locals.) - #122927 (Change an ICE regression test to use the original reproducer) - #122930 (add panic location to 'panicked while processing panic') - #122931 (Fix some typos in the pin.rs) - #122933 (tag_for_variant follow-ups) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-23Rollup merge of #122915 - fmease:lt-opaq-mismatch-delay-bug, r=compiler-errorsMatthias Krüger-4/+3
Delay a bug if no RPITITs were found Fixes #122655. See the issue for context. r? compiler-errors or compiler
2024-03-23Rollup merge of #122780 - GuillaumeGomez:rename-hir-local, r=oli-obkMatthias Krüger-3/+3
Rename `hir::Local` into `hir::LetStmt` Follow-up of #122776. As discussed on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/Improve.20naming.20of.20.60ExprKind.3A.3ALet.60.3F). I made this change into a separate PR because I'm less sure about this change as is. For example, we have `visit_local` and `LocalSource` items. Is it fine to keep these two as is (I supposed it is but I prefer to ask) or not? Having `Node::Local(LetStmt)` makes things more explicit but is it going too far? r? ```@oli-obk```
2024-03-23Auto merge of #122582 - scottmcm:swap-intrinsic-v2, r=oli-obkbors-0/+2
Let codegen decide when to `mem::swap` with immediates Making `libcore` decide this is silly; the backend has so much better information about when it's a good idea. Thus this PR introduces a new `typed_swap` intrinsic with a fallback body, and replaces that fallback implementation when swapping immediates or scalar pairs. r? oli-obk Replaces #111744, and means we'll never need more libs PRs like #111803 or #107140
2024-03-23Suggest assoc ty bound on bare dyn trait in eq constraintLeón Orell Valerian Liehr-0/+38
2024-03-22Auto merge of #122900 - matthiaskrgr:rollup-nls90mb, r=matthiaskrgrbors-20/+39
Rollup of 8 pull requests Successful merges: - #114009 (compiler: allow transmute of ZST arrays with generics) - #122195 (Note that the caller chooses a type for type param) - #122651 (Suggest `_` for missing generic arguments in turbofish) - #122784 (Add `tag_for_variant` query) - #122839 (Split out `PredicatePolarity` from `ImplPolarity`) - #122873 (Merge my contributor emails into one using mailmap) - #122885 (Adjust better spastorino membership to triagebot's adhoc_groups) - #122888 (add a couple more tests) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-22Small tweaks to the linting code for bare trait object typesLeón Orell Valerian Liehr-72/+79
2024-03-22Delay a bug if no RPITITs were foundLeón Orell Valerian Liehr-4/+3
2024-03-22Rename `hir::Local` into `hir::LetStmt`Guillaume Gomez-3/+3
2024-03-22Rollup merge of #122839 - compiler-errors:predicate-polarity, r=lcnrMatthias Krüger-14/+14
Split out `PredicatePolarity` from `ImplPolarity` Because having to deal with a third `Reservation` level in all the trait solver code is kind of weird. r? `@lcnr` or `@oli-obk`
2024-03-22Rollup merge of #122651 - kornelski:flat-turbofish, r=spastorino,compiler-errorsMatthias Krüger-6/+25
Suggest `_` for missing generic arguments in turbofish The compiler may suggest unusable generic type names for missing generic arguments in an expression context: ```rust fn main() { (0..1).collect::<Vec>() } ``` > help: add missing generic argument > > (0..1).collect::<Vec<T>>() but `T` is not a valid name in this context, and this suggestion won't compile. I've changed it to use `_` inside method calls (turbofish), so it will suggest `(0..1).collect::<Vec<_>>()` which _may_ compile. It's possible that the suggested `_` will be ambiguous, but there is very extensive E0283 that will help resolve that, which is more helpful than a basic "cannot find type `T` in this scope" users would get otherwise. Out of caution to limit scope of the change I've limited it to just turbofish, but I suspect `_` could be the better choice in more cases. Perhaps in all expressions?
2024-03-22Use != Positive rather than == NegativeMichael Goulet-1/+1
Feels more complete, and for ImplPolarity has the side-effect of making sure we also handle reservation impls correctly
2024-03-22Split out ImplPolarity and PredicatePolarityMichael Goulet-14/+14
2024-03-22Make RawPtr take Ty and Mutbl separatelyMichael Goulet-16/+22
2024-03-22Programmatically convert some of the pat ctorsMichael Goulet-8/+6
2024-03-22Ty::new_ref and Ty::new_ptr stop using TypeAndMutMichael Goulet-5/+3
2024-03-22Eagerly convert some ctors to use their specialized ctorsMichael Goulet-28/+12
2024-03-22Delegation: fix ICE on `bound_vars` divergenceBryanskiy-8/+10
2024-03-22Auto merge of #122869 - matthiaskrgr:rollup-0navj4l, r=matthiaskrgrbors-0/+10
Rollup of 9 pull requests Successful merges: - #121619 (Experimental feature postfix match) - #122370 (Gracefully handle `AnonConst` in `diagnostic_hir_wf_check()`) - #122537 (interpret/allocation: fix aliasing issue in interpreter and refactor getters a bit) - #122542 (coverage: Clean up marker statements that aren't needed later) - #122800 (Add `NonNull::<[T]>::is_empty`.) - #122820 (Stop using `<DefId as Ord>` in various diagnostic situations) - #122847 (Suggest `RUST_MIN_STACK` workaround on overflow) - #122855 (Fix Itanium mangling usizes) - #122863 (add more ice tests ) r? `@ghost` `@rustbot` modify labels: rollup
2024-03-22Rollup merge of #122370 - gurry:122199-ice-unexpected-node, r=davidtwcoMatthias Krüger-0/+10
Gracefully handle `AnonConst` in `diagnostic_hir_wf_check()` Instead of running the WF check on the `AnonConst` itself we run it on the `ty` of the generic param of which the `AnonConst` is the default value. Fixes #122199
2024-03-22Arrange methods on HirTyLowerer more logicallyLeón Orell Valerian Liehr-39/+39
This makes it easier to read the trait definition for newcomers: Sorted from least “complex” to most “complex” followed by trivial “plumbing” and grouped by area. * Move `allow_infer` above all `*_infer` methods * It's the least complex method of those * Allows the `*_infer` to be placed right next to each other * Move `probe_ty_param_bounds` further down right next to `lower_assoc_ty` and `probe_adt` * It's more complex than the `infer` methods, it should come “later” * Now all required lowering functions are grouped together * Move the “plumbing” function `set_tainted_by_errors` further down below any actual lowering methods. * Provided method should come last
2024-03-22Rename module astconv to hir_ty_loweringLeón Orell Valerian Liehr-11/+11
Split from the main renaming commit to make git generate a proper diff for ease of reviewing.
2024-03-22Update local variables and tracing callsLeón Orell Valerian Liehr-117/+105
Most of the tracing calls didn't fully leverage the power of `tracing`. For example, several of them used to hard-code method names / tracing spans as well as variable names. Use `#[instrument]` and `?var` / `%var` (etc.) instead. In my opinion, this is the proper way to migrate them from the old AstConv nomenclature to the new HIR ty lowering one.
2024-03-22Update (doc) commentsLeón Orell Valerian Liehr-215/+301
Several (doc) comments were super outdated or didn't provide enough context. Some doc comments shoved everything in a single paragraph without respecting the fact that the first paragraph should be a single sentence because rustdoc treats these as item descriptions / synopses on module pages.
2024-03-22Rename AstConv to HIR ty loweringLeón Orell Valerian Liehr-272/+267
This includes updating astconv-related items and a few local variables.
2024-03-21Implement macro-based deref!() syntax for deref patternsMichael Goulet-1/+1
Stop using `box PAT` syntax for deref patterns, as it's misleading and also causes their semantics being tangled up.