about summary refs log tree commit diff
path: root/compiler/rustc_hir_analysis
AgeCommit message (Collapse)AuthorLines
2023-11-08Only use normalize_param_env when normalizing predicate in check_item_boundsMichael Goulet-2/+8
2023-11-06check binders with bound vars for global bounds that don't holdRémy Rakic-1/+2
(instead of just late bound vars)
2023-11-04Auto merge of #117540 - ↵bors-1/+1
matthiaskrgr:baby_dont_clone_me_dont_clone_me_no_more, r=est31 clone less
2023-11-03Auto merge of #117507 - nnethercote:rustc_span, r=Nilstriebbors-3/+2
`rustc_span` cleanups Just some things I found while looking over this crate. r? `@oli-obk`
2023-11-03clone lessMatthias Krüger-1/+1
2023-11-02Add all RPITITs when augmenting param-env with GAT bounds in check_type_boundsMichael Goulet-77/+103
2023-11-02Use the normalizing param-env always in check_type_boundsMichael Goulet-123/+143
2023-11-02Minimize `pub` usage in `source_map.rs`.Nicholas Nethercote-3/+2
Most notably, this commit changes the `pub use crate::*;` in that file to `use crate::*;`. This requires a lot of `use` items in other crates to be adjusted, because everything defined within `rustc_span::*` was also available via `rustc_span::source_map::*`, which is bizarre. The commit also removes `SourceMap::span_to_relative_line_string`, which is unused.
2023-10-31Rollup merge of #117416 - compiler-errors:tait-in-bad-body, r=oli-obkMatthias Krüger-3/+11
Also consider TAIT to be uncomputable if the MIR body is tainted Not totally sure if this is the best solution. We could, alternatively, look at the hir typeck results and try to take a type from there instead of just falling back to type error, inferring `u8` instead of `{type error}`. Not certain it really matters, though. Happy to iterate on this. Fixes #117413 r? ``@oli-obk`` cc ``@Nadrieril``
2023-10-30Auto merge of #116405 - estebank:issue-103155, r=davidtwcobors-10/+41
Detect object safety errors when assoc type is missing When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
2023-10-30Sort errorsEsteban Küber-4/+6
2023-10-30Detect object safety errors when assoc type is missingEsteban Küber-11/+40
When an associated type with GATs isn't specified in a `dyn Trait`, emit an object safety error instead of only complaining about the missing associated type, as it will lead the user down a path of three different errors before letting them know that what they were trying to do is impossible to begin with. Fix #103155.
2023-10-30Auto merge of #117415 - matthiaskrgr:rollup-jr2p1t2, r=matthiaskrgrbors-40/+54
Rollup of 7 pull requests Successful merges: - #116862 (Detect when trait is implemented for type and suggest importing it) - #117389 (Some diagnostics improvements of `gen` blocks) - #117396 (Don't treat closures/coroutine types as part of the public API) - #117398 (Correctly handle nested or-patterns in exhaustiveness) - #117403 (Poison check_well_formed if method receivers are invalid to prevent typeck from running on it) - #117411 (Improve some diagnostics around `?Trait` bounds) - #117414 (Don't normalize to an un-revealed opaque when we hit the recursion limit) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-30Also consider TAIT to be uncomputable if the MIR body is taintedMichael Goulet-3/+11
2023-10-30Rollup merge of #117411 - oli-obk:query_merge_immobile_game, ↵Matthias Krüger-27/+32
r=compiler-errors,Nilstrieb Improve some diagnostics around `?Trait` bounds * uses better spans * clarifies a message that was only talking about generic params, but applies to `dyn ?Trait` and `impl ?Trait` as well
2023-10-30Improve some diagnostics around `?Trait` boundsOli Scherer-27/+32
2023-10-30Poison check_well_formed if method receivers are invalid to prevent typeck ↵Oli Scherer-13/+22
from running on it
2023-10-30Clean up `rustc_*/Cargo.toml`.Nicholas Nethercote-10/+12
- Sort dependencies and features sections. - Add `tidy` markers to the sorted sections so they stay sorted. - Remove empty `[lib`] sections. - Remove "See more keys..." comments. Excluded files: - rustc_codegen_{cranelift,gcc}, because they're external. - rustc_lexer, because it has external use. - stable_mir, because it has external use.
2023-10-26Auto merge of #117171 - fee1-dead-contrib:deny-explicit-effect-params, r=oli-obkbors-3/+13
Deny providing explicit effect params r? `@oli-obk` cc https://github.com/rust-lang/rust/issues/110395
2023-10-26Deny providing explicit effect paramsDeadbeef-3/+13
2023-10-25Rollup merge of #116553 - gurry:116464-assoc-type-invalid-suggestion, ↵Matthias Krüger-13/+57
r=compiler-errors Do not suggest 'Trait<Assoc=arg>' when in trait impl Fixes #116464 We now skip the suggestion if we're in an impl of the trait.
2023-10-25Auto merge of #117180 - matthiaskrgr:rollup-rxhl6ep, r=matthiaskrgrbors-3/+11
Rollup of 7 pull requests Successful merges: - #117111 (Remove support for alias `-Z instrument-coverage`) - #117141 (Require target features to match exactly during inlining) - #117152 (Fix unwrap suggestion for async fn) - #117154 (implement C ABI lowering for CSKY) - #117159 (Work around the fact that `check_mod_type_wf` may spuriously return `ErrorGuaranteed`) - #117163 (compiletest: Display compilation errors in mir-opt tests) - #117173 (Make `Iterator` a lang item) r? `@ghost` `@rustbot` modify labels: rollup
2023-10-25Rollup merge of #117133 - compiler-errors:coherence-constrained, r=oli-obkMatthias Krüger-6/+3
Merge `impl_wf_inference` (`check_mod_impl_wf`) check into coherence checking Problem here is that we call `collect_impl_trait_in_trait_types` when checking `check_mod_impl_wf` which is performed before coherence. Due to the `tcx.sess.track_errors`, since we end up reporting an error, we never actually proceed to coherence checking, where we would be emitting a more useful impl overlap error. This change means that we may report more errors in some cases, but can at least proceed far enough to leave a useful message for overlapping traits with RPITITs in them. Fixes #116982 r? types
2023-10-25Work around the fact that `check_mod_type_wf` may spuriously return ↵Oli Scherer-3/+11
`ErrorGuaranteed`, even if that error is only emitted by `check_modwitem_types`
2023-10-25Do not suggest 'Trait<Assoc=arg>' when in trait implGurinder Singh-14/+58
because that would be illegal syntax
2023-10-24Merge impl_wf_inference into coherence checkingMichael Goulet-6/+3
2023-10-24Migrate diagnostics in `rustc_hir_analysis/src/coherence/orphan.rs`Obei Sideg-163/+341
2023-10-23Let's see what those opaque types actually areMichael Goulet-7/+37
2023-10-23Auto merge of #116849 - oli-obk:error_shenanigans, r=cjgillotbors-110/+126
Avoid a `track_errors` by bubbling up most errors from `check_well_formed` I believe `track_errors` is mostly papering over issues that a sufficiently convoluted query graph can hit. I made this change, while the actual change I want to do is to stop bailing out early on errors, and instead use this new `ErrorGuaranteed` to invoke `check_well_formed` for individual items before doing all the `typeck` logic on them. This works towards resolving https://github.com/rust-lang/rust/issues/97477 and various other ICEs, as well as allowing us to use parallel rustc more (which is currently rather limited/bottlenecked due to the very sequential nature in which we do `rustc_hir_analysis::check_crate`) cc `@SparrowLii` `@Zoxc` for the new `try_par_for_each_in` function
2023-10-23Allow `ensure` queries to return `Result<(), ErrorGuaranteed>`Oli Scherer-5/+5
2023-10-21Rollup merge of #116995 - estebank:issue-69944, r=compiler-errorsMatthias Krüger-19/+5
Point at assoc fn definition on type param divergence When the number of type parameters in the associated function of an impl and its trait differ, we now *always* point at the trait one, even if it comes from a foreign crate. When it is local, we point at the specific params, when it is foreign, we point at the whole associated item. Fix #69944.
2023-10-20Point at assoc fn definition on type param divergenceEsteban Küber-19/+5
When the number of type parameters in the associated function of an impl and its trait differ, we now *always* point at the trait one, even if it comes from a foreign crate. When it is local, we point at the specific params, when it is foreign, we point at the whole associated item. Fix #69944.
2023-10-20s/generator/coroutine/Oli Scherer-16/+16
2023-10-20s/Generator/Coroutine/Oli Scherer-11/+11
2023-10-20Adjust importsMichael Goulet-1/+1
2023-10-20Avoid a `track_errors` by bubbling up most errors from `check_well_formed`Oli Scherer-110/+126
2023-10-18Auto merge of #116887 - lcnr:alias-ty-constructor, r=compiler-errorsbors-5/+5
`TyCtxt::mk_alias_ty` -> `AliasTy::new`
2023-10-18AliasTy::new instead of tcx methodlcnr-5/+5
2023-10-18Rollup merge of #116870 - compiler-errors:host-param-by-name, r=fee1-deadAli MJ Al-Nasrawy-4/+5
Don't compare host param by name Seems sketchy to be searching for `sym::host` by name, especially when we can get the actual index with not very much work. r? fee1-dead
2023-10-18Don't compare host param by nameMichael Goulet-4/+5
2023-10-17Unify suggestion wordingEsteban Küber-2/+2
2023-10-17Auto merge of #116756 - fee1-dead-contrib:dupe-those-bounds, r=oli-obkbors-6/+92
Duplicate `~const` bounds with a non-const one in effects desugaring This should unblock #116058. r? `@oli-obk`
2023-10-16Rollup merge of #116800 - compiler-errors:rpitit-gat-outlives, r=jackh726Guillaume Gomez-33/+27
Fix implied outlives check for GAT in RPITIT We enforce certain `Self: 'lt` bounds for GATs to save space for more sophisticated implied bounds, but those currently operate on the HIR. Code was easily reworked to operate on def-ids so that we can properly let these suggestions propagate through synthetic associated types like RPITITs and AFITs. r? `@jackh726` or `@aliemjay` Fixes #116789
2023-10-16Rollup merge of #116257 - estebank:issue-101351, r=b-naberMatthias Krüger-15/+63
Suggest trait bounds for used associated type on type param Fix #101351. When an associated type on a type parameter is used, and the type parameter isn't constrained by the correct trait, suggest the appropriate trait bound: ``` error[E0220]: associated type `Associated` not found for `T` --> file.rs:6:15 | 6 | field: T::Associated, | ^^^^^^^^^^ there is a similarly named associated type `Associated` in the trait `Foo` | help: consider restricting type parameter `T` | 5 | struct Generic<T: Foo> { | +++++ ``` When an associated type on a type parameter has a typo, suggest fixing it: ``` error[E0220]: associated type `Baa` not found for `T` --> $DIR/issue-55673.rs:9:8 | LL | T::Baa: std::fmt::Debug, | ^^^ there is a similarly named associated type `Bar` in the trait `Foo` | help: change the associated type name to use `Bar` from `Foo` | LL | T::Bar: std::fmt::Debug, | ~~~ ```
2023-10-16Fix outlives suggestion for GAT in RPITITMichael Goulet-33/+27
2023-10-15Auto merge of #116688 - compiler-errors:rustfmt-up, r=WaffleLapkin,Nilstriebbors-169/+237
Format all the let-chains in compiler crates Since rust-lang/rustfmt#5910 has landed, soon we will have support for formatting let-chains (as soon as rustfmt syncs and beta gets bumped). This PR applies the changes [from master rustfmt to rust-lang/rust eagerly](https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/out.20formatting.20of.20prs/near/374997516), so that the next beta bump does not have to deal with a 200+ file diff and can remain concerned with other things like `cfg(bootstrap)` -- #113637 was a pain to land, for example, because of let-else. I will also add this commit to the ignore list after it has landed. The commands that were run -- I'm not great at bash-foo, but this applies rustfmt to every compiler crate, and then reverts the two crates that should probably be formatted out-of-tree. ``` ~/rustfmt $ ls -1d ~/rust/compiler/* | xargs -I@ cargo run --bin rustfmt -- `@/src/lib.rs` --config-path ~/rust --edition=2021 # format all of the compiler crates ~/rust $ git checkout HEAD -- compiler/rustc_codegen_{gcc,cranelift} # revert changes to cg-gcc and cg-clif ``` cc `@rust-lang/rustfmt` r? `@WaffleLapkin` or `@Nilstrieb` who said they may be able to review this purely mechanical PR :> cc `@Mark-Simulacrum` and `@petrochenkov,` who had some thoughts on the order of operations with big formatting changes in https://github.com/rust-lang/rust/pull/95262#issue-1178993801. I think the situation has changed since then, given that let-chains support exists on master rustfmt now, and I'm fairly confident that this formatting PR should land even if *bootstrap* rustfmt doesn't yet format let-chains in order to lessen the burden of the next beta bump.
2023-10-15Duplicate `~const` bounds with a non-const one in effects desugaringDeadbeef-6/+92
2023-10-14Rollup merge of #116695 - fee1-dead-contrib:fix-cmt, r=compiler-errorsMatthias Krüger-1/+1
Fix a comment
2023-10-13Stabilize AFIT and RPITITMichael Goulet-5/+3
2023-10-13Tweak wordingEsteban Küber-1/+2