Skip to content

Don't feature gate bang macros on 'proc_macro_path_invoc'. #50295

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl<'a> Resolver<'a> {

fn resolve_macro_to_def(&mut self, scope: Mark, path: &ast::Path, kind: MacroKind, force: bool)
-> Result<Def, Determinacy> {
if path.segments.len() > 1 {
if kind != MacroKind::Bang && path.segments.len() > 1 {
if !self.session.features_untracked().proc_macro_path_invoc {
emit_feature_err(
&self.session.parse_sess,
Expand All @@ -409,6 +409,7 @@ impl<'a> Resolver<'a> {
);
}
}

let def = self.resolve_macro_to_def_inner(scope, path, kind, force);
if def != Err(Determinacy::Undetermined) {
// Do not report duplicated errors on every undetermined resolution.
Expand Down
2 changes: 1 addition & 1 deletion src/test/compile-fail/extern-macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// #41719

#![feature(use_extern_macros, proc_macro_path_invoc)]
#![feature(use_extern_macros)]

fn main() {
enum Foo {}
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/macros-nonfatal-errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#![feature(asm)]
#![feature(trace_macros, concat_idents)]
#![feature(proc_macro_path_invoc)]

#[derive(Default)] //~ ERROR
enum OrDeriveThis {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#![feature(decl_macro, associated_type_defaults)]
#![allow(unused, private_in_public)]
#![feature(proc_macro_path_invoc)]

mod priv_nominal {
pub struct Pub;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// ignore-tidy-linelength

#![feature(proc_macro_path_invoc)]
#![feature(decl_macro, associated_type_defaults)]
#![allow(unused, private_in_public)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(proc_macro_path_invoc)]
#![feature(decl_macro, associated_type_defaults)]
#![allow(unused, private_in_public)]

Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/private-inferred-type-3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// error-pattern:type `fn(u8) -> ext::PubTupleStruct {ext::PubTupleStruct::{{constructor}}}` is priv
// error-pattern:type `for<'r> fn(&'r ext::Pub<u8>) {<ext::Pub<u8>>::priv_method}` is private

#![feature(proc_macro_path_invoc)]
#![feature(decl_macro)]

extern crate private_inferred_type as ext;
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/private-inferred-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#![feature(associated_consts)]
#![feature(decl_macro)]
#![allow(private_in_public)]
#![feature(proc_macro_path_invoc)]

mod m {
fn priv_fn() {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass-fulldeps/macro-quote-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// aux-build:hello_macro.rs
// ignore-stage1

#![feature(proc_macro, proc_macro_path_invoc, proc_macro_non_items)]
#![feature(proc_macro, proc_macro_non_items)]

extern crate hello_macro;

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/hygiene/issue-47311.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]
#![allow(unused)]

macro m($S:ident, $x:ident) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/hygiene/issue-47312.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]
#![allow(unused)]

mod foo {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/hygiene/legacy_interaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// aux-build:legacy_interaction.rs

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]
#[allow(unused)]

extern crate legacy_interaction;
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/hygiene/lexical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod bar {
mod baz {
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/hygiene/wrap_unhygienic_example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// aux-build:my_crate.rs
// aux-build:unhygienic_example.rs

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

extern crate unhygienic_example;
extern crate my_crate; // (b)
Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/hygiene/xcrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// aux-build:xcrate.rs

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

extern crate xcrate;

Expand Down
2 changes: 1 addition & 1 deletion src/test/run-pass/paths-in-macro-invocations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// aux-build:two_macros.rs

#![feature(use_extern_macros, proc_macro_path_invoc)]
#![feature(use_extern_macros)]

extern crate two_macros;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod foo {
struct S { x: u32 }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/globs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod foo {
pub fn f() {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/impl_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// ignore-pretty pretty-printing is unhygienic

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod foo {
struct S;
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/intercrate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// error-pattern:type `fn() -> u32 {intercrate::foo::bar::f}` is private

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

extern crate intercrate;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/no_implicit_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod foo {
pub macro m() { Vec::new(); ().clone() }
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/privacy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod foo {
fn f() {}
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/hygiene/trait_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![feature(decl_macro, proc_macro_path_invoc)]
#![feature(decl_macro)]

mod foo {
pub trait T {
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/imports/macro-paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// aux-build:two_macros.rs

#![feature(use_extern_macros, proc_macro_path_invoc)]
#![feature(use_extern_macros)]

extern crate two_macros;

Expand Down
2 changes: 1 addition & 1 deletion src/test/ui/imports/shadow_builtin_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

// aux-build:two_macros.rs

#![feature(use_extern_macros, proc_macro_path_invoc)]
#![feature(use_extern_macros)]

mod foo {
extern crate two_macros;
Expand Down