about summary refs log tree commit diff
path: root/tests
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-02-27 00:55:14 +0000
committerbors <bors@rust-lang.org>2024-02-27 00:55:14 +0000
commit71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0 (patch)
treeae290c8dcb8654460eff1ca65a6ecafa8caf874d /tests
parent5c786a7fe307acf8b0143e1186c8799840da4095 (diff)
parentec5c5b7da8822122325d45625b9978fd3f05d84f (diff)
downloadrust-71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0.tar.gz
rust-71ffdf7ff7ac6df5f9f64de7e780b8345797e8a0.zip
Auto merge of #121655 - matthiaskrgr:rollup-qpx3kks, r=matthiaskrgr
Rollup of 4 pull requests

Successful merges:

 - #121598 (rename 'try' intrinsic to 'catch_unwind')
 - #121639 (Update books)
 - #121648 (Update Vec and String `{from,into}_raw_parts`-family docs)
 - #121651 (Properly emit `expected ;` on `#[attr] expr`)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'tests')
-rw-r--r--tests/assembly/wasm_exceptions.rs2
-rw-r--r--tests/codegen/wasm_exceptions.rs2
-rw-r--r--tests/run-make/wasm-exceptions-nostd/src/lib.rs2
-rw-r--r--tests/ui/interior-mutability/interior-mutability.stderr2
-rw-r--r--tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-1.rs (renamed from tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.rs)0
-rw-r--r--tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-1.stderr (renamed from tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.stderr)4
-rw-r--r--tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.rs15
-rw-r--r--tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr26
8 files changed, 47 insertions, 6 deletions
diff --git a/tests/assembly/wasm_exceptions.rs b/tests/assembly/wasm_exceptions.rs
index 2ca62a78688..45df444dca4 100644
--- a/tests/assembly/wasm_exceptions.rs
+++ b/tests/assembly/wasm_exceptions.rs
@@ -41,7 +41,7 @@ pub fn test_cleanup() {
 #[no_mangle]
 pub fn test_rtry() {
     unsafe {
-        core::intrinsics::r#try(|_| {
+        core::intrinsics::catch_unwind(|_| {
             may_panic();
         }, core::ptr::null_mut(), |data, exception| {
             log_number(data as usize);
diff --git a/tests/codegen/wasm_exceptions.rs b/tests/codegen/wasm_exceptions.rs
index 48a7357bfd8..66d2bbed709 100644
--- a/tests/codegen/wasm_exceptions.rs
+++ b/tests/codegen/wasm_exceptions.rs
@@ -35,7 +35,7 @@ pub fn test_cleanup() {
 #[no_mangle]
 pub fn test_rtry() {
     unsafe {
-        core::intrinsics::r#try(|_| {
+        core::intrinsics::catch_unwind(|_| {
             may_panic();
         }, core::ptr::null_mut(), |data, exception| {
             log_number(data as usize);
diff --git a/tests/run-make/wasm-exceptions-nostd/src/lib.rs b/tests/run-make/wasm-exceptions-nostd/src/lib.rs
index 7049d2fd9e0..9d336510469 100644
--- a/tests/run-make/wasm-exceptions-nostd/src/lib.rs
+++ b/tests/run-make/wasm-exceptions-nostd/src/lib.rs
@@ -39,7 +39,7 @@ pub extern "C" fn start() -> usize {
     let data = 0x1234usize as *mut u8; // Something to recognize
 
     unsafe {
-        core::intrinsics::r#try(|data: *mut u8| {
+        core::intrinsics::catch_unwind(|data: *mut u8| {
             let _log_on_drop = LogOnDrop;
 
             logging::log_str(&alloc::format!("`r#try` called with ptr {:?}", data));
diff --git a/tests/ui/interior-mutability/interior-mutability.stderr b/tests/ui/interior-mutability/interior-mutability.stderr
index 7b08a645405..29b250c1b07 100644
--- a/tests/ui/interior-mutability/interior-mutability.stderr
+++ b/tests/ui/interior-mutability/interior-mutability.stderr
@@ -15,7 +15,7 @@ note: required because it's used within this closure
    |
 LL |     catch_unwind(|| { x.set(23); });
    |                  ^^
-note: required by a bound in `catch_unwind`
+note: required by a bound in `std::panic::catch_unwind`
   --> $SRC_DIR/std/src/panic.rs:LL:COL
 
 error: aborting due to 1 previous error
diff --git a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.rs b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-1.rs
index a7412f51782..a7412f51782 100644
--- a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.rs
+++ b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-1.rs
diff --git a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.stderr b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-1.stderr
index dd0081cc2df..dcc2e92c47a 100644
--- a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body.stderr
+++ b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-1.stderr
@@ -1,5 +1,5 @@
 error: expected `;`, found `#`
-  --> $DIR/properly-recover-from-trailing-outer-attribute-in-body.rs:4:47
+  --> $DIR/properly-recover-from-trailing-outer-attribute-in-body-1.rs:4:47
    |
 LL |     #[cfg(feature = )]
    |     ------------------ only `;` terminated statements or tail expressions are allowed after this attribute
@@ -18,7 +18,7 @@ LL |     { [1, 2, 3].iter().map().collect::<String>() }
    |     +                                            +
 
 error: expected statement after outer attribute
-  --> $DIR/properly-recover-from-trailing-outer-attribute-in-body.rs:5:5
+  --> $DIR/properly-recover-from-trailing-outer-attribute-in-body-1.rs:5:5
    |
 LL |     #[attr]
    |     ^^^^^^^
diff --git a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.rs b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.rs
new file mode 100644
index 00000000000..ad9e7ad707b
--- /dev/null
+++ b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.rs
@@ -0,0 +1,15 @@
+// Issue #121647: recovery path leaving unemitted error behind
+
+macro_rules! the_macro {
+    ( $foo:stmt ; $bar:stmt ; ) => {
+        #[cfg()]
+        $foo //~ ERROR expected `;`, found `#`
+
+        #[cfg(bar)]
+        $bar
+    };
+}
+
+fn main() {
+    the_macro!( (); (); );
+}
diff --git a/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr
new file mode 100644
index 00000000000..7b9b8319674
--- /dev/null
+++ b/tests/ui/parser/attribute/properly-recover-from-trailing-outer-attribute-in-body-2.stderr
@@ -0,0 +1,26 @@
+error: expected `;`, found `#`
+  --> $DIR/properly-recover-from-trailing-outer-attribute-in-body-2.rs:6:13
+   |
+LL |         #[cfg()]
+   |         -------- only `;` terminated statements or tail expressions are allowed after this attribute
+LL |         $foo
+   |             ^ expected `;` here
+LL |
+LL |         #[cfg(bar)]
+   |         - unexpected token
+...
+LL |     the_macro!( (); (); );
+   |     --------------------- in this macro invocation
+   |
+   = note: this error originates in the macro `the_macro` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: add `;` here
+   |
+LL |         $foo;
+   |             +
+help: alternatively, consider surrounding the expression with a block
+   |
+LL |     the_macro!( { () }; (); );
+   |                 +    +
+
+error: aborting due to 1 previous error
+