Expand const-if-const trait bounds correctly
This commit is contained in:
parent
e1eaa2d5d4
commit
56bf28d4f4
4 changed files with 23 additions and 5 deletions
|
@ -1567,8 +1567,18 @@ impl<'a> State<'a> {
|
||||||
|
|
||||||
match bound {
|
match bound {
|
||||||
GenericBound::Trait(tref, modifier) => {
|
GenericBound::Trait(tref, modifier) => {
|
||||||
if modifier == &TraitBoundModifier::Maybe {
|
match modifier {
|
||||||
self.word("?");
|
TraitBoundModifier::None => {}
|
||||||
|
TraitBoundModifier::Maybe => {
|
||||||
|
self.word("?");
|
||||||
|
}
|
||||||
|
TraitBoundModifier::MaybeConst => {
|
||||||
|
self.word_space("~const");
|
||||||
|
}
|
||||||
|
TraitBoundModifier::MaybeConstMaybe => {
|
||||||
|
self.word_space("~const");
|
||||||
|
self.word("?");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self.print_poly_trait_ref(tref);
|
self.print_poly_trait_ref(tref);
|
||||||
}
|
}
|
||||||
|
|
|
@ -626,7 +626,7 @@ fn test_item() {
|
||||||
stringify_item!(
|
stringify_item!(
|
||||||
impl ~const Struct {}
|
impl ~const Struct {}
|
||||||
),
|
),
|
||||||
"impl Struct {}", // FIXME
|
"impl ~const Struct {}",
|
||||||
);
|
);
|
||||||
|
|
||||||
// ItemKind::MacCall
|
// ItemKind::MacCall
|
||||||
|
@ -838,7 +838,7 @@ fn test_ty() {
|
||||||
assert_eq!(stringify_ty!(dyn Send + 'a), "dyn Send + 'a");
|
assert_eq!(stringify_ty!(dyn Send + 'a), "dyn Send + 'a");
|
||||||
assert_eq!(stringify_ty!(dyn 'a + Send), "dyn 'a + Send");
|
assert_eq!(stringify_ty!(dyn 'a + Send), "dyn 'a + Send");
|
||||||
assert_eq!(stringify_ty!(dyn ?Sized), "dyn ?Sized");
|
assert_eq!(stringify_ty!(dyn ?Sized), "dyn ?Sized");
|
||||||
assert_eq!(stringify_ty!(dyn ~const Clone), "dyn Clone"); // FIXME
|
assert_eq!(stringify_ty!(dyn ~const Clone), "dyn ~const Clone");
|
||||||
assert_eq!(stringify_ty!(dyn for<'a> Send), "dyn for<'a> Send");
|
assert_eq!(stringify_ty!(dyn for<'a> Send), "dyn for<'a> Send");
|
||||||
|
|
||||||
// TyKind::ImplTrait
|
// TyKind::ImplTrait
|
||||||
|
@ -846,7 +846,7 @@ fn test_ty() {
|
||||||
assert_eq!(stringify_ty!(impl Send + 'a), "impl Send + 'a");
|
assert_eq!(stringify_ty!(impl Send + 'a), "impl Send + 'a");
|
||||||
assert_eq!(stringify_ty!(impl 'a + Send), "impl 'a + Send");
|
assert_eq!(stringify_ty!(impl 'a + Send), "impl 'a + Send");
|
||||||
assert_eq!(stringify_ty!(impl ?Sized), "impl ?Sized");
|
assert_eq!(stringify_ty!(impl ?Sized), "impl ?Sized");
|
||||||
assert_eq!(stringify_ty!(impl ~const Clone), "impl Clone"); // FIXME
|
assert_eq!(stringify_ty!(impl ~const Clone), "impl ~const Clone");
|
||||||
assert_eq!(stringify_ty!(impl for<'a> Send), "impl for<'a> Send");
|
assert_eq!(stringify_ty!(impl for<'a> Send), "impl for<'a> Send");
|
||||||
|
|
||||||
// TyKind::Paren
|
// TyKind::Paren
|
||||||
|
|
4
tests/ui/unpretty/ast-const-trait-bound.rs
Normal file
4
tests/ui/unpretty/ast-const-trait-bound.rs
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
// compile-flags: -Zunpretty=normal
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
fn foo() where T: ~const Bar {}
|
4
tests/ui/unpretty/ast-const-trait-bound.stdout
Normal file
4
tests/ui/unpretty/ast-const-trait-bound.stdout
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
// compile-flags: -Zunpretty=normal
|
||||||
|
// check-pass
|
||||||
|
|
||||||
|
fn foo() where T: ~const Bar {}
|
Loading…
Add table
Reference in a new issue