rust/compiler
bors 9ed5b94b28 Auto merge of #90373 - tmiasko:union-qualification, r=oli-obk
Use type based qualification for unions

Union field access is currently qualified based on the qualification of
a value previously assigned to the union. At the same time, every union
access transmutes the content of the union, which might result in a
different qualification.

For example, consider constants A and B as defined below, under the
current rules neither contains interior mutability, since a value used
in the initial assignment did not contain `UnsafeCell` constructor.

```rust
#![feature(untagged_unions)]

union U { i: u32, c: std::cell::Cell<u32> }
const A: U = U { i: 0 };
const B: std::cell::Cell<u32> = unsafe { U { i: 0 }.c };
```

To avoid the issue, the changes here propose to consider the content of
a union as opaque and use type based qualification for union types.

Fixes #90268.

`@rust-lang/wg-const-eval`
2021-10-29 12:21:09 +00:00
..
rustc Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_apfloat Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov" 2021-10-15 11:28:23 +02:00
rustc_arena Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_ast fix: inner attribute followed by outer attribute causing ICE 2021-10-25 17:31:27 +02:00
rustc_ast_lowering Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_ast_passes Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_ast_pretty Some "parenthesis" and "parentheses" fixes 2021-10-17 12:04:01 +02:00
rustc_attr Correct typo 2021-10-16 13:36:05 -07:00
rustc_borrowck Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_builtin_macros Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_codegen_cranelift Make hash_result an Option. 2021-10-20 18:29:18 +02:00
rustc_codegen_gcc Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa 2021-10-27 09:19:42 +00:00
rustc_codegen_llvm Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_codegen_ssa Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_const_eval Auto merge of #90373 - tmiasko:union-qualification, r=oli-obk 2021-10-29 12:21:09 +00:00
rustc_data_structures Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_driver Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_error_codes Rollup merge of #89922 - JohnTitor:update-e0637, r=jackh726 2021-10-22 19:42:46 +09:00
rustc_errors Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_expand Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_feature Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_fs_util Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_graphviz Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov" 2021-10-15 11:28:23 +02:00
rustc_hir Use SortedMap in HIR. 2021-10-21 23:08:57 +02:00
rustc_hir_pretty Auto merge of #89124 - cjgillot:owner-info, r=michaelwoerister 2021-10-18 19:53:05 +00:00
rustc_incremental Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_index update cfg(bootstrap) 2021-10-23 21:55:57 -04:00
rustc_infer Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_interface Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_lexer Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov" 2021-10-15 11:28:23 +02:00
rustc_lint Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_lint_defs Make all proc-macro back-compat lints deny-by-default 2021-10-18 13:17:05 -05:00
rustc_llvm Rollup merge of #89581 - jblazquez:master, r=Mark-Simulacrum 2021-10-25 22:59:46 +02:00
rustc_macros Avoid a branch on key being local for queries that use the same local and extern providers 2021-10-25 13:36:23 +02:00
rustc_metadata Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_middle Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_mir_build Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_mir_dataflow Ignore errors re: unreachable blocks in dataflow cursor unit tests 2021-10-23 21:55:57 -04:00
rustc_mir_transform Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_monomorphize Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_parse Rollup merge of #89257 - aDotInTheVoid:macro-error-2, r=estebank 2021-10-22 19:42:43 +09:00
rustc_parse_format Migrate to 2021 2021-09-20 22:21:42 -04:00
rustc_passes Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_plugin_impl Move rustc_middle::middle::cstore to rustc_session. 2021-10-03 16:08:51 +02:00
rustc_privacy Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_query_impl Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_query_system Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_resolve Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_save_analysis Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_serialize Revert "Auto merge of #89709 - clemenswasser:apply_clippy_suggestions_2, r=petrochenkov" 2021-10-15 11:28:23 +02:00
rustc_session Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_span Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_symbol_mangling Revert "Add rustc lint, warning when iterating over hashmaps" 2021-10-28 11:01:42 -04:00
rustc_target Auto merge of #89652 - rcvalle:rust-cfi, r=nagisa 2021-10-27 09:19:42 +00:00
rustc_trait_selection Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00
rustc_traits Move some outlives bounds things from rustc_trait_selection to rustc_typeck 2021-10-15 12:14:19 -04:00
rustc_ty_utils Auto merge of #90218 - JakobDegen:adt_significant_drop_fix, r=nikomatsakis 2021-10-28 16:03:13 +00:00
rustc_type_ir Add two inline annotations for hot functions 2021-10-03 12:43:43 -04:00
rustc_typeck Auto merge of #90380 - Mark-Simulacrum:revert-89558-query-stable-lint, r=lcnr 2021-10-29 04:55:51 +00:00