Auto merge of #34172 - jseyfried:avoid_configuring_interpolated_ast, r=alexcrichton
Fix ICE regression caused by configuring interpolated AST Fixes #34171. r? @nrc
This commit is contained in:
commit
0554abac63
@ -14,6 +14,7 @@ use feature_gate::GatedCfgAttr;
|
||||
use fold::Folder;
|
||||
use {ast, fold, attr};
|
||||
use codemap::{Spanned, respan};
|
||||
use parse::token;
|
||||
use ptr::P;
|
||||
|
||||
use util::small_vector::SmallVector;
|
||||
@ -247,6 +248,12 @@ impl<T: CfgFolder> fold::Folder for T {
|
||||
self.configure(item).map(|item| fold::noop_fold_trait_item(item, self))
|
||||
.unwrap_or(SmallVector::zero())
|
||||
}
|
||||
|
||||
fn fold_interpolated(&mut self, nt: token::Nonterminal) -> token::Nonterminal {
|
||||
// Don't configure interpolated AST (c.f. #34171).
|
||||
// Interpolated AST will get configured once the surrounding tokens are parsed.
|
||||
nt
|
||||
}
|
||||
}
|
||||
|
||||
fn fold_expr<F: CfgFolder>(folder: &mut F, expr: P<ast::Expr>) -> P<ast::Expr> {
|
||||
|
21
src/test/compile-fail/issue-34171.rs
Normal file
21
src/test/compile-fail/issue-34171.rs
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2016 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.
|
||||
|
||||
#![feature(rustc_attrs)]
|
||||
|
||||
macro_rules! null { ($i:tt) => {} }
|
||||
macro_rules! apply_null {
|
||||
($i:item) => { null! { $i } }
|
||||
}
|
||||
|
||||
#[rustc_error]
|
||||
fn main() { //~ ERROR compilation successful
|
||||
apply_null!(#[cfg(all())] fn f() {});
|
||||
}
|
Loading…
Reference in New Issue
Block a user