diff options
| author | bors <bors@rust-lang.org> | 2019-12-13 03:22:20 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-12-13 03:22:20 +0000 |
| commit | cf7e019b42cd523d91cb350ab49acbda1b11e571 (patch) | |
| tree | 72dbc966b84267daf162c1bbfb59e0dc00bb4afb /src/test/ui | |
| parent | 3eeb8d4f2fbae0bb1c587d00b5abeaf938da47f4 (diff) | |
| parent | d25197c52d7a1b2e1f06061e0f1b274812c25a30 (diff) | |
Auto merge of #67271 - Centril:rollup-i71iqkv, r=Centril
Rollup of 6 pull requests Successful merges: - #66341 (Match `VecDeque::extend` to `Vec::extend_desugared`) - #67243 (LinkedList: drop remaining items when drop panics) - #67247 (Don't suggest wrong snippet in closure) - #67250 (Remove the `DelimSpan` from `NamedMatch::MatchedSeq`.) - #67251 (Require `allow_internal_unstable` for stable min_const_fn using unsta…) - #67269 (parser: recover on `&'lifetime mut? $pat`.) Failed merges: r? @ghost
Diffstat (limited to 'src/test/ui')
15 files changed, 105 insertions, 30 deletions
diff --git a/src/test/ui/consts/const-mut-refs/const_mut_refs.rs b/src/test/ui/consts/const-mut-refs/const_mut_refs.rs index 99006a20b1b..33abfec02a8 100644 --- a/src/test/ui/consts/const-mut-refs/const_mut_refs.rs +++ b/src/test/ui/consts/const-mut-refs/const_mut_refs.rs @@ -1,6 +1,7 @@ // run-pass #![feature(const_mut_refs)] +#![feature(const_fn)] struct Foo { x: usize diff --git a/src/test/ui/consts/control-flow/basics.rs b/src/test/ui/consts/control-flow/basics.rs index 8bd1929956f..b9ff0409158 100644 --- a/src/test/ui/consts/control-flow/basics.rs +++ b/src/test/ui/consts/control-flow/basics.rs @@ -4,6 +4,7 @@ #![feature(const_panic)] #![feature(const_if_match)] +#![feature(const_fn)] const X: u32 = 4; const Y: u32 = 5; diff --git a/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs b/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs index 6bbbdd972a2..7887fd12e57 100644 --- a/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs +++ b/src/test/ui/consts/control-flow/exhaustive-c-like-enum-match.rs @@ -3,6 +3,7 @@ // check-pass #![feature(const_if_match)] +#![feature(const_fn)] enum E { A, diff --git a/src/test/ui/consts/control-flow/feature-gate-const-if-match.if_match.stderr b/src/test/ui/consts/control-flow/feature-gate-const-if-match.if_match.stderr index 21e3f2af15a..95096723b3c 100644 --- a/src/test/ui/consts/control-flow/feature-gate-const-if-match.if_match.stderr +++ b/src/test/ui/consts/control-flow/feature-gate-const-if-match.if_match.stderr @@ -1,5 +1,5 @@ error: fatal error triggered by #[rustc_error] - --> $DIR/feature-gate-const-if-match.rs:108:1 + --> $DIR/feature-gate-const-if-match.rs:109:1 | LL | / fn main() { LL | | let _ = [0; { diff --git a/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs b/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs index 00576d50ac6..e4b65257531 100644 --- a/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs +++ b/src/test/ui/consts/control-flow/feature-gate-const-if-match.rs @@ -6,6 +6,7 @@ #![feature(rustc_attrs)] #![cfg_attr(if_match, feature(const_if_match))] +#![feature(const_fn)] const _: i32 = if true { //[stock]~ ERROR `if` is not allowed in a `const` 5 diff --git a/src/test/ui/consts/control-flow/feature-gate-const-if-match.stock.stderr b/src/test/ui/consts/control-flow/feature-gate-const-if-match.stock.stderr index d3c6a51923f..e846ee4ab6a 100644 --- a/src/test/ui/consts/control-flow/feature-gate-const-if-match.stock.stderr +++ b/src/test/ui/consts/control-flow/feature-gate-const-if-match.stock.stderr @@ -1,5 +1,5 @@ error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:10:16 + --> $DIR/feature-gate-const-if-match.rs:11:16 | LL | const _: i32 = if true { | ________________^ @@ -13,7 +13,7 @@ LL | | }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:16:16 + --> $DIR/feature-gate-const-if-match.rs:17:16 | LL | const _: i32 = if let Some(true) = Some(false) { | ________________^ @@ -27,7 +27,7 @@ LL | | }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:22:16 + --> $DIR/feature-gate-const-if-match.rs:23:16 | LL | const _: i32 = match 1 { | ________________^ @@ -41,7 +41,7 @@ LL | | }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `static` - --> $DIR/feature-gate-const-if-match.rs:29:13 + --> $DIR/feature-gate-const-if-match.rs:30:13 | LL | let x = if true { 0 } else { 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -50,7 +50,7 @@ LL | let x = if true { 0 } else { 1 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `static` - --> $DIR/feature-gate-const-if-match.rs:31:13 + --> $DIR/feature-gate-const-if-match.rs:32:13 | LL | let x = match x { 0 => 1, _ => 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -59,7 +59,7 @@ LL | let x = match x { 0 => 1, _ => 0 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `static` - --> $DIR/feature-gate-const-if-match.rs:33:5 + --> $DIR/feature-gate-const-if-match.rs:34:5 | LL | if let Some(x) = Some(x) { x } else { 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -68,7 +68,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `static mut` - --> $DIR/feature-gate-const-if-match.rs:38:13 + --> $DIR/feature-gate-const-if-match.rs:39:13 | LL | let x = if true { 0 } else { 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -77,7 +77,7 @@ LL | let x = if true { 0 } else { 1 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `static mut` - --> $DIR/feature-gate-const-if-match.rs:40:13 + --> $DIR/feature-gate-const-if-match.rs:41:13 | LL | let x = match x { 0 => 1, _ => 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -86,7 +86,7 @@ LL | let x = match x { 0 => 1, _ => 0 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `static mut` - --> $DIR/feature-gate-const-if-match.rs:42:5 + --> $DIR/feature-gate-const-if-match.rs:43:5 | LL | if let Some(x) = Some(x) { x } else { 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -95,7 +95,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const fn` - --> $DIR/feature-gate-const-if-match.rs:47:5 + --> $DIR/feature-gate-const-if-match.rs:48:5 | LL | if true { 5 } else { 6 } | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -104,7 +104,7 @@ LL | if true { 5 } else { 6 } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const fn` - --> $DIR/feature-gate-const-if-match.rs:51:5 + --> $DIR/feature-gate-const-if-match.rs:52:5 | LL | / if let Some(true) = a { LL | | 0 @@ -117,7 +117,7 @@ LL | | } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `const fn` - --> $DIR/feature-gate-const-if-match.rs:59:5 + --> $DIR/feature-gate-const-if-match.rs:60:5 | LL | / match i { LL | | i if i > 10 => i, @@ -130,7 +130,7 @@ LL | | } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const fn` - --> $DIR/feature-gate-const-if-match.rs:90:17 + --> $DIR/feature-gate-const-if-match.rs:91:17 | LL | let x = if y { 0 } else { 1 }; | ^^^^^^^^^^^^^^^^^^^^^ @@ -139,7 +139,7 @@ LL | let x = if y { 0 } else { 1 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `const fn` - --> $DIR/feature-gate-const-if-match.rs:92:17 + --> $DIR/feature-gate-const-if-match.rs:93:17 | LL | let x = match x { 0 => 1, _ => 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -148,7 +148,7 @@ LL | let x = match x { 0 => 1, _ => 0 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const fn` - --> $DIR/feature-gate-const-if-match.rs:94:9 + --> $DIR/feature-gate-const-if-match.rs:95:9 | LL | if let Some(x) = Some(x) { x } else { 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -157,7 +157,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:110:17 + --> $DIR/feature-gate-const-if-match.rs:111:17 | LL | let x = if false { 0 } else { 1 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -166,7 +166,7 @@ LL | let x = if false { 0 } else { 1 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:112:17 + --> $DIR/feature-gate-const-if-match.rs:113:17 | LL | let x = match x { 0 => 1, _ => 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -175,7 +175,7 @@ LL | let x = match x { 0 => 1, _ => 0 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:114:9 + --> $DIR/feature-gate-const-if-match.rs:115:9 | LL | if let Some(x) = Some(x) { x } else { 1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -184,7 +184,7 @@ LL | if let Some(x) = Some(x) { x } else { 1 } = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:67:21 + --> $DIR/feature-gate-const-if-match.rs:68:21 | LL | const IF: i32 = if true { 5 } else { 6 }; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -193,7 +193,7 @@ LL | const IF: i32 = if true { 5 } else { 6 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:70:25 + --> $DIR/feature-gate-const-if-match.rs:71:25 | LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -202,7 +202,7 @@ LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:73:24 + --> $DIR/feature-gate-const-if-match.rs:74:24 | LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -211,7 +211,7 @@ LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:78:21 + --> $DIR/feature-gate-const-if-match.rs:79:21 | LL | const IF: i32 = if true { 5 } else { 6 }; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -220,7 +220,7 @@ LL | const IF: i32 = if true { 5 } else { 6 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `if` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:81:25 + --> $DIR/feature-gate-const-if-match.rs:82:25 | LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -229,7 +229,7 @@ LL | const IF_LET: i32 = if let Some(true) = None { 5 } else { 6 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0658]: `match` is not allowed in a `const` - --> $DIR/feature-gate-const-if-match.rs:84:24 + --> $DIR/feature-gate-const-if-match.rs:85:24 | LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -238,7 +238,7 @@ LL | const MATCH: i32 = match 0 { 1 => 2, _ => 0 }; = help: add `#![feature(const_if_match)]` to the crate attributes to enable error[E0019]: constant contains unimplemented expression type - --> $DIR/feature-gate-const-if-match.rs:114:21 + --> $DIR/feature-gate-const-if-match.rs:115:21 | LL | if let Some(x) = Some(x) { x } else { 1 } | ^ diff --git a/src/test/ui/consts/control-flow/short-circuit-let.rs b/src/test/ui/consts/control-flow/short-circuit-let.rs index 8cee2a54f56..4b20a2124c3 100644 --- a/src/test/ui/consts/control-flow/short-circuit-let.rs +++ b/src/test/ui/consts/control-flow/short-circuit-let.rs @@ -4,6 +4,7 @@ #![feature(const_if_match)] #![feature(const_panic)] +#![feature(const_fn)] const X: i32 = { let mut x = 0; diff --git a/src/test/ui/consts/control-flow/single_variant_match_ice.rs b/src/test/ui/consts/control-flow/single_variant_match_ice.rs index 823605ff034..bb0fce66c4d 100644 --- a/src/test/ui/consts/control-flow/single_variant_match_ice.rs +++ b/src/test/ui/consts/control-flow/single_variant_match_ice.rs @@ -1,6 +1,6 @@ // check-pass -#![feature(const_if_match)] +#![feature(const_if_match, const_fn)] enum Foo { Prob, diff --git a/src/test/ui/parser/lifetime-in-pattern-recover.rs b/src/test/ui/parser/lifetime-in-pattern-recover.rs new file mode 100644 index 00000000000..7fb14b80076 --- /dev/null +++ b/src/test/ui/parser/lifetime-in-pattern-recover.rs @@ -0,0 +1,6 @@ +fn main() { + let &'a x = &0; //~ ERROR unexpected lifetime `'a` in pattern + let &'a mut y = &mut 0; //~ ERROR unexpected lifetime `'a` in pattern + + let _recovery_witness: () = 0; //~ ERROR mismatched types +} diff --git a/src/test/ui/parser/lifetime-in-pattern-recover.stderr b/src/test/ui/parser/lifetime-in-pattern-recover.stderr new file mode 100644 index 00000000000..4bf7f57bfb5 --- /dev/null +++ b/src/test/ui/parser/lifetime-in-pattern-recover.stderr @@ -0,0 +1,23 @@ +error: unexpected lifetime `'a` in pattern + --> $DIR/lifetime-in-pattern-recover.rs:2:10 + | +LL | let &'a x = &0; + | ^^ help: remove the lifetime + +error: unexpected lifetime `'a` in pattern + --> $DIR/lifetime-in-pattern-recover.rs:3:10 + | +LL | let &'a mut y = &mut 0; + | ^^ help: remove the lifetime + +error[E0308]: mismatched types + --> $DIR/lifetime-in-pattern-recover.rs:5:33 + | +LL | let _recovery_witness: () = 0; + | -- ^ expected `()`, found integer + | | + | expected due to this + +error: aborting due to 3 previous errors + +For more information about this error, try `rustc --explain E0308`. diff --git a/src/test/ui/parser/lifetime-in-pattern.rs b/src/test/ui/parser/lifetime-in-pattern.rs index afee685cd05..d3c638d0cd7 100644 --- a/src/test/ui/parser/lifetime-in-pattern.rs +++ b/src/test/ui/parser/lifetime-in-pattern.rs @@ -1,5 +1,6 @@ fn test(&'a str) { //~^ ERROR unexpected lifetime `'a` in pattern + //~| ERROR expected one of `:`, `@`, or `|`, found `)` } fn main() { diff --git a/src/test/ui/parser/lifetime-in-pattern.stderr b/src/test/ui/parser/lifetime-in-pattern.stderr index e525c7b6d68..71fd3cdf723 100644 --- a/src/test/ui/parser/lifetime-in-pattern.stderr +++ b/src/test/ui/parser/lifetime-in-pattern.stderr @@ -2,7 +2,13 @@ error: unexpected lifetime `'a` in pattern --> $DIR/lifetime-in-pattern.rs:1:10 | LL | fn test(&'a str) { - | ^^ unexpected lifetime + | ^^ help: remove the lifetime -error: aborting due to previous error +error: expected one of `:`, `@`, or `|`, found `)` + --> $DIR/lifetime-in-pattern.rs:1:16 + | +LL | fn test(&'a str) { + | ^ expected one of `:`, `@`, or `|` + +error: aborting due to 2 previous errors diff --git a/src/test/ui/self/self-vs-path-ambiguity.stderr b/src/test/ui/self/self-vs-path-ambiguity.stderr index 5ce6a81bfcf..2beef50cdb5 100644 --- a/src/test/ui/self/self-vs-path-ambiguity.stderr +++ b/src/test/ui/self/self-vs-path-ambiguity.stderr @@ -2,7 +2,7 @@ error: unexpected lifetime `'a` in pattern --> $DIR/self-vs-path-ambiguity.rs:9:11 | LL | fn i(&'a self::S: &S) {} - | ^^ unexpected lifetime + | ^^ help: remove the lifetime error: aborting due to previous error diff --git a/src/test/ui/suggestions/option-content-move2.rs b/src/test/ui/suggestions/option-content-move2.rs new file mode 100644 index 00000000000..88e8a5b7aee --- /dev/null +++ b/src/test/ui/suggestions/option-content-move2.rs @@ -0,0 +1,16 @@ +struct NotCopyable; + +fn func<F: FnMut() -> H, H: FnMut()>(_: F) {} + +fn parse() { + let mut var = None; + func(|| { + // Shouldn't suggest `move ||.as_ref()` here + move || { + //~^ ERROR: cannot move out of `var` + var = Some(NotCopyable); + } + }); +} + +fn main() {} diff --git a/src/test/ui/suggestions/option-content-move2.stderr b/src/test/ui/suggestions/option-content-move2.stderr new file mode 100644 index 00000000000..71f745374e5 --- /dev/null +++ b/src/test/ui/suggestions/option-content-move2.stderr @@ -0,0 +1,18 @@ +error[E0507]: cannot move out of `var`, a captured variable in an `FnMut` closure + --> $DIR/option-content-move2.rs:9:9 + | +LL | let mut var = None; + | ------- captured outer variable +... +LL | move || { + | ^^^^^^^ move out of `var` occurs here +LL | +LL | var = Some(NotCopyable); + | --- + | | + | move occurs because `var` has type `std::option::Option<NotCopyable>`, which does not implement the `Copy` trait + | move occurs due to use in closure + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. |
