about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2023-08-12Opaques do not constrain generic paramsMichael Goulet-1/+1
2023-08-11Only check outlives goals on impl compared to traitJack Huey-12/+39
2023-08-11Don't add associated type bound for non-typesMichael Goulet-10/+31
2023-08-08Auto merge of #114545 - fee1-dead-contrib:lower-impl-effect, r=oli-obkbors-32/+55
correctly lower `impl const` to bind to host effect param r? `@oli-obk`
2023-08-08Auto merge of #114602 - compiler-errors:rpit-outlives-sadness, r=oli-obkbors-190/+56
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-08Install bidirectional outlives predicates for RPITITs (and RPITs) correctlyMichael Goulet-66/+28
2023-08-08Unconditionally record lifetime mappingMichael Goulet-1/+1
2023-08-08Rollup merge of #114594 - compiler-errors:new-solver-resolve-aliases, r=lcnrMatthias Krüger-1/+1
Structurally normalize weak and inherent in new solver It seems pretty obvious to me that we should be normalizing weak and inherent aliases too, since they can always be normalized. This PR still leaves open the question of what to do with opaques, though 💀 **Also**, we need to structurally resolve the target of a coercion, for the UI test to work. r? `@lcnr`
2023-08-08Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, ↵Matthias Krüger-22/+21
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-07Structurally normalize weak and inherent tooMichael Goulet-1/+1
2023-08-07Fix ICEDeadbeef-17/+48
2023-08-07Store the laziness of type aliases in the DefKindLeón Orell Valerian Liehr-22/+21
2023-08-06Add a new `compare_bytes` intrinsic instead of calling `memcmp` directlyScott McMurray-0/+4
2023-08-06lower impl const to bind to host effect paramDeadbeef-35/+27
2023-08-05Consolidate opaque ty and async fn lowering codeMichael Goulet-1/+1
2023-08-04Rollup merge of #114253 - fmease:compute-variances-for-lazy-ty-aliases, ↵Matthias Krüger-9/+63
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-9/+63
2023-08-02Remove constness from `TraitPredicate`Deadbeef-74/+18
2023-08-02Rollup merge of #114314 - compiler-errors:sized-crit, r=lcnrMatthias Krüger-1/+1
Tweaks to `adt_sized_constraint` fixes a comment, but also some other nits. r? lcnr
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-01Fix a commentMichael Goulet-1/+1
2023-08-01Suppress unnecessary outlivesMichael Goulet-4/+5
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