about summary refs log tree commit diff
path: root/src/tools/rustfmt/tests/source
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-24 06:30:10 +0000
committerbors <bors@rust-lang.org>2023-10-24 06:30:10 +0000
commitcc13d045f42e2cf2359bda28f0273e42488b168d (patch)
tree373e61763313b41349bafb994870b8ac5d555c39 /src/tools/rustfmt/tests/source
parentd32b1583dff13eba9b8e3e79a59fcd8b08b7635f (diff)
parentddc76e232aac96d7ca30735aa78d9ea8ae43d721 (diff)
downloadrust-cc13d045f42e2cf2359bda28f0273e42488b168d.tar.gz
rust-cc13d045f42e2cf2359bda28f0273e42488b168d.zip
Auto merge of #3138 - rust-lang:rustup-2023-10-24, r=RalfJung
Automatic Rustup
Diffstat (limited to 'src/tools/rustfmt/tests/source')
-rw-r--r--src/tools/rustfmt/tests/source/issue-3984.rs12
-rw-r--r--src/tools/rustfmt/tests/source/issue-4808.rs13
-rw-r--r--src/tools/rustfmt/tests/source/issue-5655/one.rs9
-rw-r--r--src/tools/rustfmt/tests/source/issue-5655/two.rs9
-rw-r--r--src/tools/rustfmt/tests/source/issue-5791.rs3
-rw-r--r--src/tools/rustfmt/tests/source/issue-5835.rs8
-rw-r--r--src/tools/rustfmt/tests/source/issue-5852/default.rs104
-rw-r--r--src/tools/rustfmt/tests/source/issue-5852/horizontal.rs106
-rw-r--r--src/tools/rustfmt/tests/source/issue-5852/horizontal_vertical.rs106
-rw-r--r--src/tools/rustfmt/tests/source/issue-5852/issue_example.rs8
-rw-r--r--src/tools/rustfmt/tests/source/issue-5852/split.rs111
-rw-r--r--src/tools/rustfmt/tests/source/issue-5852/vertical.rs106
-rw-r--r--src/tools/rustfmt/tests/source/issue-5935.rs9
-rw-r--r--src/tools/rustfmt/tests/source/issue_5721.rs8
-rw-r--r--src/tools/rustfmt/tests/source/issue_5730.rs3
-rw-r--r--src/tools/rustfmt/tests/source/issue_5735.rs6
-rw-r--r--src/tools/rustfmt/tests/source/issue_5882.rs7
-rw-r--r--src/tools/rustfmt/tests/source/let_chains.rs121
-rw-r--r--src/tools/rustfmt/tests/source/let_else.rs20
-rw-r--r--src/tools/rustfmt/tests/source/let_else_v2.rs56
-rw-r--r--src/tools/rustfmt/tests/source/match.rs3
-rw-r--r--src/tools/rustfmt/tests/source/non-lifetime-binders.rs10
-rw-r--r--src/tools/rustfmt/tests/source/skip_macro_invocations/config_file.rs9
23 files changed, 847 insertions, 0 deletions
diff --git a/src/tools/rustfmt/tests/source/issue-3984.rs b/src/tools/rustfmt/tests/source/issue-3984.rs
new file mode 100644
index 00000000000..c9bcfa40635
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-3984.rs
@@ -0,0 +1,12 @@
+use a::{item /* comment */};
+use b::{
+    a,
+    // comment
+    item,
+};
+use c::item /* comment */;
+use d::item; // really long comment (with `use` exactly 100 characters) ____________________________
+
+use std::e::{/* it's a comment! */ bar /* and another */};
+use std::f::{/* it's a comment! */ bar};
+use std::g::{bar /* and another */};
diff --git a/src/tools/rustfmt/tests/source/issue-4808.rs b/src/tools/rustfmt/tests/source/issue-4808.rs
new file mode 100644
index 00000000000..93076edcdce
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-4808.rs
@@ -0,0 +1,13 @@
+trait Trait {
+    fn method(&self) {}
+}
+
+impl<F: Fn() -> T, T> Trait for F {}
+
+impl Trait for f32 {}
+
+fn main() {
+    || 10. .method();
+    || .. .method();
+    || 1.. .method();
+}
diff --git a/src/tools/rustfmt/tests/source/issue-5655/one.rs b/src/tools/rustfmt/tests/source/issue-5655/one.rs
new file mode 100644
index 00000000000..1758ec56f8b
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5655/one.rs
@@ -0,0 +1,9 @@
+// rustfmt-version: One
+
+fn foo<T>(_: T)
+where
+    T: std::fmt::Debug,
+
+    T: std::fmt::Display,
+{
+}
diff --git a/src/tools/rustfmt/tests/source/issue-5655/two.rs b/src/tools/rustfmt/tests/source/issue-5655/two.rs
new file mode 100644
index 00000000000..e37ebbea8af
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5655/two.rs
@@ -0,0 +1,9 @@
+// rustfmt-version: Two
+
+fn foo<T>(_: T)
+where
+    T: std::fmt::Debug,
+
+    T: std::fmt::Display,
+{
+}
diff --git a/src/tools/rustfmt/tests/source/issue-5791.rs b/src/tools/rustfmt/tests/source/issue-5791.rs
new file mode 100644
index 00000000000..40bc6daa9f9
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5791.rs
@@ -0,0 +1,3 @@
+pub fn main() {
+    0. .to_string();
+}
diff --git a/src/tools/rustfmt/tests/source/issue-5835.rs b/src/tools/rustfmt/tests/source/issue-5835.rs
new file mode 100644
index 00000000000..3e4da3492ce
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5835.rs
@@ -0,0 +1,8 @@
+// rustfmt-wrap_comments: true
+
+/// .   a
+pub fn foo() {}
+
+pub fn main() {
+    // .   a
+}
diff --git a/src/tools/rustfmt/tests/source/issue-5852/default.rs b/src/tools/rustfmt/tests/source/issue-5852/default.rs
new file mode 100644
index 00000000000..df84f8f58e1
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5852/default.rs
@@ -0,0 +1,104 @@
+use std::{
+    fs,
+    // (temporarily commented, we'll need this again in a second) io,
+};
+
+use foo::{
+    self // this is important
+};
+
+use foo :: bar
+;
+
+use foo::{bar};
+
+use foo::{
+    bar
+    // abc
+};
+
+use foo::{
+    bar,
+    // abc
+};
+
+use foo::{
+    // 345
+    bar
+};
+
+use foo::{
+    self
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+};
+
+use foo::{
+    // 345
+    self
+};
+
+use foo::{
+    self // a
+        ,
+};
+
+use foo::{ self /* a */ };
+
+use foo::{ self /* a */, };
+
+use foo::{
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    // abc
+    bar,
+    abc
+};
+
+use foo::{
+    bar,
+    // abc
+    abc
+};
+
+use foo::{
+    bar,
+    abc
+    // abc
+};
+
+use foo::{
+    bar,
+    abc,
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        // 123
+        xyz
+    }
+};
+
+use path::{self /*comment*/,};
diff --git a/src/tools/rustfmt/tests/source/issue-5852/horizontal.rs b/src/tools/rustfmt/tests/source/issue-5852/horizontal.rs
new file mode 100644
index 00000000000..63bfb7e57ce
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5852/horizontal.rs
@@ -0,0 +1,106 @@
+// rustfmt-imports_layout: Horizontal
+
+use std::{
+    fs,
+    // (temporarily commented, we'll need this again in a second) io,
+};
+
+use foo::{
+    self // this is important
+};
+
+use foo :: bar
+;
+
+use foo::{bar};
+
+use foo::{
+    bar
+    // abc
+};
+
+use foo::{
+    bar,
+    // abc
+};
+
+use foo::{
+    // 345
+    bar
+};
+
+use foo::{
+    self
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+};
+
+use foo::{
+    // 345
+    self
+};
+
+use foo::{
+    self // a
+        ,
+};
+
+use foo::{ self /* a */ };
+
+use foo::{ self /* a */, };
+
+use foo::{
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    // abc
+    bar,
+    abc
+};
+
+use foo::{
+    bar,
+    // abc
+    abc
+};
+
+use foo::{
+    bar,
+    abc
+    // abc
+};
+
+use foo::{
+    bar,
+    abc,
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        // 123
+        xyz
+    }
+};
+
+use path::{self /*comment*/,};
diff --git a/src/tools/rustfmt/tests/source/issue-5852/horizontal_vertical.rs b/src/tools/rustfmt/tests/source/issue-5852/horizontal_vertical.rs
new file mode 100644
index 00000000000..3f3ce066909
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5852/horizontal_vertical.rs
@@ -0,0 +1,106 @@
+// rustfmt-imports_layout: HorizontalVertical
+
+use std::{
+    fs,
+    // (temporarily commented, we'll need this again in a second) io,
+};
+
+use foo::{
+    self // this is important
+};
+
+use foo :: bar
+;
+
+use foo::{bar};
+
+use foo::{
+    bar
+    // abc
+};
+
+use foo::{
+    bar,
+    // abc
+};
+
+use foo::{
+    // 345
+    bar
+};
+
+use foo::{
+    self
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+};
+
+use foo::{
+    // 345
+    self
+};
+
+use foo::{
+    self // a
+        ,
+};
+
+use foo::{ self /* a */ };
+
+use foo::{ self /* a */, };
+
+use foo::{
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    // abc
+    bar,
+    abc
+};
+
+use foo::{
+    bar,
+    // abc
+    abc
+};
+
+use foo::{
+    bar,
+    abc
+    // abc
+};
+
+use foo::{
+    bar,
+    abc,
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        // 123
+        xyz
+    }
+};
+
+use path::{self /*comment*/,};
diff --git a/src/tools/rustfmt/tests/source/issue-5852/issue_example.rs b/src/tools/rustfmt/tests/source/issue-5852/issue_example.rs
new file mode 100644
index 00000000000..20c2b764011
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5852/issue_example.rs
@@ -0,0 +1,8 @@
+use std::{
+    fs,
+    // (temporarily commented, we'll need this again in a second) io,
+};
+
+use foo::{
+    self // this is important
+};
diff --git a/src/tools/rustfmt/tests/source/issue-5852/split.rs b/src/tools/rustfmt/tests/source/issue-5852/split.rs
new file mode 100644
index 00000000000..14e9ea1b6ca
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5852/split.rs
@@ -0,0 +1,111 @@
+// rustfmt-imports_granularity: Item
+
+use std::{
+    fs,
+    // (temporarily commented, we'll need this again in a second) io,
+};
+
+use foo::{
+    self // this is important
+};
+
+use foo :: bar
+;
+
+use foo::{bar};
+
+use foo::{
+    bar
+    // abc
+};
+
+use foo::{
+    bar,
+    // abc
+};
+
+use foo::{
+    // 345
+    bar
+};
+
+use foo::{
+    self
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+};
+
+use foo::{
+    // 345
+    self
+};
+
+use foo::{
+    self // a
+        ,
+};
+
+use foo::{ self /* a */ };
+
+use foo::{ self /* a */, };
+
+use foo::{
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    bar,
+    abc
+};
+
+use foo::{
+    // abc
+    bar,
+    abc
+};
+
+use foo::{
+    bar,
+    // abc
+    abc
+};
+
+use foo::{
+    bar,
+    abc
+    // abc
+};
+
+use foo::{
+    bar,
+    abc,
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        // 123
+        xyz
+    }
+};
+
+use path::{self /*comment*/,};
diff --git a/src/tools/rustfmt/tests/source/issue-5852/vertical.rs b/src/tools/rustfmt/tests/source/issue-5852/vertical.rs
new file mode 100644
index 00000000000..b9ba99889ac
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5852/vertical.rs
@@ -0,0 +1,106 @@
+// rustfmt-imports_layout: Vertical
+
+use std::{
+    fs,
+    // (temporarily commented, we'll need this again in a second) io,
+};
+
+use foo::{
+    self // this is important
+};
+
+use foo :: bar
+;
+
+use foo::{bar};
+
+use foo::{
+    bar
+    // abc
+};
+
+use foo::{
+    bar,
+    // abc
+};
+
+use foo::{
+    // 345
+    bar
+};
+
+use foo::{
+    self
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+};
+
+use foo::{
+    // 345
+    self
+};
+
+use foo::{
+    self // a
+        ,
+};
+
+use foo::{ self /* a */ };
+
+use foo::{ self /* a */, };
+
+use foo::{
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    // abc
+    bar,
+    abc
+};
+
+use foo::{
+    bar,
+    // abc
+    abc
+};
+
+use foo::{
+    bar,
+    abc
+    // abc
+};
+
+use foo::{
+    bar,
+    abc,
+    // abc
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        xyz
+        // 123
+    }
+};
+
+use foo::{
+    self,
+    // abc
+    abc::{
+        // 123
+        xyz
+    }
+};
+
+use path::{self /*comment*/,};
diff --git a/src/tools/rustfmt/tests/source/issue-5935.rs b/src/tools/rustfmt/tests/source/issue-5935.rs
new file mode 100644
index 00000000000..a1aac05627a
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue-5935.rs
@@ -0,0 +1,9 @@
+struct Regs<
+    const BEGIN: u64,
+    const END: u64,
+    const DIM: usize,
+    const N: usize = { (END - BEGIN) as usize / (8 * DIM) + 1 },
+>
+{
+    _foo: u64,
+}
\ No newline at end of file
diff --git a/src/tools/rustfmt/tests/source/issue_5721.rs b/src/tools/rustfmt/tests/source/issue_5721.rs
new file mode 100644
index 00000000000..e5ae9612c98
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue_5721.rs
@@ -0,0 +1,8 @@
+#![feature(non_lifetime_binders)]
+#![allow(incomplete_features)]
+
+trait Other<U: ?Sized> {}
+
+trait Trait<U> 
+where
+    for<T> U: Other<T> {}
diff --git a/src/tools/rustfmt/tests/source/issue_5730.rs b/src/tools/rustfmt/tests/source/issue_5730.rs
new file mode 100644
index 00000000000..9a3f4f0d07a
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue_5730.rs
@@ -0,0 +1,3 @@
+macro_rules! statement {
+    () => {;};
+}
diff --git a/src/tools/rustfmt/tests/source/issue_5735.rs b/src/tools/rustfmt/tests/source/issue_5735.rs
new file mode 100644
index 00000000000..7708d028bf5
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue_5735.rs
@@ -0,0 +1,6 @@
+fn find_errors(mut self) {
+	let errors: Vec<> = vec!{
+		#[debug_format = "A({})"]
+		struct A {}
+	};
+}
diff --git a/src/tools/rustfmt/tests/source/issue_5882.rs b/src/tools/rustfmt/tests/source/issue_5882.rs
new file mode 100644
index 00000000000..e36f9965438
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/issue_5882.rs
@@ -0,0 +1,7 @@
+macro_rules!foo{}
+macro_rules!bar{/*comment*/}
+macro_rules!baz{//comment
+}
+macro_rules!foobar{
+//comment
+}
diff --git a/src/tools/rustfmt/tests/source/let_chains.rs b/src/tools/rustfmt/tests/source/let_chains.rs
new file mode 100644
index 00000000000..b7c1f811096
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/let_chains.rs
@@ -0,0 +1,121 @@
+fn main() {
+    if let x = x && x {}
+
+    if xxx && let x = x {}
+
+    if aaaaaaaaaaaaaaaaaaaaa &&  aaaaaaaaaaaaaaa && aaaaaaaaa && let Some(x) = xxxxxxxxxxxx && aaaaaaa && let None = aaaaaaaaaa {}
+
+    if aaaaaaaaaaaaaaaaaaaaa &&  aaaaaaaaaaaaaaa && aaaaaaaaa && let Some(x) = xxxxxxxxxxxx && aaaaaaa && let None = aaaaaaaaaa {}
+
+    if let Some(Struct { x:TS(1,2) }) = path::to::<_>(hehe)
+        && let [Simple, people] = /* get ready */ create_universe(/* hi */  GreatPowers).initialize_badminton().populate_swamps() &&
+        let    everybody    =    (Loops { hi /*hi*/  , ..loopy() }) && summons::triumphantly() { todo!() }
+
+    if let XXXXXXXXX { xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, yyyyyyyyyyyyy, zzzzzzzzzzzzz} = xxxxxxx()
+    && let Foo = bar() { todo!() }
+}
+
+fn test_single_line_let_chain() {
+    // first item in let-chain is an ident
+    if a && let Some(b) = foo() {
+    }
+
+    // first item in let-chain is a unary ! with an ident
+    let unary_not = if !from_hir_call
+        && let Some(p) = parent
+    {
+    };
+
+    // first item in let-chain is a unary * with an ident
+    let unary_deref = if *some_deref
+        && let Some(p) = parent
+    {
+    };
+
+    // first item in let-chain is a unary - (neg) with an ident
+    let unary_neg = if -some_ident
+        && let Some(p) = parent
+    {
+    };
+
+    // first item in let-chain is a try (?) with an ident
+    let try_ = if some_try?
+        && let Some(p) = parent
+    {
+    };
+
+    // first item in let-chain is an ident wrapped in parens
+    let in_parens = if (some_ident)
+        && let Some(p) = parent
+    {
+    };
+
+    // first item in let-chain is a ref & with an ident
+    let _ref = if &some_ref
+        && let Some(p) = parent
+    {
+    };
+
+    // first item in let-chain is a ref &mut with an ident
+    let mut_ref = if &mut some_ref
+        && let Some(p) = parent
+    {
+    };
+
+    // chain unary ref and try
+    let chain_of_unary_ref_and_try = if !&*some_ref?
+        && let Some(p) = parent {
+    };
+}
+
+fn test_multi_line_let_chain() {
+    // Can only single line the let-chain if the first item is an ident
+    if let Some(x) = y && a {
+
+    }
+
+    // More than one let-chain must be formatted on multiple lines
+    if let Some(x) = y && let Some(a) = b {
+
+    }
+
+    // The ident isn't long enough so we don't wrap the first let-chain
+    if a && let Some(x) = y && let Some(a) = b {
+
+    }
+
+    // The ident is long enough so both let-chains are wrapped
+    if aaa && let Some(x) = y && let Some(a) = b {
+
+    }
+
+    // function call
+    if a() && let Some(x) = y {
+
+    }
+
+    // bool literal
+    if true && let Some(x) = y {
+
+    }
+
+    // cast to a bool
+    if 1 as bool && let Some(x) = y {
+
+    }
+
+    // matches! macro call
+    if matches!(a, some_type) && let Some(x) = y {
+
+    }
+
+    // block expression returning bool
+    if { true } && let Some(x) = y {
+
+    }
+
+    // field access
+    if a.x && let Some(x) = y {
+
+    }
+}
diff --git a/src/tools/rustfmt/tests/source/let_else.rs b/src/tools/rustfmt/tests/source/let_else.rs
index 85b3604ad3c..cb2859e805d 100644
--- a/src/tools/rustfmt/tests/source/let_else.rs
+++ b/src/tools/rustfmt/tests/source/let_else.rs
@@ -160,3 +160,23 @@ fn with_trailing_try_operator() {
     // Maybe this is a workaround?
     let Ok(Some(next_bucket)) = ranking_rules[cur_ranking_rule_index].next_bucket(ctx, logger, &ranking_rule_universes[cur_ranking_rule_index]) else { return };
 }
