diff options
| author | Aaron Hill <aa1ronham@gmail.com> | 2019-09-29 19:22:18 -0400 |
|---|---|---|
| committer | Aaron Hill <aa1ronham@gmail.com> | 2019-10-02 00:38:52 -0400 |
| commit | 73b50d211b254bf72ce10b5ea4c3e0033e3189f4 (patch) | |
| tree | ffd2406f05d8bae7607cac2399493bbd331657ef /src/libsyntax/parse/mod.rs | |
| parent | 7130fc54e05e247f93c7ecc2d10f56b314c97831 (diff) | |
| download | rust-73b50d211b254bf72ce10b5ea4c3e0033e3189f4.tar.gz rust-73b50d211b254bf72ce10b5ea4c3e0033e3189f4.zip | |
Add support for 'extern const fn'
This works just as you might expect - an 'extern const fn' is a 'const fn' that is callable from foreign code. Currently, panicking is not allowed in consts. When RFC 2345 is stabilized, then panicking in an 'extern const fn' will produce a compile-time error when invoked at compile time, and an abort when invoked at runtime. Since this is extending the language (we're allowing the `const` keyword in a new context), I believe that this will need an FCP. However, it's a very minor change, so I didn't think that filing an RFC was necessary. This will allow libc (and other FFI crates) to make many functions `const`, without having to give up on making them `extern` as well.
Diffstat (limited to 'src/libsyntax/parse/mod.rs')
| -rw-r--r-- | src/libsyntax/parse/mod.rs | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index fa4c1043122..1518da23b09 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -57,6 +57,8 @@ pub struct GatedSpans { pub yields: Lock<Vec<Span>>, /// Spans collected for gating `or_patterns`, e.g. `Some(Foo | Bar)`. pub or_patterns: Lock<Vec<Span>>, + /// Spans collected for gating `const_extern_fn`, e.g. `const extern fn foo`. + pub const_extern_fn: Lock<Vec<Span>>, } /// Info about a parsing session. |
