about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/crashes/127916.rs16
-rw-r--r--tests/crashes/128119.rs15
-rw-r--r--tests/crashes/128190.rs7
-rw-r--r--tests/ui/asm/invalid-const-operand.rs8
-rw-r--r--tests/ui/asm/invalid-const-operand.stderr8
-rw-r--r--tests/ui/asm/tainting-on-error.rs13
-rw-r--r--tests/ui/asm/tainting-on-error.stderr10
-rw-r--r--tests/ui/asm/x86_64/type-check-2.rs8
-rw-r--r--tests/ui/asm/x86_64/type-check-2.stderr16
-rw-r--r--tests/ui/delegation/ice-isssue-128190.rs9
-rw-r--r--tests/ui/delegation/ice-isssue-128190.stderr10
11 files changed, 68 insertions, 52 deletions
diff --git a/tests/crashes/127916.rs b/tests/crashes/127916.rs
deleted file mode 100644
index 295c88df857..00000000000
--- a/tests/crashes/127916.rs
+++ /dev/null
@@ -1,16 +0,0 @@
-//@ known-bug: #127916
-
-trait Trait {
-    fn foo(&self) -> u32 { 0 }
-}
-
-struct F;
-struct S;
-
-mod to_reuse {
-    pub fn foo(&self) -> u32 {}
-}
-
-impl Trait  S {
-    reuse to_reuse::foo { self }
-}
diff --git a/tests/crashes/128119.rs b/tests/crashes/128119.rs
deleted file mode 100644
index 7677b15a2f3..00000000000
--- a/tests/crashes/128119.rs
+++ /dev/null
@@ -1,15 +0,0 @@
-//@ known-bug: #128119
-
-trait Trait {
-    reuse to_reuse::foo { self }
-}
-
-struct S;
-
-mod to_reuse {
-    pub fn foo(&self) -> u32 {}
-}
-
-impl Trait  S {
-    reuse to_reuse::foo { self }
-}
diff --git a/tests/crashes/128190.rs b/tests/crashes/128190.rs
deleted file mode 100644
index 0fa7027ae60..00000000000
--- a/tests/crashes/128190.rs
+++ /dev/null
@@ -1,7 +0,0 @@
-//@ known-bug: rust-lang/rust#128190
-
-fn a(&self) {
-    15
-}
-
-reuse a as b {  struct S; }
diff --git a/tests/ui/asm/invalid-const-operand.rs b/tests/ui/asm/invalid-const-operand.rs
index a688f5042db..bbf4001752a 100644
--- a/tests/ui/asm/invalid-const-operand.rs
+++ b/tests/ui/asm/invalid-const-operand.rs
@@ -14,7 +14,7 @@ global_asm!("{}", const 0f32);
 global_asm!("{}", const 0 as *mut u8);
 //~^ ERROR invalid type for `const` operand
 
