about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2024-06-26Rollup merge of #126968 - lqd:issue-126670, r=compiler-errorsMatthias Krüger-4/+4
Don't ICE during RPITIT refinement checking for resolution errors after normalization #126670 shows a case where resolution errors after normalization can happen during RPITIT refinement checking. Our tests didn't reach this path before, and we explicitly ICEd until we had a test. We can now delay a bug since we're sure it is reachable and have the test from the isue. The comment I added likely still needs more expert wordsmithing. r? ``@compiler-errors`` who's making me work during vacation (j/k). Fixes #126670
2024-06-25delay bug in RPITIT refinement checking with resolution errorsRémy Rakic-4/+4
2024-06-25Rollup merge of #126868 - bvanjoi:fix-126764, r=davidtwcoMatthias Krüger-5/+12
not use offset when there is not ends with brace Fixes #126764
2024-06-24Split out IntoIterator and non-Iterator constructors for ↵Michael Goulet-15/+24
AliasTy/AliasTerm/TraitRef/projection
2024-06-23not use offset when there is not ends with bracebohan-5/+12
2024-06-22Rollup merge of #126552 - fee1-dead-contrib:rmfx, r=compiler-errorsMatthias Krüger-12/+12
Remove use of const traits (and `feature(effects)`) from stdlib The current uses are already unsound because they are using non-const impls in const contexts. We can reintroduce them by reverting the commit in this PR, after #120639 lands. Also, make `effects` an incomplete feature. cc `@rust-lang/project-const-traits` r? `@compiler-errors`
2024-06-22Rollup merge of #126686 - fmease:dump-preds-n-item-bounds, r=compiler-errorsGuillaume Gomez-102/+116
Add `#[rustc_dump_{predicates,item_bounds}]` Conflicts with #126668. As discussed r? compiler-errors CC ``@fee1-dead``
2024-06-22Add `#[rustc_dump_{predicates,item_bounds}]`León Orell Valerian Liehr-0/+26
2024-06-21Rename a bunch of thingsMichael Goulet-11/+11
2024-06-21update intrinsic const param countingDeadbeef-12/+12
2024-06-20Slightly refactor the dumping of HIR analysis dataLeón Orell Valerian Liehr-102/+90
2024-06-20Rollup merge of #126717 - nnethercote:rustfmt-use-pre-cleanups, r=jieyouxuMatthias Krüger-0/+1
Clean up some comments near `use` declarations #125443 will reformat all `use` declarations in the repository. There are a few edge cases involving comments on `use` declarations that require care. This PR cleans up some clumsy comment cases, taking us a step closer to #125443 being able to merge. r? ``@lqd``
2024-06-20Rollup merge of #126620 - oli-obk:taint_errors, r=fee1-deadMatthias Krüger-10/+1
Actually taint InferCtxt when a fulfillment error is emitted And avoid checking the global error counter fixes #122044 fixes #123255 fixes #123276 fixes #125799
2024-06-20Add blank lines after module-level `//` comments.Nicholas Nethercote-0/+1
Similar to the previous commit.
2024-06-19Allow tracing through item_bounds query invocations on opaquesOli Scherer-1/+1
Previously these caused cycles when printing the result
2024-06-19Remove a hack that isn't needed anymoreOli Scherer-10/+1
2024-06-19Rollup merge of #125293 - dingxiangfei2009:tail-expr-temp-lifetime, ↵许杰友 Jieyou Xu (Joe)-2/+8
r=estebank,davidtwco Place tail expression behind terminating scope This PR implements #123739 so that we can do further experiments in nightly. A little rewrite has been applied to `for await` lowering. It was previously `unsafe { Pin::unchecked_new(into_async_iter(..)) }`. Under the edition 2024 rule, however, `into_async_iter` gets dropped at the end of the `unsafe` block. This presumably the first Edition 2024 migration rule goes by hoisting `into_async_iter(..)` into `match` one level above, so it now looks like the following. ```rust match into_async_iter($iter_expr) { ref mut iter => match unsafe { Pin::unchecked_new(iter) } { ... } } ```
2024-06-18Remove redundant argument from `subdiagnostic` methodOli Scherer-46/+28
2024-06-18Use a dedicated type instead of a reference for the diagnostic contextOli Scherer-2/+2
This paves the way for tracking more state (e.g. error tainting) in the diagnostic context handle
2024-06-18Prefer `dcx` methods over fields or fields' methodsOli Scherer-1/+1
2024-06-17Rework precise capturing syntaxMichael Goulet-2/+8
2024-06-18tail expression behind terminating scopeDing Xiang Fei-2/+8
2024-06-15Rollup merge of #126417 - beetrees:f16-f128-inline-asm-x86, r=AmanieuMatthias Krüger-0/+4
Add `f16` and `f128` inline ASM support for `x86` and `x86-64` This PR adds `f16` and `f128` input and output support to inline ASM on `x86` and `x86-64`. `f16` vector sizes are taken from [here](https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html). Relevant issue: #125398 Tracking issue: #116909 ``@rustbot`` label +F-f16_and_f128
2024-06-14Use is_lang_item more aggressivelyMichael Goulet-5/+6
2024-06-14Update for reviewmatt rice-2/+17
2024-06-14Rollup merge of #126054 - veera-sivarajan:bugfix-113073-bound-on-generics-2, ↵Matthias Krüger-10/+78
r=fee1-dead `E0229`: Suggest Moving Type Constraints to Type Parameter Declaration Fixes #113073 This PR suggests `impl<T: Bound> Trait<T> for Foo` when finding `impl Trait<T: Bound> for Foo`. Tangentially, it also improves a handful of other error messages. It accomplishes this in two steps: 1. Check if constrained arguments and parameter names appear in the same order and delay emitting "incorrect number of generic arguments" error because it can be confusing for the programmer to see `0 generic arguments provided` when there are `n` constrained generic arguments. 2. Inside `E0229`, suggest declaring the type parameter right after the `impl` keyword by finding the relevant impl block's span for type parameter declaration. This also handles lifetime declarations correctly. Also, the multi part suggestion doesn't use the fluent error mechanism because translating all the errors to fluent style feels outside the scope of this PR. I will handle it in a separate PR if this gets approved.
2024-06-13Add `f16` and `f128` inline ASM support for `x86` and `x86-64`beetrees-0/+4
2024-06-12E0229: Suggest Moving Type Constraints to Type Parameter DeclarationVeera-10/+78
2024-06-12Rollup merge of #126340 - fee1-dead-contrib:fix-predicates_of-comments, ↵Michael Goulet-5/+4
r=compiler-errors Fix outdated predacates_of.rs comments <!-- If this PR is related to an unstable feature or an otherwise tracked effort, please link to the relevant tracking issue here. If you don't know of a related tracking issue or there are none, feel free to ignore this. This PR will get automatically assigned to a reviewer. In case you would like a specific user to review your work, you can assign it to them by using r​? <reviewer name> -->
2024-06-12Fix outdated predacates_of.rs commentsDeadbeef-5/+4
2024-06-12Rollup merge of #126228 - BoxyUwU:nested_repeat_expr_generics, r=compiler-errorsGuillaume Gomez-5/+21
Provide correct parent for nested anon const Fixes #126147 99% of this PR is just comments explaining what the issue is. `tcx.parent(` and `hir().get_parent_item(` give different results as the hir owner for all the hir of anon consts is the enclosing function. I didn't attempt to change that as being a hir owner requires a `DefId` and long term we want to stop creating anon consts' `DefId`s before hir ty lowering. So i just opted to change `generics_of` to use `tcx.parent` to get the parent for `AnonConst`'s. I'm not entirely sure about this being what we want, it does seem weird that we have two ways of getting the parent of an `AnonConst` and they both give different results. Alternatively we could just go ahead and make `const_evaluatable_unchecked` a hard error and stop providing generics to repeat exprs. Then this isn't an issue. (The FCW has been around for almost 4 years now) r? ````@compiler-errors````
2024-06-12Auto merge of #126319 - workingjubilee:rollup-lendnud, r=workingjubileebors-68/+91
Rollup of 16 pull requests Successful merges: - #123374 (DOC: Add FFI example for slice::from_raw_parts()) - #124514 (Recommend to never display zero disambiguators when demangling v0 symbols) - #125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking) - #125980 (Nvptx remove direct passmode) - #126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.) - #126210 (docs(core): make more const_ptr doctests assert instead of printing) - #126249 (Simplify `[T; N]::try_map` signature) - #126256 (Add {{target}} substitution to compiletest) - #126263 (Make issue-122805.rs big endian compatible) - #126281 (set_env: State the conclusion upfront) - #126286 (Make `storage-live.rs` robust against rustc internal changes.) - #126287 (Update a cranelift patch file for formatting changes.) - #126301 (Use `tidy` to sort crate attributes for all compiler crates.) - #126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`) - #126310 (Migrate run make prefer rlib) - #126314 (fix RELEASES: we do not support upcasting to auto traits) r? `@ghost` `@rustbot` modify labels: rollup
2024-06-12Rollup merge of #126301 - nnethercote:sort-crate-attributes, r=davidtwcoJubilee-2/+4
Use `tidy` to sort crate attributes for all compiler crates. We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`). r? `@davidtwco`
2024-06-12Rollup merge of #125978 - ↵Jubilee-66/+87
fmease:cleanup-hir-ty-lowering-consolidate-assoc-item-access-checking, r=davidtwco Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking Use `probe_assoc_item` (for hygienically probing an assoc item and checking if it's accessible wrt. visibility and stability) for assoc item constraints, too, not just for assoc type paths and make the privacy error translatable.
2024-06-12Require any function with a tait in its signature to actually constrain a ↵Oli Scherer-2/+24
hidden type
2024-06-12Use `tidy` to sort crate attributes for all compiler crates.Nicholas Nethercote-2/+4
We already do this for a number of crates, e.g. `rustc_middle`, `rustc_span`, `rustc_metadata`, `rustc_span`, `rustc_errors`. For the ones we don't, in many cases the attributes are a mess. - There is no consistency about order of attribute kinds (e.g. `allow`/`deny`/`feature`). - Within attribute kind groups (e.g. the `feature` attributes), sometimes the order is alphabetical, and sometimes there is no particular order. - Sometimes the attributes of a particular kind aren't even grouped all together, e.g. there might be a `feature`, then an `allow`, then another `feature`. This commit extends the existing sorting to all compiler crates, increasing consistency. If any new attribute line is added there is now only one place it can go -- no need for arbitrary decisions. Exceptions: - `rustc_log`, `rustc_next_trait_solver` and `rustc_type_ir_macros`, because they have no crate attributes. - `rustc_codegen_gcc`, because it's quasi-external to rustc (e.g. it's ignored in `rustfmt.toml`).
2024-06-10Correct parent for nested anon constsBoxy-5/+21
2024-06-07Auto merge of #125918 - oli-obk:const_block_ice, r=compiler-errorsbors-15/+13
Revert: create const block bodies in typeck via query feeding as per the discussion in https://github.com/rust-lang/rust/pull/125806#discussion_r1622563948 It was a mistake to try to shoehorn const blocks and some specific anon consts into the same box and feed them during typeck. It turned out not simplifying anything (my hope was that we could feed `type_of` to start avoiding the huge HIR matcher, but that didn't work out), but instead making a few things more fragile. reverts the const-block-specific parts of https://github.com/rust-lang/rust/pull/124650 `@bors` rollup=never had a small perf impact previously fixes https://github.com/rust-lang/rust/issues/125846 r? `@compiler-errors`
2024-06-07Revert "Create const block DefIds in typeck instead of ast lowering"Oli Scherer-15/+13
This reverts commit ddc5f9b6c1f21da5d4596bf7980185a00984ac42.
2024-06-06Uplift TypeErrorMichael Goulet-0/+1
2024-06-06Auto merge of #124482 - spastorino:unsafe-extern-blocks, r=oli-obkbors-9/+13
Unsafe extern blocks This implements RFC 3484. Tracking issue #123743 and RFC https://github.com/rust-lang/rfcs/pull/3484 This is better reviewed commit by commit.
2024-06-05Misc fixes (pattern type lowering, cfi, pretty printing)Boxy-12/+11
2024-06-05Basic removal of `Ty` from places (boring)Boxy-48/+25
2024-06-05Unify optional param info with object lifetime default boolean into an enum ↵Oli Scherer-32/+48
that exhaustively supports all call sites
2024-06-05Remove `allows_infer` now that every use of it is delegated to `HirTyLowerer`Oli Scherer-7/+0
2024-06-05Only collect infer vars to error about in case infer vars are actually forbiddenOli Scherer-85/+95
2024-06-05Remove an `Option` and instead eagerly create error lifetimesOli Scherer-52/+35
2024-06-05Simplify some code paths and remove an unused fieldOli Scherer-15/+3
`ct_infer` and `lower_ty` will correctly result in an error constant or type respectively, as they go through a `HirTyLowerer` method (just like `HirTyLowerer::allow_infer` is a method implemented by both implementors
2024-06-05Use a `LocalDefId` for `HirTyLowerer::item_def_id`, since we only ever (can) ↵Oli Scherer-13/+11
use it for local items
2024-06-04Cleanup: HIR ty lowering: Consolidate assoc item access checkingLeón Orell Valerian Liehr-66/+87