diff options
| author | bors <bors@rust-lang.org> | 2018-10-15 19:50:50 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-10-15 19:50:50 +0000 |
| commit | 46880f41b7aeb897b8245474196bba9dc11f0e88 (patch) | |
| tree | 62fe4510055d0d70dc6ea315af27bf09db4dff3b /src/test | |
| parent | 5a52983d690bfdc0d0343c1db14c2c6b2359df2d (diff) | |
| parent | 562625dda21cbfbce8206c7553991eacd09e714b (diff) | |
| download | rust-46880f41b7aeb897b8245474196bba9dc11f0e88.tar.gz rust-46880f41b7aeb897b8245474196bba9dc11f0e88.zip | |
Auto merge of #55095 - Manishearth:rollup, r=Manishearth
Rollup of 11 pull requests Successful merges: - #54820 (Closes #54538: `unused_patterns` lint) - #54963 (Cleanup rustc/session) - #54991 (add test for #23189) - #55025 (Add missing lifetime fragment specifier to error message.) - #55047 (doc: make core::fmt::Error example more simple) - #55048 (Don't collect to vectors where unnecessary) - #55060 (clarify pointer add/sub function safety concerns) - #55062 (Make EvalContext::step public again) - #55066 (Fix incorrect link in println! documentation) - #55081 (Deduplicate tests) - #55088 (Update rustc documentation link) Failed merges: r? @ghost
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/binding/pat-tuple-7.rs | 1 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-21356.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23189.rs (renamed from src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs) | 14 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-23189.stderr | 9 | ||||
| -rw-r--r-- | src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr | 13 | ||||
| -rw-r--r-- | src/test/ui/lint/issue-54538-unused-parens-lint.rs | 38 | ||||
| -rw-r--r-- | src/test/ui/lint/issue-54538-unused-parens-lint.stderr | 42 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-group-style.rs | 36 | ||||
| -rw-r--r-- | src/test/ui/lint/lint-group-style.stderr | 67 | ||||
| -rw-r--r-- | src/test/ui/macros/macro-invalid-fragment-spec.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr | 2 |
12 files changed, 98 insertions, 141 deletions
diff --git a/src/test/run-pass/binding/pat-tuple-7.rs b/src/test/run-pass/binding/pat-tuple-7.rs index c32b52eac33..06bd14d188e 100644 --- a/src/test/run-pass/binding/pat-tuple-7.rs +++ b/src/test/run-pass/binding/pat-tuple-7.rs @@ -11,6 +11,7 @@ // run-pass fn main() { + #[allow(unused_parens)] match 0 { (pat) => assert_eq!(pat, 0) } diff --git a/src/test/ui/issues/issue-21356.stderr b/src/test/ui/issues/issue-21356.stderr index 5787476c2f2..924767fb5e1 100644 --- a/src/test/ui/issues/issue-21356.stderr +++ b/src/test/ui/issues/issue-21356.stderr @@ -4,7 +4,7 @@ error: invalid fragment specifier `t_ty` LL | macro_rules! test { ($wrong:t_ty ..) => () } | ^^^^^^^^^^^ | - = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis` + = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` error: aborting due to previous error diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs b/src/test/ui/issues/issue-23189.rs index 78e6dc2d3e7..7a475d1a6ab 100644 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.rs +++ b/src/test/ui/issues/issue-23189.rs @@ -1,4 +1,4 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // @@ -7,13 +7,9 @@ // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. -struct Ref<'a, 'b> { - a: &'a u32, - b: &'b u32, -} -fn foo(mut x: Ref) { - x.a = x.b; //~ ERROR lifetime mismatch -} +mod module {} -fn main() {} +fn main() { + let _ = module { x: 0 }; //~ERROR expected struct +} diff --git a/src/test/ui/issues/issue-23189.stderr b/src/test/ui/issues/issue-23189.stderr new file mode 100644 index 00000000000..c7bbab4524d --- /dev/null +++ b/src/test/ui/issues/issue-23189.stderr @@ -0,0 +1,9 @@ +error[E0574]: expected struct, variant or union type, found module `module` + --> $DIR/issue-23189.rs:14:13 + | +LL | let _ = module { x: 0 }; //~ERROR expected struct + | ^^^^^^ not a struct, variant or union type + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0574`. diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr deleted file mode 100644 index 4f0efe24cf7..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.nll.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error: unsatisfied lifetime constraints - --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:5 - | -LL | fn foo(mut x: Ref) { - | ----- - | | - | has type `Ref<'_, '1>` - | has type `Ref<'2, '_>` -LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^^^^^^^ assignment requires that `'1` must outlive `'2` - -error: aborting due to previous error - diff --git a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr b/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr deleted file mode 100644 index ccc5e02ab70..00000000000 --- a/src/test/ui/lifetimes/lifetime-errors/ex3-both-anon-regions-both-are-structs-4.stderr +++ /dev/null @@ -1,13 +0,0 @@ -error[E0623]: lifetime mismatch - --> $DIR/ex3-both-anon-regions-both-are-structs-4.rs:16:11 - | -LL | fn foo(mut x: Ref) { - | --- - | | - | this type is declared with multiple lifetimes... -LL | x.a = x.b; //~ ERROR lifetime mismatch - | ^^^ ...but data with one lifetime flows into the other here - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0623`. diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.rs b/src/test/ui/lint/issue-54538-unused-parens-lint.rs new file mode 100644 index 00000000000..97a2dd59a62 --- /dev/null +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.rs @@ -0,0 +1,38 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or +// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license +// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-pass + +#![allow(unreachable_patterns)] +#![allow(unused_variables)] +#![warn(unused_parens)] + +fn main() { + match 1 { + (_) => {} //~ WARNING: unnecessary parentheses around pattern + (y) => {} //~ WARNING: unnecessary parentheses around pattern + (ref r) => {} //~ WARNING: unnecessary parentheses around pattern + (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern + (1..=2) => {} // Non ambiguous range pattern should not warn + e @ (3..=4) => {} // Non ambiguous range pattern should not warn + } + + match &1 { + (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern + &(_) => {} //~ WARNING: unnecessary parentheses around pattern + e @ &(1...2) => {} // Ambiguous range pattern should not warn + &(1..=2) => {} // Ambiguous range pattern should not warn + } + + match &1 { + e @ &(1...2) | e @ &(3..=4) => {} // Complex ambiguous pattern should not warn + &_ => {} + } +} diff --git a/src/test/ui/lint/issue-54538-unused-parens-lint.stderr b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr new file mode 100644 index 00000000000..b76b969fd2b --- /dev/null +++ b/src/test/ui/lint/issue-54538-unused-parens-lint.stderr @@ -0,0 +1,42 @@ +warning: unnecessary parentheses around pattern + --> $DIR/issue-54538-unused-parens-lint.rs:19:9 + | +LL | (_) => {} //~ WARNING: unnecessary parentheses around pattern + | ^^^ help: remove these parentheses + | +note: lint level defined here + --> $DIR/issue-54538-unused-parens-lint.rs:15:9 + | +LL | #![warn(unused_parens)] + | ^^^^^^^^^^^^^ + +warning: unnecessary parentheses around pattern + --> $DIR/issue-54538-unused-parens-lint.rs:20:9 + | +LL | (y) => {} //~ WARNING: unnecessary parentheses around pattern + | ^^^ help: remove these parentheses + +warning: unnecessary parentheses around pattern + --> $DIR/issue-54538-unused-parens-lint.rs:21:9 + | +LL | (ref r) => {} //~ WARNING: unnecessary parentheses around pattern + | ^^^^^^^ help: remove these parentheses + +warning: unnecessary parentheses around pattern + --> $DIR/issue-54538-unused-parens-lint.rs:22:9 + | +LL | (e @ 1..=2) => {} //~ WARNING: unnecessary parentheses around outer pattern + | ^^^^^^^^^^^ help: remove these parentheses + +warning: unnecessary parentheses around pattern + --> $DIR/issue-54538-unused-parens-lint.rs:28:9 + | +LL | (e @ &(1...2)) => {} //~ WARNING: unnecessary parentheses around outer pattern + | ^^^^^^^^^^^^^^ help: remove these parentheses + +warning: unnecessary parentheses around pattern + --> $DIR/issue-54538-unused-parens-lint.rs:29:10 + | +LL | &(_) => {} //~ WARNING: unnecessary parentheses around pattern + | ^^^ help: remove these parentheses + diff --git a/src/test/ui/lint/lint-group-style.rs b/src/test/ui/lint/lint-group-style.rs deleted file mode 100644 index 55d6168e6e0..00000000000 --- a/src/test/ui/lint/lint-group-style.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014–2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or -// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license -// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![deny(nonstandard_style)] -#![allow(dead_code)] - -fn CamelCase() {} //~ ERROR should have a snake - -#[allow(nonstandard_style)] -mod test { - fn CamelCase() {} - - #[forbid(nonstandard_style)] - mod bad { - fn CamelCase() {} //~ ERROR should have a snake - - static bad: isize = 1; //~ ERROR should have an upper - } - - mod warn { - #![warn(nonstandard_style)] - - fn CamelCase() {} //~ WARN should have a snake - - struct snake_case; //~ WARN should have a camel - } -} - -fn main() {} diff --git a/src/test/ui/lint/lint-group-style.stderr b/src/test/ui/lint/lint-group-style.stderr deleted file mode 100644 index 6b91ce5b93c..00000000000 --- a/src/test/ui/lint/lint-group-style.stderr +++ /dev/null @@ -1,67 +0,0 @@ -error: function `CamelCase` should have a snake case name such as `camel_case` - --> $DIR/lint-group-style.rs:14:1 - | -LL | fn CamelCase() {} //~ ERROR should have a snake - | ^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-group-style.rs:11:9 - | -LL | #![deny(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ - = note: #[deny(non_snake_case)] implied by #[deny(nonstandard_style)] - -error: function `CamelCase` should have a snake case name such as `camel_case` - --> $DIR/lint-group-style.rs:22:9 - | -LL | fn CamelCase() {} //~ ERROR should have a snake - | ^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-group-style.rs:20:14 - | -LL | #[forbid(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ - = note: #[forbid(non_snake_case)] implied by #[forbid(nonstandard_style)] - -error: static variable `bad` should have an upper case name such as `BAD` - --> $DIR/lint-group-style.rs:24:9 - | -LL | static bad: isize = 1; //~ ERROR should have an upper - | ^^^^^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-group-style.rs:20:14 - | -LL | #[forbid(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ - = note: #[forbid(non_upper_case_globals)] implied by #[forbid(nonstandard_style)] - -warning: function `CamelCase` should have a snake case name such as `camel_case` - --> $DIR/lint-group-style.rs:30:9 - | -LL | fn CamelCase() {} //~ WARN should have a snake - | ^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-group-style.rs:28:17 - | -LL | #![warn(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ - = note: #[warn(non_snake_case)] implied by #[warn(nonstandard_style)] - -warning: type `snake_case` should have a camel case name such as `SnakeCase` - --> $DIR/lint-group-style.rs:32:9 - | -LL | struct snake_case; //~ WARN should have a camel - | ^^^^^^^^^^^^^^^^^^ - | -note: lint level defined here - --> $DIR/lint-group-style.rs:28:17 - | -LL | #![warn(nonstandard_style)] - | ^^^^^^^^^^^^^^^^^ - = note: #[warn(non_camel_case_types)] implied by #[warn(nonstandard_style)] - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/macros/macro-invalid-fragment-spec.stderr b/src/test/ui/macros/macro-invalid-fragment-spec.stderr index 765621f51d4..e683d47cf54 100644 --- a/src/test/ui/macros/macro-invalid-fragment-spec.stderr +++ b/src/test/ui/macros/macro-invalid-fragment-spec.stderr @@ -4,7 +4,7 @@ error: invalid fragment specifier `foo` LL | ($x:foo) => () | ^^^^^^ | - = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis` + = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` error: aborting due to previous error diff --git a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr index 88435878905..20b1ae690ec 100644 --- a/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr +++ b/src/test/ui/unused/unused-macro-with-bad-frag-spec.stderr @@ -4,7 +4,7 @@ error: invalid fragment specifier `t_ty` LL | ($wrong:t_ty) => () //~ ERROR invalid fragment specifier `t_ty` | ^^^^^^^^^^^ | - = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `literal`, `path`, `meta`, `tt`, `item` and `vis` + = help: valid fragment specifiers are `ident`, `block`, `stmt`, `expr`, `pat`, `ty`, `lifetime`, `literal`, `path`, `meta`, `tt`, `item` and `vis` error: aborting due to previous error |
