diff options
| author | bors <bors@rust-lang.org> | 2019-02-14 10:32:25 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-02-14 10:32:25 +0000 |
| commit | f47ec2ad5b6887b3d400aee49e2294bd27733d18 (patch) | |
| tree | 8888f8d17504ecad6033bd1992efeb9e04145f93 /src/test | |
| parent | c67d4749a547a0c937e257ad9e0248075178ddc4 (diff) | |
| parent | 410b4456ca52b6e90259d4aaf04376d862ad36d3 (diff) | |
| download | rust-f47ec2ad5b6887b3d400aee49e2294bd27733d18.tar.gz rust-f47ec2ad5b6887b3d400aee49e2294bd27733d18.zip | |
Auto merge of #58455 - Centril:rollup, r=Centril
Rollup of 7 pull requests Successful merges: - #58309 (Add more profiler events) - #58347 (Closure bounds fixes) - #58365 (Add an option to print the status of incremental tasks / dep nodes after running them) - #58371 (Check user type annotations for range patterns.) - #58378 (rustc: Implement incremental "fat" LTO) - #58407 (specify "upper camel case" in style lint) - #58449 (Notify @topecongiro when the state of rustfmt has changed) Failed merges: r? @ghost
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/incremental/lto.rs | 40 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-group-nonstandard-style.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-group-nonstandard-style.stderr | 6 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-non-camel-case-types.rs | 24 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-non-camel-case-types.stderr | 66 | ||||
| -rw-r--r-- | src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs | 40 | ||||
| -rw-r--r-- | src/test/ui/nll/issue-58299.rs | 30 | ||||
| -rw-r--r-- | src/test/ui/nll/issue-58299.stderr | 20 | ||||
| -rw-r--r-- | src/test/ui/utf8_idents.rs | 4 | ||||
| -rw-r--r-- | src/test/ui/utf8_idents.stderr | 14 |
10 files changed, 174 insertions, 72 deletions
diff --git a/src/test/incremental/lto.rs b/src/test/incremental/lto.rs new file mode 100644 index 00000000000..2a3e3c2467c --- /dev/null +++ b/src/test/incremental/lto.rs @@ -0,0 +1,40 @@ +// no-prefer-dynamic +// revisions:rpass1 rpass2 +// compile-flags: -C lto + +mod x { + pub struct X { + x: u32, y: u32, + } + + #[cfg(rpass1)] + fn make() -> X { + X { x: 22, y: 0 } + } + + #[cfg(rpass2)] + fn make() -> X { + X { x: 11, y: 11 } + } + + pub fn new() -> X { + make() + } + + pub fn sum(x: &X) -> u32 { + x.x + x.y + } +} + +mod y { + use x; + + pub fn assert_sum() -> bool { + let x = x::new(); + x::sum(&x) == 22 + } +} + +pub fn main() { + y::assert_sum(); +} diff --git a/src/test/ui/lint/lint-group-nonstandard-style.rs b/src/test/ui/lint/lint-group-nonstandard-style.rs index 0386daaa59b..bd7f327bc0f 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.rs +++ b/src/test/ui/lint/lint-group-nonstandard-style.rs @@ -19,7 +19,7 @@ mod test { fn CamelCase() {} //~ WARN should have a snake - struct snake_case; //~ WARN should have a camel + struct snake_case; //~ WARN should have an upper camel } } diff --git a/src/test/ui/lint/lint-group-nonstandard-style.stderr b/src/test/ui/lint/lint-group-nonstandard-style.stderr index f3c7d70054b..ab36cda57ec 100644 --- a/src/test/ui/lint/lint-group-nonstandard-style.stderr +++ b/src/test/ui/lint/lint-group-nonstandard-style.stderr @@ -1,8 +1,8 @@ -warning: type `snake_case` should have a camel case name +warning: type `snake_case` should have an upper camel case name --> $DIR/lint-group-nonstandard-style.rs:22:16 | -LL | struct snake_case; //~ WARN should have a camel - | ^^^^^^^^^^ help: convert the identifier to camel case: `SnakeCase` +LL | struct snake_case; //~ WARN should have an upper camel + | ^^^^^^^^^^ help: convert the identifier to upper camel case: `SnakeCase` | note: lint level defined here --> $DIR/lint-group-nonstandard-style.rs:18:17 diff --git a/src/test/ui/lint/lint-non-camel-case-types.rs b/src/test/ui/lint/lint-non-camel-case-types.rs index bca1992605b..d3b119a9441 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.rs +++ b/src/test/ui/lint/lint-non-camel-case-types.rs @@ -2,43 +2,35 @@ #![allow(dead_code)] struct ONE_TWO_THREE; -//~^ ERROR type `ONE_TWO_THREE` should have a camel case name +//~^ ERROR type `ONE_TWO_THREE` should have an upper camel case name -struct foo { //~ ERROR type `foo` should have a camel case name +struct foo { //~ ERROR type `foo` should have an upper camel case name bar: isize, } -enum foo2 { //~ ERROR type `foo2` should have a camel case name +enum foo2 { //~ ERROR type `foo2` should have an upper camel case name Bar } -struct foo3 { //~ ERROR type `foo3` should have a camel case name +struct foo3 { //~ ERROR type `foo3` should have an upper camel case name bar: isize } -type foo4 = isize; //~ ERROR type `foo4` should have a camel case name +type foo4 = isize; //~ ERROR type `foo4` should have an upper camel case name enum Foo5 { - bar //~ ERROR variant `bar` should have a camel case name + bar //~ ERROR variant `bar` should have an upper camel case name } -trait foo6 { //~ ERROR trait `foo6` should have a camel case name +trait foo6 { //~ ERROR trait `foo6` should have an upper camel case name fn dummy(&self) { } } -fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name +fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have an upper camel case name #[repr(C)] struct foo7 { bar: isize, } -struct X86_64; - -struct X86__64; //~ ERROR type `X86__64` should have a camel case name - -struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name - -struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name - fn main() { } diff --git a/src/test/ui/lint/lint-non-camel-case-types.stderr b/src/test/ui/lint/lint-non-camel-case-types.stderr index 74f9a5993b8..7afacf64d87 100644 --- a/src/test/ui/lint/lint-non-camel-case-types.stderr +++ b/src/test/ui/lint/lint-non-camel-case-types.stderr @@ -1,8 +1,8 @@ -error: type `ONE_TWO_THREE` should have a camel case name +error: type `ONE_TWO_THREE` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:4:8 | LL | struct ONE_TWO_THREE; - | ^^^^^^^^^^^^^ help: convert the identifier to camel case: `OneTwoThree` + | ^^^^^^^^^^^^^ help: convert the identifier to upper camel case: `OneTwoThree` | note: lint level defined here --> $DIR/lint-non-camel-case-types.rs:1:11 @@ -10,65 +10,47 @@ note: lint level defined here LL | #![forbid(non_camel_case_types)] | ^^^^^^^^^^^^^^^^^^^^ -error: type `foo` should have a camel case name +error: type `foo` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:7:8 | -LL | struct foo { //~ ERROR type `foo` should have a camel case name - | ^^^ help: convert the identifier to camel case: `Foo` +LL | struct foo { //~ ERROR type `foo` should have an upper camel case name + | ^^^ help: convert the identifier to upper camel case: `Foo` -error: type `foo2` should have a camel case name +error: type `foo2` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:11:6 | -LL | enum foo2 { //~ ERROR type `foo2` should have a camel case name - | ^^^^ help: convert the identifier to camel case: `Foo2` +LL | enum foo2 { //~ ERROR type `foo2` should have an upper camel case name + | ^^^^ help: convert the identifier to upper camel case: `Foo2` -error: type `foo3` should have a camel case name +error: type `foo3` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:15:8 | -LL | struct foo3 { //~ ERROR type `foo3` should have a camel case name - | ^^^^ help: convert the identifier to camel case: `Foo3` +LL | struct foo3 { //~ ERROR type `foo3` should have an upper camel case name + | ^^^^ help: convert the identifier to upper camel case: `Foo3` -error: type `foo4` should have a camel case name +error: type `foo4` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:19:6 | -LL | type foo4 = isize; //~ ERROR type `foo4` should have a camel case name - | ^^^^ help: convert the identifier to camel case: `Foo4` +LL | type foo4 = isize; //~ ERROR type `foo4` should have an upper camel case name + | ^^^^ help: convert the identifier to upper camel case: `Foo4` -error: variant `bar` should have a camel case name +error: variant `bar` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:22:5 | -LL | bar //~ ERROR variant `bar` should have a camel case name - | ^^^ help: convert the identifier to camel case: `Bar` +LL | bar //~ ERROR variant `bar` should have an upper camel case name + | ^^^ help: convert the identifier to upper camel case: `Bar` -error: trait `foo6` should have a camel case name +error: trait `foo6` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:25:7 | -LL | trait foo6 { //~ ERROR trait `foo6` should have a camel case name - | ^^^^ help: convert the identifier to camel case: `Foo6` +LL | trait foo6 { //~ ERROR trait `foo6` should have an upper camel case name + | ^^^^ help: convert the identifier to upper camel case: `Foo6` -error: type parameter `ty` should have a camel case name +error: type parameter `ty` should have an upper camel case name --> $DIR/lint-non-camel-case-types.rs:29:6 | -LL | fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have a camel case name - | ^^ help: convert the identifier to camel case: `Ty` +LL | fn f<ty>(_: ty) {} //~ ERROR type parameter `ty` should have an upper camel case name + | ^^ help: convert the identifier to upper camel case: `Ty` -error: type `X86__64` should have a camel case name - --> $DIR/lint-non-camel-case-types.rs:38:8 - | -LL | struct X86__64; //~ ERROR type `X86__64` should have a camel case name - | ^^^^^^^ help: convert the identifier to camel case: `X86_64` - -error: type `Abc_123` should have a camel case name - --> $DIR/lint-non-camel-case-types.rs:40:8 - | -LL | struct Abc_123; //~ ERROR type `Abc_123` should have a camel case name - | ^^^^^^^ help: convert the identifier to camel case: `Abc123` - -error: type `A1_b2_c3` should have a camel case name - --> $DIR/lint-non-camel-case-types.rs:42:8 - | -LL | struct A1_b2_c3; //~ ERROR type `A1_b2_c3` should have a camel case name - | ^^^^^^^^ help: convert the identifier to camel case: `A1B2C3` - -error: aborting due to 11 previous errors +error: aborting due to 8 previous errors diff --git a/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs b/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs new file mode 100644 index 00000000000..71d5d4053ee --- /dev/null +++ b/src/test/ui/nll/closure-requirements/issue-58127-mutliple-requirements.rs @@ -0,0 +1,40 @@ +// revisions: migrate nll +//[migrate]compile-flags: -Z borrowck=migrate +#![cfg_attr(nll, feature(nll))] + +// compile-pass + +// Test that we propagate region relations from closures precisely when there is +// more than one non-local lower bound. + +// In this case the closure has signature +// |x: &'4 mut (&'5 (&'1 str, &'2 str), &'3 str)| -> .. +// We end up with a `'3: '5` constraint that we can propagate as +// `'3: '1`, `'3: '2`, but previously we approximated it as `'3: 'static`. + +// As an optimization, we primarily propagate bounds for the "representative" +// of each SCC. As such we have these two similar cases where hopefully one +// of them will test the case we want (case2, when this test was added). +mod case1 { + fn f(s: &str) { + g(s, |x| h(x)); + } + + fn g<T, F>(_: T, _: F) + where F: Fn(&mut (&(T, T), T)) {} + + fn h<T>(_: &mut (&(T, T), T)) {} +} + +mod case2 { + fn f(s: &str) { + g(s, |x| h(x)); + } + + fn g<T, F>(_: T, _: F) + where F: Fn(&mut (T, &(T, T))) {} + + fn h<T>(_: &mut (T, &(T, T))) {} +} + +fn main() {} diff --git a/src/test/ui/nll/issue-58299.rs b/src/test/ui/nll/issue-58299.rs new file mode 100644 index 00000000000..9267cac5dd3 --- /dev/null +++ b/src/test/ui/nll/issue-58299.rs @@ -0,0 +1,30 @@ +#![allow(dead_code)] +#![feature(nll)] + +struct A<'a>(&'a ()); + +trait Y { + const X: i32; +} + +impl Y for A<'static> { + const X: i32 = 10; +} + +fn foo<'a>(x: i32) { + match x { + // This uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`. + A::<'a>::X..=A::<'static>::X => (), //~ ERROR lifetime may not live long enough + _ => (), + } +} + +fn bar<'a>(x: i32) { + match x { + // This uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`. + A::<'static>::X..=A::<'a>::X => (), //~ ERROR lifetime may not live long enough + _ => (), + } +} + +fn main() {} diff --git a/src/test/ui/nll/issue-58299.stderr b/src/test/ui/nll/issue-58299.stderr new file mode 100644 index 00000000000..b87d0de51a3 --- /dev/null +++ b/src/test/ui/nll/issue-58299.stderr @@ -0,0 +1,20 @@ +error: lifetime may not live long enough + --> $DIR/issue-58299.rs:17:9 + | +LL | fn foo<'a>(x: i32) { + | -- lifetime `'a` defined here +... +LL | A::<'a>::X..=A::<'static>::X => (), //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: lifetime may not live long enough + --> $DIR/issue-58299.rs:25:27 + | +LL | fn bar<'a>(x: i32) { + | -- lifetime `'a` defined here +... +LL | A::<'static>::X..=A::<'a>::X => (), //~ ERROR lifetime may not live long enough + | ^^^^^^^^^^ requires that `'a` must outlive `'static` + +error: aborting due to 2 previous errors + diff --git a/src/test/ui/utf8_idents.rs b/src/test/ui/utf8_idents.rs index e601c6e4555..f59d5502aae 100644 --- a/src/test/ui/utf8_idents.rs +++ b/src/test/ui/utf8_idents.rs @@ -1,9 +1,7 @@ -// - fn foo< 'β, //~ ERROR non-ascii idents are not fully supported γ //~ ERROR non-ascii idents are not fully supported - //~^ WARN type parameter `γ` should have a camel case name + //~^ WARN type parameter `γ` should have an upper camel case name >() {} struct X { diff --git a/src/test/ui/utf8_idents.stderr b/src/test/ui/utf8_idents.stderr index 268dd99d060..52fb607af5b 100644 --- a/src/test/ui/utf8_idents.stderr +++ b/src/test/ui/utf8_idents.stderr @@ -1,5 +1,5 @@ error[E0658]: non-ascii idents are not fully supported. (see issue #55467) - --> $DIR/utf8_idents.rs:4:5 + --> $DIR/utf8_idents.rs:2:5 | LL | 'β, //~ ERROR non-ascii idents are not fully supported | ^^ @@ -7,7 +7,7 @@ LL | 'β, //~ ERROR non-ascii idents are not fully supported = help: add #![feature(non_ascii_idents)] to the crate attributes to enable error[E0658]: non-ascii idents are not fully supported. (see issue #55467) - --> $DIR/utf8_idents.rs:5:5 + --> $DIR/utf8_idents.rs:3:5 | LL | γ //~ ERROR non-ascii idents are not fully supported | ^ @@ -15,7 +15,7 @@ LL | γ //~ ERROR non-ascii idents are not fully supported = help: add #![feature(non_ascii_idents)] to the crate attributes to enable error[E0658]: non-ascii idents are not fully supported. (see issue #55467) - --> $DIR/utf8_idents.rs:10:5 + --> $DIR/utf8_idents.rs:8:5 | LL | δ: usize //~ ERROR non-ascii idents are not fully supported | ^ @@ -23,18 +23,18 @@ LL | δ: usize //~ ERROR non-ascii idents are not fully supported = help: add #![feature(non_ascii_idents)] to the crate attributes to enable error[E0658]: non-ascii idents are not fully supported. (see issue #55467) - --> $DIR/utf8_idents.rs:14:9 + --> $DIR/utf8_idents.rs:12:9 | LL | let α = 0.00001f64; //~ ERROR non-ascii idents are not fully supported | ^ | = help: add #![feature(non_ascii_idents)] to the crate attributes to enable -warning: type parameter `γ` should have a camel case name - --> $DIR/utf8_idents.rs:5:5 +warning: type parameter `γ` should have an upper camel case name + --> $DIR/utf8_idents.rs:3:5 | LL | γ //~ ERROR non-ascii idents are not fully supported - | ^ help: convert the identifier to camel case: `Γ` + | ^ help: convert the identifier to upper camel case: `Γ` | = note: #[warn(non_camel_case_types)] on by default |
