Skip to content

Commit bb252a8

Browse files
committed
rollup merge of #23948: nikomatsakis/feature-gate-rust-abi
Like it says. r? @alexcrichton
2 parents 9bb05fd + 3d8df31 commit bb252a8

File tree

5 files changed

+37
-7
lines changed

5 files changed

+37
-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;
@@ -517,7 +517,7 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
517517
across platforms, it is recommended to \
518518
use `#[link(name = \"foo\")]` instead")
519519
}
520-
if foreign_module.abi == RustIntrinsic {
520+
if foreign_module.abi == Abi::RustIntrinsic {
521521
self.gate_feature("intrinsics",
522522
i.span,
523523
"intrinsics are subject to change")
@@ -633,11 +633,17 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
633633
span: Span,
634634
_node_id: NodeId) {
635635
match fn_kind {
636-
visit::FkItemFn(_, _, _, abi) if abi == RustIntrinsic => {
636+
visit::FkItemFn(_, _, _, abi) if abi == Abi::RustIntrinsic => {
637637
self.gate_feature("intrinsics",
638638
span,
639639
"intrinsics are subject to change")
640640
}
641+
visit::FkItemFn(_, _, _, abi) |
642+
visit::FkMethod(_, &ast::MethodSig { abi, .. }) if abi == Abi::RustCall => {
643+
self.gate_feature("unboxed_closures",
644+
span,
645+
"rust-call ABI is subject to change")
646+
}
641647
_ => {}
642648
}
643649
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() {}

src/test/run-make/rustdoc-extern-method/bar.rs

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11+
#![feature(unboxed_closures)]
12+
1113
extern crate foo;
1214

1315
// @has bar/trait.Foo.html //pre "pub trait Foo"

src/test/run-make/rustdoc-extern-method/foo.rs

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
// except according to those terms.
1010

1111
#![crate_type="lib"]
12+
#![feature(unboxed_closures)]
1213

1314
pub trait Foo {
1415
extern "rust-call" fn foo(&self, _: ()) -> i32;

0 commit comments

Comments
 (0)