about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src
AgeCommit message (Collapse)AuthorLines
2023-07-31Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorinoMatthias Krüger-17/+47
Map RPITIT's opaque type bounds back from projections to opaques An RPITIT in a program's AST is eventually translated into both a projection GAT and an opaque. The opaque is used for default trait methods, like: ``` trait Foo { fn bar() -> impl Sized { 0i32 } } ``` The item bounds for both the projection and opaque are identical, and both have a *projection* self ty. This is mostly okay, since we can normalize this projection within the default trait method body to the opaque, but it does two things: 1. it leads to bugs in places where we don't normalize item bounds, like `deduce_future_output_from_obligations` 2. it leads to extra match arms that are both suspicious looking and also easy to miss This PR maps the opaque type bounds of the RPITIT's *opaque* back to the opaque's self type to avoid this quirk. Then we can fix the UI test for #108304 (1.) and also remove a bunch of match arms (2.). Fixes #108304 r? `@spastorino`
2023-07-30No need to expect RPITIT projections in opaque item boundsMichael Goulet-15/+1
2023-07-30Remap explicit item bounds of RPITIT's opaque back to ty::OpaqueMichael Goulet-2/+46
2023-07-30Check lazy type aliases for well-formednessLeón Orell Valerian Liehr-2/+5
2023-07-29Take RPITITs inherit the assumed_wf_types of their parent fnMichael Goulet-88/+11
2023-07-29Auto merge of #114156 - calebzulawski:simd-bswap, r=compiler-errorsbors-0/+4
Add simd_bswap, simd_bitreverse, simd_ctlz, and simd_cttz intrinsics cc `@workingjubilee`
2023-07-28Auto merge of #114181 - matthiaskrgr:rollup-14m8s7f, r=matthiaskrgrbors-4/+22
Rollup of 7 pull requests Successful merges: - #114099 (privacy: no nominal visibility for assoc fns ) - #114128 (When flushing delayed span bugs, write to the ICE dump file even if it doesn't exist) - #114138 (Adjust spans correctly for fn -> method suggestion) - #114146 (Skip reporting item name when checking RPITIT GAT's associated type bounds hold) - #114147 (Insert RPITITs that were shadowed by missing ADTs that resolve to [type error]) - #114155 (Replace a lazy `RefCell<Option<T>>` with `OnceCell<T>`) - #114164 (Add regression test for `--cap-lints allow` and trait bounds warning) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-28Type-check generic const itemsLeón Orell Valerian Liehr-103/+122
2023-07-28Lower generic const items to HIRLeón Orell Valerian Liehr-2/+2
2023-07-28Rollup merge of #114147 - compiler-errors:missing-rpitits, r=spastorinoMatthias Krüger-4/+22
Insert RPITITs that were shadowed by missing ADTs that resolve to [type error] Comment inline explains how this can happen. Fixes #113903
2023-07-27Add SIMD bitreverse, ctlz, cttz intrinsicsCaleb Zulawski-0/+3
2023-07-27Add simd_bswap intrinsicCaleb Zulawski-0/+1
2023-07-27Insert RPITITs that were shadowed by missing ADTs that resolve to type errorMichael Goulet-4/+22
2023-07-27Remove `constness` from `ParamEnv`Deadbeef-19/+8
2023-07-27Rollup merge of #114075 - matthiaskrgr:fmt_args_rustc_3, r=wesleywiserMatthias Krüger-74/+63
inline format!() args from rustc_codegen_llvm to the end (4) r? `@WaffleLapkin`
2023-07-25Rollup merge of #113661 - oli-obk:tait_wtf, r=lcnrMatthias Krüger-4/+175
Double check that hidden types match the expected hidden type Fixes https://github.com/rust-lang/rust/issues/113278 specifically, but I left a TODO for where we should also add some hardening. It feels a bit like papering over the issue, but at least this way we don't get unsoundness, but just surprising errors. Errors will be improved and given spans before this PR lands. r? `@compiler-errors` `@lcnr`
2023-07-25inline format!() args from rustc_codegen_llvm to the end (4)Matthias Krüger-74/+63
r? @WaffleLapkin
2023-07-25Try explaining where `Inner` is in the signature betterOli Scherer-1/+1
2023-07-24Explain RPITs in the way they actually workOli Scherer-10/+16
2023-07-24Some documentation nitsOli Scherer-7/+30
2023-07-24Explain what the heck is going on with this lifetime remapping businessOli Scherer-5/+12
2023-07-23fix clippy::useless_formatMatthias Krüger-1/+1
2023-07-22Rollup merge of #113950 - cjgillot:clean-resolve, r=jackh726Matthias Krüger-38/+21
Remove Scope::Elision from bound-vars resolution. This scope is a remnant of HIR-based lifetime resolution. It's only role was to ensure that object lifetime resolution falled back to `'static`. This can be done using `ObjectLifetimeDefault` scope.
2023-07-22Remove Scope::Elision.Camille GILLOT-38/+21
2023-07-21Double check that hidden types match the expected hidden typeOli Scherer-4/+139
2023-07-21error/E0691: include alignment in error messageDavid Rheinsberg-10/+19
Include the computed alignment of the violating field when rejecting transparent types with non-trivially aligned ZSTs. ZST member fields in transparent types must have an alignment of 1 (to ensure it does not raise the layout requirements of the transparent field). The current error message looks like this: LL | struct Foobar(u32, [u32; 0]); | ^^^^^^^^ has alignment larger than 1 This patch changes the report to include the alignment of the violating field: LL | struct Foobar(u32, [u32; 0]); | ^^^^^^^^ has alignment of 4, which is larger than 1 In case of unknown alignments, it will yield: LL | struct Foobar<T>(u32, [T; 0]); | ^^^^^^ may have alignment larger than 1 This allows developers to get a better grasp why a specific field is rejected. Knowing the alignment of the violating field makes it easier to judge where that alignment-requirement originates, and thus hopefully provide better hints on how to mitigate the problem. This idea was proposed in 2022 in #98071 as part of a bigger change. This commit simply extracts this error-message change, to decouple it from the other diagnostic improvements.
2023-07-20Auto merge of #113546 - cjgillot:unused-query, r=compiler-errorsbors-3/+9
Querify unused trait check. This code transitively loads information for all bodies, and from resolutions. As it does not return a value, it should be beneficial to have it as a query.
2023-07-20XSimplifiedType to SimplifiedType::Xlcnr-5/+5
2023-07-20Rollup merge of #113795 - compiler-errors:doc, r=spastorinoMatthias Krüger-1/+1
Properly document `lifetime_mapping` in `OpaqueTy` Also use an `Option` to signify that the value is actually present, instead of just no captured lifetimes.
2023-07-19Make it clearer that edition functions are >=, not ==Michael Goulet-1/+1
2023-07-17Rename arg_iter to iter_instantiatedMichael Goulet-5/+5
2023-07-17Properly document lifetime_mapping in OpaqueTyMichael Goulet-1/+1
2023-07-16Querify unused trait check.Camille GILLOT-3/+9
2023-07-15Check entry type as part of item type checking.Camille GILLOT-269/+284
2023-07-14Rollup merge of #113698 - compiler-errors:rpitit-check, r=spastorinoMatthias Krüger-6/+6
Make it clearer that we're just checking for an RPITIT Tiny nit to use `is_impl_trait_in_trait` more, to make it clearer that we're just checking whether a def-id is an RPITIT, rather than doing something meaningful with the `opt_rpitit_info`. r? `@spastorino`
2023-07-14Make it clearer that we're just checking for an RPITITMichael Goulet-6/+6
2023-07-14refactor(rustc_middle): Substs -> GenericArgMahdi Dibaiee-525/+536
2023-07-14Introduce ExtentUnord trait for collections that can safely consume UnordItems.Michael Woerister-1/+1
2023-07-14Auto merge of #113519 - SparrowLii:parallel_typeck, r=cjgillotbors-0/+16
typeck in parallel #108118 caused `typeck` to be transferred to the serial part (`check_unused`), which made the performance of parallel rustc significantly reduced. This pr re-parallelize this part, which increases the average performance improvement of parallel rustc in `full` and `incr-full` scenarios from [14.4%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1545354608) to [23.2%](https://github.com/rust-lang/rust/pull/110284#issuecomment-1624770626). r? `@cjgillot` cc `@oli-obk` `@Zoxc`
2023-07-12Re-format let-else per rustfmt updateMark Rousskov-90/+118
2023-07-11typeck in parallelSparrowLii-0/+16
2023-07-08Replace RPITIT current impl with new strategy that lowers as a GATSantiago Pastorino-48/+7
2023-07-08Auto merge of #113474 - compiler-errors:rollup-07x1up7, r=compiler-errorsbors-13/+26
Rollup of 8 pull requests Successful merges: - #113413 (Add needs-triage to all new issues) - #113426 (Don't ICE in `resolve_bound_vars` when associated return-type bounds are in bad positions) - #113427 (Remove `variances_of` on RPITIT GATs, remove its one use-case) - #113441 (miri: check that assignments do not self-overlap) - #113453 (Remove unused from_method from rustc_on_unimplemented) - #113456 (Avoid calling report_forbidden_specialization for RPITITs) - #113466 (Update cargo) - #113467 (Fix comment of `fn_can_unwind`) r? `@ghost` `@rustbot` modify labels: rollup
2023-07-07Rollup merge of #113456 - spastorino:new-rpitit-31, r=compiler-errorsMichael Goulet-2/+11
Avoid calling report_forbidden_specialization for RPITITs Fixes #113438 r? ``@compiler-errors``
2023-07-07Rollup merge of #113427 - compiler-errors:no-variances-of-rpitit-gat, ↵Michael Goulet-9/+3
r=spastorino Remove `variances_of` on RPITIT GATs, remove its one use-case It doesn't make sense to implement variances on a GAT anyways, since we don't relate GATs with variance: https://github.com/rust-lang/rust/blob/85bf07972a1041b9e25393b803d0e006bec3eaaf/compiler/rustc_middle/src/ty/relate.rs#L569-L579 r? ``@spastorino``
2023-07-08Auto merge of #112652 - oli-obk:tait_only_in_sig, r=compiler-errorsbors-1/+20
Require TAITs to be mentioned in the signatures of functions that register hidden types for them r? `@lcnr` `@compiler-errors` This implements the lang team decision from [the TAIT design meeting](https://rust-lang.zulipchat.com/#narrow/stream/213817-t-lang/topic/design.20meeting.202023-05-31.20TAITs/near/362518164).
2023-07-07Don't ICE in resolve_bound_vars when associated return-type bounds are in ↵Michael Goulet-2/+12
bad positions
2023-07-07Avoid calling report_forbidden_specialization for RPITITsSantiago Pastorino-2/+11
2023-07-07Auto merge of #113245 - lukas-code:unsizing-sanity-check, r=the8472bors-1/+1
sanity check field offsets in unsizeable structs As promised in https://github.com/rust-lang/rust/pull/112062#issuecomment-1567494994, this PR extends the layout sanity checks to ensure that structs fields don't move around when unsizing and prevent issues like https://github.com/rust-lang/rust/issues/112048 in the future. Like most other layout sanity checks, this only runs on compilers with debug assertions enabled. Here is how it looks when it fails: ```text error: internal compiler error: compiler/rustc_ty_utils/src/layout.rs:533:21: unsizing GcNode<std::boxed::Box<i32>> changed field order! Layout { size: Size(32 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: true }, fields: Arbitrary { offsets: [Size(0 bytes), Size(8 bytes), Size(24 bytes)], memory_index: [0, 1, 2] }, largest_niche: Some(Niche { offset: Size(24 bytes), value: Pointer(AddressSpace(0)), valid_range: 1..=18446744073709551615 }), variants: Single { index: 0 } } Layout { size: Size(24 bytes), align: AbiAndPrefAlign { abi: Align(8 bytes), pref: Align(8 bytes) }, abi: Aggregate { sized: false }, fields: Arbitrary { offsets: [Size(16 bytes), Size(0 bytes), Size(24 bytes)], memory_index: [1, 0, 2] }, largest_niche: None, variants: Single { index: 0 } } ``` r? `@the8472`
2023-07-07Require TAITs to be mentioned in the signatures of functions that register ↵Oli Scherer-1/+20
hidden types for them