Stream: wg-ffi-unwind

Topic: reconsider stabilizing attribute?


Kyle Strand (Oct 31 2019 at 17:34, on Zulip):

I just learned about this: https://github.com/rust-lang/rust/pull/64010/

Would this resolve our previous concern about stabilizing the unwind(abort) attribute, namely, that it couldn't be used on function pointers? (As long as we add unwind to the list of attributes that can be used in parameter position, of course.)

As far as I can see, attributes are still not useable on local variables.

gnzlbg (Oct 31 2019 at 17:37, on Zulip):

IIRC the concern is that as implemented the attribute is not part of a function's type.

nikomatsakis (Oct 31 2019 at 17:37, on Zulip):

We can revisit that debate but

nikomatsakis (Oct 31 2019 at 17:37, on Zulip):

I think that the ABI version is kind of "just better" in most ways

gnzlbg (Oct 31 2019 at 17:39, on Zulip):

I think there is consensus that it should be part of the type, whether the syntax is an ABI string or an attribute is more a syntactic issue, there are certainly other cases where attributes as part of the type make sense (e.g. #[target_feature] is part of the function ABI, and we currently forbid creating pointers to target feature functions to work around that).

centril (Oct 31 2019 at 18:08, on Zulip):

@Kyle Strand those attributes only work on formal params; not types. You'd need https://github.com/rust-lang/rfcs/pull/2602 for attributes on types.

centril (Oct 31 2019 at 18:09, on Zulip):

Also, I agree with @nikomatsakis -- I'd also like to see the WG more focused and for it to have less back and forth

Kyle Strand (Oct 31 2019 at 18:11, on Zulip):

I think that the merit in the "noexcept-like feature" is in the idea that we may not want the unwindability of a function to be in the type system, at least not without introducing a real noexcept feature that can be used independently of extern.

Kyle Strand (Oct 31 2019 at 18:12, on Zulip):

Also, I agree with nikomatsakis -- I'd also like to see the WG more focused and for it to have less back and forth

I'm not sure how to help with that at this point. It seems to me that we do have some genuinely new information being introduced (e.g. from discussion w/ Amanieu).

centril (Oct 31 2019 at 18:13, on Zulip):

:frown: -- I was hoping to get the soundness hole closed in a reasonable timeframe

Kyle Strand (Oct 31 2019 at 18:15, on Zulip):

So was I. But I am of the opinion that letting extern "C" unwind is a perfectly reasonable way to do that.

Kyle Strand (Oct 31 2019 at 18:16, on Zulip):

I've also said that I personally don't have an objection to stabilizing the abort-on-unwind shim.

centril (Oct 31 2019 at 18:16, on Zulip):

@Kyle Strand appreciated

Kyle Strand (Oct 31 2019 at 18:33, on Zulip):

@gnzlbg See the PR link up above; such attributes can at least be applied to fn pointers in function params, which may be sufficient for now

gnzlbg (Oct 31 2019 at 18:34, on Zulip):

It isn't sufficient for statics I think.

gnzlbg (Oct 31 2019 at 18:34, on Zulip):

e.g. static X: Option<#[unwind(aborts)] fn f()> = ...; would need to work

gnzlbg (Oct 31 2019 at 18:34, on Zulip):

but I don't see any reasons why we can't make that work

Last update: Nov 15 2019 at 10:45UTC