rust/compiler
bors cdeba02ff7 Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk
Const drop

The changes are pretty primitive at this point. But at least it works. ^-^

Problems with the current change that I can think of now:
 - [x] `~const Drop` shouldn't change anything in the non-const world.
 - [x] types that do not have drop glues shouldn't fail to satisfy `~const Drop` in const contexts. `struct S { a: u8, b: u16 }` This might not fail for `needs_non_const_drop`, but it will fail in `rustc_trait_selection`.
 - [x] The current change accepts types that have `const Drop` impls but have non-const `Drop` glue.

Fixes #88424.

Significant Changes:

- `~const Drop` is no longer treated as a normal trait bound. In non-const contexts, this bound has no effect, but in const contexts, this restricts the input type and all of its transitive fields to either a) have a `const Drop` impl or b) can be trivially dropped (i.e. no drop glue)
- `T: ~const Drop` will not be linted like `T: Drop`.
- Instead of recursing and iterating through the type in `rustc_mir::transform::check_consts`, we use the trait system to special case `~const Drop`. See [`rustc_trait_selection::...::candidate_assembly#assemble_const_drop_candidates`](https://github.com/fee1-dead/rust/blob/const-drop/compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs#L817) and others.

Changes not related to `const Drop`ping and/or changes that are insignificant:

 - `Node.constness_for_typeck` no longer returns `hir::Constness::Const` for type aliases in traits. This was previously used to hack how we determine default bound constness for items. But because we now use an explicit opt-in, it is no longer needed.
 - Removed `is_const_impl_raw` query. We have `impl_constness`, and the only existing use of that query uses `HirId`, which means we can just operate it with hir.
 - `ty::Destructor` now has a field `constness`, which represents the constness of the destructor.

r? `@oli-obk`
2021-09-15 03:51:03 +00:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Keep a parent LocalDefId in SpanData. 2021-09-10 20:17:33 +02:00
rustc_ast_lowering Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov 2021-09-11 23:35:28 +00:00
rustc_ast_passes Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
rustc_ast_pretty
rustc_attr
rustc_borrowck Auto merge of #88811 - jackh726:issue-88446, r=nikomatsakis 2021-09-12 17:04:10 +00:00
rustc_builtin_macros Rollup merge of #88209 - Amanieu:asm_in_underscore, r=nagisa 2021-09-11 08:23:40 -07:00
rustc_codegen_cranelift Auto merge of #88839 - nbdd0121:alignof, r=nagisa 2021-09-12 23:49:24 +00:00
rustc_codegen_llvm Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb 2021-09-12 20:48:09 +00:00
rustc_codegen_ssa Auto merge of #88839 - nbdd0121:alignof, r=nagisa 2021-09-12 23:49:24 +00:00
rustc_const_eval Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
rustc_data_structures Rollup merge of #88711 - Mark-Simulacrum:fix-dfs-bug, r=jackh726 2021-09-12 03:44:57 -07:00
rustc_driver Rename rustc_mir to rustc_const_eval. 2021-09-07 20:46:26 +02:00
rustc_error_codes
rustc_errors Auto merge of #87915 - estebank:fancy-spans, r=oli-obk 2021-09-13 16:31:12 +00:00
rustc_expand Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov 2021-09-11 23:35:28 +00:00
rustc_feature Ignore automatically derived impls of Clone and Debug in dead code analysis 2021-09-09 19:49:07 +02:00
rustc_fs_util
rustc_graphviz
rustc_hir Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
rustc_hir_pretty don't convert types into identical types 2021-09-11 10:32:38 +02:00
rustc_incremental Auto merge of #83214 - cjgillot:dep-map, r=michaelwoerister 2021-09-06 23:58:16 +00:00
rustc_index
rustc_infer Rollup merge of #88336 - jackh726:gats-where-constraints, r=estebank 2021-09-12 03:44:53 -07:00
rustc_interface Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb 2021-09-12 20:48:09 +00:00
rustc_lexer
rustc_lint Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
rustc_lint_defs
rustc_llvm RustWrapper: remove some uses of AttrBuilder 2021-09-08 10:47:41 -04:00
rustc_macros don't clone types that are Copy (clippy::clone_on_copy) 2021-09-11 10:18:56 +02:00
rustc_metadata Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb 2021-09-12 20:48:09 +00:00
rustc_middle Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
rustc_mir_build Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr 2021-09-12 03:44:56 -07:00
rustc_mir_dataflow Introduce NullOp::AlignOf 2021-09-13 00:08:35 +01:00
rustc_mir_transform Auto merge of #88839 - nbdd0121:alignof, r=nagisa 2021-09-12 23:49:24 +00:00
rustc_monomorphize Rebase fallout. 2021-09-08 20:40:30 +02:00
rustc_parse Auto merge of #88914 - GuillaumeGomez:rollup-h5svc6w, r=GuillaumeGomez 2021-09-14 08:46:22 +00:00
rustc_parse_format
rustc_passes don't convert types into identical types 2021-09-11 10:32:38 +02:00
rustc_plugin_impl
rustc_privacy add a CastKind to Node::Cast 2021-09-09 01:32:03 +01:00
rustc_query_impl Rollup merge of #88709 - BoxyUwU:thir-abstract-const, r=lcnr 2021-09-12 03:44:56 -07:00
rustc_query_system Auto merge of #78780 - cjgillot:req, r=Mark-Simulacrum 2021-09-11 20:39:47 +00:00
rustc_resolve Auto merge of #87915 - estebank:fancy-spans, r=oli-obk 2021-09-13 16:31:12 +00:00
rustc_save_analysis Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
rustc_serialize rustc: Remove local variable IDs from Exports 2021-09-10 23:41:48 +03:00
rustc_session Auto merge of #88759 - Amanieu:panic_in_drop, r=nagisa,eddyb 2021-09-12 20:48:09 +00:00
rustc_span Auto merge of #84373 - cjgillot:resolve-span, r=michaelwoerister,petrochenkov 2021-09-11 23:35:28 +00:00
rustc_symbol_mangling
rustc_target Auto merge of #87794 - bonega:enum_niche_prefer_zero, r=nagisa 2021-09-13 22:14:57 +00:00
rustc_trait_selection Auto merge of #88558 - fee1-dead:const-drop, r=oli-obk 2021-09-15 03:51:03 +00:00
rustc_traits
rustc_ty_utils Remove the queries 2021-09-09 05:21:32 +00:00
rustc_type_ir Use index newtyping for TyVid 2021-09-06 22:38:06 -04:00
rustc_typeck Auto merge of #87915 - estebank:fancy-spans, r=oli-obk 2021-09-13 16:31:12 +00:00