summary refs log tree commit diff
path: root/compiler/rustc_middle/src
AgeCommit message (Collapse)AuthorLines
2023-04-16Move a const-prop-lint specific hack from mir interpret to const-prop-lint ↵Oli Scherer-3/+3
and make it fallible
2023-03-11tweak ClosureOutlivesSubjectTyAli MJ Al-Nasrawy-7/+10
2023-03-11promote subject even if it has unnamed regionsAli MJ Al-Nasrawy-12/+45
Don't require a region to have an `external_name` in order to be promoted.
2023-03-04Auto merge of #108732 - Dylan-DPC:rollup-dy1l8sx, r=Dylan-DPCbors-3/+7
Rollup of 6 pull requests Successful merges: - #108298 (Fix ICE: check if snippet is `)`) - #108405 (Lazily compute crate name for consider_optimizing) - #108656 (Rustdoc search: Emit an error for unclosed generic) - #108660 (Remove ne implementations from strings) - #108669 (Allow checking whether a type allows being uninitialized) - #108727 (rustc_expand: make proc-macro derive error translatable) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-04Rollup merge of #108669 - Nilstrieb:query-my-uninitness, r=compiler-errorsDylan DPC-1/+6
Allow checking whether a type allows being uninitialized This is useful for clippy ([rust-lang/clippy#10407](https://github.com/rust-lang/rust-clippy/issues/10407)) and for the future `MaybeUninit::assume_init` panics (#100423).
2023-03-04Rollup merge of #108405 - Nilstrieb:lazy-crate-name-optimization-fuel, ↵Dylan DPC-2/+1
r=WaffleLapkin Lazily compute crate name for consider_optimizing The extra query is unnecessary in the common case of not having fuel.
2023-03-04Auto merge of #108689 - compiler-errors:normalization-error-smaller, r=lcnrbors-3/+0
Remove `NormalizationError::ConstantKind` No longer in use by `TryNormalizeAfterErasingRegionsFolder` (as of #102355 / e8150fa60cc445de7a57db634deb0668880be593 it seems). It's making `LayoutError`, etc. kinda large -- that was noticed by `@zoxc.`
2023-03-03Rollup merge of #108694 - est31:backticks_matchmaking_comments, r=NilstriebMatthias Krüger-10/+10
Match unmatched backticks in compiler/ comments r? ``@Nilstrieb`` as per [advice](https://github.com/rust-lang/rust/pull/108685#issuecomment-1453018499)
2023-03-03Rollup merge of #108685 - est31:backticks_matchmaking, r=petrochenkovMatthias Krüger-1/+1
Match unmatched backticks in compiler/ Found with GNU grep: ``` grep -rEn '^(([^`]*`){2})*[^`]*`[^`]*$' compiler/ | rg -v '\s*[//]?.{1,2}```' ```
2023-03-03Rollup merge of #107981 - lcnr:canonicalization-uwu, r=compiler-errorsMatthias Krüger-7/+83
new solver: implement canonicalization and region constraints see the corresponding rustc-dev-guide chapter: https://rustc-dev-guide.rust-lang.org/solve/canonicalization.html r? ``@compiler-errors``
2023-03-03canonicalizationlcnr-7/+83
2023-03-03Match end user facing unmatched backticks in compiler/est31-1/+1
2023-03-03Match unmatched backticks in comments in compiler/est31-5/+5
2023-03-03Match unmatched backticks in compiler/ that are part of rustdocest31-5/+5
2023-03-03Remove NormalizationError::ConstantKindMichael Goulet-3/+0
2023-03-02Rollup merge of #108624 - Nilstrieb:move-it-up, r=WaffleLapkinMatthias Krüger-3/+3
Make `ExprKind` the first field in `thir::Expr` This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
2023-03-02Rollup merge of #108022 - CraftSpider:align-bytes, r=oli-obkMatthias Krüger-28/+80
Support allocations with non-Box<[u8]> bytes This is prep work for allowing miri to support passing pointers to C code, which will require `Allocation`s to be correctly aligned. Currently, it just makes `Allocation` generic and plumbs the necessary changes through the right places. The follow-up to this will be adding a type in the miri interpreter which correctly aligns the bytes, using that for the Miri engine, then allowing Miri to pass pointers into these allocations to C calls. Based off of #100467, credit to ```@emarteca``` for the code
2023-03-02Allow checking whether a type allows being uninitializedNilstrieb-1/+6
This is useful for clippy and for the future `MaybeUninit::assume_init` panics.
2023-03-02Make `ExprKind` the first field in `thir::Expr`Nilstrieb-3/+3
This makes its `Debug` impl print it first which is useful, as it's the most important part when looking at an expr.
2023-03-01FormatRune Tynan-8/+2
2023-03-01Make associated_item_def_ids for traits use an unstable option to also ↵Santiago Pastorino-0/+11
return associated types for RPITITs
2023-03-01Add opt_rpitit_info querySantiago Pastorino-0/+15
2023-03-01Auto merge of #108587 - matthiaskrgr:rollup-rw6po59, r=matthiaskrgrbors-9/+23
Rollup of 10 pull requests Successful merges: - #108376 (compiler/rustc_session: fix sysroot detection logic) - #108400 (add llvm cgu instructions stats to perf) - #108496 (fix #108495, postfix decrement and prefix decrement has no warning) - #108505 (Further unify validity intrinsics) - #108520 (Small cleanup to `one_bound_for_assoc_type`) - #108560 (Some `infer/mod.rs` cleanups) - #108563 (Make mailmap more correct) - #108564 (Fix `x clean` with specific paths) - #108571 (Add contains_key to SortedIndexMultiMap) - #108578 (Update Fuchsia platform team members) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-01Rollup merge of #108505 - Nilstrieb:further-unify-validity-intrinsics, ↵Matthias Krüger-9/+23
r=michaelwoerister Further unify validity intrinsics Also merges the inhabitedness check into the query to further unify the code paths. Depends on #108364
2023-02-28Make zeroed return an OptionRune Tynan-13/+8
2023-02-28Descriptive error when users try to combine RPITIT/AFIT with specializationMichael Goulet-0/+28
2023-02-27Auto merge of #108487 - cjgillot:no-typeck-mir, r=oli-obkbors-30/+77
Avoid invoking typeck from borrowck This PR attempts to reduce direct dependencies between typeck and MIR-related queries. The goal is to have all the information transit either through THIR or through dedicated queries that avoid depending on the whole `TypeckResults`. In a first commit, we store the type information that MIR building requires into THIR. This avoids edges between mir_built and typeck. In the second and third commit, we wrap informations around closures (upvars, kind origin and user-provided signature) to avoid borrowck depending on typeck information. There should be a single remaining borrowck -> typeck edge in the good path, due to inline consts.
2023-02-27Auto merge of #108538 - matthiaskrgr:rollup-vw6h5ea, r=matthiaskrgrbors-9/+0
Rollup of 8 pull requests Successful merges: - #104265 (Move IpAddr, SocketAddr and V4+V6 related types to `core`) - #107110 ([stdio][windows] Use MBTWC and WCTMB) - #108308 (Allow building serde and serde_derive in parallel) - #108363 (Move the unused extern crate check back to the resolver.) - #108519 (Bages for easy access links to Rust community) - #108522 (Commit some new solver tests) - #108523 (Avoid `&str` to `String` conversions) - #108533 (diagnostics: avoid querying `associated_item` in the resolver) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-27Rollup merge of #108363 - cjgillot:unused-crate, r=WaffleLapkinMatthias Krüger-9/+0
Move the unused extern crate check back to the resolver. It doesn't have anything to do in `rustc_hir_typeck`.
2023-02-27Auto merge of #108493 - cjgillot:thir-print, r=compiler-errorsbors-882/+0
Move THIR printing to rustc_mir_build. https://github.com/rust-lang/rust/pull/107451 increased the compilation time of `rustc_middle` by 10% = 3s. As https://github.com/rust-lang/rust/pull/107006 adds quite a lot of code to rustc_middle, I suspect it to be the cause. This PR moves the THIR printing code to `rustc_mir_build`, where the query provider lives, in order to benefit from higher parallelism when compiling rustc.
2023-02-27Unify all validity check intrinsicsNilstrieb-9/+23
Also merges the inhabitedness check into the query to further unify the code paths.
2023-02-27Rollup merge of #108486 - cjgillot:owner-ditem, r=NilstriebMatthias Krüger-5/+9
Merge diagnostic_items duplicate diagnostics To deduplicate how we diagnose duplication.
2023-02-27Rollup merge of #108364 - Nilstrieb:validity-checks-refactor, r=compiler-errorsMatthias Krüger-7/+43
Unify validity checks into a single query Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern. I am planning on adding a further initness to check in #100423, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one. I am not entirely happy with the naming and key type and open for improvements. r? oli-obk
2023-02-26Move THIR printing to rustc_mir_build.Camille GILLOT-882/+0
2023-02-26Wrap more into into closure_typeinfo query.Camille GILLOT-11/+36
2023-02-26Access upvars through a query.Camille GILLOT-25/+27
2023-02-26Store the body type in THIR.Camille GILLOT-3/+23
2023-02-26Simplify diagnostic_items.Camille GILLOT-5/+9
2023-02-26Auto merge of #108375 - Zoxc:query-inline, r=cjgillotbors-0/+1
Add inlining attributes for query system functions These only have a single caller, but don't always get inlined.
2023-02-25Auto merge of #108450 - matthiaskrgr:rollup-rqvfgu3, r=matthiaskrgrbors-2/+3
Rollup of 7 pull requests Successful merges: - #108354 (Update `fuchsia-test-runner.py` and docs) - #108404 (support `x fmt` for sub and outside of rust directories) - #108407 (docs: use intra-doc links for `Vec::get(_mut)`) - #108410 (rustdoc: avoid including `<li>` tags in item table short desc) - #108412 (Fix GUI test navigation bug) - #108433 (Wrap missing provider message correctly) - #108434 (Migrate `rustc_hir_analysis` to session diagnostic [Part One]) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-02-25Add inlining attributes for query system functionsJohn Kåre Alsaker-0/+1
2023-02-24Wrap missing provider message correctlyMichael Goulet-2/+3
2023-02-24Use `List::empty()` instead of `mk_substs(&[])`.Nicholas Nethercote-1/+1
2023-02-24Add `mk_canonical_var_infos_from_iter`.Nicholas Nethercote-3/+11
It's missing, and is useful in two places.
2023-02-24Rename `mk_{ty,region}` as `mk_{ty,region}_from_kind`.Nicholas Nethercote-33/+41
To discourage accidental use -- there are more specific `mk_*` functions for all `Ty` and `Region` kinds.
2023-02-24Rename many interner functions.Nicholas Nethercote-138/+148
(This is a large commit. The changes to `compiler/rustc_middle/src/ty/context.rs` are the most important ones.) The current naming scheme is a mess, with a mix of `_intern_`, `intern_` and `mk_` prefixes, with little consistency. In particular, in many cases it's easy to use an iterator interner when a (preferable) slice interner is available. The guiding principles of the new naming system: - No `_intern_` prefixes. - The `intern_` prefix is for internal operations. - The `mk_` prefix is for external operations. - For cases where there is a slice interner and an iterator interner, the former is `mk_foo` and the latter is `mk_foo_from_iter`. Also, `slice_interners!` and `direct_interners!` can now be `pub` or non-`pub`, which helps enforce the internal/external operations division. It's not perfect, but I think it's a clear improvement. The following lists show everything that was renamed. slice_interners - const_list - mk_const_list -> mk_const_list_from_iter - intern_const_list -> mk_const_list - substs - mk_substs -> mk_substs_from_iter - intern_substs -> mk_substs - check_substs -> check_and_mk_substs (this is a weird one) - canonical_var_infos - intern_canonical_var_infos -> mk_canonical_var_infos - poly_existential_predicates - mk_poly_existential_predicates -> mk_poly_existential_predicates_from_iter - intern_poly_existential_predicates -> mk_poly_existential_predicates - _intern_poly_existential_predicates -> intern_poly_existential_predicates - predicates - mk_predicates -> mk_predicates_from_iter - intern_predicates -> mk_predicates - _intern_predicates -> intern_predicates - projs - intern_projs -> mk_projs - place_elems - mk_place_elems -> mk_place_elems_from_iter - intern_place_elems -> mk_place_elems - bound_variable_kinds - mk_bound_variable_kinds -> mk_bound_variable_kinds_from_iter - intern_bound_variable_kinds -> mk_bound_variable_kinds direct_interners - region - intern_region (unchanged) - const - mk_const_internal -> intern_const - const_allocation - intern_const_alloc -> mk_const_alloc - layout - intern_layout -> mk_layout - adt_def - intern_adt_def -> mk_adt_def_from_data (unusual case, hard to avoid) - alloc_adt_def(!) -> mk_adt_def - external_constraints - intern_external_constraints -> mk_external_constraints Other - type_list - mk_type_list -> mk_type_list_from_iter - intern_type_list -> mk_type_list - tup - mk_tup -> mk_tup_from_iter - intern_tup -> mk_tup
2023-02-24Tweak the slice interners.Nicholas Nethercote-59/+24
All the slice interners have a wrapper that handles the empty slice case. We can instead handle this in the `slice_interners!` macro, avoiding the need for most of the wrappers, and allowing the interner functions to be renamed from `_intern_foos` to `intern_foos`. The two exceptions: - intern_predicates: I kept this wrapper because there's a FIXME comment about a possible future change. - intern_poly_existential_predicates: I kept this wrapper because it asserts that the slice is empty and sorted.
2023-02-23Lazily compute crate name for consider_optimizingNilstrieb-2/+1
The extra query is unnecessary in the common case of not having fuel.
2023-02-23Unify validity checks into a single queryNilstrieb-7/+43
Previously, there were two queries to check whether a type allows the 0x01 or zeroed bitpattern. I am planning on adding a further initness to check, truly uninit for MaybeUninit, which would make this three queries. This seems overkill for such a small feature, so this PR unifies them into one.
2023-02-23Auto merge of #108369 - compiler-errors:ty-error-more, r=BoxyUwUbors-13/+12
Use `tcx.ty_error_with_guaranteed` in more places, rename variants 1. Use `ty_error_with_guaranteed` more so we don't delay so many span bugs 2. Rename `ty_error_with_guaranteed` to `ty_error`, `ty_error` to `ty_error_misc`. This is to incentivize using the former over the latter in cases where we already are witness to a `ErrorGuaranteed` token. Second commit is just name replacement, so the first commit can be reviewed on its own with more scrutiny.