Skip to content

Commit 1b679fd

Browse files
JulianKnodtvarkor
authored andcommittedDec 30, 2020
Add has_default to GenericParamDefKind::Const
This currently creates a field which is always false on GenericParamDefKind for future use when consts are permitted to have defaults Update const_generics:default locations Previously just ignored them, now actually do something about them. Fix using type check instead of value Add parsing This adds all the necessary changes to lower const-generics defaults from parsing. Change P<Expr> to AnonConst This matches the arguments passed to instantiations of const generics, and makes it specific to just anonymous constants. Attempt to fix lowering bugs
1 parent d107a87 commit 1b679fd

File tree

48 files changed

+220
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+220
-92
lines changed
 

‎compiler/rustc_ast/src/ast.rs

+1
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,7 @@ pub enum GenericParamKind {
368368
ty: P<Ty>,
369369
/// Span of the `const` keyword.
370370
kw_span: Span,
371+
default: Option<AnonConst>,
371372
},
372373
}
373374

‎compiler/rustc_ast/src/mut_visit.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,8 @@ pub fn noop_flat_map_generic_param<T: MutVisitor>(
790790
GenericParamKind::Type { default } => {
791791
visit_opt(default, |default| vis.visit_ty(default));
792792
}
793-
GenericParamKind::Const { ty, kw_span: _ } => {
793+
GenericParamKind::Const { ty, kw_span: _, default } => {
794+
visit_opt(default, |default| vis.visit_anon_const(default));
794795
vis.visit_ty(ty);
795796
}
796797
}

0 commit comments

Comments
 (0)