summaryrefslogtreecommitdiffstats
path: root/src/test/ui/typeof
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:18:21 +0000
commit4e8199b572f2035b7749cba276ece3a26630d23e (patch)
treef09feeed6a0fe39d027b1908aa63ea6b35e4b631 /src/test/ui/typeof
parentAdding upstream version 1.66.0+dfsg1. (diff)
downloadrustc-4e8199b572f2035b7749cba276ece3a26630d23e.tar.xz
rustc-4e8199b572f2035b7749cba276ece3a26630d23e.zip
Adding upstream version 1.67.1+dfsg1.upstream/1.67.1+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/typeof')
-rw-r--r--src/test/ui/typeof/issue-29184.rs3
-rw-r--r--src/test/ui/typeof/issue-29184.stderr14
-rw-r--r--src/test/ui/typeof/issue-42060.rs11
-rw-r--r--src/test/ui/typeof/issue-42060.stderr32
4 files changed, 60 insertions, 0 deletions
diff --git a/src/test/ui/typeof/issue-29184.rs b/src/test/ui/typeof/issue-29184.rs
new file mode 100644
index 000000000..c77e364c3
--- /dev/null
+++ b/src/test/ui/typeof/issue-29184.rs
@@ -0,0 +1,3 @@
+fn main() {
+ let x: typeof(92) = 92; //~ ERROR `typeof` is a reserved keyword
+}
diff --git a/src/test/ui/typeof/issue-29184.stderr b/src/test/ui/typeof/issue-29184.stderr
new file mode 100644
index 000000000..75b6c64f2
--- /dev/null
+++ b/src/test/ui/typeof/issue-29184.stderr
@@ -0,0 +1,14 @@
+error[E0516]: `typeof` is a reserved keyword but unimplemented
+ --> $DIR/issue-29184.rs:2:12
+ |
+LL | let x: typeof(92) = 92;
+ | ^^^^^^^^^^ reserved keyword
+ |
+help: consider replacing `typeof(...)` with an actual type
+ |
+LL | let x: i32 = 92;
+ | ~~~
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0516`.
diff --git a/src/test/ui/typeof/issue-42060.rs b/src/test/ui/typeof/issue-42060.rs
new file mode 100644
index 000000000..1740b2383
--- /dev/null
+++ b/src/test/ui/typeof/issue-42060.rs
@@ -0,0 +1,11 @@
+fn main() {
+ let thing = ();
+ let other: typeof(thing) = thing; //~ ERROR attempt to use a non-constant value in a constant
+ //~^ ERROR `typeof` is a reserved keyword but unimplemented [E0516]
+}
+
+fn f(){
+ let q = 1;
+ <typeof(q)>::N //~ ERROR attempt to use a non-constant value in a constant
+ //~^ ERROR `typeof` is a reserved keyword but unimplemented [E0516]
+}
diff --git a/src/test/ui/typeof/issue-42060.stderr b/src/test/ui/typeof/issue-42060.stderr
new file mode 100644
index 000000000..effcbe4d7
--- /dev/null
+++ b/src/test/ui/typeof/issue-42060.stderr
@@ -0,0 +1,32 @@
+error[E0435]: attempt to use a non-constant value in a constant
+ --> $DIR/issue-42060.rs:3:23
+ |
+LL | let thing = ();
+ | --------- help: consider using `const` instead of `let`: `const thing`
+LL | let other: typeof(thing) = thing;
+ | ^^^^^ non-constant value
+
+error[E0435]: attempt to use a non-constant value in a constant
+ --> $DIR/issue-42060.rs:9:13
+ |
+LL | let q = 1;
+ | ----- help: consider using `const` instead of `let`: `const q`
+LL | <typeof(q)>::N
+ | ^ non-constant value
+
+error[E0516]: `typeof` is a reserved keyword but unimplemented
+ --> $DIR/issue-42060.rs:3:16
+ |
+LL | let other: typeof(thing) = thing;
+ | ^^^^^^^^^^^^^ reserved keyword
+
+error[E0516]: `typeof` is a reserved keyword but unimplemented
+ --> $DIR/issue-42060.rs:9:6
+ |
+LL | <typeof(q)>::N
+ | ^^^^^^^^^ reserved keyword
+
+error: aborting due to 4 previous errors
+
+Some errors have detailed explanations: E0435, E0516.
+For more information about an error, try `rustc --explain E0435`.