diff options
| author | bors <bors@rust-lang.org> | 2017-12-13 11:09:55 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2017-12-13 11:09:55 +0000 |
| commit | 3dfbc88a626625be01e112da11ec367e2fc71bb3 (patch) | |
| tree | 3123349d2f450ac5317944d5f5803b20c3eca65b /src/test | |
| parent | 61100840e5c978a99b0489e8eaa922da06c05f65 (diff) | |
| parent | 85d19b33357897c51d80727a4208f46b19c5c5a6 (diff) | |
| download | rust-3dfbc88a626625be01e112da11ec367e2fc71bb3.tar.gz rust-3dfbc88a626625be01e112da11ec367e2fc71bb3.zip | |
Auto merge of #46550 - jseyfried:cleanup_builtin_hygiene, r=nrc
macros: hygienize use of `core`/`std` in builtin macros Today, if a builtin macro wants to access an item from `core` or `std` (depending `#![no_std]`), it generates `::core::path::to::item` or `::std::path::to::item` respectively (c.f. `fn std_path()` in `libsyntax/ext/base.rs`). This PR refactors the builtin macros to instead always emit `$crate::path::to::item` here. That is, the def site of builtin macros is taken to be in `extern crate core;` or `extern crate std;`. Since builtin macros are macros 1.0 (i.e. mostly unhygienic), changing the def site can only effect the resolution of `$crate`. r? @nrc
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/pretty/issue-4264.pp | 2 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs | 2 | ||||
| -rw-r--r-- | src/test/run-pass-fulldeps/derive-no-std-not-supported.rs (renamed from src/test/compile-fail-fulldeps/derive-no-std-not-supported.rs) | 6 |
5 files changed, 7 insertions, 7 deletions
diff --git a/src/test/pretty/issue-4264.pp b/src/test/pretty/issue-4264.pp index 02b8425d88b..81518b0b872 100644 --- a/src/test/pretty/issue-4264.pp +++ b/src/test/pretty/issue-4264.pp @@ -40,7 +40,7 @@ pub fn bar() ({ ((::fmt::format as - for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::std::fmt::Arguments>::new_v1 + for<'r> fn(std::fmt::Arguments<'r>) -> std::string::String {std::fmt::format})(((<::fmt::Arguments>::new_v1 as fn(&[&str], &[std::fmt::ArgumentV1<'_>]) -> std::fmt::Arguments<'_> {std::fmt::Arguments<'_>::new_v1})((&([("test" as diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs index 63dbd4d5bed..f485982e2d3 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_partial_eq.rs @@ -69,7 +69,7 @@ fn expand_deriving_partial_eq(cx: &mut ExtCtxt, span: Span, mitem: &MetaItem, it let trait_def = TraitDef { span: span, attributes: Vec::new(), - path: deriving::generic::ty::Path::new(vec!["std", "cmp", "PartialEq"]), + path: deriving::generic::ty::Path::new(vec!["cmp", "PartialEq"]), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs index 16856d30417..449cd29ada3 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin.rs @@ -50,7 +50,7 @@ fn expand(cx: &mut ExtCtxt, let trait_def = TraitDef { span: span, attributes: vec![], - path: Path::new(vec!["TotalSum"]), + path: Path::new_local("TotalSum"), additional_bounds: vec![], generics: LifetimeBounds::empty(), associated_types: vec![], diff --git a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs index 50b16a0e26f..1a9358f22bf 100644 --- a/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs +++ b/src/test/run-pass-fulldeps/auxiliary/custom_derive_plugin_attr.rs @@ -46,7 +46,7 @@ fn expand(cx: &mut ExtCtxt, let trait_def = TraitDef { span: span, attributes: vec![], - path: Path::new(vec!["TotalSum"]), + path: Path::new_local("TotalSum"), additional_bounds: vec![], generics: LifetimeBounds::empty(), associated_types: vec![], diff --git a/src/test/compile-fail-fulldeps/derive-no-std-not-supported.rs b/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs index 1e97cb07f89..a0747e0fbf5 100644 --- a/src/test/compile-fail-fulldeps/derive-no-std-not-supported.rs +++ b/src/test/run-pass-fulldeps/derive-no-std-not-supported.rs @@ -8,22 +8,22 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(rustc_private)] #![no_std] extern crate serialize as rustc_serialize; -#[derive(RustcEncodable)] //~ ERROR this trait cannot be derived +#[derive(RustcEncodable)] struct Bar { x: u32, } -#[derive(RustcDecodable)] //~ ERROR this trait cannot be derived +#[derive(RustcDecodable)] struct Baz { x: u32, } fn main() { - Foo { x: 0 }; Bar { x: 0 }; Baz { x: 0 }; } |
