rust/compiler
Matthias Krüger 3cd0a109a8
Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk
Store the laziness of type aliases in their `DefKind`

Previously, we would treat paths referring to type aliases as *lazy* type aliases if the current crate had lazy type aliases enabled independently of whether the crate which the alias was defined in had the feature enabled or not.

With this PR, the laziness of a type alias depends on the crate it is defined in. This generally makes more sense to me especially if / once lazy type aliases become the default in a new edition and we need to think about *edition interoperability*:

Consider the hypothetical case where the dependency crate has an older edition (and thus eager type aliases), it exports a type alias with bounds & a where-clause (which are void but technically valid), the dependent crate has the latest edition (and thus lazy type aliases) and it uses that type alias. Arguably, the bounds should *not* be checked since at any time, the dependency crate should be allowed to change the bounds at will with a *non*-major version bump & without negatively affecting downstream crates.

As for the reverse case (dependency: lazy type aliases, dependent: eager type aliases), I guess it rules out anything from slight confusion to mild annoyance from upstream crate authors that would be caused by the compiler ignoring the bounds of their type aliases in downstream crates with older editions.

---

This fixes #114468 since before, my assumption that the type alias associated with a given weak projection was lazy (and therefore had its variances computed) did not necessarily hold in cross-crate scenarios (which [I kinda had a hunch about](https://github.com/rust-lang/rust/pull/114253#discussion_r1278608099)) as outlined above. Now it does hold.

`@rustbot` label F-lazy_type_alias
r? `@oli-obk`
2023-08-08 03:30:56 +02:00
..
rustc
rustc_abi Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_arena Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_ast Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
rustc_ast_lowering Consolidate opaque ty and async fn lowering code 2023-08-05 16:53:13 +00:00
rustc_ast_passes
rustc_ast_pretty Improve spans for indexing expressions 2023-08-04 13:17:39 +02:00
rustc_attr [rustc_attr][nit] Replace filter + is_some with map_or. 2023-08-01 12:39:32 -07:00
rustc_baked_icu_data
rustc_borrowck Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_builtin_macros Generate better function argument names in global_allocator expansion 2023-08-06 07:36:05 -07:00
rustc_codegen_cranelift Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot 2023-08-07 05:29:12 +02:00
rustc_codegen_gcc Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot 2023-08-07 05:29:12 +02:00
rustc_codegen_llvm Update powerpc data layouts 2023-08-07 20:35:55 +02:00
rustc_codegen_ssa Rollup merge of #114500 - taiki-e:arm-crypto, r=Amanieu 2023-08-08 03:30:55 +02:00
rustc_const_eval Rollup merge of #114382 - scottmcm:compare-bytes-intrinsic, r=cjgillot 2023-08-07 05:29:12 +02:00
rustc_data_structures Rollup merge of #114418 - klensy:parking_lot, r=oli-obk 2023-08-04 21:31:56 +02:00
rustc_driver
rustc_driver_impl Auto merge of #114476 - Urgau:missing-dep-file-112898, r=oli-obk 2023-08-06 00:04:52 +00:00
rustc_error_codes Auto merge of #109348 - cjgillot:issue-109146, r=petrochenkov 2023-08-05 11:52:07 +00:00
rustc_error_messages Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_errors Auto merge of #114104 - oli-obk:syn2, r=compiler-errors 2023-08-04 18:46:19 +00:00
rustc_expand Auto merge of #114104 - oli-obk:syn2, r=compiler-errors 2023-08-04 18:46:19 +00:00
rustc_feature Rollup merge of #114562 - Trolldemorted:thiscall, r=oli-obk 2023-08-07 16:47:57 +02:00
rustc_fluent_macro
rustc_fs_util
rustc_graphviz
rustc_hir Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_hir_analysis Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_hir_pretty Improve spans for indexing expressions 2023-08-04 13:17:39 +02:00
rustc_hir_typeck Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_incremental Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_index Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_infer Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_interface Make MissingDoc a module lint. 2023-08-04 16:09:14 +00:00
rustc_lexer
rustc_lint Rollup merge of #114486 - Urgau:const-context-nan-suggestion-114471, r=compiler-errors 2023-08-06 03:56:09 +02:00
rustc_lint_defs Auto merge of #114414 - cjgillot:early-unnameable-test, r=petrochenkov 2023-08-04 14:13:11 +00:00
rustc_llvm Fix LLVM version check for ThinLTO import/export lists 2023-08-07 20:36:14 +02:00
rustc_log
rustc_macros Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_metadata Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
rustc_middle Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_mir_build Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_mir_dataflow Rollup merge of #114505 - ouz-a:cleanup_mir, r=RalfJung 2023-08-06 17:26:29 +02:00
rustc_mir_transform Auto merge of #113902 - Enselic:lint-recursive-drop, r=oli-obk 2023-08-07 13:39:28 +00:00
rustc_monomorphize Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
rustc_parse Rollup merge of #114434 - Nilstrieb:indexing-spans, r=est31 2023-08-04 21:31:57 +02:00
rustc_parse_format
rustc_passes Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_plugin_impl
rustc_privacy Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
rustc_query_impl Add internal_features lint 2023-08-03 14:50:50 +02:00
rustc_query_system Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_resolve Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_serialize
rustc_session Auto merge of #114104 - oli-obk:syn2, r=compiler-errors 2023-08-04 18:46:19 +00:00
rustc_smir Add TraitDef::trait_decl method 2023-08-07 10:24:12 -03:00
rustc_span Rollup merge of #114549 - chenyukang:yukang-review-resolve-part, r=petrochenkov 2023-08-07 05:29:13 +02:00
rustc_symbol_mangling avoid 'miri' when refering to the shared interpreter 2023-08-02 16:52:03 +02:00
rustc_target Rollup merge of #114497 - taiki-e:revert-riscv-atomic, r=Amanieu 2023-08-08 03:30:55 +02:00
rustc_trait_selection Rollup merge of #114566 - fmease:type-alias-laziness-is-crate-specific, r=oli-obk 2023-08-08 03:30:56 +02:00
rustc_traits
rustc_transmute
rustc_ty_utils Store the laziness of type aliases in the DefKind 2023-08-07 15:54:31 +02:00
rustc_type_ir Rollup merge of #114355 - compiler-errors:resolve_vars_early, r=lcnr 2023-08-04 09:18:59 +02:00