about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/rustdoc-gui/theme-change.goml6
-rw-r--r--tests/ui/const-generics/generic_const_exprs/inline-const-in-const-generic-defaults.rs9
-rw-r--r--tests/ui/suggestions/while-let-typo.rs2
-rw-r--r--tests/ui/suggestions/while-let-typo.stderr13
-rw-r--r--tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs9
-rw-r--r--tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.stderr14
6 files changed, 48 insertions, 5 deletions
diff --git a/tests/rustdoc-gui/theme-change.goml b/tests/rustdoc-gui/theme-change.goml
index ae694721389..e4b031b735e 100644
--- a/tests/rustdoc-gui/theme-change.goml
+++ b/tests/rustdoc-gui/theme-change.goml
@@ -3,9 +3,9 @@ go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
 set-local-storage: {"rustdoc-use-system-theme": "false", "rustdoc-theme": "dark"}
 reload:
 
-store-value: (background_light, "rgb(255, 255, 255)")
-store-value: (background_dark, "rgb(53, 53, 53)")
-store-value: (background_ayu, "rgb(15, 20, 25)")
+store-value: (background_light, "white")
+store-value: (background_dark, "#353535")
+store-value: (background_ayu, "#0f1419")
 
 click: "#settings-menu"
 wait-for: "#theme-ayu"
diff --git a/tests/ui/const-generics/generic_const_exprs/inline-const-in-const-generic-defaults.rs b/tests/ui/const-generics/generic_const_exprs/inline-const-in-const-generic-defaults.rs
new file mode 100644
index 00000000000..d81cba62754
--- /dev/null
+++ b/tests/ui/const-generics/generic_const_exprs/inline-const-in-const-generic-defaults.rs
@@ -0,0 +1,9 @@
+// check-pass
+
+#![feature(generic_const_exprs)]
+#![feature(inline_const)]
+#![allow(incomplete_features)]
+
+pub struct ConstDefaultUnstable<const N: usize = { const { 3 } }>;
+
+pub fn main() {}
diff --git a/tests/ui/suggestions/while-let-typo.rs b/tests/ui/suggestions/while-let-typo.rs
index dbbcdee3c19..21b254054bb 100644
--- a/tests/ui/suggestions/while-let-typo.rs
+++ b/tests/ui/suggestions/while-let-typo.rs
@@ -2,7 +2,7 @@ fn main() {
     let foo = Some(0);
     let bar = None;
     while Some(x) = foo {} //~ ERROR cannot find value `x` in this scope
-    while Some(foo) = bar {}
+    while Some(foo) = bar {} //~ ERROR mismatched types
     while 3 = foo {} //~ ERROR mismatched types
     while Some(3) = foo {} //~ ERROR invalid left-hand side of assignment
     while x = 5 {} //~ ERROR cannot find value `x` in this scope
diff --git a/tests/ui/suggestions/while-let-typo.stderr b/tests/ui/suggestions/while-let-typo.stderr
index 7cc2ed3149b..69a7e5761d4 100644
--- a/tests/ui/suggestions/while-let-typo.stderr
+++ b/tests/ui/suggestions/while-let-typo.stderr
@@ -21,6 +21,17 @@ LL |     while let x = 5 {}
    |           +++
 
 error[E0308]: mismatched types
+  --> $DIR/while-let-typo.rs:5:11
+   |
+LL |     while Some(foo) = bar {}
+   |           ^^^^^^^^^^^^^^^ expected `bool`, found `()`
+   |
+help: consider adding `let`
+   |
+LL |     while let Some(foo) = bar {}
+   |           +++
+
+error[E0308]: mismatched types
   --> $DIR/while-let-typo.rs:6:11
    |
 LL |     while 3 = foo {}
@@ -39,7 +50,7 @@ help: you might have meant to use pattern destructuring
 LL |     while let Some(3) = foo {}
    |           +++
 
-error: aborting due to 4 previous errors
+error: aborting due to 5 previous errors
 
 Some errors have detailed explanations: E0070, E0308, E0425.
 For more information about an error, try `rustc --explain E0070`.
diff --git a/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs b/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs
new file mode 100644
index 00000000000..3cb011dc06f
--- /dev/null
+++ b/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.rs
@@ -0,0 +1,9 @@
+// Previously, the while loop with an assignment statement (mistakenly) as the condition
+// which has a place expr as the LHS would trigger an ICE in typeck.
+// Reduced from https://github.com/rust-lang/rust/issues/112385.
+
+fn main() {
+    let foo = Some(());
+    while Some(foo) = None {}
+    //~^ ERROR mismatched types
+}
diff --git a/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.stderr b/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.stderr
new file mode 100644
index 00000000000..cf2648d0840
--- /dev/null
+++ b/tests/ui/typeck/issue-112385-while-assign-lhs-place-expr-ice.stderr
@@ -0,0 +1,14 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-112385-while-assign-lhs-place-expr-ice.rs:7:11
+   |
+LL |     while Some(foo) = None {}
+   |           ^^^^^^^^^^^^^^^^ expected `bool`, found `()`
+   |
+help: consider adding `let`
+   |
+LL |     while let Some(foo) = None {}
+   |           +++
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.