-fn main() {
+fn test1() {
     unsafe {
         // Const operands must be integers and must be constants.
 
@@ -27,7 +27,11 @@ fn main() {
         //~^ ERROR invalid type for `const` operand
         asm!("{}", const &0);
         //~^ ERROR invalid type for `const` operand
+    }
+}
 
+fn test2() {
+    unsafe {
         // Constants must be... constant
 
         let x = 0;
@@ -47,3 +51,5 @@ fn main() {
         //~^ ERROR attempt to use a non-constant value in a constant
     }
 }
+
+fn main() {}
diff --git a/tests/ui/asm/invalid-const-operand.stderr b/tests/ui/asm/invalid-const-operand.stderr
index 1cedabeef28..01aa843c6fb 100644
--- a/tests/ui/asm/invalid-const-operand.stderr
+++ b/tests/ui/asm/invalid-const-operand.stderr
@@ -1,5 +1,5 @@
 error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/invalid-const-operand.rs:40:26
+  --> $DIR/invalid-const-operand.rs:44:26
    |
 LL |         asm!("{}", const x);
    |                          ^ non-constant value
@@ -11,7 +11,7 @@ LL +         const x: /* Type */ = 0;
    |
 
 error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/invalid-const-operand.rs:43:36
+  --> $DIR/invalid-const-operand.rs:47:36
    |
 LL |         asm!("{}", const const_foo(x));
    |                                    ^ non-constant value
@@ -23,7 +23,7 @@ LL +         const x: /* Type */ = 0;
    |
 
 error[E0435]: attempt to use a non-constant value in a constant
-  --> $DIR/invalid-const-operand.rs:46:36
+  --> $DIR/invalid-const-operand.rs:50:36
    |
 LL |         asm!("{}", const const_bar(x));
    |                                    ^ non-constant value
@@ -80,7 +80,7 @@ error: invalid type for `const` operand
 LL |         asm!("{}", const &0);
    |                    ^^^^^^--
    |                          |
-   |                          is a `&{integer}`
+   |                          is a `&i32`
    |
    = help: `const` operands must be of an integer type
 
diff --git a/tests/ui/asm/tainting-on-error.rs b/tests/ui/asm/tainting-on-error.rs
new file mode 100644
index 00000000000..a8e9af91158
--- /dev/null
+++ b/tests/ui/asm/tainting-on-error.rs
@@ -0,0 +1,13 @@
+//@ needs-asm-support
+
+use std::arch::asm;
+
+fn main() {
+    unsafe {
+        asm!(
+            "/* {} */",
+            sym None::<()>,
+            //~^ ERROR invalid `sym` operand
+        );
+    }
+}
diff --git a/tests/ui/asm/tainting-on-error.stderr b/tests/ui/asm/tainting-on-error.stderr
new file mode 100644
index 00000000000..bd706d1f310
--- /dev/null
+++ b/tests/ui/asm/tainting-on-error.stderr
@@ -0,0 +1,10 @@
+error: invalid `sym` operand
+  --> $DIR/tainting-on-error.rs:9:13
+   |
+LL |             sym None::<()>,
+   |             ^^^^^^^^^^^^^^ is an `Option<()>`
+   |
+   = help: `sym` operands must refer to either a function or a static
+
+error: aborting due to 1 previous error
+
diff --git a/tests/ui/asm/x86_64/type-check-2.rs b/tests/ui/asm/x86_64/type-check-2.rs
index 1650c595fae..c63042298da 100644
--- a/tests/ui/asm/x86_64/type-check-2.rs
+++ b/tests/ui/asm/x86_64/type-check-2.rs
@@ -7,7 +7,7 @@ use std::arch::{asm, global_asm};
 #[repr(simd)]
 struct SimdNonCopy([f32; 4]);
 
-fn main() {
+fn test1() {
     unsafe {
         // Inputs must be initialized
 
@@ -26,7 +26,11 @@ fn main() {
         asm!("{}", in(reg) v[0]);
         asm!("{}", out(reg) v[0]);
         asm!("{}", inout(reg) v[0]);
+    }
+}
 
+fn test2() {
+    unsafe {
         // Register operands must be Copy
 
         asm!("{}", in(xmm_reg) SimdNonCopy([0.0, 0.0, 0.0, 0.0]));
@@ -68,3 +72,5 @@ fn main() {
         asm!("{}", in(reg) u);
     }
 }
+
+fn main() {}
diff --git a/tests/ui/asm/x86_64/type-check-2.stderr b/tests/ui/asm/x86_64/type-check-2.stderr
index 8b1bfa85fa2..d5c5a3ff1f8 100644
--- a/tests/ui/asm/x86_64/type-check-2.stderr
+++ b/tests/ui/asm/x86_64/type-check-2.stderr
@@ -1,13 +1,13 @@
 error: arguments for inline assembly must be copyable
-  --> $DIR/type-check-2.rs:32:32
+  --> $DIR/type-check-2.rs:36:32
    |
 LL |         asm!("{}", in(xmm_reg) SimdNonCopy([0.0, 0.0, 0.0, 0.0]));
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `SimdNonCopy` does not implement the Copy trait
 
-error: cannot use value of type `{closure@$DIR/type-check-2.rs:44:28: 44:36}` for inline assembly
-  --> $DIR/type-check-2.rs:44:28
+error: cannot use value of type `{closure@$DIR/type-check-2.rs:48:28: 48:36}` for inline assembly
+  --> $DIR/type-check-2.rs:48:28
    |
 LL |         asm!("{}", in(reg) |x: i32| x);
    |                            ^^^^^^^^^^
@@ -15,7 +15,7 @@ LL |         asm!("{}", in(reg) |x: i32| x);
    = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
 
 error: cannot use value of type `Vec<i32>` for inline assembly
-  --> $DIR/type-check-2.rs:46:28
+  --> $DIR/type-check-2.rs:50:28
    |
 LL |         asm!("{}", in(reg) vec![0]);
    |                            ^^^^^^^
@@ -24,7 +24,7 @@ LL |         asm!("{}", in(reg) vec![0]);
    = note: this error originates in the macro `vec` (in Nightly builds, run with -Z macro-backtrace for more info)
 
 error: cannot use value of type `(i32, i32, i32)` for inline assembly
-  --> $DIR/type-check-2.rs:48:28
+  --> $DIR/type-check-2.rs:52:28
    |
 LL |         asm!("{}", in(reg) (1, 2, 3));
    |                            ^^^^^^^^^
@@ -32,7 +32,7 @@ LL |         asm!("{}", in(reg) (1, 2, 3));
    = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
 
 error: cannot use value of type `[i32; 3]` for inline assembly
-  --> $DIR/type-check-2.rs:50:28
+  --> $DIR/type-check-2.rs:54:28
    |
 LL |         asm!("{}", in(reg) [1, 2, 3]);
    |                            ^^^^^^^^^
@@ -40,7 +40,7 @@ LL |         asm!("{}", in(reg) [1, 2, 3]);
    = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
 
 error: cannot use value of type `fn() {main}` for inline assembly
-  --> $DIR/type-check-2.rs:58:31
+  --> $DIR/type-check-2.rs:62:31
    |
 LL |         asm!("{}", inout(reg) f);
    |                               ^
@@ -48,7 +48,7 @@ LL |         asm!("{}", inout(reg) f);
    = note: only integers, floats, SIMD vectors, pointers and function pointers can be used as arguments for inline assembly
 
 error: cannot use value of type `&mut i32` for inline assembly
-  --> $DIR/type-check-2.rs:61:31
+  --> $DIR/type-check-2.rs:65:31
    |
 LL |         asm!("{}", inout(reg) r);
    |                               ^
diff --git a/tests/ui/delegation/ice-isssue-128190.rs b/tests/ui/delegation/ice-isssue-128190.rs
new file mode 100644
index 00000000000..dab3bbee663
--- /dev/null
+++ b/tests/ui/delegation/ice-isssue-128190.rs
@@ -0,0 +1,9 @@
+#![feature(fn_delegation)]
+#![allow(incomplete_features)]
+
+fn a(&self) {}
+//~^ ERROR `self` parameter is only allowed in associated functions
+
+reuse a as b;
+
+fn main() {}
diff --git a/tests/ui/delegation/ice-isssue-128190.stderr b/tests/ui/delegation/ice-isssue-128190.stderr
new file mode 100644
index 00000000000..18f676642c2
--- /dev/null
+++ b/tests/ui/delegation/ice-isssue-128190.stderr
@@ -0,0 +1,10 @@
+error: `self` parameter is only allowed in associated functions
+  --> $DIR/ice-isssue-128190.rs:4:6
+   |
+LL | fn a(&self) {}
+   |      ^^^^^ not semantically valid as function parameter
+   |
+   = note: associated functions are those in `impl` or `trait` definitions
+
+error: aborting due to 1 previous error
+