rust/compiler
bors 0cc541e4b2 Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errors
Add `AliasKind::Weak` for type aliases.

`type Foo<T: Debug> = Bar<T>;` does not check `T: Debug` at use sites of `Foo<NotDebug>`, because in contrast to a

```rust
trait Identity {
    type Identity;
}
impl<T: Debug> Identity for T {
    type Identity = T;
}
<NotDebug as Identity>::Identity
```

type aliases do not exist in the type system, but are expanded to their aliased type immediately when going from HIR to the type layer.

Similarly:

* a private type alias for a public type is a completely fine thing, even though it makes it a bit hard to write out complex times sometimes
* rustdoc expands the type alias, even though often times users use them for documentation purposes
* diagnostics show the expanded type, which is confusing if the user wrote a type alias and the diagnostic talks about another type that they don't know about.

For type alias impl trait, these issues do not actually apply in most cases, but sometimes you have a type alias impl trait like `type Foo<T: Debug> = (impl Debug, Bar<T>);`, which only really checks it for `impl Debug`, but by accident prevents `Bar<T>` from only being instantiated after proving `T: Debug`. This PR makes sure that we always check these bounds explicitly and don't rely on an implementation accident.

To not break all the type aliases out there, we only use it when the type alias contains an opaque type. We can decide to do this for all type aliases over an edition.

Or we can later extend this to more types if we figure out the back-compat concerns with suddenly checking such bounds.

As a side effect, easily allows fixing https://github.com/rust-lang/rust/issues/108617, which I did.

