|
| 1 | +// The purpose of this feature gate is to make something into a hard error in a |
| 2 | +// future edition. Consequently, this test differs from most other feature gate |
| 3 | +// tests. Instead of verifying that an error occurs when the feature gate is |
| 4 | +// missing, it ensures that the hard error is only produced with the feature |
| 5 | +// gate is present in the `future` edition -- and otherwise that only a warning |
| 6 | +// is emitted. |
| 7 | + |
| 8 | +//@ revisions: current current_feature future future_feature |
| 9 | + |
| 10 | +//@ [current] run-rustfix |
| 11 | +//@ [current] check-pass |
| 12 | + |
| 13 | +//@ [current_feature] run-rustfix |
| 14 | +//@ [current_feature] check-pass |
| 15 | + |
| 16 | +//@ [future] edition: future |
| 17 | +//@ [future] compile-flags: -Z unstable-options |
| 18 | +//@ [future] run-rustfix |
| 19 | +//@ [future] check-pass |
| 20 | + |
| 21 | +//@ [future_feature] edition: future |
| 22 | +//@ [future_feature] compile-flags: -Z unstable-options |
| 23 | + |
| 24 | +#![cfg_attr(future_feature, feature(explicit_extern_abis))] |
| 25 | +#![cfg_attr(current_feature, feature(explicit_extern_abis))] |
| 26 | + |
| 27 | +extern "C" fn _foo() {} |
| 28 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated |
| 29 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated |
| 30 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated |
| 31 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed |
| 32 | + |
| 33 | +unsafe extern "C" fn _bar() {} |
| 34 | +//[current]~^ WARN `extern` declarations without an explicit ABI are deprecated |
| 35 | +//[current_feature]~^^ WARN `extern` declarations without an explicit ABI are deprecated |
| 36 | +//[future]~^^^ WARN `extern` declarations without an explicit ABI are deprecated |
| 37 | +//[future_feature]~^^^^ ERROR `extern` declarations without an explicit ABI are disallowed |
| 38 | + |
| 39 | +fn main() {} |
0 commit comments