about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/test/incremental/issue-80691-bad-eval-cache.rs184
-rw-r--r--src/test/rustdoc-gui/README.md12
-rw-r--r--src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs10
-rw-r--r--src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr15
-rw-r--r--src/test/ui/issues/issue-83048.rs5
-rw-r--r--src/test/ui/issues/issue-83048.stderr9
-rw-r--r--src/test/ui/rfc-2091-track-caller/std-panic-locations.rs5
7 files changed, 235 insertions, 5 deletions
diff --git a/src/test/incremental/issue-80691-bad-eval-cache.rs b/src/test/incremental/issue-80691-bad-eval-cache.rs
new file mode 100644
index 00000000000..1a644fd88d6
--- /dev/null
+++ b/src/test/incremental/issue-80691-bad-eval-cache.rs
@@ -0,0 +1,184 @@
+// revisions: rfail1 rfail2
+// failure-status: 101
+// error-pattern: not implemented
+
+pub trait Interner {
+    type InternedVariableKinds;
+}
+
+trait RustIrDatabase<I: Interner> {
+    fn associated_ty_data(&self) -> AssociatedTyDatum<I>;
+    fn impl_datum(&self) -> ImplDatum<I>;
+}
+
+trait Fold<I: Interner> {
+    type Result;
+}
+impl<T, I: Interner> Fold<I> for Binders<T>
+where
+    T: HasInterner<Interner = I> + Fold<I>,
+    <T as Fold<I>>::Result: HasInterner<Interner = I>,
+    I: Interner,
+{
+    type Result = Binders<T::Result>;
+}
+impl<I: Interner> Fold<I> for WhereClause<I> {
+    type Result = Binders<WhereClause<I>>;
+}
+
+trait HasInterner {
+    type Interner: Interner;
+}
+impl<T: HasInterner> HasInterner for Vec<T> {
+    type Interner = T::Interner;
+}
+impl<T: HasInterner + ?Sized> HasInterner for &T {
+    type Interner = T::Interner;
+}
+
+pub struct VariableKind<I: Interner> {
+    _marker: std::marker::PhantomData<I>,
+}
+
+struct VariableKinds<I: Interner> {
+    _interned: I::InternedVariableKinds,
+}
+
+struct WhereClause<I: Interner> {
+    _marker: std::marker::PhantomData<I>,
+}
+impl<I: Interner> HasInterner for WhereClause<I> {
+    type Interner = I;
+}
+
+struct Binders<T> {
+    _marker: std::marker::PhantomData<T>,
+}
+impl<T: HasInterner> HasInterner for Binders<T> {
+    type Interner = T::Interner;
+}
+impl<T> Binders<&T> {
+    fn cloned(self) -> Binders<T> {
+        unimplemented!()
+    }
+}
+impl<T: HasInterner> Binders<T> {
+    fn map_ref<'a, U, OP>(&'a self, _op: OP) -> Binders<U>
+    where
+        OP: FnOnce(&'a T) -> U,
+        U: HasInterner<Interner = T::Interner>,
+    {
+        unimplemented!()
+    }
+}
+impl<T, I: Interner> Binders<T>
+where
+    T: Fold<I> + HasInterner<Interner = I>,
+    I: Interner,
+{
+    fn substitute(self) -> T::Result {
+        unimplemented!()
+    }
+}
+impl<V, U> IntoIterator for Binders<V>
+where
+    V: HasInterner + IntoIterator<Item = U>,
+    U: HasInterner<Interner = V::Interner>,
+{
+    type Item = Binders<U>;
+    type IntoIter = BindersIntoIterator<V>;
+    fn into_iter(self) -> Self::IntoIter {
+        unimplemented!()
+    }
+}
+struct BindersIntoIterator<V: HasInterner> {
+    _binders: VariableKinds<V::Interner>,
+}
+impl<V> Iterator for BindersIntoIterator<V>
+where
+    V: HasInterner + IntoIterator,
+    <V as IntoIterator>::Item: HasInterner<Interner = V::Interner>,
+{
+    type Item = Binders<<V as IntoIterator>::Item>;
+    fn next(&mut self) -> Option<Self::Item> {
+        unimplemented!()
+    }
+}
+
+struct ImplDatum<I: Interner> {
+    binders: Binders<ImplDatumBound<I>>,
+}
+struct ImplDatumBound<I: Interner> {
+    where_clauses: Vec<Binders<WhereClause<I>>>,
+}
+impl<I: Interner> HasInterner for ImplDatumBound<I> {
+    type Interner = I;
+}
+
+struct AssociatedTyDatum<I: Interner> {
+    binders: Binders<AssociatedTyDatumBound<I>>,
+}
+
+struct AssociatedTyDatumBound<I: Interner> {
+    where_clauses: Vec<Binders<WhereClause<I>>>,
+}
+impl<I: Interner> HasInterner for AssociatedTyDatumBound<I> {
+    type Interner = I;
+}
+
+struct ClauseBuilder<'me, I: Interner> {
+    db: &'me dyn RustIrDatabase<I>,
+}
+impl<'me, I: Interner> ClauseBuilder<'me, I> {
+    fn new() -> Self {
+        unimplemented!()
+    }
+    fn push_clause(&mut self, _conditions: impl Iterator<Item = Binders<Binders<WhereClause<I>>>>) {
+        unimplemented!()
+    }
+}
+
+pub(crate) struct Forest<I: Interner> {
+    _marker: std::marker::PhantomData<I>,
+}
+
+impl<I: Interner> Forest<I> {
+    fn iter_answers<'f>(&'f self) {
+        let builder = &mut ClauseBuilder::<I>::new();
+        let impl_datum = builder.db.impl_datum();
+        let impl_where_clauses = impl_datum
+            .binders
+            .map_ref(|b| &b.where_clauses)
+            .into_iter()
+            .map(|wc| wc.cloned().substitute());
+        let associated_ty = builder.db.associated_ty_data();
+        let assoc_ty_where_clauses = associated_ty
+            .binders
+            .map_ref(|b| &b.where_clauses)
+            .into_iter()
+            .map(|wc| wc.cloned().substitute());
+        builder.push_clause(impl_where_clauses.chain(assoc_ty_where_clauses));
+    }
+}
+
+pub struct SLGSolver {
+    pub(crate) forest: Forest<ChalkIr>,
+}
+impl SLGSolver {
+    fn new() -> Self {
+        unimplemented!()
+    }
+    fn solve_multiple(&self) {
+        let _answers = self.forest.iter_answers();
+    }
+}
+
+pub struct ChalkIr;
+impl Interner for ChalkIr {
+    type InternedVariableKinds = Vec<VariableKind<ChalkIr>>;
+}
+
+fn main() {
+    let solver = SLGSolver::new();
+    solver.solve_multiple();
+}
diff --git a/src/test/rustdoc-gui/README.md b/src/test/rustdoc-gui/README.md
new file mode 100644
index 00000000000..499a98a3d22
--- /dev/null
+++ b/src/test/rustdoc-gui/README.md
@@ -0,0 +1,12 @@
+The tests present here are used to test the generated HTML from rustdoc. The
+goal is to prevent unsound/unexpected GUI changes.
+
+This is using the [browser-ui-test] framework to do so. It works as follows:
+
+It wraps [puppeteer] to send commands to a web browser in order to navigate and
+test what's being currently displayed in the web page.
+
+You can find more information and its documentation in its [repository][browser-ui-test].
+
+[browser-ui-test]: https://github.com/GuillaumeGomez/browser-UI-test/
+[puppeteer]: https://pptr.dev/
diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
new file mode 100644
index 00000000000..3a6af00254c
--- /dev/null
+++ b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.rs
@@ -0,0 +1,10 @@
+// run-pass
+
+#![warn(disjoint_capture_drop_reorder)]
+
+fn main() {
+    if let a = "" {
+    //~^ WARNING: irrefutable `if let` pattern
+        drop(|_: ()| drop(a));
+    }
+}
diff --git a/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
new file mode 100644
index 00000000000..7e5da949cb2
--- /dev/null
+++ b/src/test/ui/closures/2229_closure_analysis/migrations/issue-78720.stderr
@@ -0,0 +1,15 @@
+warning: irrefutable `if let` pattern
+  --> $DIR/issue-78720.rs:6:5
+   |
+LL | /     if let a = "" {
+LL | |
+LL | |         drop(|_: ()| drop(a));
+LL | |     }
+   | |_____^
+   |
+   = note: `#[warn(irrefutable_let_patterns)]` on by default
+   = note: this pattern will always match, so the `if let` is useless
+   = help: consider replacing the `if let` with a `let`
+
+warning: 1 warning emitted
+
diff --git a/src/test/ui/issues/issue-83048.rs b/src/test/ui/issues/issue-83048.rs
new file mode 100644
index 00000000000..520ae974398
--- /dev/null
+++ b/src/test/ui/issues/issue-83048.rs
@@ -0,0 +1,5 @@
+// compile-flags: -Z unpretty=thir-tree
+
+pub fn main() {
+    break; //~ ERROR: `break` outside of a loop [E0268]
+}
diff --git a/src/test/ui/issues/issue-83048.stderr b/src/test/ui/issues/issue-83048.stderr
new file mode 100644
index 00000000000..62d67d75844
--- /dev/null
+++ b/src/test/ui/issues/issue-83048.stderr
@@ -0,0 +1,9 @@
+error[E0268]: `break` outside of a loop
+  --> $DIR/issue-83048.rs:4:5
+   |
+LL |     break;
+   |     ^^^^^ cannot `break` outside of a loop
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0268`.
diff --git a/src/test/ui/rfc-2091-track-caller/std-panic-locations.rs b/src/test/ui/rfc-2091-track-caller/std-panic-locations.rs
index 84b7c6701e5..f0850d5c1f1 100644
--- a/src/test/ui/rfc-2091-track-caller/std-panic-locations.rs
+++ b/src/test/ui/rfc-2091-track-caller/std-panic-locations.rs
@@ -3,7 +3,6 @@
 // revisions: default mir-opt
 //[mir-opt] compile-flags: -Zmir-opt-level=4
 
-#![feature(option_expect_none, option_unwrap_none)]
 #![allow(unconditional_panic)]
 
 //! Test that panic locations for `#[track_caller]` functions in std have the correct
@@ -32,10 +31,6 @@ fn main() {
     assert_panicked(|| nope.unwrap());
     assert_panicked(|| nope.expect(""));
 
-    let yep: Option<()> = Some(());
-    assert_panicked(|| yep.unwrap_none());
-    assert_panicked(|| yep.expect_none(""));
-
     let oops: Result<(), ()> = Err(());
     assert_panicked(|| oops.unwrap());
     assert_panicked(|| oops.expect(""));