about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-03-09 03:59:42 +0000
committerbors <bors@rust-lang.org>2018-03-09 03:59:42 +0000
commit2079a084df08c38eb4dbfc5c8de5c0245170c3d9 (patch)
tree0fcabcc7de8c86c92497c331b5be41f45f79a579 /src/test
parent604d4ce7577b07b73d115c94fbd8007c1d9c9335 (diff)
parentb65b171f4433eb14b317c877ac84e4455caec837 (diff)
downloadrust-2079a084df08c38eb4dbfc5c8de5c0245170c3d9.tar.gz
rust-2079a084df08c38eb4dbfc5c8de5c0245170c3d9.zip
Auto merge of #48860 - Manishearth:rollup, r=Manishearth
Rollup of 5 pull requests

- Successful merges: #48527, #48588, #48801, #48856, #48857
- Failed merges:
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/epoch-gate-feature.rs21
-rw-r--r--src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs97
-rw-r--r--src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr38
-rw-r--r--src/test/ui/inference-variable-behind-raw-pointer.stderr2
4 files changed, 157 insertions, 1 deletions
diff --git a/src/test/run-pass/epoch-gate-feature.rs b/src/test/run-pass/epoch-gate-feature.rs
new file mode 100644
index 00000000000..37d092c06e0
--- /dev/null
+++ b/src/test/run-pass/epoch-gate-feature.rs
@@ -0,0 +1,21 @@
+// 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.
+
+// Checks if the correct registers are being used to pass arguments
+// when the sysv64 ABI is specified.
+
+// compile-flags: -Zepoch=2018
+
+pub trait Foo {}
+
+// should compile without the dyn trait feature flag
+fn foo(x: &dyn Foo) {}
+
+pub fn main() {}
diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs
new file mode 100644
index 00000000000..7bdaaddad84
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.rs
@@ -0,0 +1,97 @@
+// 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.
+
+#![allow(unused)]
+
+#[derive(Copy, Clone)]
+enum Nucleotide {
+    Adenine,
+    Thymine,
+    Cytosine,
+    Guanine
+}
+
+#[derive(Clone)]
+struct Autosome;
+
+#[derive(Clone)]
+enum Allosome {
+    X(Vec<Nucleotide>),
+    Y(Vec<Nucleotide>)
+}
+
+impl Allosome {
+    fn is_x(&self) -> bool {
+        match *self {
+            Allosome::X(_) => true,
+            Allosome::Y(_) => false,
+        }
+    }
+}
+
+#[derive(Clone)]
+struct Genome {
+    autosomes: [Autosome; 22],
+    allosomes: (Allosome, Allosome)
+}
+
+fn find_start_codon(strand: &[Nucleotide]) -> Option<usize> {
+    let mut reading_frame = strand.windows(3);
+    // (missing parentheses in `while let` tuple pattern)
+    while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") {
+        //~^ ERROR unexpected `,` in pattern
+        // ...
+    }
+    None
+}
+
+fn find_thr(strand: &[Nucleotide]) -> Option<usize> {
+    let mut reading_frame = strand.windows(3);
+    let mut i = 0;
+    // (missing parentheses in `if let` tuple pattern)
+    if let b1, b2, b3 = reading_frame.next().unwrap() {
+        //~^ ERROR unexpected `,` in pattern
+        // ...
+    }
+    None
+}
+
+fn is_thr(codon: (Nucleotide, Nucleotide, Nucleotide)) -> bool {
+    match codon {
+        // (missing parentheses in match arm tuple pattern)
+        Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
+        //~^ ERROR unexpected `,` in pattern
+        _ => false
+    }
+}
+
+fn analyze_female_sex_chromosomes(women: &[Genome]) {
+    // (missing parentheses in `for` tuple pattern)
+    for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
+        //~^ ERROR unexpected `,` in pattern
+        // ...
+    }
+}
+
+fn analyze_male_sex_chromosomes(men: &[Genome]) {
+    // (missing parentheses in pattern with `@` binding)
+    for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
+        //~^ ERROR unexpected `,` in pattern
+        // ...
+    }
+}
+
+fn main() {
+    let genomes = Vec::new();
+    // (missing parentheses in `let` pattern)
+    let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
+    //~^ ERROR unexpected `,` in pattern
+        .partition(|g: &Genome| g.allosomes.0.is_x() && g.allosomes.1.is_x());
+}
diff --git a/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
new file mode 100644
index 00000000000..db3f93af444
--- /dev/null
+++ b/src/test/ui/did_you_mean/issue-48492-tuple-destructure-missing-parens.stderr
@@ -0,0 +1,38 @@
+error: unexpected `,` in pattern
+  --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:48:17
+   |
+LL |     while let b1, b2, b3 = reading_frame.next().expect("there should be a start codon") {
+   |               --^------- help: try adding parentheses: `(b1, b2, b3)`
+
+error: unexpected `,` in pattern
+  --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:59:14
+   |
+LL |     if let b1, b2, b3 = reading_frame.next().unwrap() {
+   |            --^------- help: try adding parentheses: `(b1, b2, b3)`
+
+error: unexpected `,` in pattern
+  --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:69:28
+   |
+LL |         Nucleotide::Adenine, Nucleotide::Cytosine, _ => true
+   |         -------------------^------------------------ help: try adding parentheses: `(Nucleotide::Adenine, Nucleotide::Cytosine, _)`
+
+error: unexpected `,` in pattern
+  --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:77:10
+   |
+LL |     for x, _barr_body in women.iter().map(|woman| woman.allosomes.clone()) {
+   |         -^----------- help: try adding parentheses: `(x, _barr_body)`
+
+error: unexpected `,` in pattern
+  --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:85:10
+   |
+LL |     for x, y @ Allosome::Y(_) in men.iter().map(|man| man.allosomes.clone()) {
+   |         -^------------------- help: try adding parentheses: `(x, y @ Allosome::Y(_))`
+
+error: unexpected `,` in pattern
+  --> $DIR/issue-48492-tuple-destructure-missing-parens.rs:94:14
+   |
+LL |     let women, men: (Vec<Genome>, Vec<Genome>) = genomes.iter().cloned()
+   |         -----^---- help: try adding parentheses: `(women, men)`
+
+error: aborting due to 6 previous errors
+
diff --git a/src/test/ui/inference-variable-behind-raw-pointer.stderr b/src/test/ui/inference-variable-behind-raw-pointer.stderr
index e1d4df85c2f..eb40151615d 100644
--- a/src/test/ui/inference-variable-behind-raw-pointer.stderr
+++ b/src/test/ui/inference-variable-behind-raw-pointer.stderr
@@ -5,6 +5,6 @@ LL |     if data.is_null() {}
    |             ^^^^^^^
    |
    = note: #[warn(tyvar_behind_raw_pointer)] on by default
-   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
+   = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in the 2018 epoch!
    = note: for more information, see issue #46906 <https://github.com/rust-lang/rust/issues/46906>