rust/src/test/ui/consts
bors ff59ab127a Auto merge of #51366 - japaric:stable-panic-impl, r=Mark-Simulacrum
stabilize #[panic_handler]

closes #44489

### Update(2018-09-07)

This was proposed for stabilization in https://github.com/rust-lang/rust/issues/44489#issuecomment-398965881 and its FCP with disposition to merge / accept is nearly over. The summary of what's being stabilized can be found in https://github.com/rust-lang/rust/issues/44489#issuecomment-416645946

Documentation PRs:

- Reference. https://github.com/rust-lang-nursery/reference/pull/362
- Nomicon. https://github.com/rust-lang-nursery/nomicon/pull/75

---

`#[panic_implementation]` was implemented recently in #50338. `#[panic_implementation]` is basically the old `panic_fmt` language item but in a less error prone (\*) shape. There are still some issues and questions to sort out around this feature (cf. #44489) but this PR is meant to start a discussion about those issues / questions with the language team.

(\*) `panic_fmt` was not type checked; changes in its function signature caused serious, silent binary size regressions like the one observed in #43054

Some unresolved questions from #44489:

> Should the Display of PanicInfo format the panic information as "panicked at 'reason',
> src/main.rs:27:4", as "'reason', src/main.rs:27:4", or simply as "reason".

The current implementation formats `PanicInfo` as the first alternative, which is how panic messages are formatted by the `std` panic handler. The `Display` implementation is more than a convenience: `PanicInfo.message` is unstable so it's not possible to replicate the `Display` implementation on stable.

> Is this design compatible, or can it be extended to work, with unwinding implementations for
> no-std environments?

I believe @whitequark made more progress with unwinding in no-std since their last comment in #44489. Perhaps they can give us an update?

---

Another unresolved question is where this feature should be documented. The feature currently doesn't have any documentation.

cc @rust-lang/lang
cc @jackpot51 @alevy @phil-opp
2018-09-08 09:23:45 +00:00
..
auxiliary Restrict most uses of const_fn to min_const_fn 2018-08-31 08:40:00 +02:00
const-eval stabilize #[panic_handler] 2018-09-07 13:27:30 +02:00
min_const_fn Add test that min const fns can't call unstable min const fns even with the feature gate active 2018-08-31 08:40:00 +02:00
const-array-oob-arith.rs
const-array-oob-arith.stderr
const-array-oob.rs
const-array-oob.stderr
const-block-non-item-statement-2.rs
const-block-non-item-statement-2.stderr
const-block-non-item-statement-3.rs
const-block-non-item-statement-3.stderr
const-block-non-item-statement.rs
const-block-non-item-statement.stderr
const-call.rs
const-call.stderr
const-cast-different-types.rs
const-cast-different-types.stderr
const-cast-wrong-type.rs
const-cast-wrong-type.stderr
const-deref-ptr.rs
const-deref-ptr.stderr
const-err-early.rs
const-err-early.stderr
const-err-multi.rs
const-err-multi.stderr
const-err.rs
const-err.stderr
const-err2.rs
const-err2.stderr
const-err4.rs
const-err4.stderr
const-expr-addr-operator.rs
const-fn-destructuring-arg.rs
const-fn-destructuring-arg.stderr
const-fn-error.rs
const-fn-error.stderr
const-fn-mismatch.rs
const-fn-mismatch.stderr
const-fn-not-in-trait.rs
const-fn-not-in-trait.stderr
const-fn-not-safe-for-const.rs Made std::intrinsics::transmute() const fn. 2018-08-30 13:06:20 +01:00
const-fn-not-safe-for-const.stderr Made std::intrinsics::transmute() const fn. 2018-08-30 13:06:20 +01:00
const-fn-stability-calls-3.rs
const-fn-stability-calls-3.stderr
const-int-conversion.rs rebase 2018-09-01 15:05:55 +02:00
const-int-conversion.stderr rebase 2018-09-01 15:05:55 +02:00
const-int-overflowing.rs rebase 2018-09-01 15:05:55 +02:00
const-int-overflowing.stderr rebase 2018-09-01 15:05:55 +02:00
const-int-rotate.rs rebase 2018-09-01 15:05:55 +02:00
const-int-rotate.stderr rebase 2018-09-01 15:05:55 +02:00
const-int-sign.rs rebase 2018-09-01 15:05:55 +02:00
const-int-sign.stderr rebase 2018-09-01 15:05:55 +02:00
const-int-unchecked.rs Add unchecked_shl/shr checks for intrinsics 2018-09-06 13:13:07 +02:00
const-int-unchecked.stderr Add unchecked_shl/shr checks for intrinsics 2018-09-06 13:13:07 +02:00
const-int-wrapping.rs rebase 2018-09-01 15:05:55 +02:00
const-int-wrapping.stderr rebase 2018-09-01 15:05:55 +02:00
const-integer-bool-ops.rs
const-integer-bool-ops.stderr
const-len-underflow-separate-spans.rs
const-len-underflow-separate-spans.stderr
const-len-underflow-subspans.rs
const-len-underflow-subspans.stderr
const-match-check.eval1.stderr
const-match-check.eval2.stderr
const-match-check.matchck.stderr
const-match-check.rs
const-match-pattern-arm.rs
const-match-pattern-arm.stderr
const-pattern-irrefutable.rs
const-pattern-irrefutable.stderr
const-pattern-not-const-evaluable.rs Restrict most uses of const_fn to min_const_fn 2018-08-31 08:40:00 +02:00
const-size_of-cycle.rs Restrict most uses of const_fn to min_const_fn 2018-08-31 08:40:00 +02:00
const-size_of-cycle.stderr Implement the min_const_fn feature gate 2018-08-31 08:39:59 +02:00
const-slice-oob.rs
const-slice-oob.stderr
const-tup-index-span.rs
const-tup-index-span.stderr
const-type-mismatch.rs
const-type-mismatch.stderr
const-typeid-of.rs
const-typeid-of.stderr
const-unsized.rs
const-unsized.stderr