rust/compiler
bors e2be5f568d Auto merge of #74595 - lcnr:ConstEvaluatable-fut-compat, r=oli-obk
make `ConstEvaluatable` more strict

relevant zulip discussion: https://rust-lang.zulipchat.com/#narrow/stream/146212-t-compiler.2Fconst-eval/topic/.60ConstEvaluatable.60.20generic.20functions/near/204125452

Let's see how much this impacts. Depending on how this goes this should probably be a future compat warning.

Short explanation: we currently forbid anonymous constants which depend on generic types, e.g. `[0; std::mem::size_of::<T>]` currently errors.

We previously checked this by evaluating the constant and returned an error if that failed. This however allows things like
```rust
const fn foo<T>() -> usize {
    if std::mem::size_of::<*mut T>() < 8 { // size of *mut T does not depend on T
        std::mem::size_of::<T>()
    } else {
        8
    }
}

fn test<T>() {
    let _ = [0; foo::<T>()];
}
```
which is a backwards compatibility hazard. This also has worrying interactions with mir optimizations (https://github.com/rust-lang/rust/pull/74491#issuecomment-661890421) and intrinsics (#74538).

r? `@oli-obk` `@eddyb`
2020-09-09 20:04:04 +00:00
..
rustc
rustc_apfloat
rustc_arena
rustc_ast Rollup merge of #76274 - scottmcm:fix-76271, r=petrochenkov 2020-09-07 01:17:46 +02:00
rustc_ast_lowering
rustc_ast_passes Implementation of incompatible features error 2020-09-04 22:17:28 +08:00
rustc_ast_pretty Auto merge of #76170 - matklad:notrivia, r=petrochenkov 2020-09-02 03:19:38 +00:00
rustc_attr
rustc_builtin_macros Improve recovery on malformed format call 2020-09-02 13:18:19 +02:00
rustc_codegen_llvm Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_codegen_ssa Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_data_structures Add BREAK too, and improve the comments 2020-09-04 16:28:23 -07:00
rustc_driver Auto merge of #73996 - da-x:short-unique-paths, r=petrochenkov 2020-09-03 23:27:45 +00:00
rustc_error_codes Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514 2020-09-09 08:23:33 +00:00
rustc_errors rustc_{errors,session}: add delay_good_path_bug 2020-09-02 10:43:17 +03:00
rustc_expand Auto merge of #76406 - GuillaumeGomez:create-e0774, r=pickfire,jyn514 2020-09-09 08:23:33 +00:00
rustc_feature Implementation of incompatible features error 2020-09-04 22:17:28 +08:00
rustc_fs_util
rustc_graphviz
rustc_hir add track_caller to local_def_id_to_hir_id 2020-09-04 09:24:44 +02:00
rustc_hir_pretty
rustc_incremental
rustc_index
rustc_infer ty.flags -> ty.flags() 2020-09-04 18:28:20 +02:00
rustc_interface Auto merge of #73996 - da-x:short-unique-paths, r=petrochenkov 2020-09-03 23:27:45 +00:00
rustc_lexer lexer: Tiny improvement to shebang detection 2020-09-02 00:40:19 +03:00
rustc_lint Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_macros Auto merge of #75138 - jumbatm:session-diagnostic-derive, r=oli-obk 2020-09-08 00:58:43 +00:00
rustc_metadata Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_middle Auto merge of #74595 - lcnr:ConstEvaluatable-fut-compat, r=oli-obk 2020-09-09 20:04:04 +00:00
rustc_mir Auto merge of #76308 - wesleywiser:enable_simplifyarmidentity_mir_opt, r=oli-obk 2020-09-08 09:27:23 +00:00
rustc_mir_build Rollup merge of #76318 - scottmcm:one-control-flow, r=ecstatic-morse 2020-09-07 01:18:05 +02:00
rustc_parse Optimize Cursor::look_ahead 2020-09-03 23:28:22 +02:00
rustc_parse_format
rustc_passes Auto merge of #75888 - GuillaumeGomez:trait-impl-assoc-const-doc-alias, r=ollie27 2020-09-05 09:35:17 +00:00
rustc_plugin_impl
rustc_privacy Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_query_system
rustc_resolve Rollup merge of #76143 - jyn514:duplicate-builtin-macros, r=petrochenkov 2020-09-01 18:24:35 -07:00
rustc_save_analysis Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_serialize
rustc_session add tracking issue, fix rebase 2020-09-08 16:39:12 +02:00
rustc_span
rustc_symbol_mangling Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_target Rollup merge of #76364 - fusion-engineering-forks:avr-no-atomic, r=jonas-schievink 2020-09-07 01:18:17 +02:00
rustc_trait_selection add tracking issue, fix rebase 2020-09-08 16:39:12 +02:00
rustc_traits kind -> kind() 2020-09-04 19:17:57 -04:00
rustc_ty Change ty.kind to a method 2020-09-04 17:47:51 +02:00
rustc_typeck Rollup merge of #76401 - JulianKnodt:i68366, r=lcnr 2020-09-09 01:35:20 +02:00