rust/compiler
bors d9aa287672 Auto merge of #86580 - BoxyUwU:cgd-subst-ice, r=nikomatsakis
dont provide fwd declared params to cg defaults

Fixes #83938

```rust
#![feature(const_evaluatable_checked, const_generics, const_generics_defaults)]
#![allow(incomplete_features)]

pub struct Bar<const N: usize, const M: usize = { N + 1 }>;
pub fn foo<const N1: usize>() -> Bar<N1> { loop {} }

fn main() {}
```
This PR makes this code no longer ICE, it was ICE'ing previously because when building substs for `Bar<N1>` we would subst the anon ct: `ConstKind::Unevaluated({N + 1}, substs: [N, M])` with substs of `[N1]`. the anon const has forward declared params supplied though so we end up trying to substitute the provided `M` param which causes the ICE.

This PR doesn't handle the predicates of the const so
```rust
trait Foo<const N: usize> { const Assoc: usize; }
pub struct Bar<const N: usize = { <()>::Assoc }> where (): Foo<N>;
```
Resolves to `<() as Foo<N>>::Assoc` which can allow for using fwd declared params indirectly.

```rust
trait Foo<const N: usize> {}
struct Bar<const N: usize = { 2 + 3 }> where (): Foo<N>;
```
This code also ICEs under this PR because instantiating the default's predicates causes an ICE as predicates_of contains predicates with fwd declared params

PR was briefly discussed [in this zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/evil.20preds.20in.20param.20env.20.2386580)
2021-07-24 20:01:51 +00:00
..
rustc
rustc_apfloat Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_arena
rustc_ast Remove special case for ExprKind::Paren in MutVisitor 2021-07-19 17:23:10 -05:00
rustc_ast_lowering Correct fmt 2021-07-21 12:01:03 +08:00
rustc_ast_passes Auto merge of #83918 - workingjubilee:stable-rangefrom-pat, r=joshtriplett 2021-07-11 06:31:42 +00:00
rustc_ast_pretty Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
rustc_attr Enhance well-formedness checks for #[repr(...)] attributes 2021-07-09 22:03:48 +02:00
rustc_builtin_macros Rollup merge of #87206 - matthiaskrgr:clippy_collect, r=davidtwco 2021-07-21 15:52:45 +02:00
rustc_codegen_cranelift Rollup merge of #87092 - ricobbe:fix-raw-dylib-multiple-definitions, r=petrochenkov 2021-07-18 14:21:56 +09:00
rustc_codegen_llvm Auto merge of #86950 - tmiasko:personality, r=nagisa 2021-07-18 20:33:23 +00:00
rustc_codegen_ssa Auto merge of #87153 - michaelwoerister:debuginfo-names-dyn-trait-projection-bounds, r=wesleywiser 2021-07-19 21:25:43 +00:00
rustc_data_structures Auto merge of #86429 - JohnTitor:get-by-key-enum-part-2, r=oli-obk 2021-07-23 23:17:38 +00:00
rustc_driver Auto merge of #80182 - in42:stack_trace, r=tmandry 2021-07-02 05:40:51 +00:00
rustc_error_codes Rollup merge of #87342 - midgleyc:add-E0757-long, r=GuillaumeGomez 2021-07-21 15:52:53 +02:00
rustc_errors Various diagnostics clean ups/tweaks 2021-07-19 08:43:35 -07:00
rustc_expand Rollup merge of #87389 - Aaron1011:expand-known-attrs, r=wesleywiser 2021-07-24 09:51:59 -07:00
rustc_feature Add internal attribute and tests. 2021-07-20 22:14:43 +08:00
rustc_fs_util
rustc_graphviz Use HTTPS links where possible 2021-06-23 16:26:46 -04:00
rustc_hir Auto merge of #86580 - BoxyUwU:cgd-subst-ice, r=nikomatsakis 2021-07-24 20:01:51 +00:00
rustc_hir_pretty Rollup merge of #86358 - klensy:pp-loop, r=Mark-Simulacrum 2021-06-29 00:26:55 +09:00
rustc_incremental Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
rustc_index
rustc_infer Auto merge of #86461 - crlf0710:rich_vtable, r=nikomatsakis 2021-07-24 10:21:23 +00:00
rustc_interface Remove deadlock virtual call. 2021-07-18 11:14:08 +02:00
rustc_lexer Rename 'bad prefix' to 'unknown prefix'. 2021-06-26 23:11:14 +08:00
rustc_lint Auto merge of #87296 - Aaron1011:inert-warn, r=petrochenkov 2021-07-24 13:19:17 +00:00
rustc_lint_defs Auto merge of #87296 - Aaron1011:inert-warn, r=petrochenkov 2021-07-24 13:19:17 +00:00
rustc_llvm Upgrade cc crate to 1.0.69 2021-07-13 17:58:50 +09:00
rustc_macros Move OnDiskCache to rustc_query_impl. 2021-07-18 11:14:07 +02:00
rustc_metadata Remove detection of rustup and cargo in 'missing extern crate' diagnostics 2021-07-24 01:29:42 +00:00
rustc_middle Auto merge of #86580 - BoxyUwU:cgd-subst-ice, r=nikomatsakis 2021-07-24 20:01:51 +00:00
rustc_mir Auto merge of #86461 - crlf0710:rich_vtable, r=nikomatsakis 2021-07-24 10:21:23 +00:00
rustc_mir_build Implement AssignToDroppingUnionField in THIR unsafeck 2021-07-23 15:38:19 +02:00
rustc_parse Auto merge of #87242 - JohnTitor:rollup-t9rmwpo, r=JohnTitor 2021-07-18 08:15:17 +00:00
rustc_parse_format Rework SESSION_GLOBALS API to prevent overwriting it 2021-07-08 16:16:28 +02:00
rustc_passes Allow some temporarily dead code. 2021-07-21 22:57:10 -04:00
rustc_plugin_impl
rustc_privacy Make resolutions a query. 2021-07-06 19:22:27 +02:00
rustc_query_impl Support HIR wf checking for function signatures 2021-07-20 10:58:14 -05:00
rustc_query_system Add docs to new methods 2021-07-07 11:14:14 +02:00
rustc_resolve Compute a better lint_node_id during expansion 2021-07-17 23:03:56 -05:00
rustc_save_analysis rustc_span: Revert addition of proc_macro field to ExpnKind::Macro 2021-07-10 23:03:35 +03:00
rustc_serialize Emit warnings for unused fields in custom targets. 2021-06-17 21:48:02 +02:00
rustc_session Rename known_attrs to expanded_inert_attrs and move to rustc_expand 2021-07-23 17:03:07 -05:00
rustc_span Add internal attribute and tests. 2021-07-20 22:14:43 +08:00
rustc_symbol_mangling Revert "Revert "Merge CrateDisambiguator into StableCrateId"" 2021-07-06 11:28:04 +02:00
rustc_target Add support for powerpc-unknown-freebsd 2021-07-22 17:29:33 +02:00
rustc_trait_selection Auto merge of #86461 - crlf0710:rich_vtable, r=nikomatsakis 2021-07-24 10:21:23 +00:00
rustc_traits Add initial implementation of HIR-based WF checking for diagnostics 2021-07-16 16:29:02 -05:00
rustc_ty_utils Add impl_constness query 2021-07-10 20:54:49 +08:00
rustc_type_ir
rustc_typeck Auto merge of #86580 - BoxyUwU:cgd-subst-ice, r=nikomatsakis 2021-07-24 20:01:51 +00:00