about summary refs log tree commit diff
path: root/src/test/compile-fail
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2017-08-07 22:30:39 -0700
committerAlex Crichton <alex@alexcrichton.com>2017-08-09 11:44:21 -0700
commitc25ddf21f18c3eeeaea2a4dffd70d2f6183068b5 (patch)
tree9715e57405ae14bd7877dec129bce733daf72dc1 /src/test/compile-fail
parentcc4ff8f4d169562ff4ae22b94197a191215e6d56 (diff)
parentc5e2051f070c01241f68720a92a0957bcb070597 (diff)
downloadrust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.tar.gz
rust-c25ddf21f18c3eeeaea2a4dffd70d2f6183068b5.zip
Merge remote-tracking branch 'origin/master' into gen
Diffstat (limited to 'src/test/compile-fail')
-rw-r--r--src/test/compile-fail/E0559.rs3
-rw-r--r--src/test/compile-fail/E0560.rs1
-rw-r--r--src/test/compile-fail/E0624.rs22
-rw-r--r--src/test/compile-fail/asm-bad-clobber.rs1
-rw-r--r--src/test/compile-fail/asm-in-bad-modifier.rs1
-rw-r--r--src/test/compile-fail/asm-misplaced-option.rs1
-rw-r--r--src/test/compile-fail/asm-out-assign-imm.rs1
-rw-r--r--src/test/compile-fail/asm-out-no-modifier.rs1
-rw-r--r--src/test/compile-fail/asm-out-read-uninit.rs1
-rw-r--r--src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs24
-rw-r--r--src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs46
-rw-r--r--src/test/compile-fail/hr-subtype.rs3
-rw-r--r--src/test/compile-fail/issue-19922.rs3
-rw-r--r--src/test/compile-fail/issue-35675.rs67
-rw-r--r--src/test/compile-fail/issue-40510-1.rs23
-rw-r--r--src/test/compile-fail/issue-40510-2.rs (renamed from src/test/compile-fail/issue-34222.rs)15
-rw-r--r--src/test/compile-fail/issue-40510-3.rs25
-rw-r--r--src/test/compile-fail/issue-40510-4.rs25
-rw-r--r--src/test/compile-fail/numeric-fields.rs3
-rw-r--r--src/test/compile-fail/struct-fields-too-many.rs1
-rw-r--r--src/test/compile-fail/suggest-private-fields.rs3
-rw-r--r--src/test/compile-fail/union/union-fields.rs1
-rw-r--r--src/test/compile-fail/useless_comment.rs30
23 files changed, 182 insertions, 119 deletions
diff --git a/src/test/compile-fail/E0559.rs b/src/test/compile-fail/E0559.rs
index fa6c885843e..e8b0915d2b5 100644
--- a/src/test/compile-fail/E0559.rs
+++ b/src/test/compile-fail/E0559.rs
@@ -15,5 +15,6 @@ enum Field {
 fn main() {
     let s = Field::Fool { joke: 0 };
     //~^ ERROR E0559
-    //~| NOTE field does not exist - did you mean `x`?
+    //~| NOTE `Field::Fool` does not have this field
+    //~| NOTE available fields are: `x`
 }
diff --git a/src/test/compile-fail/E0560.rs b/src/test/compile-fail/E0560.rs
index c6326a0f977..955ef7ca99c 100644
--- a/src/test/compile-fail/E0560.rs
+++ b/src/test/compile-fail/E0560.rs
@@ -16,4 +16,5 @@ fn main() {
     let s = Simba { mother: 1, father: 0 };
     //~^ ERROR E0560
     //~| NOTE `Simba` does not have this field
+    //~| NOTE available fields are: `mother`
 }
diff --git a/src/test/compile-fail/E0624.rs b/src/test/compile-fail/E0624.rs
new file mode 100644
index 00000000000..952e0b31c4c
--- /dev/null
+++ b/src/test/compile-fail/E0624.rs
@@ -0,0 +1,22 @@
+// Copyright 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.
+
+mod inner {
+    pub struct Foo;
+
+    impl Foo {
+        fn method(&self) {}
+    }
+}
+
+fn main() {
+    let foo = inner::Foo;
+    foo.method(); //~ ERROR method `method` is private [E0624]
+}
diff --git a/src/test/compile-fail/asm-bad-clobber.rs b/src/test/compile-fail/asm-bad-clobber.rs
index 145662fd87c..b863e90a3b7 100644
--- a/src/test/compile-fail/asm-bad-clobber.rs
+++ b/src/test/compile-fail/asm-bad-clobber.rs
@@ -14,6 +14,7 @@
 // ignore-s390x
 // ignore-emscripten
 // ignore-powerpc
+// ignore-sparc
 
 #![feature(asm, rustc_attrs)]
 
diff --git a/src/test/compile-fail/asm-in-bad-modifier.rs b/src/test/compile-fail/asm-in-bad-modifier.rs
index f0467e75223..cae41332795 100644
--- a/src/test/compile-fail/asm-in-bad-modifier.rs
+++ b/src/test/compile-fail/asm-in-bad-modifier.rs
@@ -11,6 +11,7 @@
 // ignore-s390x
 // ignore-emscripten
 // ignore-powerpc
+// ignore-sparc
 
 #![feature(asm)]
 
diff --git a/src/test/compile-fail/asm-misplaced-option.rs b/src/test/compile-fail/asm-misplaced-option.rs
index 37a26753531..e634238c6e1 100644
--- a/src/test/compile-fail/asm-misplaced-option.rs
+++ b/src/test/compile-fail/asm-misplaced-option.rs
@@ -14,6 +14,7 @@
 // ignore-s390x
 // ignore-emscripten
 // ignore-powerpc
+// ignore-sparc
 
 #![feature(asm, rustc_attrs)]
 
diff --git a/src/test/compile-fail/asm-out-assign-imm.rs b/src/test/compile-fail/asm-out-assign-imm.rs
index f95e4410381..546d402252e 100644
--- a/src/test/compile-fail/asm-out-assign-imm.rs
+++ b/src/test/compile-fail/asm-out-assign-imm.rs
@@ -11,6 +11,7 @@
 // ignore-s390x
 // ignore-emscripten
 // ignore-powerpc
+// ignore-sparc
 
 #![feature(asm)]
 
diff --git a/src/test/compile-fail/asm-out-no-modifier.rs b/src/test/compile-fail/asm-out-no-modifier.rs
index acf575c003a..2e843ddac82 100644
--- a/src/test/compile-fail/asm-out-no-modifier.rs
+++ b/src/test/compile-fail/asm-out-no-modifier.rs
@@ -11,6 +11,7 @@
 // ignore-s390x
 // ignore-emscripten
 // ignore-powerpc
+// ignore-sparc
 
 #![feature(asm)]
 
diff --git a/src/test/compile-fail/asm-out-read-uninit.rs b/src/test/compile-fail/asm-out-read-uninit.rs
index bd180f6e5eb..c85a097b962 100644
--- a/src/test/compile-fail/asm-out-read-uninit.rs
+++ b/src/test/compile-fail/asm-out-read-uninit.rs
@@ -11,6 +11,7 @@
 // ignore-s390x
 // ignore-emscripten
 // ignore-powerpc
+// ignore-sparc
 
 #![feature(asm)]
 
diff --git a/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs b/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs
index c5557cee7cc..0e822aff01e 100644
--- a/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs
+++ b/src/test/compile-fail/associated-types/cache/project-fn-ret-contravariant.rs
@@ -43,23 +43,19 @@ fn baz<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
     (a, b)
 }
 