+
+fn issue5901() {
+    #[cfg(target_os = "linux")]
+    let Some(x) = foo else { todo!() };
+
+    #[cfg(target_os = "linux")]
+    // Some comments between attributes and let-else statement
+    let Some(x) = foo else { todo!() };
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Some(x) = foo else { todo!() };
+
+    // The else block will be multi-lined because attributes and comments before `let`
+    // are included when calculating max width
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    // Some comments between attributes and let-else statement
+    let Some(x) = foo() else { todo!() };
+}
diff --git a/src/tools/rustfmt/tests/source/let_else_v2.rs b/src/tools/rustfmt/tests/source/let_else_v2.rs
new file mode 100644
index 00000000000..a420fbcf95b
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/let_else_v2.rs
@@ -0,0 +1,56 @@
+// rustfmt-version: Two
+// rustfmt-single_line_let_else_max_width: 100
+
+fn issue5901() {
+    #[cfg(target_os = "linux")]
+    let Some(x) = foo else { todo!() };
+
+    #[cfg(target_os = "linux")]
+    // Some comments between attributes and let-else statement
+    let Some(x) = foo else { todo!() };
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Some(x) = foo else { todo!() };
+
+    // The else block is multi-lined
+    #[cfg(target_os = "linux")]
+    let Some(x) = foo else { return; };
+
+    // The else block will be single-lined because attributes and comments before `let`
+    // are no longer included when calculating max width
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    // Some comments between attributes and let-else statement
+    let Some(x) = foo else { todo!() };
+
+    // Some more test cases for v2 formatting with attributes
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Some(x) = opt
+    // pre else keyword line-comment
+    else { return; };
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Some(x) = opt else
+    // post else keyword line-comment
+    { return; };
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Foo {x: Bar(..), y: FooBar(..), z: Baz(..)} = opt else {
+        return;
+    };
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Some(Ok((Message::ChangeColor(super::color::Color::Rgb(r, g, b)), Point { x, y, z }))) = opt else {
+        return;
+    };
+
+    #[cfg(target_os = "linux")]
+    #[cfg(target_arch = "x86_64")]
+    let Some(x) = very_very_very_very_very_very_very_very_very_very_very_very_long_expression_in_assign_rhs() else { return; };
+}
diff --git a/src/tools/rustfmt/tests/source/match.rs b/src/tools/rustfmt/tests/source/match.rs
index b5dc9957a2c..d1d8d7f2c36 100644
--- a/src/tools/rustfmt/tests/source/match.rs
+++ b/src/tools/rustfmt/tests/source/match.rs
@@ -292,6 +292,9 @@ fn guards() {
         aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
             if fooooooooooooooooooooo &&
                (bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb || cccccccccccccccccccccccccccccccccccccccc) => {}
+        Hi { friend } if let None = friend => {}
+        aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa if let Some(foooooooooooooo) = hiiiiiiiiiiiiiii => {}
+        aaaaaaaaaaaaaaaaa if let Superman { powers: Some(goteem), .. } = all::get_random_being::<Super>() => {}
     }
 }
 
diff --git a/src/tools/rustfmt/tests/source/non-lifetime-binders.rs b/src/tools/rustfmt/tests/source/non-lifetime-binders.rs
new file mode 100644
index 00000000000..c26393c8f89
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/non-lifetime-binders.rs
@@ -0,0 +1,10 @@
+fn main() where for<'a, T: Sized + 'a, const C: usize> [&'a T; C]: Sized { 
+    let x = for<T> 
+    || {};
+
+    let y: dyn 
+    for<T> Into<T>;
+    
+    let z: for<T> 
+    fn(T);
+}
diff --git a/src/tools/rustfmt/tests/source/skip_macro_invocations/config_file.rs b/src/tools/rustfmt/tests/source/skip_macro_invocations/config_file.rs
new file mode 100644
index 00000000000..e0f5ddf52e7
--- /dev/null
+++ b/src/tools/rustfmt/tests/source/skip_macro_invocations/config_file.rs
@@ -0,0 +1,9 @@
+// rustfmt-unstable: true
+// rustfmt-config: issue-5816.toml
+
+fn main() {
+    println!(             "Hello, world!");
+    let     x    =    
+7
+;
+}