about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/ui-fulldeps/obtain-borrowck.rs3
-rw-r--r--tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs6
-rw-r--r--tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr (renamed from tests/ui/feature-gates/feature-gate-pattern-complexity.stderr)8
-rw-r--r--tests/ui/feature-gates/feature-gate-pattern-complexity.rs6
-rw-r--r--tests/ui/lint/invalid_from_utf8.rs53
-rw-r--r--tests/ui/lint/invalid_from_utf8.stderr237
-rw-r--r--tests/ui/parser/raw/raw-idents.rs158
-rw-r--r--tests/ui/pattern/complexity_limit.rs2
-rw-r--r--tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs2
9 files changed, 421 insertions, 54 deletions
diff --git a/tests/ui-fulldeps/obtain-borrowck.rs b/tests/ui-fulldeps/obtain-borrowck.rs
index c6bec4f77a0..84f6970c83a 100644
--- a/tests/ui-fulldeps/obtain-borrowck.rs
+++ b/tests/ui-fulldeps/obtain-borrowck.rs
@@ -67,7 +67,6 @@ impl rustc_driver::Callbacks for CompilerCalls {
     fn after_analysis<'tcx>(&mut self, _compiler: &Compiler, tcx: TyCtxt<'tcx>) -> Compilation {
         tcx.sess.dcx().abort_if_errors();
         // Collect definition ids of MIR bodies.
-        let hir = tcx.hir();
         let mut bodies = Vec::new();
 
         let crate_items = tcx.hir_crate_items(());
@@ -79,7 +78,7 @@ impl rustc_driver::Callbacks for CompilerCalls {
 
         for id in crate_items.trait_items() {
             if matches!(tcx.def_kind(id.owner_id), DefKind::AssocFn) {
-                let trait_item = hir.trait_item(id);
+                let trait_item = tcx.hir_trait_item(id);
                 if let rustc_hir::TraitItemKind::Fn(_, trait_fn) = &trait_item.kind {
                     if let rustc_hir::TraitFn::Provided(_) = trait_fn {
                         bodies.push(trait_item.owner_id);
diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs
new file mode 100644
index 00000000000..d1f6f4755f0
--- /dev/null
+++ b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.rs
@@ -0,0 +1,6 @@
+// check that `pattern_complexity_limit` is feature-gated
+
+#![pattern_complexity_limit = "42"]
+//~^ ERROR: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests
+
+fn main() {}
diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr
index c05e6abb017..e6f17710e09 100644
--- a/tests/ui/feature-gates/feature-gate-pattern-complexity.stderr
+++ b/tests/ui/feature-gates/feature-gate-pattern-complexity-limit.stderr
@@ -1,8 +1,8 @@
-error[E0658]: the `#[pattern_complexity]` attribute is just used for rustc unit tests and will never be stable
-  --> $DIR/feature-gate-pattern-complexity.rs:3:1
+error[E0658]: the `#[pattern_complexity_limit]` attribute is just used for rustc unit tests and will never be stable
+  --> $DIR/feature-gate-pattern-complexity-limit.rs:3:1
    |
-LL | #![pattern_complexity = "42"]
-   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+LL | #![pattern_complexity_limit = "42"]
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable
    = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
diff --git a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs b/tests/ui/feature-gates/feature-gate-pattern-complexity.rs
deleted file mode 100644
index 43e9a00c9a7..00000000000
--- a/tests/ui/feature-gates/feature-gate-pattern-complexity.rs
+++ /dev/null
@@ -1,6 +0,0 @@
-// check that `pattern_complexity` is feature-gated
-
-#![pattern_complexity = "42"]
-//~^ ERROR: the `#[pattern_complexity]` attribute is just used for rustc unit tests
-
-fn main() {}
diff --git a/tests/ui/lint/invalid_from_utf8.rs b/tests/ui/lint/invalid_from_utf8.rs
index 2d1822a54ac..8f8000fe34d 100644
--- a/tests/ui/lint/invalid_from_utf8.rs
+++ b/tests/ui/lint/invalid_from_utf8.rs
@@ -1,7 +1,7 @@
 //@ check-pass
 
 #![feature(concat_bytes)]
-
+#![feature(inherent_str_constructors)]
 #![warn(invalid_from_utf8_unchecked)]
 #![warn(invalid_from_utf8)]
 
@@ -9,7 +9,9 @@ pub fn from_utf8_unchecked_mut() {
     // Valid
     unsafe {
         std::str::from_utf8_unchecked_mut(&mut [99, 108, 105, 112, 112, 121]);
+        str::from_utf8_unchecked_mut(&mut [99, 108, 105, 112, 112, 121]);
         std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']);
+        str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']);
 
         let x = 0xA0;
         std::str::from_utf8_unchecked_mut(&mut [0xC0, x]);
@@ -19,8 +21,12 @@ pub fn from_utf8_unchecked_mut() {
     unsafe {
         std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
         //~^ WARN calls to `std::str::from_utf8_unchecked_mut`
+        str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
+        //~^ WARN calls to `str::from_utf8_unchecked_mut`
         std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
         //~^ WARN calls to `std::str::from_utf8_unchecked_mut`
+        str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+        //~^ WARN calls to `str::from_utf8_unchecked_mut`
     }
 }
 
@@ -28,23 +34,35 @@ pub fn from_utf8_unchecked() {
     // Valid
     unsafe {
         std::str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]);
+        str::from_utf8_unchecked(&[99, 108, 105, 112, 112, 121]);
         std::str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']);
+        str::from_utf8_unchecked(&[b'c', b'l', b'i', b'p', b'p', b'y']);
         std::str::from_utf8_unchecked(b"clippy");
+        str::from_utf8_unchecked(b"clippy");
 
         let x = 0xA0;
         std::str::from_utf8_unchecked(&[0xC0, x]);
+        str::from_utf8_unchecked(&[0xC0, x]);
     }
 
     // Invalid
     unsafe {
         std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
         //~^ WARN calls to `std::str::from_utf8_unchecked`
+        str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
+        //~^ WARN calls to `str::from_utf8_unchecked`
         std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
         //~^ WARN calls to `std::str::from_utf8_unchecked`
+        str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+        //~^ WARN calls to `str::from_utf8_unchecked`
         std::str::from_utf8_unchecked(b"cl\x82ippy");
         //~^ WARN calls to `std::str::from_utf8_unchecked`
+        str::from_utf8_unchecked(b"cl\x82ippy");
+        //~^ WARN calls to `str::from_utf8_unchecked`
         std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
         //~^ WARN calls to `std::str::from_utf8_unchecked`
+        str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
+        //~^ WARN calls to `str::from_utf8_unchecked`
     }
 }
 
@@ -52,18 +70,25 @@ pub fn from_utf8_mut() {
     // Valid
     {
         std::str::from_utf8_mut(&mut [99, 108, 105, 112, 112, 121]);
+        str::from_utf8_mut(&mut [99, 108, 105, 112, 112, 121]);
         std::str::from_utf8_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']);
+        str::from_utf8_mut(&mut [b'c', b'l', b'i', b'p', b'p', b'y']);
 
         let x = 0xa0;
         std::str::from_utf8_mut(&mut [0xc0, x]);
+        str::from_utf8_mut(&mut [0xc0, x]);
     }
 
     // Invalid
     {
         std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
         //~^ WARN calls to `std::str::from_utf8_mut`
+        str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
+        //~^ WARN calls to `str::from_utf8_mut`
         std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
         //~^ WARN calls to `std::str::from_utf8_mut`
+        str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+        //~^ WARN calls to `str::from_utf8_mut`
     }
 }
 
@@ -71,23 +96,35 @@ pub fn from_utf8() {
     // Valid
     {
         std::str::from_utf8(&[99, 108, 105, 112, 112, 121]);
+        str::from_utf8(&[99, 108, 105, 112, 112, 121]);
         std::str::from_utf8(&[b'c', b'l', b'i', b'p', b'p', b'y']);
+        str::from_utf8(&[b'c', b'l', b'i', b'p', b'p', b'y']);
         std::str::from_utf8(b"clippy");
+        str::from_utf8(b"clippy");
 
         let x = 0xA0;
         std::str::from_utf8(&[0xC0, x]);
+        str::from_utf8(&[0xC0, x]);
     }
 
     // Invalid
     {
         std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
         //~^ WARN calls to `std::str::from_utf8`
+        str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
+        //~^ WARN calls to `str::from_utf8`
         std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
         //~^ WARN calls to `std::str::from_utf8`
+        str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+        //~^ WARN calls to `str::from_utf8`
         std::str::from_utf8(b"cl\x82ippy");
         //~^ WARN calls to `std::str::from_utf8`
+        str::from_utf8(b"cl\x82ippy");
+        //~^ WARN calls to `str::from_utf8`
         std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
         //~^ WARN calls to `std::str::from_utf8`
+        str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
+        //~^ WARN calls to `str::from_utf8`
     }
 }
 
@@ -95,25 +132,39 @@ pub fn from_utf8_with_indirections() {
     let mut a = [99, 108, 130, 105, 112, 112, 121];
     std::str::from_utf8_mut(&mut a);
     //~^ WARN calls to `std::str::from_utf8_mut`
+    str::from_utf8_mut(&mut a);
+    //~^ WARN calls to `str::from_utf8_mut`
     let mut b = &mut a;
     let mut c = b;
     std::str::from_utf8_mut(c);
     //~^ WARN calls to `std::str::from_utf8_mut`
+    str::from_utf8_mut(c);
+    //~^ WARN calls to `str::from_utf8_mut`
     let mut c = &[99, 108, 130, 105, 112, 112, 121];
     std::str::from_utf8(c);
     //~^ WARN calls to `std::str::from_utf8`
+    str::from_utf8(c);
+    //~^ WARN calls to `str::from_utf8`
     const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
     std::str::from_utf8(&INVALID_1);
     //~^ WARN calls to `std::str::from_utf8`
+    str::from_utf8(&INVALID_1);
+    //~^ WARN calls to `str::from_utf8`
     static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
     std::str::from_utf8(&INVALID_2);
     //~^ WARN calls to `std::str::from_utf8`
+    str::from_utf8(&INVALID_2);
+    //~^ WARN calls to `str::from_utf8`
     const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
     std::str::from_utf8(INVALID_3);
     //~^ WARN calls to `std::str::from_utf8`
+    str::from_utf8(INVALID_3);
+    //~^ WARN calls to `str::from_utf8`
     const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
     std::str::from_utf8(INVALID_4);
     //~^ WARN calls to `std::str::from_utf8`
+    str::from_utf8(INVALID_4);
+    //~^ WARN calls to `str::from_utf8`
 }
 
 fn main() {}
diff --git a/tests/ui/lint/invalid_from_utf8.stderr b/tests/ui/lint/invalid_from_utf8.stderr
index 07616e11801..715ecf56f21 100644
--- a/tests/ui/lint/invalid_from_utf8.stderr
+++ b/tests/ui/lint/invalid_from_utf8.stderr
@@ -1,5 +1,5 @@
-warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
-  --> $DIR/invalid_from_utf8.rs:20:9
+warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:22:9
    |
 LL |         std::str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@@ -12,48 +12,96 @@ note: the lint level is defined here
 LL | #![warn(invalid_from_utf8_unchecked)]
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8_unchecked_mut` with a invalid literal are undefined behavior
-  --> $DIR/invalid_from_utf8.rs:22:9
+warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:24:9
+   |
+LL |         str::from_utf8_unchecked_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+   |                                           |
+   |                                           the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:26:9
    |
 LL |         std::str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
    |                                                |
    |                                                the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
-  --> $DIR/invalid_from_utf8.rs:40:9
+warning: calls to `str::from_utf8_unchecked_mut` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:28:9
+   |
+LL |         str::from_utf8_unchecked_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+   |                                           |
+   |                                           the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:50:9
    |
 LL |         std::str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
    |                                        |
    |                                        the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
-  --> $DIR/invalid_from_utf8.rs:42:9
+warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:52:9
+   |
+LL |         str::from_utf8_unchecked(&[99, 108, 130, 105, 112, 112, 121]);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+   |                                   |
+   |                                   the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:54:9
    |
 LL |         std::str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
    |                                        |
    |                                        the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
-  --> $DIR/invalid_from_utf8.rs:44:9
+warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:56:9
+   |
+LL |         str::from_utf8_unchecked(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+   |                                   |
+   |                                   the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:58:9
    |
 LL |         std::str::from_utf8_unchecked(b"cl\x82ippy");
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
    |                                       |
    |                                       the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_unchecked` with a invalid literal are undefined behavior
-  --> $DIR/invalid_from_utf8.rs:46:9
+warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:60:9
+   |
+LL |         str::from_utf8_unchecked(b"cl\x82ippy");
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^-------------^
+   |                                  |
+   |                                  the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:62:9
    |
 LL |         std::str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
    |                                       |
    |                                       the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:63:9
+warning: calls to `str::from_utf8_unchecked` with an invalid literal are undefined behavior
+  --> $DIR/invalid_from_utf8.rs:64:9
+   |
+LL |         str::from_utf8_unchecked(concat_bytes!(b"cl", b"\x82ippy"));
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------^
+   |                                  |
+   |                                  the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:84:9
    |
 LL |         std::str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
@@ -66,56 +114,113 @@ note: the lint level is defined here
 LL | #![warn(invalid_from_utf8)]
    |         ^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:65:9
+warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:86:9
+   |
+LL |         str::from_utf8_mut(&mut [99, 108, 130, 105, 112, 112, 121]);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^----------------------------------^
+   |                                 |
+   |                                 the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:88:9
    |
 LL |         std::str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
    |                                      |
    |                                      the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:83:9
+warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:90:9
+   |
+LL |         str::from_utf8_mut(&mut [b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+   |         ^^^^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
+   |                                 |
+   |                                 the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:112:9
    |
 LL |         std::str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
    |         ^^^^^^^^^^^^^^^^^^^^^----------------------------------^
    |                              |
    |                              the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:85:9
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:114:9
+   |
+LL |         str::from_utf8(&[99, 108, 130, 105, 112, 112, 121]);
+   |         ^^^^^^^^^^^^^^^^----------------------------------^
+   |                         |
+   |                         the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:116:9
    |
 LL |         std::str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
    |         ^^^^^^^^^^^^^^^^^^^^^---------------------------------------------^
    |                              |
    |                              the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:87:9
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:118:9
+   |
+LL |         str::from_utf8(&[b'c', b'l', b'\x82', b'i', b'p', b'p', b'y']);
+   |         ^^^^^^^^^^^^^^^^---------------------------------------------^
+   |                         |
+   |                         the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:120:9
    |
 LL |         std::str::from_utf8(b"cl\x82ippy");
    |         ^^^^^^^^^^^^^^^^^^^^-------------^
    |                             |
    |                             the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:89:9
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:122:9
+   |
+LL |         str::from_utf8(b"cl\x82ippy");
+   |         ^^^^^^^^^^^^^^^-------------^
+   |                        |
+   |                        the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:124:9
    |
 LL |         std::str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
    |         ^^^^^^^^^^^^^^^^^^^^---------------------------------^
    |                             |
    |                             the literal was valid UTF-8 up to the 2 bytes
 
-warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:96:5
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:126:9
+   |
+LL |         str::from_utf8(concat_bytes!(b"cl", b"\x82ippy"));
+   |         ^^^^^^^^^^^^^^^---------------------------------^
+   |                        |
+   |                        the literal was valid UTF-8 up to the 2 bytes
+
+warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:133:5
    |
 LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
    |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8_mut(&mut a);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8_mut` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:100:5
+warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:135:5
+   |
+LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
+   |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8_mut(&mut a);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:139:5
    |
 LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
    |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
@@ -123,45 +228,99 @@ LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
 LL |     std::str::from_utf8_mut(c);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:103:5
+warning: calls to `str::from_utf8_mut` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:141:5
+   |
+LL |     let mut a = [99, 108, 130, 105, 112, 112, 121];
+   |                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8_mut(c);
+   |     ^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:144:5
    |
 LL |     let mut c = &[99, 108, 130, 105, 112, 112, 121];
    |                  ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8(c);
    |     ^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:106:5
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:146:5
+   |
+LL |     let mut c = &[99, 108, 130, 105, 112, 112, 121];
+   |                  ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8(c);
+   |     ^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:149:5
    |
 LL |     const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
    |                                ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8(&INVALID_1);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:109:5
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:151:5
+   |
+LL |     const INVALID_1: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+   |                                ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8(&INVALID_1);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:154:5
    |
 LL |     static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
    |                                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8(&INVALID_2);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:112:5
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:156:5
+   |
+LL |     static INVALID_2: [u8; 7] = [99, 108, 130, 105, 112, 112, 121];
+   |                                 ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8(&INVALID_2);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:159:5
    |
 LL |     const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
    |                                          ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8(INVALID_3);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: calls to `std::str::from_utf8` with a invalid literal always return an error
-  --> $DIR/invalid_from_utf8.rs:115:5
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:161:5
+   |
+LL |     const INVALID_3: &'static [u8; 7] = &[99, 108, 130, 105, 112, 112, 121];
+   |                                          ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8(INVALID_3);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: calls to `std::str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:164:5
    |
 LL |     const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
    |                                            ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
 LL |     std::str::from_utf8(INVALID_4);
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-warning: 19 warnings emitted
+warning: calls to `str::from_utf8` with an invalid literal always return an error
+  --> $DIR/invalid_from_utf8.rs:166:5
+   |
+LL |     const INVALID_4: &'static [u8; 7] = { &[99, 108, 130, 105, 112, 112, 121] };
+   |                                            ---------------------------------- the literal was valid UTF-8 up to the 2 bytes
+...
+LL |     str::from_utf8(INVALID_4);
+   |     ^^^^^^^^^^^^^^^^^^^^^^^^^
+
+warning: 38 warnings emitted
 
diff --git a/tests/ui/parser/raw/raw-idents.rs b/tests/ui/parser/raw/raw-idents.rs
new file mode 100644
index 00000000000..93015ee6c49
--- /dev/null
+++ b/tests/ui/parser/raw/raw-idents.rs
@@ -0,0 +1,158 @@
+//@ check-pass
+//@ revisions:e2015 e2018 e2021 e2024
+//@[e2015] edition:2015
+//@[e2018] edition:2018
+//@[e2021] edition:2021
+//@[e2024] edition:2024
+
+// Ensure that all (usable as identifier) keywords work as raw identifiers in all positions.
+// This was motivated by issue #137128, where `r#move`/`r#static`` did not work as `const` names
+// due to a parser check not acounting for raw identifiers.
+
+#![crate_type = "lib"]
+#![allow(dead_code, nonstandard_style)]
+
+// NOTE: It is vital to only use a `tt` fragment to avoid confusing
+// the parser with nonterminals that can mask bugs.
+
+macro_rules! tests {
+    ($kw:tt) => {
+        mod $kw {
+            mod const_item {
+                const $kw: () = ();
+            }
+            mod static_item {
+                static $kw: () = ();
+            }
+            mod fn_item {
+                fn $kw() {}
+            }
+            mod mod_and_use_item {
+                mod $kw {
+                    use super::$kw;
+                }
+            }
+            mod ty_alias_item {
+                type $kw = ();
+            }
+            mod struct_item {
+                struct $kw { $kw: () }
+            }
+            mod enum_item {
+                enum $kw { $kw }
+            }
+            mod union_item {
+                union $kw { $kw: () }
+            }
+            mod trait_item {
+                trait $kw {
+                    fn $kw() {}
+                }
+            }
+            mod generics_and_impl {
+                struct A<$kw>($kw);
+                enum B<$kw> { A($kw) }
+                trait Tr<$kw> {
+                    type $kw;
+                }
+
+                impl<$kw> Tr<$kw> for A<$kw> {
+                    type $kw = ();
+                }
+                impl<$kw> B<$kw> {}
+            }
+            mod extern_crate {
+                #[cfg(any())]
+                extern crate $kw;
+            }
+            mod body {
+                fn expr() {
+                    let $kw = 0;
+                    let b = $kw;
+                    assert_eq!($kw, b);
+                    type $kw = ();
+                    let $kw: $kw = ();
+                    let _ = $kw as $kw;
+                }
+                fn pat_const() {
+                    const $kw: u8 = 0;
+
+                    // Ensure that $kw actually matches the constant.
+                    #[forbid(unreachable_patterns)]
+                    match 1 {
+                        $kw => {}
+                        _ => {}
+                    }
+                }
+                fn pat_binding() {
+                    match 1 {
+                        $kw => {}
+                        _ => {}
+                    }
+                }
+            }
+        }
+    };
+}
+
+tests!(r#break);
+tests!(r#const);
+tests!(r#continue);
+tests!(r#else);
+tests!(r#enum);
+tests!(r#extern);
+tests!(r#false);
+tests!(r#fn);
+tests!(r#for);
+tests!(r#if);
+tests!(r#impl);
+tests!(r#in);
+tests!(r#let);
+tests!(r#loop);
+tests!(r#match);
+tests!(r#mod);
+tests!(r#move);
+tests!(r#mut);
+tests!(r#pub);
+tests!(r#ref);
+tests!(r#return);
+tests!(r#static);
+tests!(r#struct);
+tests!(r#trait);
+tests!(r#true);
+tests!(r#type);
+tests!(r#unsafe);
+tests!(r#use);
+tests!(r#where);
+tests!(r#while);
+tests!(r#abstract);
+tests!(r#become);
+tests!(r#box);
+tests!(r#do);
+tests!(r#final);
+tests!(r#macro);
+tests!(r#override);
+tests!(r#priv);
+tests!(r#typeof);
+tests!(r#unsized);
+tests!(r#virtual);
+tests!(r#yield);
+tests!(r#async);
+tests!(r#await);
+tests!(r#dyn);
+tests!(r#gen);
+tests!(r#try);
+
+// Weak keywords:
+tests!(auto);
+tests!(builtin);
+tests!(catch);
+tests!(default);
+tests!(macro_rules);
+tests!(raw);
+tests!(reuse);
+tests!(contract_ensures);
+tests!(contract_requires);
+tests!(safe);
+tests!(union);
+tests!(yeet);
diff --git a/tests/ui/pattern/complexity_limit.rs b/tests/ui/pattern/complexity_limit.rs
index c9a3f99bccd..7c127820511 100644
--- a/tests/ui/pattern/complexity_limit.rs
+++ b/tests/ui/pattern/complexity_limit.rs
@@ -1,5 +1,5 @@
 #![feature(rustc_attrs)]
-#![pattern_complexity = "10000"]
+#![pattern_complexity_limit = "10000"]
 
 #[derive(Default)]
 struct BaseCommand {
diff --git a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs
index 783512d5cca..44d1586ce4f 100644
--- a/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs
+++ b/tests/ui/pattern/usefulness/issue-118437-exponential-time-on-diagonal-match.rs
@@ -1,5 +1,5 @@
 #![feature(rustc_attrs)]
-#![pattern_complexity = "61"]
+#![pattern_complexity_limit = "61"]
 
 //@ check-pass
 struct BaseCommand {