Skip to content

Commit d81e866

Browse files
committedApr 1, 2015
Feature gate rust-call ABI.
1 parent d528aa9 commit d81e866

File tree

3 files changed

+34
-7
lines changed

3 files changed

+34
-7
lines changed
 

‎src/libsyntax/feature_gate.rs

+9-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
use self::Status::*;
2626
use self::AttributeType::*;
2727

28-
use abi::RustIntrinsic;
28+
use abi::Abi;
2929
use ast::NodeId;
3030
use ast;
3131
use attr;
@@ -511,7 +511,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
511511
across platforms, it is recommended to \
512512
use `#[link(name = \"foo\")]` instead")
513513
}
514-
if foreign_module.abi == RustIntrinsic {
514+
if foreign_module.abi == Abi::RustIntrinsic {
515515
self.gate_feature("intrinsics",
516516
i.span,
517517
"intrinsics are subject to change")
@@ -627,11 +627,17 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
627627
span: Span,
628628
_node_id: NodeId) {
629629
match fn_kind {
630-
visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
630+
visit::FkItemFn(_, _, _, abi) if abi == Abi::RustIntrinsic => {
631631
self.gate_feature("intrinsics",
632632
span,
633633
"intrinsics are subject to change")
634634
}
635+
visit::FkItemFn(_, _, _, abi) |
636+
visit::FkMethod(_, &ast::MethodSig { abi, .. }) if abi == Abi::RustCall => {
637+
self.gate_feature("unboxed_closures",
638+
span,
639+
"rust-call ABI is subject to change")
640+
}
635641
_ => {}
636642
}
637643
visit::walk_fn(self, fn_kind, fn_decl, block, span);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
extern "rust-call" fn foo() { } //~ ERROR rust-call ABI is subject to change
12+
13+
trait Foo {
14+
extern "rust-call" fn foo();
15+
}
16+
17+
impl Foo for i32 {
18+
extern "rust-call" fn foo() { } //~ ERROR rust-call ABI is subject to change
19+
}
20+
21+
fn main() { }

‎src/test/compile-fail/feature-gate-unboxed-closures-manual-impls.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,23 +17,23 @@
1717

1818
struct Foo;
1919
impl Fn<()> for Foo {
20-
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits
2120
extern "rust-call" fn call(self, args: ()) -> () {}
21+
//~^ ERROR rust-call ABI is subject to change
2222
}
2323
struct Foo1;
2424
impl FnOnce() for Foo1 {
25-
//~^ ERROR associated type bindings are not allowed here
2625
extern "rust-call" fn call_once(self, args: ()) -> () {}
26+
//~^ ERROR rust-call ABI is subject to change
2727
}
2828
struct Bar;
2929
impl FnMut<()> for Bar {
30-
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits
3130
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
31+
//~^ ERROR rust-call ABI is subject to change
3232
}
3333
struct Baz;
3434
impl FnOnce<()> for Baz {
35-
//~^ ERROR angle-bracket notation is not stable when used with the `Fn` family of traits
3635
extern "rust-call" fn call_once(&self, args: ()) -> () {}
36+
//~^ ERROR rust-call ABI is subject to change
3737
}
3838

3939
fn main() {}

0 commit comments

Comments
 (0)
Please sign in to comment.