about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
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/+23
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/+23
hidden types for them
2023-07-07Remove variances_of on RPITIT gats, remove its one use-caseMichael Goulet-9/+3
2023-07-06Do not assert >1 RPITITs on collect_return_position_impl_trait_in_trait_tysSantiago Pastorino-5/+7
2023-07-06add helper methods for accessing struct tailLukas Markeffsky-1/+1
2023-07-05Move `TyCtxt::mk_x` to `Ty::new_x` where applicableBoxy-199/+239
2023-07-05Auto merge of #113210 - fee1-dead-contrib:effects-mvp, r=oli-obkbors-5/+25
Effects/keyword generics MVP This adds `feature(effects)`, which adds `const host: bool` to the generics of const functions, const traits and const impls. This will be used to replace the current logic around const traits. r? `@oli-obk`
2023-07-05Only use a single loop over the associated typesOli Scherer-5/+2
2023-07-05Prefer `retain` over hand-rolling an inefficient version of itOli Scherer-7/+3
2023-07-05tidy: move a large function out of an even larger fileOli Scherer-406/+418
2023-07-05Lint now-unnecessary associated type boundsOli Scherer-4/+35
2023-07-05Don't require associated types with `Self: Sized` bounds in `dyn Trait` objectsOli Scherer-0/+10
2023-07-04include `host_effect_index` in `Generics`Deadbeef-5/+21
2023-07-04Replace `const_error` methods with `Const::new_error`Boxy-11/+11
2023-07-04Replace `mk_const` with `Const::new_x` methodsBoxy-13/+15
2023-07-04add testDeadbeef-2/+6
2023-07-04Auto merge of #113303 - compiler-errors:yeet-chalk, r=lcnrbors-6/+3
Remove chalk support from the compiler Removes chalk (`-Ztrait-solver=chalk`) from the compiler and prunes any dead code resulting from this, mainly: * Remove the chalk compatibility layer in `compiler/rustc_traits/src/chalk` * Remove the chalk flag `-Ztrait-solver=chalk` and its `TraitEngine` implementation * Remove `TypeWellFormedFromEnv` (and its many `bug!()` match arms) * Remove the chalk migration mode from compiletest * Remove the `chalkify` UI tests (do we want to keep any of these, but migrate them to `-Ztrait-solver=next`??) Fulfills rust-lang/types-team#93. r? `@jackh726`
2023-07-04Auto merge of #113215 - compiler-errors:rpitit-predicates-tweaks, r=spastorinobors-3/+16
Make RPITITs assume/require their parent method's predicates Removes a FIXME from the `param_env` query where we were manually adding the parent function's predicates to the RPITIT's assumptions. r? `@spastorino`
2023-07-03remove TypeWellFormedFromEnvMichael Goulet-6/+3
2023-07-03Rollup merge of #113286 - fmease:iat-dont-select-if-not-enabled, ↵Guillaume Gomez-5/+9
r=compiler-errors Don't perform selection if inherent associated types are not enabled Fixes #113265. As discussed r? `@compiler-errors`
2023-07-03Don't perform selection if IATs are not enabledLeón Orell Valerian Liehr-5/+9
2023-07-03use `deeply_normalize` for `assumed_wf_types`lcnr-21/+27
2023-07-01Rollup merge of #113182 - compiler-errors:rpit-stricter-captures, r=oli-obkMatthias Krüger-32/+116
Error when RPITITs' hidden types capture more lifetimes than their trait definitions This implements a stricter set of captures rules for RPITITs. They now may only capture: 1. Lifetimes from the impl header (both the self type and any trait substs -- we may want to restrict just to the self type's lifetimes, but the PR makes that easy to do, too) 2. Lifetimes mentioned by the `impl Trait` in the trait method's definition. Namely, they may not mention lifetimes from the method (early or late) that are not mentioned in the `impl Trait`. cc #105258 which I think was trying to do this too, though I'm not super familiar with what exactly differs from that or why that one was broken. cc #112194 (doesn't fix this issue per se, because it's still an open question, but I think this is objectively better than the status quo, and gets us closer to resolving that issue.) Technically is a fix for the ICE in #108580, but it turns that issue into an error now. We can decide separately whether or not nested RPITITs should capture lifetimes from their parents. r? ``@oli-obk``
2023-07-01Auto merge of #113154 - lcnr:better-probe-check, r=compiler-errorsbors-3/+3
change snapshot tracking in fulfillment contexts use the exact snapshot number to prevent misuse even when created inside of a snapshot
2023-06-30RPITITs inherit method predicatesMichael Goulet-2/+14
2023-06-30use explicit predicatesMichael Goulet-1/+2
2023-06-30Rollup merge of #113171 - spastorino:new-rpitit-25, r=compiler-errorsMatthias Krüger-9/+15
Properly implement variances_of for RPITIT GAT This fixes some of the issues found by crater run in https://github.com/rust-lang/rust/pull/112988#issuecomment-1610019572 r? ``@compiler-errors``