Skip to content

Commit 22c0127

Browse files
committed
Remove braces from Rust 2015 panic macro
1 parent 6162529 commit 22c0127

File tree

5 files changed

+17
-29
lines changed

5 files changed

+17
-29
lines changed

library/std/src/panic.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@ use crate::thread::Result;
1414
#[cfg_attr(not(test), rustc_diagnostic_item = "std_panic_2015_macro")]
1515
#[rustc_macro_transparency = "semitransparent"]
1616
pub macro panic_2015 {
17-
() => ({
17+
() => (
1818
$crate::rt::begin_panic("explicit panic")
19-
}),
20-
($msg:expr $(,)?) => ({
19+
),
20+
($msg:expr $(,)?) => (
2121
$crate::rt::begin_panic($msg)
22-
}),
22+
),
2323
// Special-case the single-argument case for const_panic.
24-
("{}", $arg:expr $(,)?) => ({
24+
("{}", $arg:expr $(,)?) => (
2525
$crate::rt::panic_display(&$arg)
26-
}),
27-
($fmt:expr, $($arg:tt)+) => ({
26+
),
27+
($fmt:expr, $($arg:tt)+) => (
2828
$crate::rt::panic_fmt($crate::const_format_args!($fmt, $($arg)+))
29-
}),
29+
),
3030
}
3131

3232
#[doc(hidden)]

src/test/ui/block-result/issue-5500.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ fn main() {
22
&panic!()
33
//~^ ERROR mismatched types
44
//~| expected unit type `()`
5-
//~| found reference `&_`
6-
//~| expected `()`, found reference
5+
//~| found reference `&!`
6+
//~| expected `()`, found `&!`
77
}

src/test/ui/block-result/issue-5500.stderr

+2-7
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,10 @@ error[E0308]: mismatched types
44
LL | fn main() {
55
| - expected `()` because of default return type
66
LL | &panic!()
7-
| ^^^^^^^^^ expected `()`, found reference
7+
| ^^^^^^^^^ expected `()`, found `&!`
88
|
99
= note: expected unit type `()`
10-
found reference `&_`
11-
help: consider removing the borrow
12-
|
13-
LL - &panic!()
14-
LL + panic!()
15-
|
10+
found reference `&!`
1611

1712
error: aborting due to previous error
1813

src/test/ui/diverging-tuple-parts-39485.stderr

+4-11
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,13 @@
11
error[E0308]: mismatched types
22
--> $DIR/diverging-tuple-parts-39485.rs:8:5
33
|
4+
LL | fn g() {
5+
| - help: try adding a return type: `-> &!`
46
LL | &panic!()
5-
| ^^^^^^^^^ expected `()`, found reference
7+
| ^^^^^^^^^ expected `()`, found `&!`
68
|
79
= note: expected unit type `()`
8-
found reference `&_`
9-
help: try adding a return type
10-
|
11-
LL | fn g() -> &_ {
12-
| +++++
13-
help: consider removing the borrow
14-
|
15-
LL - &panic!()
16-
LL + panic!()
17-
|
10+
found reference `&!`
1811

1912
error[E0308]: mismatched types
2013
--> $DIR/diverging-tuple-parts-39485.rs:12:5

src/test/ui/issues/issue-5500-1.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ struct TrieMapIterator<'a> {
1111
fn main() {
1212
let a = 5;
1313
let _iter = TrieMapIterator{node: &a};
14-
_iter.node = &panic!()
14+
_iter.node = &{panic!()}
1515
}

0 commit comments

Comments
 (0)