1
Fork 0
rust/compiler
Matthias Krüger ae92125a75
Rollup merge of #127574 - lcnr:coherence-check-supertrait, r=compiler-errors
elaborate unknowable goals

A reimplemented version of #124532 affecting only the new solver. Always trying to prove super traits ends up causing a fatal overflow error in diesel, so we cannot land this in the old solver.

The following test currently does not pass coherence:
```rust
trait Super {}
trait Sub<T>: Super {}

trait Overlap<T> {}
impl<T, U: Sub<T>> Overlap<T> for U {}
impl<T> Overlap<T> for () {}

fn main() {}
```

We check whether `(): Sub<?t>` holds. This stalls with ambiguity as downstream crates may add an impl for `(): Sub<Local>`. However, its super trait bound `(): Super` cannot be implemented downstream, so this one is known not to hold.

By trying to prove that all the super bounds of a trait before adding a coherence unknowable candidate, this compiles. This is necessary to prevent breakage from enabling `-Znext-solver=coherence` (#121848), see tests/ui/coherence/super-traits/super-trait-knowable-2.rs for more details. The idea is that while there may be an impl of the trait itself we don't know about, if we're able to prove that a super trait is definitely not implemented, then that impl would also never apply/not be well-formed.

This approach is different from #124532 as it allows tests/ui/coherence/super-traits/super-trait-knowable-3.rs to compile. The approach in #124532 only elaborating the root obligations while this approach tries it for all unknowable trait goals.

r? `@compiler-errors`
2024-07-30 04:31:54 +02:00
..
rustc The rustc crate feature is called jemalloc 2024-07-15 13:01:20 -04:00
rustc_abi Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_arena Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_ast Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_ast_ir Use dep: for crate dependencies 2024-07-15 12:40:10 -04:00
rustc_ast_lowering Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_ast_passes Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_ast_pretty Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_attr Rollup merge of #128341 - Alexendoo:parse-version-pub, r=compiler-errors 2024-07-29 17:46:44 +02:00
rustc_baked_icu_data Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_borrowck Stop using MoveDataParamEnv for places that don't need a param-env 2024-07-29 11:59:47 -04:00
rustc_builtin_macros Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_codegen_cranelift Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35 2024-07-29 07:41:33 +00:00
rustc_codegen_gcc Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35 2024-07-29 07:41:33 +00:00
rustc_codegen_llvm Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35 2024-07-29 07:41:33 +00:00
rustc_codegen_ssa Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_const_eval Rollup merge of #128277 - RalfJung:offset_from_wildcard, r=oli-obk 2024-07-29 11:42:34 +02:00
rustc_data_structures Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_driver Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
rustc_driver_impl Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_error_codes Stabilize offset_of_nested 2024-07-29 17:50:12 +01:00
rustc_error_messages Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_errors Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_expand Rollup merge of #128202 - compiler-errors:internal-lib-features, r=oli-obk 2024-07-29 17:46:43 +02:00
rustc_feature Stabilize offset_of_nested 2024-07-29 17:50:12 +01:00
rustc_fluent_macro Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_fs_util Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_graphviz Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_hir Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_hir_analysis Rollup merge of #128174 - compiler-errors:trait-alias-marker, r=oli-obk 2024-07-29 17:46:42 +02:00
rustc_hir_pretty Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_hir_typeck Auto merge of #128360 - matthiaskrgr:rollup-wwy5mkj, r=matthiaskrgr 2024-07-29 21:46:59 +00:00
rustc_incremental Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_index Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_index_macros Remove usage of specialization from newtype_index! 2024-06-30 16:42:53 +00:00
rustc_infer Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_interface Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_lexer Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_lint Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_lint_defs Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_llvm Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_log Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_macros Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_metadata Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_middle Rollup merge of #128304 - Zalathar:thir-pat-display, r=Nadrieril 2024-07-29 11:42:34 +02:00
rustc_mir_build Rollup merge of #128304 - Zalathar:thir-pat-display, r=Nadrieril 2024-07-29 11:42:34 +02:00
rustc_mir_dataflow Stop using MoveDataParamEnv for places that don't need a param-env 2024-07-29 11:59:47 -04:00
rustc_mir_transform Stop using MoveDataParamEnv for places that don't need a param-env 2024-07-29 11:59:47 -04:00
rustc_monomorphize Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_next_trait_solver Rollup merge of #127574 - lcnr:coherence-check-supertrait, r=compiler-errors 2024-07-30 04:31:54 +02:00
rustc_parse Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_parse_format Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_passes Rollup merge of #128104 - mu001999-contrib:fix/128053, r=petrochenkov 2024-07-29 21:26:12 +02:00
rustc_pattern_analysis Rollup merge of #128304 - Zalathar:thir-pat-display, r=Nadrieril 2024-07-29 11:42:34 +02:00
rustc_privacy Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_query_impl Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_query_system Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_resolve Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_sanitizers Rollup merge of #127882 - compiler-errors:cfi-sized-self-gat, r=oli-obk 2024-07-29 17:46:42 +02:00
rustc_serialize Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_session Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_smir Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_span Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_symbol_mangling Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_target Auto merge of #125016 - nicholasbishop:bishop-cb-112, r=tgross35 2024-07-29 07:41:33 +00:00
rustc_trait_selection only accept adt type during infer source visitor 2024-07-29 22:29:34 +08:00
rustc_traits Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_transmute Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_ty_utils Reformat use declarations. 2024-07-29 08:26:52 +10:00
rustc_type_ir Rollup merge of #127574 - lcnr:coherence-check-supertrait, r=compiler-errors 2024-07-30 04:31:54 +02:00
rustc_type_ir_macros Reformat use declarations. 2024-07-29 08:26:52 +10:00
stable_mir Reformat use declarations. 2024-07-29 08:26:52 +10:00