Commit Graph

22 Commits

Author SHA1 Message Date
Loïc BRANSTETT
565710b33c Fix invalid special casing of the unreachable! macro 2022-01-31 17:09:31 +01:00
Amanieu d'Antras
fe9dc6e62a Change TerminatorKind::Abort to call the panic handler instead of
aborting immediately.

The panic handler is called with a special flag which forces it to abort
after calling the panic hook.
2022-01-17 00:39:34 +00:00
Amanieu d'Antras
528c4f9158 Add PanicInfo::can_unwind which indicates whether a panic handler is
allowed to trigger unwinding.
2022-01-17 00:39:28 +00:00
Deadbeef
f52eb4ca8b Add const-stability to panicking::panic_* fns
This allows us to use `panic!` and friends in a const-stable context
within libcore.
2021-12-23 19:03:43 +08:00
Jacob Pratt
6d2f8af1db Permit const assertions in stdlib 2021-11-08 17:06:00 -05:00
Gary Guo
cc4345a1c5 Clean up special function const checks
Mark them as const and `#[rustc_do_not_const_check]` instead of hard-coding
them in const-eval checks.
2021-10-25 17:32:01 +01:00
Pietro Albini
b63ab8005a update cfg(bootstrap) 2021-10-23 21:55:57 -04:00
Gary Guo
9370156957 Deduplicate panic_fmt
std's begin_panic_fmt and core's panic_fmt are duplicates.
Merge them to declutter code and remove a lang item.
2021-10-19 15:02:21 +01:00
Cameron Steffen
09b37d7433 Use ZST for fmt unsafety
This allows the format_args! macro to keep the pre-expansion code out of
the unsafe block without doing gymnastics with nested `match`
expressions. This reduces codegen.
2021-09-21 10:04:44 -05:00
Gary Guo
11c0e58c74 Allow panic!("{}", computed_str) in const fn. 2021-09-15 21:56:43 +01:00
Mark Rousskov
b4e7649d6d Bump stage0 compiler to 1.56 2021-09-08 20:51:05 -04:00
Cameron Steffen
975bc18481 Make Arguments constructors unsafe 2021-08-16 16:28:16 +00:00
Mara Bos
0b8033ad8d Improve comments about const panic handling
Co-authored-by: Ralf Jung <post@ralfj.de>
2021-07-28 16:18:38 +02:00
Mara Bos
b48274fd98 Use unreachable_unchecked in const_panic_fmt. 2021-07-28 16:12:30 +02:00
Mara Bos
f827d3e285 Make const panic!("..") work in Rust 2021.
During const eval, this replaces calls to core::panicking::panic_fmt and
std::panicking::being_panic_fmt with a call to a new const fn:
core::panicking::const_panic_fmt. That function uses
fmt::Arguments::as_str() to get the str and calls panic_str with that
instead.

panic!() invocations with formatting arguments are still not accepted,
as the creation of such a fmt::Arguments cannot be done in constant
functions right now.
2021-07-28 16:10:41 +02:00
hyd-dev
bc8093ed55 Fix panic message of assert_failed_inner 2021-03-13 18:50:43 +08:00
Mara Bos
eb18746bc6 Add assert_matches!(expr, pat). 2021-03-04 18:07:20 +01:00
Alphyr
a357d86b7c Hide internals items in documentation
Co-authored-by: Joshua Nelson <joshua@yottadb.com>
2021-02-14 23:39:43 +01:00
Benoît du Garreau
546d062820 Apply suggestions
- Move `assert_failed` to core::panicking`
- Make `assert_failed` use an enum instead of a string
2021-02-14 23:39:42 +01:00
Jake Goulding
dcef5ff372 Bump bootstrap compiler version 2020-11-19 19:23:36 -05:00
Mara Bos
4f7ffbf351 Fix const core::panic!(non_literal_str). 2020-10-22 18:41:35 +02:00
mark
2c31b45ae8 mv std libs to library/ 2020-07-27 19:51:13 -05:00