-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A bunch of nits fixed, and a new test for pretty printing the AST.
- Loading branch information
1 parent
9fe793a
commit ea2af70
Showing
11 changed files
with
69 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// run-pass | ||
#![feature(staged_api)] | ||
|
||
#![feature(const_generics)] | ||
#![feature(const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
|
||
#![stable(feature = "const_default_test", since="none")] | ||
|
||
|
||
#[unstable(feature = "const_default_stable", issue="none")] | ||
pub struct ConstDefaultUnstable<const N: usize = 3>; | ||
|
||
#[stable(feature = "const_default_unstable", since="none")] | ||
pub struct ConstDefaultStable<const N: usize = { | ||
#[stable(feature = "const_default_unstable_val", since="none")] | ||
3 | ||
}>; | ||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/const-generics/defaults/pretty-printing-ast.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Test the AST pretty printer correctly handles default values for const generics | ||
// check-pass | ||
// compile-flags: -Z unpretty=expanded | ||
|
||
#![crate_type = "lib"] | ||
#![feature(const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
|
||
trait Foo<const KIND: bool = true> {} | ||
|
||
fn foo<const SIZE: usize = 5>() {} | ||
|
||
struct Range<const FROM: usize = 0, const LEN: usize = 0, const TO: usize = {FROM + LEN}>; |
20 changes: 20 additions & 0 deletions
20
src/test/ui/const-generics/defaults/pretty-printing-ast.stdout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#![feature(prelude_import)] | ||
#![no_std] | ||
// Test the AST pretty printer correctly handles default values for const generics | ||
// check-pass | ||
// compile-flags: -Z unpretty=expanded | ||
|
||
#![crate_type = "lib"] | ||
#![feature(const_generics_defaults)] | ||
#![allow(incomplete_features)] | ||
#[prelude_import] | ||
use ::std::prelude::rust_2015::*; | ||
#[macro_use] | ||
extern crate std; | ||
|
||
trait Foo<const KIND : bool = true> { } | ||
|
||
fn foo<const SIZE : usize = 5>() { } | ||
|
||
struct Range<const FROM : usize = 0, const LEN : usize = 0, const TO : usize = | ||
{ FROM + LEN }>; |