fixes https://github.com/rust-lang/rust/issues/108617
2023-06-17 00:33:29 +00:00
..
rustc fix link 2023-03-11 10:53:47 -06:00
rustc_abi Auto merge of #112062 - lukas-code:unsized-layout, r=wesleywiser 2023-06-13 22:34:59 +00:00
rustc_apfloat
rustc_arena Extend unused_must_use to cover block exprs 2023-06-15 17:59:13 +08:00
rustc_ast Remember names of cfg-ed out items to mention them in diagnostics 2023-06-01 19:17:19 +02:00
rustc_ast_lowering Separate AnonConst from ConstBlock in HIR. 2023-06-02 21:25:18 +00:00
rustc_ast_passes Fix debug ICE for extern type with where clauses 2023-06-12 15:15:45 +08:00
rustc_ast_pretty Fix suggestion for E0404 not dealing with multiple generics 2023-06-15 18:19:09 +08:00
rustc_attr Ensure Fluent messages are in alphabetical order 2023-05-25 23:49:35 +00:00
rustc_baked_icu_data Regen baked data 2023-05-02 10:45:16 -07:00
rustc_borrowck Rollup merge of #112654 - aliemjay:closure-output-normalize, r=compiler-errors 2023-06-15 22:04:57 +02:00
rustc_builtin_macros Remove accidental comment 2023-06-07 17:16:34 +00:00
rustc_codegen_cranelift Merge commit '8830dccd1d' into sync_cg_clif-2023-06-15 2023-06-15 17:56:01 +00:00
rustc_codegen_gcc Support 128-bit enum variant in debuginfo codegen 2023-06-10 03:39:24 +08:00
rustc_codegen_llvm Rollup merge of #112474 - ldm0:ldm_enum_debuginfo_128_support, r=compiler-errors 2023-06-16 12:53:22 -07:00
rustc_codegen_ssa Rollup merge of #112474 - ldm0:ldm_enum_debuginfo_128_support, r=compiler-errors 2023-06-16 12:53:22 -07:00
rustc_const_eval Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_data_structures Don't print Interned or PrivateZst 2023-06-09 00:20:37 +00:00
rustc_driver fix spelling error 2023-06-05 16:01:09 +02:00
rustc_driver_impl Rollup merge of #112109 - Alexendoo:unsupported-split-debuginfo, r=b-naber 2023-06-14 18:10:29 +02:00
rustc_error_codes Implement custom diagnostic for ConstParamTy 2023-06-01 18:21:42 +00:00
rustc_error_messages Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
rustc_errors s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
rustc_expand Add SyntaxContext::is_root 2023-06-16 13:47:42 +00:00
rustc_feature cleanup 2023-06-03 09:44:30 +08:00
rustc_fluent_macro Remove unused synstructure dep 2023-04-22 22:03:33 +01:00
rustc_fs_util Add try_canonicalize to rustc_fs_util and use it over fs::canonicalize 2023-03-16 21:50:23 +01:00
rustc_graphviz enable rust_2018_idioms for doctests 2023-05-07 00:12:29 +03:00
rustc_hir #[lang_item] for core::ptr::Unique 2023-06-16 15:22:18 +02:00
rustc_hir_analysis Pacify tidy 2023-06-16 19:39:48 +00:00
rustc_hir_pretty Separate AnonConst from ConstBlock in HIR. 2023-06-02 21:25:18 +00:00
rustc_hir_typeck Rollup merge of #112399 - compiler-errors:closure-substs-root-universe, r=lcnr 2023-06-16 14:46:14 +05:30
rustc_incremental Removed stable/unstable sort arg from into_sorted_stable_ord, fixed a few misc issues, added collect to UnordItems 2023-06-08 00:38:50 -04:00
rustc_index Auto merge of #111925 - Manishearth:rollup-z6z6l2v, r=Manishearth 2023-05-25 00:33:43 +00:00
rustc_infer Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_interface Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
rustc_lexer Don't try to eat non-existent decimal digits. 2023-05-15 18:33:12 +10:00
rustc_lint Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_lint_defs Private-in-public lints implementation 2023-06-12 01:02:19 +03:00
rustc_llvm Add SafeStack support to rustc 2023-05-26 15:18:54 -04:00
rustc_log Stabilize IsTerminal 2023-04-10 17:24:23 +09:00
rustc_macros Use translatable diagnostics in rustc_const_eval 2023-06-01 14:45:18 +00:00
rustc_metadata s/drain_filter/extract_if/ for Vec, Btree{Map,Set} and LinkedList 2023-06-14 09:28:54 +02:00
rustc_middle Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errors 2023-06-17 00:33:29 +00:00
rustc_mir_build Show note for type ascription interpreted as a constant pattern, not a new variable 2023-06-04 20:49:30 +08:00
rustc_mir_dataflow Auto merge of #108293 - Jarcho:mut_analyses, r=eholk 2023-06-08 23:58:44 +00:00
rustc_mir_transform Auto merge of #112716 - compiler-errors:rollup-h77daia, r=compiler-errors 2023-06-16 21:14:24 +00:00
rustc_monomorphize Merge CGUs in a nicer way. 2023-06-15 18:58:23 +10:00
rustc_parse Handle interpolated literal errors 2023-06-15 01:55:37 +00:00
rustc_parse_format Fix typos in compiler 2023-04-10 22:02:52 +02:00
rustc_passes Rollup merge of #112081 - obeis:doc-test-literal, r=compiler-errors 2023-06-05 23:47:57 +02:00
rustc_plugin_impl Add rustc_fluent_macro to decouple fluent from rustc_macros 2023-04-18 18:56:22 +00:00
rustc_privacy Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_query_impl Update field-offset and enable unstable_offset_of 2023-06-05 15:57:13 +02:00
rustc_query_system Rollup merge of #112333 - Zoxc:try_collect_active_jobs-deadlock, r=cjgillot 2023-06-08 12:36:18 +02:00
rustc_resolve Fix suggestion for E0404 not dealing with multiple generics 2023-06-15 18:19:09 +08:00
rustc_serialize Fix the FileEncoder buffer size. 2023-05-15 08:59:11 +10:00
rustc_session Remove comments from mir-opt MIR dumps 2023-06-15 15:19:11 -04:00
rustc_smir Use a Stable trait to translate mir -> smir 2023-06-13 15:17:01 -07:00
rustc_span Rollup merge of #112706 - WaffleLapkin:syntax_context_is_root, r=petrochenkov 2023-06-16 12:53:24 -07:00
rustc_symbol_mangling Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_target loongarch64-none*: Remove environment component from llvm target 2023-06-13 20:24:22 +08:00
rustc_trait_selection Auto merge of #108860 - oli-obk:tait_alias, r=compiler-errors 2023-06-17 00:33:29 +00:00
rustc_traits Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00
rustc_transmute Safe Transmute: Refactor error handling and Answer type 2023-06-12 16:56:21 -07:00
rustc_ty_utils Separate AnonConst from ConstBlock in HIR. 2023-06-02 21:25:18 +00:00
rustc_type_ir Add AliasKind::Weak for type aliases. 2023-06-16 19:39:48 +00:00