about summary refs log tree commit diff
path: root/compiler/rustc_middle
AgeCommit message (Collapse)AuthorLines
2023-01-18Rollup merge of #106873 - BoxyUwU:ty_const_formatting, r=compiler-errorsMatthias Krüger-29/+16
dont randomly use `_` to print out const generic arguments const generics seem to get printed out as `_` for no reason a lot of the time, as someone who spends a lot of time with const generics this has gotten :sparkles: very annoying :sparkles:. Latest example would be #106423 where the ICE messaged formatted a `ty::Const` containing no infer vars, as `_`. For some reason printing of the const argument on arrays was custom instead of using the existing logic for printing `ty::Const`. Additionally the existing logic for printing `ty::Const` would print out `_` for anon consts that are in a separate crate leading to weird diagnostics (see second commit). There ought to be less cases of consts randomly getting printed as `_` hiding valuable info now.
2023-01-18Rollup merge of #106747 - yanchen4791:issue-105507-fix, r=estebankMatthias Krüger-0/+7
Add 'static lifetime suggestion when GAT implied 'static requirement from HRTB Fix for issue #105507 The problem: When generic associated types (GATs) are from higher-ranked trait bounds (HRTB), they are implied 'static requirement (see [Implied 'static requirement from higher-ranked trait bounds](https://blog.rust-lang.org/2022/10/28/gats-stabilization.html#implied-static-requirement-from-higher-ranked-trait-bounds) for more details). If the user did not explicitly specify the `'static` lifetime when using the GAT, the current error message will only point out the type `does not live long enough` where the type is used, but not where the GAT is specified and how to fix the problem. The solution: Add notes at the span where the problematic GATs are specified and suggestions of how to fix the problem by adding `'static` lifetime at the right spans.
2023-01-18i am freeBoxy-8/+11
2023-01-18actually print out non local anon constsBoxy-3/+3
2023-01-18defer array len printing to const arg printingBoxy-20/+4
2023-01-17Add 'static lifetime suggestion when GAT implied 'static requirement from HRTByanchen4791-0/+7
2023-01-17Rollup merge of #106980 - Nilstrieb:_use_mk_manual_debug_impl_instead, r=lcnrMatthias Krüger-2/+11
Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`
2023-01-17Rollup merge of #106970 - kylematsuda:earlybinder-item-bounds, r=lcnrMatthias Krüger-8/+1
Switch to `EarlyBinder` for `item_bounds` query Part of the work to finish #105779 (also see https://github.com/rust-lang/types-team/issues/78). Several queries `X` have a `bound_X` variant that wraps the output in `EarlyBinder`. This adds `EarlyBinder` to the return type of the `item_bounds` query and removes `bound_item_bounds`. r? `@lcnr`
2023-01-17Rollup merge of #106834 - compiler-errors:new-solver-did-changed, r=lcnrMatthias Krüger-0/+16
new trait solver: only consider goal changed if response is not identity I think this is the right way of implementing it.. r? `@lcnr`
2023-01-17Rollup merge of #104505 - WaffleLapkin:no-double-spaces-in-comments, r=jackh726Matthias Krüger-27/+27
Remove double spaces after dots in comments Most of the comments do not have double spaces, so I assume these are typos.
2023-01-17new trait solver: only consider goal changed if response is not identityMichael Goulet-0/+16
2023-01-17change item_bounds query to return EarlyBinder; remove bound_item_bounds queryKyle Matsuda-8/+1
2023-01-17Hide `_use_mk_alias_ty_instead` in `<AliasTy as Debug>::fmt`nils-2/+11
2023-01-17Document how to get the type of a default associated typenils-0/+5
2023-01-17Refactor basic blocks control flow cachesTomasz Miąsko-296/+74
2023-01-17Auto merge of #106612 - JakobDegen:cleanup-wf, r=tmiaskobors-0/+10
Document wf constraints on control flow in cleanup blocks Was recently made aware of [this code](https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/compiler/rustc_codegen_ssa/src/mir/analyze.rs#L247-L368), which has this potential ICE: https://github.com/rust-lang/rust/blob/a377893da2cd7124e5a18c7116cbb70e16dd5541/compiler/rustc_codegen_ssa/src/mir/analyze.rs#L308-L314 Roughly speaking, the code there is attempting to partition the cleanup blocks into funclets that satisfy a "unique successor" property, and the ICE is set off if that's not possible. This PR documents the well-formedness constraints that MIR must satisfy to avoid setting off that ICE. The constraints documented are slightly stronger than the cases in which the ICE would have been set off in that code. This is necessary though, since whether or not that ICE gets set off can depend on iteration order in some graphs. This sort of constraint is kind of ugly, but I don't know a better alternative at the moment. It's worth knowing that two important optimizations are still correct: - Removing edges in the cfg: Fewer edges => fewer paths => stronger dominance relations => more contractions, and more contractions can't turn a forest into not-a-forest. - Contracting an edge u -> v when u only has one successor and v only has one predecessor: u already dominated v, so this contraction was going to happen anyway. There is definitely a MIR opt somewhere that can run afoul of this, but I don't know where it is. `@saethlin` was able to set it off though, so maybe he'll be able to shed some light on it. r? `@RalfJung` I suppose, and cc `@tmiasko` who might have insight/opinions on this
2023-01-17Remove double spaces after dots in commentsMaybe Waffle-27/+27
2023-01-17Don't call closures immediately, use `try{}` blocksMaybe Waffle-11/+13
2023-01-17Rollup merge of #106953 - kylematsuda:early-binder-docs, r=jackh726Matthias Krüger-0/+19
Document `EarlyBinder::subst_identity` and `skip_binder` Finishing implementing #105779 will change several commonly used queries to return `EarlyBinder` by default. This PR adds documentation for two of the methods used to access data inside the `EarlyBinder`. I tried to summarize some of the [discussion from the issue](https://github.com/rust-lang/rust/issues/105779#issuecomment-1375512647) in writing this. r? `@lcnr`
2023-01-17Rollup merge of #106829 - compiler-errors:more-alias-combine, r=spastorinoMatthias Krüger-4/+3
Unify `Opaque`/`Projection` handling in region outlives code They share basically identical paths in most places which are even easier to unify now that they're both `ty::Alias` r? types
2023-01-16Add cycle checking to cleanup control flow validationJakob Degen-4/+7
2023-01-16Document wf constraints on control flow in cleanup blocksJakob Degen-0/+7
Also fixes a bug in dominator computation
2023-01-16document EarlyBinder::subst_identity and skip_binderKyle Matsuda-0/+19
2023-01-16Rollup merge of #106940 - oli-obk:tait_error, r=compiler-errorsMatthias Krüger-1/+8
Improve a TAIT error and add an error code plus documentation cc https://github.com/rust-lang/rust/issues/106858
2023-01-16Improve a TAIT error and add an error code plus documentationOli Scherer-1/+8
2023-01-16Auto merge of #106395 - compiler-errors:rework-predicates, r=eholkbors-23/+47
Rework some `predicates_of`/`{Generic,Instantiated}Predicates` code 1. Make `instantiate_own` return an iterator, since it's a bit more efficient and easier to work with 2. Remove `bound_{explicit,}_predicates_of` -- these `bound_` methods in particular were a bit awkward to work with since `ty::GenericPredicates` *already* acts kinda like an `EarlyBinder` with its own `instantiate_*` methods, and had only a few call sites anyways. 3. Implement `IntoIterator` for `InstantiatedPredicates`, since it's *very* commonly being `zip`'d together.
2023-01-15Remove bound_{explicit,}_item_boundsMichael Goulet-14/+0
2023-01-15drive-by: assert when iterating through InstantiatedPredicatesMichael Goulet-0/+2
2023-01-15Make InstantiatedPredicates impl IntoIteratorMichael Goulet-0/+27
2023-01-15instantiate_own doesn't need to return a pair of vectorsMichael Goulet-9/+18
2023-01-15Auto merge of #106742 - compiler-errors:new-solver-make-it-not-ice, r=lcnrbors-2/+88
Implement some FIXME methods in the new trait solver Implement just enough of the solver's response logic to make it not ICE. Also, fix a bug with `no_bound_vars` call failing due to canonical bound vars. r? `@lcnr`
2023-01-15Rollup merge of #106863 - anden3:compiler-double-spaces, r=NilstriebMatthias Krüger-1/+1
Remove various double spaces in compiler source comments. Was asked to do it by `@Nilstrieb`
2023-01-14Fix some missed double spaces.André Vennberg-1/+1
2023-01-14Use associated items of `char` instead of freestanding items in `core::char`Lukas Markeffsky-1/+0
2023-01-14fix various subst_identity vs skip_binderKyle Matsuda-2/+4
2023-01-14change impl_trait_ref query to return EarlyBinder; remove ↵Kyle Matsuda-19/+8
bound_impl_trait_ref query; add EarlyBinder to impl_trait_ref in metadata
2023-01-14change usages of impl_trait_ref to bound_impl_trait_refKyle Matsuda-7/+12
2023-01-14change const_param_default query to return EarlyBinder; remove ↵Kyle Matsuda-8/+4
bound_const_param_default query; add EarlyBinder to const_param_default in metadata
2023-01-14add EarlyBinder::subst_identity; impl ParameterizedOverTcx (needed for ↵Kyle Matsuda-0/+20
rustc_metadata) and Value for EarlyBinder
2023-01-13Unify Opaque/Projection handling in region outlives codeMichael Goulet-4/+3
2023-01-13Auto merge of #106776 - oli-obk:om_nom_nom_nom_nom, r=cjgillotbors-35/+16
Feed a bunch of queries instead of tracking fields on TyCtxt r? `@cjgillot` pulled out of https://github.com/rust-lang/rust/pull/105462
2023-01-13Rollup merge of #106754 - compiler-errors:ty-infer-method-is-confusing, r=lcnrYuki Okushi-2/+2
Rename `Ty::is_ty_infer` -> `Ty::is_ty_or_numeric_infer` Makes sure people are aware that they may have a type variable *or* an int/float variable. r? `@oli-obk` https://github.com/rust-lang/rust/pull/106322#issuecomment-1376913539 but I could instead implement your solution, let me know. (This will conflict with #106322 for now, ignore that :smile:)
2023-01-13Auto merge of #106004 - fee1-dead-contrib:const-closures, r=oli-obkbors-4/+10
Const closures cc https://github.com/rust-lang/rust/issues/106003
2023-01-12is_ty_infer -> is_ty_or_numeric_inferMichael Goulet-2/+2
2023-01-12HACK: Handle escaping bound vars from the canonical queryMichael Goulet-2/+88
2023-01-12Feed the `features_query` instead of grabbing it from the session lazilyOli Scherer-2/+1
2023-01-12Remove `output_filenames` field from TyCtxt and feed the query insteadOli Scherer-8/+3
2023-01-12Remove `untracked_crate` field and instead pass it along with the resolver.Oli Scherer-8/+5
2023-01-12Feed `crate_name` queryOli Scherer-12/+5
2023-01-12Feed `resolutions` query instead of it being a thin wrapper around an ↵Oli Scherer-6/+3
untracked field