Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Uses the same approach as #17286 (and subsequent changes making it more correct), where the visitor will skip any pieces of the AST that are from "foreign code", where the spans don't line up, indicating that that piece of code is due to a macro expansion. If this breaks your code, read the error message to determine which feature gate you should add to your crate, and bask in the knowledge that your code won't mysteriously break should you try to use the 1.0 release. Closes #18102 [breaking-change]
- Loading branch information
Showing
6 changed files
with
172 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/test/compile-fail/feature-gated-feature-in-macro-arg.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
// tests that input to a macro is checked for use of gated features. If this | ||
// test succeeds due to the acceptance of a feature, pick a new feature to | ||
// test. Not ideal, but oh well :( | ||
|
||
fn main() { | ||
let a = &[1i32, 2, 3]; | ||
println!("{}", { | ||
extern "rust-intrinsic" { //~ ERROR intrinsics are subject to change | ||
fn atomic_fence(); | ||
} | ||
atomic_fence(); | ||
42 | ||
}); | ||
} |
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at https://github.com/cmr/rust/commit/41da99dff417eadf8f296a93529d9810f79e1d1b
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging cmr/rust/gate-macro-args = 41da99d into auto
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status: {"merge_sha": "5b8427e856dfc93c70db10290694f1d6f5271c70"}
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmr/rust/gate-macro-args = 41da99d merged ok, testing candidate = 5b8427e8
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some tests failed:
failure: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2610
exception: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2960
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2954
exception: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2955
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2946
exception: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2945
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2948
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2941
exception: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2938
exception: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2613
exception: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/1449
exception: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/1440
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
saw approval from alexcrichton
at https://github.com/cmr/rust/commit/41da99dff417eadf8f296a93529d9810f79e1d1b
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
merging cmr/rust/gate-macro-args = 41da99d into auto
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
status: {"merge_sha": "39d74026663597a8d4ad0ab04e6d117bf9fd6ad4"}
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmr/rust/gate-macro-args = 41da99d merged ok, testing candidate = 39d7402
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all tests pass:
success: http://buildbot.rust-lang.org/builders/auto-mac-32-opt/builds/2962
success: http://buildbot.rust-lang.org/builders/auto-mac-64-opt/builds/2956
success: http://buildbot.rust-lang.org/builders/auto-mac-64-nopt-t/builds/2957
success: http://buildbot.rust-lang.org/builders/auto-linux-32-opt/builds/2948
success: http://buildbot.rust-lang.org/builders/auto-linux-32-nopt-t/builds/2947
success: http://buildbot.rust-lang.org/builders/auto-linux-64-opt/builds/2950
success: http://buildbot.rust-lang.org/builders/auto-linux-64-nopt-t/builds/2943
success: http://buildbot.rust-lang.org/builders/auto-linux-64-x-android-t/builds/2940
success: http://buildbot.rust-lang.org/builders/auto-win-32-opt/builds/2615
success: http://buildbot.rust-lang.org/builders/auto-win-32-nopt-t/builds/2612
success: http://buildbot.rust-lang.org/builders/auto-win-64-opt/builds/1451
success: http://buildbot.rust-lang.org/builders/auto-win-64-nopt-t/builds/1442
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 39d7402
41da99d
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fast-forwarding master to auto = 39d7402