about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2023-03-15Rename impl_trait_in_trait_parent to impl_trait_in_trait_parent_fnSantiago Pastorino-2/+2
2023-03-15Revert "Auto merge of #107376 - aliemjay:remove-givens, r=lcnr"Rémy Rakic-3/+8
This reverts commit e84e5ff04a647ce28540300244a26ba120642eea, reversing changes made to 1716932743a7b3705cbf0c34db0c4e070ed1930d.
2023-03-15always make `define_opaque_types` explicitlcnr-6/+9
2023-03-15Auto merge of #109035 - scottmcm:ptr-read-should-know-undef, ↵bors-0/+2
r=WaffleLapkin,JakobDegen Ensure `ptr::read` gets all the same LLVM `load` metadata that dereferencing does I was looking into `array::IntoIter` optimization, and noticed that it wasn't annotating the loads with `noundef` for simple things like `array::IntoIter<i32, N>`. Trying to narrow it down, it seems that was because `MaybeUninit::assume_init_read` isn't marking the load as initialized (<https://rust.godbolt.org/z/Mxd8TPTnv>), which is unfortunate since that's basically its reason to exist. The root cause is that `ptr::read` is currently implemented via the *untyped* `copy_nonoverlapping`, and thus the `load` doesn't get any type-aware metadata: no `noundef`, no `!range`. This PR solves that by lowering `ptr::read(p)` to `copy *p` in MIR, for which the backends already do the right thing. Fortuitiously, this also improves the IR we give to LLVM for things like `mem::replace`, and fixes a couple of long-standing bugs where `ptr::read` on `Copy` types was worse than `*`ing them. Zulip conversation: <https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Move.20array.3A.3AIntoIter.20to.20ManuallyDrop/near/341189936> cc `@erikdesjardins` `@JakobDegen` `@workingjubilee` `@the8472` Fixes #106369 Fixes #73258
2023-03-15Auto merge of #107376 - aliemjay:remove-givens, r=lcnrbors-8/+3
remove obsolete `givens` from regionck Fixes #106567 r? `@lcnr` (feel free to reassign)
2023-03-14Rollup merge of #109105 - compiler-errors:late-ct-in-anon-ct, r=oli-obkMatthias Krüger-7/+7
Don't ICE for late-bound consts across `AnonConstBoundary` Fixes #108194
2023-03-14Rollup merge of #108909 - spastorino:new-rpitit-7, r=compiler-errorsMatthias Krüger-0/+1
Fix object safety checks for new RPITITs This one goes on top of #108869 r? `@compiler-errors`
2023-03-13Don't ICE for late-bound consts across AnonConstBoundaryMichael Goulet-7/+7
2023-03-13Better names?Michael Goulet-5/+8
2023-03-13Treat projections with infer as placeholder during fast reject in new solverMichael Goulet-3/+10
2023-03-12Allow `#[target_feature]` on `main` and `start` for WASMLéo Lanteri Thauvin-2/+11
2023-03-12Forbid the use of `#[target_feature]` on `start`Léo Lanteri Thauvin-0/+19
2023-03-12Forbid the use of `#[target_feature]` on `main`Léo Lanteri Thauvin-0/+15
2023-03-12Filter out RPITITs in astconv when checking for missing associated typesSantiago Pastorino-0/+1
2023-03-12Auto merge of #108682 - est31:simplify_dirs, r=davidtwcobors-1/+1
Simplify message paths This makes it easier to open the messages file. Right now I have to first click on the `locales` dir to open it, and then on the `en-US.ftl` file. `Cargo.toml` and `build.rs` files are also in the top level, and I think there should not be more than one file, so a directory isn't really needed. The [chosen strategy for pontoon adoption](https://rust-lang.zulipchat.com/#narrow/stream/336883-i18n/topic/pontoon.20and.20next.20steps) is out of tree. Even if this descision is changed in the future, the `messages.ftl` approach is also compatible with non-english translations living in-tree, as long as the non-english translations don't live in the `compiler/rustc_foo/` directories but in different ones. That would also be helpful for grepability purposes. The commit was the result of automated changes: ``` for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done ``` r? `@davidtwco`
2023-03-11`MaybeUninit::assume_init_read` should have `noundef` load metadataScott McMurray-0/+2
I was looking into `array::IntoIter` optimization, and noticed that it wasn't annotating the loads with `noundef` for simple things like `array::IntoIter<i32, N>`. Turned out to be a more general problem as `MaybeUninit::assume_init_read` isn't marking the load as initialized (<https://rust.godbolt.org/z/Mxd8TPTnv>), which is unfortunate since that's basically its reason to exist. This PR lowers `ptr::read(p)` to `copy *p` in MIR, which fortuitiously also improves the IR we give to LLVM for things like `mem::replace`.
2023-03-12Auto merge of #108700 - spastorino:new-rpitit-impl-side-2, r=compiler-errorsbors-21/+67
Make RPITITs simple cases work when using lower_impl_trait_in_trait_to_assoc_ty r? `@compiler-errors` It's probably best reviewed commit by commit.
2023-03-11Simplify message pathsest31-1/+1
This makes it easier to open the messages file while developing on features. The commit was the result of automatted changes: for p in compiler/rustc_*; do mv $p/locales/en-US.ftl $p/messages.ftl; rmdir $p/locales; done for p in compiler/rustc_*; do sed -i "s#\.\./locales/en-US.ftl#../messages.ftl#" $p/src/lib.rs; done
2023-03-10Rollup merge of #108930 - Ezrashaw:better-error-for-manual-fn-impl, ↵Matthias Krüger-51/+96
r=petrochenkov feat: implement better error for manual impl of `Fn*` traits Fixes #39259 cc `@estebank` (you gave me some advice in the linked issue, would you like to review?)
2023-03-10feat: implement better error for manual impl of `Fn*` traitsEzra Shaw-52/+97
2023-03-09Remove body_def_id from InheritedMichael Goulet-13/+13
2023-03-09Auto merge of #108920 - matthiaskrgr:rollup-qrr9a0u, r=matthiaskrgrbors-22/+39
Rollup of 8 pull requests Successful merges: - #108754 (Retry `pred_known_to_hold_modulo_regions` with fulfillment if ambiguous) - #108759 (1.41.1 supported 32-bit Apple targets) - #108839 (Canonicalize root var when making response from new solver) - #108856 (Remove DropAndReplace terminator) - #108882 (Tweak E0740) - #108898 (Set `LIBC_CHECK_CFG=1` when building Rust code in bootstrap) - #108911 (Improve rustdoc-gui/tester.js code a bit) - #108916 (Remove an unused return value in `rustc_hir_typeck`) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2023-03-09remove obsolete `givens` from regionckAli MJ Al-Nasrawy-8/+3
2023-03-08Rollup merge of #108882 - compiler-errors:E0740, r=eholkMatthias Krüger-22/+39
Tweak E0740 Also drive-by suppress E0740 if it's an unresolved type.
2023-03-08Rollup merge of #108884 - compiler-errors:tweak-illegal-copy-impl-message, ↵Matthias Krüger-3/+11
r=WaffleLapkin Tweak illegal `Copy` impl message The phrase "may not" can both mean "is not able to" and "possibly does not". Disambiguate this by just using "cannot". ``@Lokathor`` expressed being annoyed by this [here](https://twitter.com/Lokathor/status/1633200313544089602?s=20). Also drive-by fix for this extremely noisy message: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=6a37275bc810f7846bfe191845b7d11d. r? diagnostics
2023-03-08Auto merge of #108312 - michaelwoerister:hash-set-not-hash-stable, r=eholkbors-4/+4
Do not implement HashStable for HashSet (MCP 533) This PR removes all occurrences of `HashSet` in query results, replacing it either with `FxIndexSet` or with `UnordSet`, and then removes the `HashStable` implementation of `HashSet`. This is part of implementing [MCP 533](https://github.com/rust-lang/compiler-team/issues/533), that is, removing the `HashStable` implementations of all collection types with unstable iteration order. The changes are mostly mechanical. The only place where additional sorting is happening is in Miri's override implementation of the `exported_symbols` query.
2023-03-08Tweak E0740Michael Goulet-21/+36
2023-03-08Don't report E0740 for type errorMichael Goulet-1/+3
2023-03-08Dedup copy field errors for identical typesMichael Goulet-0/+8
2023-03-08may not => cannotMichael Goulet-3/+3
2023-03-07Error code E0794 for late-bound lifetime parameter error.Christopher Acosta-1/+1
2023-03-07Rollup merge of #108460 - obeis:hir-analysis-migrate-diagnostics-2, ↵Matthias Krüger-28/+68
r=compiler-errors migrate `rustc_hir_analysis` to session diagnostic [Part Two] migrate `rustc_hir_analysis` to session diagnostic (part two) files list: - rustc_hir_analysis/variance/* - rustc_hir_analysis/missing_cast_for_variadic_arg.rs - rustc_hir_analysis/sized_unsized_cast.rs Updates #100717
2023-03-07Auto merge of #95317 - Jules-Bertholet:round_ties_to_even, ↵bors-0/+2
r=pnkfelix,m-ou-se,scottmcm Add `round_ties_even` to `f32` and `f64` Tracking issue: #96710 Redux of #82273. See also #55107 Adds a new method, `round_ties_even`, to `f32` and `f64`, that rounds the float to the nearest integer , rounding halfway cases to the number with an even least significant bit. Uses the `roundeven` LLVM intrinsic to do this. Of the five IEEE 754 rounding modes, this is the only one that doesn't already have a round-to-integer function exposed by Rust (others are `round`, `floor`, `ceil`, and `trunc`). Ties-to-even is also the rounding mode used for int-to-float and float-to-float `as` casts, as well as float arithmentic operations. So not having an explicit rounding method for it seems like an oversight. Bikeshed: this PR currently uses `round_ties_even` for the name of the method. But maybe `round_ties_to_even` is better, or `round_even`, or `round_to_even`?
2023-03-06Implement type_of for RPITITs assoc typeSantiago Pastorino-1/+20
2023-03-06Properly implement explicit_item_bounds for RPITITs trait assoc tySantiago Pastorino-11/+23
2023-03-06Map to new synthesized assoc ty for RPITITs in astconvSantiago Pastorino-1/+9
2023-03-06Collect newly synthesized RPITITs on ImplTraitInTraitCollectorSantiago Pastorino-1/+1
2023-03-06Avoid accessing HIR for RPITITs on check_type_boundsSantiago Pastorino-7/+14
2023-03-06emit the suspicious_auto_trait_impls for negative impls as wellMu42-4/+0
2023-03-05Rollup merge of #108764 - cjgillot:dpm-adapt, r=compiler-errorsMatthias Krüger-0/+8
Tweaks to -Zdrop-tracking-mir Split from https://github.com/rust-lang/rust/pull/107421 3 commits: 1 diagnostic improvement and 2 ICEs.
2023-03-05Rollup merge of #108746 - ↵Matthias Krüger-2/+2
compiler-errors:rpitit-dont-project-default-w-no-valu, r=cjgillot Don't project to RPITIT that has no default value Replicates this behavior, but for RPITIT projection logic (which currently is separate) https://github.com/rust-lang/rust/blob/b1719530f44e3c8ec903f76020a52bd8764d5d10/compiler/rustc_trait_selection/src/traits/project.rs#L2105-L2115 Fixes #108738
2023-03-05Auto merge of #108351 - petrochenkov:rmdit, r=cjgillotbors-10/+8
rustc_middle: Remove trait `DefIdTree` This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-05drop_tracking_mir: diagnose recursive generator.Camille GILLOT-0/+8
2023-03-05migrate `rustc_hir_analysis` to session diagnosticObei Sideg-28/+68
part two files list: rustc_hir_analysis/variance/* rustc_hir_analysis/missing_cast_for_variadic_arg.rs rustc_hir_analysis/sized_unsized_cast.rs
2023-03-04Don't project to RPITIT that has no default valueMichael Goulet-2/+2
2023-03-03Rollup merge of #108694 - est31:backticks_matchmaking_comments, r=NilstriebMatthias Krüger-2/+2
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 #108553 - compiler-errors:non-lt-late-bound-in-anon-ct, ↵Matthias Krüger-5/+83
r=petrochenkov Deny capturing late-bound non-lifetime param in anon const Introduce a new AnonConstBoundary so we can detect when we capture a late-bound non-lifetime param with `non_lifetime_binders` enabled. In the future, we could technically do something like introduce an early-bound parameter on the anon const, and stick the late-bound param in its substs (kinda like how we turn late-bound lifetimes in opaques into early-bound ones). But for now, just deny it so we don't ICE. Fixes #108191
2023-03-03Match unmatched backticks in comments in compiler/est31-2/+2
2023-03-02rustc_middle: Remove trait `DefIdTree`Vadim Petrochenkov-10/+8
This trait was a way to generalize over both `TyCtxt` and `Resolver`, but now `Resolver` has access to `TyCtxt`, so this trait is no longer necessary.
2023-03-02Rollup merge of #108575 - compiler-errors:erase, r=estebankMatthias Krüger-2/+4
Erase **all** regions when probing for associated types on ambiguity in astconv Fixes #108562