-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-lang-itemArea: Language itemsArea: Language itemsF-rustc_attrsInternal rustc attributes gated on the `#[rustc_attrs]` feature gate.Internal rustc attributes gated on the `#[rustc_attrs]` feature gate.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Currently, #[rustc_nounwind]
is only applied to functions that are explicitly annotated; it's neither required nor applied by default to all implementations. I have no objection to this, but I think we need to clarify what the expected behavior should be.
An alternative is:
If you apply
#[rustc_nounwind]
on a trait method, it should be fine to assume that all calls of this trait method don't unwind, right? If any of the implementations doesn't use#[rustc_nounwind]
, that should probably be reported as error. (from #137669 (comment) @bjorn3)
pub trait Trait {
#[rustc_nounwind]
fn m(&self, _: (i32, i32, i32));
}
impl Trait for () {
fn m(&self, _: (i32, i32, i32)) {
panic!();
}
}
Based on the current behavior, there are some miscompile.
In the case of https://rust.godbolt.org/z/aTWsEMxWq, all invokes should be unwinding.
From #137669.
compiler-errors
Metadata
Metadata
Assignees
Labels
A-dyn-traitArea: trait objects, vtable layoutArea: trait objects, vtable layoutA-lang-itemArea: Language itemsArea: Language itemsF-rustc_attrsInternal rustc attributes gated on the `#[rustc_attrs]` feature gate.Internal rustc attributes gated on the `#[rustc_attrs]` feature gate.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.