about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis/src/check
AgeCommit message (Collapse)AuthorLines
2023-09-08Stabilize impl_trait_projectionsMichael Goulet-132/+3
2023-09-07Don't emit refining_impl_trait for private itemsMichael Goulet-0/+28
2023-09-07Use self instead of the actual self tyMichael Goulet-3/+15
2023-09-07Implement refinement lint for RPITITMichael Goulet-0/+279
2023-08-30Auto merge of #114908 - cjgillot:no-let-under, r=compiler-errorsbors-1/+1
Do not compute unneeded query results. r? `@ghost`
2023-08-29repr(transparent): it's fine if the one non-1-ZST field is a ZSTRalf Jung-37/+21
2023-08-23Allow MaybeUninit in input and output of inline assemblyTaiki Endo-19/+34
2023-08-22unknown unstable lint command linemojave2-0/+1
fix ##113702 fix #113702 unknown unstable lint command lint improve impelementation
2023-08-20Add projection obligations when comparing impl tooJack Huey-1/+8
2023-08-19Do not compute unneeded results.Camille GILLOT-1/+1
2023-08-15Rollup merge of #114772 - fee1-dead-contrib:typed-did, r=b-naberGuillaume Gomez-5/+5
Add `{Local}ModDefId` to more strongly type DefIds` Based on #110862 by `@Nilstrieb`
2023-08-14Rollup merge of #114752 - RickleAndMortimer:issue-113788-fix, r=compiler-errorsMatthias Krüger-1/+1
fixed *const [type error] does not implement the Copy trait Removes "error: arguments for inline assembly must be copyable" when moving an unknown type Fixes: #113788
2023-08-14fixed *const [type error] does not implement the Copy traitnxya-1/+1
2023-08-14Use `{Local}ModDefId` in many queriesNilstrieb-4/+4
2023-08-13Select obligations before processing wf obligation in ↵Michael Goulet-1/+10
compare_method_predicate_entailment
2023-08-13Add typed `{Local}DefId` for modulesNilstrieb-1/+1
This allows for better type safety in the compiler and also improves the documentation for many things, making it clear that they expect modules.
2023-08-11Only check outlives goals on impl compared to traitJack Huey-12/+39
2023-08-08Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obkbors-124/+28
Map RPIT duplicated lifetimes back to fn captured lifetimes Use the [`lifetime_mapping`](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_hir/hir/struct.OpaqueTy.html#structfield.lifetime_mapping) to map an RPIT's captured lifetimes back to the early- or late-bound lifetimes from its parent function. We may be going thru several layers of mapping, since opaques can be nested, so we introduce `TyCtxt::map_rpit_lifetime_to_fn_lifetime` to loop through several opaques worth of mapping, and handle turning it into a `ty::Region` as well. We can then use this instead of the identity substs for RPITs in `check_opaque_meets_bounds` to address #114285. We can then also use `map_rpit_lifetime_to_fn_lifetime` to properly install bidirectional-outlives predicates for both RPITs and RPITITs. This addresses #114601. I based this on #114574, but I don't actually know how much of that PR we still need, so some code may be redundant now... :shrug: --- Fixes #114597 Fixes #114579 Fixes #114285 Also fixes #114601, since it turns out we had other bugs with RPITITs and their duplicated lifetime params :sweat_smile:. Supersedes #114574 r? `@oli-obk`
2023-08-08Simplify via map_rpit_lifetime_to_fn_lifetimeMichael Goulet-144/+11
2023-08-08Stop using identity args for opaque type wf checks and instead load the args ↵Oli Scherer-76/+113
from the single use of a RPIT in its parent function's return type
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-1/+1
r=oli-obk Store the laziness of type aliases in their `DefKind` Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not. With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*: Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates. As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions. --- This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold. `@rustbot` label F-lazy_type_alias r? `@oli-obk`
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-1/+1
2023-08-06Add a new `compare_bytes` intrinsic instead of calling `memcmp` directlyScott McMurray-0/+4
2023-08-04Rollup merge of #114253 - fmease:compute-variances-for-lazy-ty-aliases, ↵Matthias Krüger-4/+22
r=oli-obk Compute variances for lazy type aliases Fixes #114221. CC ``@oli-obk`` r? types
2023-08-03Forbid old-style `simd_shuffleN` intrinsicsOli Scherer-14/+0
2023-08-03Compute variances for lazy type aliasesLeón Orell Valerian Liehr-4/+22
2023-08-02Remove constness from `TraitPredicate`Deadbeef-10/+3
2023-08-02Rollup merge of #114301 - ↵Matthias Krüger-4/+5
compiler-errors:dont-error-on-missing-region-outlives, r=spastorino Don't check unnecessarily that impl trait is RPIT We have this random `return_type_impl_trait` function to detect if a function returns an RPIT which is used in outlives suggestions, but removing it doesn't actually change any diagnostics. Let's just remove it. Also, suppress a spurious outlives error from a ReError. Fixes #114274
2023-08-01Suppress unnecessary outlivesMichael Goulet-4/+5
2023-07-31Rollup merge of #114267 - compiler-errors:rpitit-opaque-bounds, r=spastorinoMatthias Krüger-15/+1
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-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-33/+77
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-13/+11
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-13/+11
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-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.