-// FIXME(#32330)
-//#[cfg(transmute)] // one instantiations: BAD
-//fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
-//    bar(foo, x) //[transmute] ERROR E0495
-//}
+#[cfg(transmute)] // one instantiations: BAD
+fn baz<'a,'b>(x: &'a u32) -> &'static u32 {
+   bar(foo, x) //[transmute]~ ERROR E0495
+}
 
-// FIXME(#32330)
-//#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
-//fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
-//    let a = bar(foo, y); //[krisskross] ERROR E0495
-//    let b = bar(foo, x); //[krisskross] ERROR E0495
-//    (a, b)
-//}
+#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
+fn transmute<'a,'b>(x: &'a u32, y: &'b u32) -> (&'a u32, &'b u32) {
+   let a = bar(foo, y); //[krisskross]~ ERROR E0495
+   let b = bar(foo, x); //[krisskross]~ ERROR E0495
+   (a, b)
+}
 
 #[rustc_error]
 fn main() { }
 //[ok]~^ ERROR compilation successful
 //[oneuse]~^^ ERROR compilation successful
-//[transmute]~^^^ ERROR compilation successful
-//[krisskross]~^^^^ ERROR compilation successful
diff --git a/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs b/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs
index a15422e42d9..10fe612980d 100644
--- a/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs
+++ b/src/test/compile-fail/associated-types/cache/project-fn-ret-invariant.rs
@@ -42,35 +42,29 @@ fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
     (a, b)
 }
 
