Stream: project-ffi-unwind

Topic: reconsider stabilizing attribute?


view this post on Zulip BatmanAoD (Kyle Strand) (Oct 31 2019 at 17:34):

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.

view this post on Zulip gnzlbg (Oct 31 2019 at 17:37):

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

view this post on Zulip nikomatsakis (Oct 31 2019 at 17:37):

We can revisit that debate but

view this post on Zulip nikomatsakis (Oct 31 2019 at 17:37):

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

view this post on Zulip gnzlbg (Oct 31 2019 at 17:39):

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).

view this post on Zulip centril (Oct 31 2019 at 18:08):

@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.

view this post on Zulip centril (Oct 31 2019 at 18:09):

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

view this post on Zulip BatmanAoD (Kyle Strand) (Oct 31 2019 at 18:11):

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.

view this post on Zulip BatmanAoD (Kyle Strand) (Oct 31 2019 at 18:12):

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).

view this post on Zulip centril (Oct 31 2019 at 18:13):

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

view this post on Zulip BatmanAoD (Kyle Strand) (Oct 31 2019 at 18:15):

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

view this post on Zulip BatmanAoD (Kyle Strand) (Oct 31 2019 at 18:16):

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

view this post on Zulip centril (Oct 31 2019 at 18:16):

@Kyle Strand appreciated

view this post on Zulip BatmanAoD (Kyle Strand) (Oct 31 2019 at 18:33):

@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

view this post on Zulip gnzlbg (Oct 31 2019 at 18:34):

It isn't sufficient for statics I think.

view this post on Zulip gnzlbg (Oct 31 2019 at 18:34):

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

view this post on Zulip gnzlbg (Oct 31 2019 at 18:34):

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


Last updated: Jan 26 2022 at 09:02 UTC