-// FIXME(#32330)
-//#[cfg(oneuse)] // one instantiation: BAD
-//fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
-//    let f = foo; // <-- No consistent type can be inferred for `f` here.
-//    let a = bar(f, x); //[oneuse] ERROR E0495
-//    let b = bar(f, y);
-//    (a, b)
-//}
+#[cfg(oneuse)] // one instantiation: BAD
+fn baz<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   let f = foo; // <-- No consistent type can be inferred for `f` here.
+   let a = bar(f, x); //[oneuse]~^ ERROR E0495
+   let b = bar(f, y);
+   (a, b)
+}
 
-// FIXME(#32330)
-//#[cfg(transmute)] // one instantiations: BAD
-//fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
-//    // Cannot instantiate `foo` with any lifetime other than `'a`,
-//    // since it is provided as input.
-//
-//    bar(foo, x) //[transmute] ERROR E0495
-//}
+#[cfg(transmute)] // one instantiations: BAD
+fn baz<'a,'b>(x: Type<'a>) -> Type<'static> {
+   // Cannot instantiate `foo` with any lifetime other than `'a`,
+   // since it is provided as input.
 
-// FIXME(#32330)
-//#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
-//fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
-//    let a = bar(foo, y); //[krisskross] ERROR E0495
-//    let b = bar(foo, x); //[krisskross] ERROR E0495
-//    (a, b)
-//}
+   bar(foo, x) //[transmute]~ ERROR E0495
+}
+
+#[cfg(krisskross)] // two instantiations, mixing and matching: BAD
+fn transmute<'a,'b>(x: Type<'a>, y: Type<'b>) -> (Type<'a>, Type<'b>) {
+   let a = bar(foo, y); //[krisskross]~ ERROR E0495
+   let b = bar(foo, x); //[krisskross]~ ERROR E0495
+   (a, b)
+}
 
 #[rustc_error]
 fn main() { }
 //[ok]~^ ERROR compilation successful
-//[oneuse]~^^ ERROR compilation successful
-//[transmute]~^^^ ERROR compilation successful
-//[krisskross]~^^^^ ERROR compilation successful
diff --git a/src/test/compile-fail/hr-subtype.rs b/src/test/compile-fail/hr-subtype.rs
index 95e469ebcfd..c88d74d53ce 100644
--- a/src/test/compile-fail/hr-subtype.rs
+++ b/src/test/compile-fail/hr-subtype.rs
@@ -91,9 +91,6 @@ check! { free_inv_x_vs_free_inv_y: (fn(Inv<'x>),
 // - if we are covariant, then 'a and 'b can be set to the call-site
 //   intersection;
 // - if we are contravariant, then 'a can be inferred to 'static.
-//
-// FIXME(#32330) this is true, but we are not currently impl'ing this
-// full semantics
 check! { bound_a_b_vs_bound_a: (for<'a,'b> fn(&'a u32, &'b u32),
                                 for<'a>    fn(&'a u32, &'a u32)) }
 check! { bound_co_a_b_vs_bound_co_a: (for<'a,'b> fn(Co<'a>, Co<'b>),
diff --git a/src/test/compile-fail/issue-19922.rs b/src/test/compile-fail/issue-19922.rs
index d7b2f2b3f99..938ccb343d4 100644
--- a/src/test/compile-fail/issue-19922.rs
+++ b/src/test/compile-fail/issue-19922.rs
@@ -15,5 +15,6 @@ enum Homura {
 fn main() {
     let homura = Homura::Akemi { kaname: () };
     //~^ ERROR variant `Homura::Akemi` has no field named `kaname`
-    //~| NOTE field does not exist - did you mean `madoka`?
+    //~| NOTE `Homura::Akemi` does not have this field
+    //~| NOTE available fields are: `madoka`
 }
diff --git a/src/test/compile-fail/issue-35675.rs b/src/test/compile-fail/issue-35675.rs
deleted file mode 100644
index c09e56cbc5b..00000000000
--- a/src/test/compile-fail/issue-35675.rs
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 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.
-
-// these two HELPs are actually in a new line between this line and the `enum Fruit` line
-enum Fruit { //~ HELP possible candidate is found in another module, you can import it into scope
-    //~^ HELP possible candidate is found in another module, you can import it into scope
-    Apple(i64),
-    Orange(i64),
-}
-
-fn should_return_fruit() -> Apple {
-    //~^ ERROR cannot find type `Apple` in this scope
-    //~| NOTE not found in this scope
-    //~| HELP you can try using the variant's enum
-    Apple(5)
-    //~^ ERROR cannot find function `Apple` in this scope
-    //~| NOTE not found in this scope
-}
-
-fn should_return_fruit_too() -> Fruit::Apple {
-    //~^ ERROR expected type, found variant `Fruit::Apple`
-    //~| HELP you can try using the variant's enum
-    //~| NOTE not a type
-    Apple(5)
-    //~^ ERROR cannot find function `Apple` in this scope
-    //~| NOTE not found in this scope
-}
-
-fn foo() -> Ok {
-    //~^ ERROR expected type, found variant `Ok`
-    //~| NOTE not a type
-    //~| HELP there is an enum variant
-    //~| HELP there is an enum variant
-    Ok(())
-}
-
-fn bar() -> Variant3 {
-    //~^ ERROR cannot find type `Variant3` in this scope
-    //~| HELP you can try using the variant's enum
-    //~| NOTE not found in this scope
-}
-
-fn qux() -> Some {
-    //~^ ERROR expected type, found variant `Some`
-    //~| NOTE not a type
-    //~| HELP there is an enum variant
-    //~| HELP there is an enum variant
-    Some(1)
-}
-
-fn main() {}
-
-mod x {
-    enum Enum {
-        Variant1,
-        Variant2(),
-        Variant3(usize),
-        Variant4 {},
-    }
-}
diff --git a/src/test/compile-fail/issue-40510-1.rs b/src/test/compile-fail/issue-40510-1.rs
new file mode 100644
index 00000000000..142092ff41e
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-1.rs
@@ -0,0 +1,23 @@
+// Copyright 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+    let mut x: Box<()> = Box::new(());
+
+    || {
+        &mut x
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-34222.rs b/src/test/compile-fail/issue-40510-2.rs
index 4609c0ccb1c..0fe56584822 100644
--- a/src/test/compile-fail/issue-34222.rs
+++ b/src/test/compile-fail/issue-40510-2.rs
@@ -9,10 +9,15 @@
 // except according to those terms.
 
 #![feature(rustc_attrs)]
-#![allow(warnings)]
+#![allow(unused)]
 
-#[rustc_error]
-fn main() { //~ ERROR compilation successful
-    /// crash
-    let x = 0;
+fn f() {
+    let x: Box<()> = Box::new(());
+
+    || {
+        &x
+    };
 }
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-40510-3.rs b/src/test/compile-fail/issue-40510-3.rs
new file mode 100644
index 00000000000..afa8f15ee57
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-3.rs
@@ -0,0 +1,25 @@
+// Copyright 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+    let mut x: Vec<()> = Vec::new();
+
+    || {
+        || {
+            x.push(())
+        }
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/issue-40510-4.rs b/src/test/compile-fail/issue-40510-4.rs
new file mode 100644
index 00000000000..a39c500225b
--- /dev/null
+++ b/src/test/compile-fail/issue-40510-4.rs
@@ -0,0 +1,25 @@
+// Copyright 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.
+
+#![feature(rustc_attrs)]
+#![allow(unused)]
+
+fn f() {
+    let x: Vec<()> = Vec::new();
+
+    || {
+        || {
+            x.len()
+        }
+    };
+}
+
+#[rustc_error]
+fn main() {} //~ ERROR compilation successful
diff --git a/src/test/compile-fail/numeric-fields.rs b/src/test/compile-fail/numeric-fields.rs
index 00fde3025a6..d6e091a1472 100644
--- a/src/test/compile-fail/numeric-fields.rs
+++ b/src/test/compile-fail/numeric-fields.rs
@@ -13,7 +13,8 @@ struct S(u8, u16);
 fn main() {
     let s = S{0b1: 10, 0: 11};
     //~^ ERROR struct `S` has no field named `0b1`
-    //~| NOTE field does not exist - did you mean `1`?
+    //~| NOTE `S` does not have this field
+    //~| NOTE available fields are: `0`, `1`
     match s {
         S{0: a, 0x1: b, ..} => {}
         //~^ ERROR does not have a field named `0x1`
diff --git a/src/test/compile-fail/struct-fields-too-many.rs b/src/test/compile-fail/struct-fields-too-many.rs
index 0848ada731a..b1af142ad0f 100644
--- a/src/test/compile-fail/struct-fields-too-many.rs
+++ b/src/test/compile-fail/struct-fields-too-many.rs
@@ -18,5 +18,6 @@ fn main() {
         bar: 0
         //~^ ERROR struct `BuildData` has no field named `bar`
         //~| NOTE `BuildData` does not have this field
+        //~| NOTE available fields are: `foo`
     };
 }
diff --git a/src/test/compile-fail/suggest-private-fields.rs b/src/test/compile-fail/suggest-private-fields.rs
index 3672e0e90c2..d0752b5f02f 100644
--- a/src/test/compile-fail/suggest-private-fields.rs
+++ b/src/test/compile-fail/suggest-private-fields.rs
@@ -27,7 +27,8 @@ fn main () {
         //~| NOTE field does not exist - did you mean `a`?
         bb: 20,
         //~^ ERROR struct `xc::B` has no field named `bb`
-        //~| NOTE field does not exist - did you mean `a`?
+        //~| NOTE `xc::B` does not have this field
+        //~| NOTE available fields are: `a`
     };
     // local crate struct
     let l = A {
diff --git a/src/test/compile-fail/union/union-fields.rs b/src/test/compile-fail/union/union-fields.rs
index b5d582a5746..124b16f99b1 100644
--- a/src/test/compile-fail/union/union-fields.rs
+++ b/src/test/compile-fail/union/union-fields.rs
@@ -20,6 +20,7 @@ fn main() {
     let u = U { a: 0, b: 1, c: 2 }; //~ ERROR union expressions should have exactly one field
                                     //~^ ERROR union `U` has no field named `c`
                                     //~| NOTE `U` does not have this field
+                                    //~| NOTE available fields are: `a`, `b`
     let u = U { ..u }; //~ ERROR union expressions should have exactly one field
                        //~^ ERROR functional record update syntax requires a struct
 
diff --git a/src/test/compile-fail/useless_comment.rs b/src/test/compile-fail/useless_comment.rs
new file mode 100644
index 00000000000..a1172bb214d
--- /dev/null
+++ b/src/test/compile-fail/useless_comment.rs
@@ -0,0 +1,30 @@
+// Copyright 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(unused_doc_comment)]
+
+fn foo() {
+    /// a //~ ERROR doc comment not used by rustdoc
+    let x = 12;
+
+    /// b //~ doc comment not used by rustdoc
+    match x {
+        /// c //~ ERROR doc comment not used by rustdoc
+        1 => {},
+        _ => {}
+    }
+
+    /// foo //~ ERROR doc comment not used by rustdoc
+    unsafe {}
+}
+
+fn main() {
+    foo();
+}
\ No newline at end of file