From 64a8c8a4932416fd0ec9735db8c1d8ba32542a52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Mi=C4=85sko?= Date: Tue, 24 Mar 2020 00:00:00 +0000 Subject: [PATCH 1/4] Update backtrace crate to 0.3.46 --- Cargo.lock | 8 ++++---- src/libstd/Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 22a06151353ba..6a9cb1d7fec07 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -121,9 +121,9 @@ checksum = "1d49d90015b3c36167a20fe2810c5cd875ad504b39cff3d4eae7977e6b7c1cb2" [[package]] name = "backtrace" -version = "0.3.45" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad235dabf00f36301792cfe82499880ba54c6486be094d1047b02bacb67c14e8" +checksum = "b1e692897359247cc6bb902933361652380af0f1b7651ae5c5013407f30e109e" dependencies = [ "backtrace-sys", "cfg-if", @@ -135,9 +135,9 @@ dependencies = [ [[package]] name = "backtrace-sys" -version = "0.1.34" +version = "0.1.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca797db0057bae1a7aa2eef3283a874695455cecf08a43bfb8507ee0ebc1ed69" +checksum = "7de8aba10a69c8e8d7622c5710229485ec32e9d55fdad160ea559c086fdcd118" dependencies = [ "cc", "compiler_builtins", diff --git a/src/libstd/Cargo.toml b/src/libstd/Cargo.toml index b147aa55b2a61..0dd2f79d066e4 100644 --- a/src/libstd/Cargo.toml +++ b/src/libstd/Cargo.toml @@ -27,7 +27,7 @@ hashbrown = { version = "0.6.2", default-features = false, features = ['rustc-de [dependencies.backtrace_rs] package = "backtrace" -version = "0.3.44" +version = "0.3.46" default-features = false # without the libstd `backtrace` feature, stub out everything features = [ "rustc-dep-of-std" ] # enable build support for integrating into libstd From 1fa6be0358f79cc6a636cb1b4d3bea90450277f5 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Tue, 24 Mar 2020 20:41:16 +0300 Subject: [PATCH 2/4] resolve: Remove `rustc_attrs` as a standalone feature gate Now it only gates specific built-in attributes --- src/librustc_resolve/macros.rs | 17 ++++------ .../auxiliary/lint-for-crate-rpass.rs | 12 +++---- .../ui-fulldeps/auxiliary/macro-crate-test.rs | 33 ------------------- src/test/ui-fulldeps/issue-15778-pass.rs | 24 +++++++------- .../feature-gate-rustc-attrs.stderr | 12 ++----- src/test/ui/proc-macro/auxiliary/duplicate.rs | 32 ++++++++++++++++++ .../ui/proc-macro/expand-to-unstable-2.stderr | 4 +-- .../macro-crate-multi-decorator.rs | 29 ++++++++-------- .../ui/reserved/reserved-attr-on-macro.stderr | 5 +-- .../ui/suggestions/attribute-typos.stderr | 5 +-- 10 files changed, 75 insertions(+), 98 deletions(-) delete mode 100644 src/test/ui-fulldeps/auxiliary/macro-crate-test.rs create mode 100644 src/test/ui/proc-macro/auxiliary/duplicate.rs rename src/test/{ui-fulldeps => ui/proc-macro}/macro-crate-multi-decorator.rs (52%) diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 166fc48b44c4c..a783cfa4811fd 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -20,7 +20,6 @@ use rustc_feature::is_builtin_attr_name; use rustc_hir::def::{self, DefKind, NonMacroAttrKind}; use rustc_hir::def_id; use rustc_session::lint::builtin::UNUSED_MACROS; -use rustc_session::parse::feature_err; use rustc_session::Session; use rustc_span::edition::Edition; use rustc_span::hygiene::{self, ExpnData, ExpnId, ExpnKind}; @@ -397,20 +396,16 @@ impl<'a> Resolver<'a> { Err(Determinacy::Undetermined) => return Err(Indeterminate), }; - // Report errors and enforce feature gates for the resolved macro. - let features = self.session.features_untracked(); + // Report errors for the resolved macro. for segment in &path.segments { if let Some(args) = &segment.args { self.session.span_err(args.span(), "generic arguments in macro path"); } - if kind == MacroKind::Attr - && !features.rustc_attrs - && segment.ident.as_str().starts_with("rustc") - { - let msg = - "attributes starting with `rustc` are reserved for use by the `rustc` compiler"; - feature_err(&self.session.parse_sess, sym::rustc_attrs, segment.ident.span, msg) - .emit(); + if kind == MacroKind::Attr && segment.ident.as_str().starts_with("rustc") { + self.session.span_err( + segment.ident.span, + "attributes starting with `rustc` are reserved for use by the `rustc` compiler", + ); } } diff --git a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs index 52620b2464bd6..f8cb1640cb4c1 100644 --- a/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs +++ b/src/test/ui-fulldeps/auxiliary/lint-for-crate-rpass.rs @@ -2,19 +2,19 @@ #![feature(plugin_registrar, rustc_private)] #![feature(box_syntax)] + extern crate rustc_driver; extern crate rustc_hir; -extern crate rustc_span; -#[macro_use] extern crate rustc_lint; +extern crate rustc_span; #[macro_use] extern crate rustc_session; extern crate rustc_ast; +use rustc_ast::attr; use rustc_driver::plugin::Registry; use rustc_lint::{LateContext, LateLintPass, LintContext, LintPass}; use rustc_span::symbol::Symbol; -use rustc_ast::attr; macro_rules! fake_lint_pass { ($struct:ident, $($attr:expr),*) => { @@ -50,17 +50,17 @@ declare_lint!(CRATE_NOT_GREEN, Warn, "crate not marked with #![crate_green]"); fake_lint_pass! { PassOkay, - Symbol::intern("rustc_crate_okay") + Symbol::intern("crate_okay") } fake_lint_pass! { PassRedBlue, - Symbol::intern("rustc_crate_red"), Symbol::intern("rustc_crate_blue") + Symbol::intern("crate_red"), Symbol::intern("crate_blue") } fake_lint_pass! { PassGreyGreen, - Symbol::intern("rustc_crate_grey"), Symbol::intern("rustc_crate_green") + Symbol::intern("crate_grey"), Symbol::intern("crate_green") } #[plugin_registrar] diff --git a/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs b/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs deleted file mode 100644 index 56a560acbb44a..0000000000000 --- a/src/test/ui-fulldeps/auxiliary/macro-crate-test.rs +++ /dev/null @@ -1,33 +0,0 @@ -// force-host -// no-prefer-dynamic - -#![crate_type = "proc-macro"] -#![feature(rustc_private)] - -extern crate rustc_ast; -extern crate rustc; -extern crate rustc_driver; -extern crate proc_macro; - -use proc_macro::{TokenTree, TokenStream}; - -#[proc_macro_attribute] -pub fn rustc_duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { - let mut new_name = Some(attr.into_iter().nth(0).unwrap()); - let mut encountered_idents = 0; - let input = item.to_string(); - let ret = item.into_iter().map(move |token| match token { - TokenTree::Ident(_) if encountered_idents == 1 => { - encountered_idents += 1; - new_name.take().unwrap() - } - TokenTree::Ident(_) => { - encountered_idents += 1; - token - } - _ => token - }).collect::(); - let mut input_again = input.parse::().unwrap(); - input_again.extend(ret); - input_again -} diff --git a/src/test/ui-fulldeps/issue-15778-pass.rs b/src/test/ui-fulldeps/issue-15778-pass.rs index 4b3cf07e2830d..c031dbc7155db 100644 --- a/src/test/ui-fulldeps/issue-15778-pass.rs +++ b/src/test/ui-fulldeps/issue-15778-pass.rs @@ -1,23 +1,23 @@ -// run-pass +// check-pass // aux-build:lint-for-crate-rpass.rs // ignore-stage1 // compile-flags: -D crate-not-okay -#![feature(plugin, register_attr, custom_inner_attributes, rustc_attrs)] +#![feature(plugin, register_attr, custom_inner_attributes)] #![register_attr( - rustc_crate_okay, - rustc_crate_blue, - rustc_crate_red, - rustc_crate_grey, - rustc_crate_green, + crate_okay, + crate_blue, + crate_red, + crate_grey, + crate_green, )] #![plugin(lint_for_crate_rpass)] //~ WARNING compiler plugins are deprecated -#![rustc_crate_okay] -#![rustc_crate_blue] -#![rustc_crate_red] -#![rustc_crate_grey] -#![rustc_crate_green] +#![crate_okay] +#![crate_blue] +#![crate_red] +#![crate_grey] +#![crate_green] fn main() {} diff --git a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr index 1e039f17a0d11..1517a7a5c731a 100644 --- a/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr +++ b/src/test/ui/feature-gates/feature-gate-rustc-attrs.stderr @@ -1,10 +1,8 @@ -error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler +error: attributes starting with `rustc` are reserved for use by the `rustc` compiler --> $DIR/feature-gate-rustc-attrs.rs:8:3 | LL | #[rustc::unknown] | ^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: expected attribute, found macro `rustc::unknown` --> $DIR/feature-gate-rustc-attrs.rs:8:3 @@ -12,13 +10,11 @@ error: expected attribute, found macro `rustc::unknown` LL | #[rustc::unknown] | ^^^^^^^^^^^^^^ not an attribute -error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler +error: attributes starting with `rustc` are reserved for use by the `rustc` compiler --> $DIR/feature-gate-rustc-attrs.rs:13:12 | LL | #[unknown::rustc] | ^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: expected attribute, found macro `unknown::rustc` --> $DIR/feature-gate-rustc-attrs.rs:13:3 @@ -26,13 +22,11 @@ error: expected attribute, found macro `unknown::rustc` LL | #[unknown::rustc] | ^^^^^^^^^^^^^^ not an attribute -error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler +error: attributes starting with `rustc` are reserved for use by the `rustc` compiler --> $DIR/feature-gate-rustc-attrs.rs:20:3 | LL | #[rustc_unknown] | ^^^^^^^^^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: cannot find attribute `rustc_unknown` in this scope --> $DIR/feature-gate-rustc-attrs.rs:20:3 diff --git a/src/test/ui/proc-macro/auxiliary/duplicate.rs b/src/test/ui/proc-macro/auxiliary/duplicate.rs new file mode 100644 index 0000000000000..b8f82b46f0945 --- /dev/null +++ b/src/test/ui/proc-macro/auxiliary/duplicate.rs @@ -0,0 +1,32 @@ +// force-host +// no-prefer-dynamic + +#![deny(unused)] +#![crate_type = "proc-macro"] + +extern crate proc_macro; +use proc_macro::*; + +#[proc_macro_attribute] +pub fn duplicate(attr: TokenStream, item: TokenStream) -> TokenStream { + let mut new_name = Some(attr.into_iter().nth(0).unwrap()); + let mut encountered_idents = 0; + let input = item.to_string(); + let ret = item + .into_iter() + .map(move |token| match token { + TokenTree::Ident(_) if encountered_idents == 1 => { + encountered_idents += 1; + new_name.take().unwrap() + } + TokenTree::Ident(_) => { + encountered_idents += 1; + token + } + _ => token, + }) + .collect::(); + let mut input_again = input.parse::().unwrap(); + input_again.extend(ret); + input_again +} diff --git a/src/test/ui/proc-macro/expand-to-unstable-2.stderr b/src/test/ui/proc-macro/expand-to-unstable-2.stderr index 19144b210a127..5974fa4c554ca 100644 --- a/src/test/ui/proc-macro/expand-to-unstable-2.stderr +++ b/src/test/ui/proc-macro/expand-to-unstable-2.stderr @@ -1,12 +1,10 @@ -error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler +error: attributes starting with `rustc` are reserved for use by the `rustc` compiler --> $DIR/expand-to-unstable-2.rs:10:10 | LL | #[derive(Unstable)] | ^^^^^^^^ | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable = note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info) error: aborting due to previous error -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui-fulldeps/macro-crate-multi-decorator.rs b/src/test/ui/proc-macro/macro-crate-multi-decorator.rs similarity index 52% rename from src/test/ui-fulldeps/macro-crate-multi-decorator.rs rename to src/test/ui/proc-macro/macro-crate-multi-decorator.rs index f21617be5d26f..ec57dec14ed20 100644 --- a/src/test/ui-fulldeps/macro-crate-multi-decorator.rs +++ b/src/test/ui/proc-macro/macro-crate-multi-decorator.rs @@ -1,36 +1,33 @@ -// check-pass -// aux-build:macro-crate-test.rs -// ignore-stage1 +// The duplicate macro will create a copy of the item with the given identifier. -#![feature(rustc_attrs)] +// check-pass +// aux-build:duplicate.rs #[macro_use] -extern crate macro_crate_test; - -// The duplicate macro will create a copy of the item with the given identifier. +extern crate duplicate; -#[rustc_duplicate(MyCopy)] +#[duplicate(MyCopy)] struct MyStruct { - number: i32 + number: i32, } trait TestTrait { - #[rustc_duplicate(TestType2)] + #[duplicate(TestType2)] type TestType; - #[rustc_duplicate(required_fn2)] + #[duplicate(required_fn2)] fn required_fn(&self); - #[rustc_duplicate(provided_fn2)] - fn provided_fn(&self) { } + #[duplicate(provided_fn2)] + fn provided_fn(&self) {} } impl TestTrait for MyStruct { - #[rustc_duplicate(TestType2)] + #[duplicate(TestType2)] type TestType = f64; - #[rustc_duplicate(required_fn2)] - fn required_fn(&self) { } + #[duplicate(required_fn2)] + fn required_fn(&self) {} } fn main() { diff --git a/src/test/ui/reserved/reserved-attr-on-macro.stderr b/src/test/ui/reserved/reserved-attr-on-macro.stderr index c387bba0a1310..e55b58bef2855 100644 --- a/src/test/ui/reserved/reserved-attr-on-macro.stderr +++ b/src/test/ui/reserved/reserved-attr-on-macro.stderr @@ -1,10 +1,8 @@ -error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler +error: attributes starting with `rustc` are reserved for use by the `rustc` compiler --> $DIR/reserved-attr-on-macro.rs:1:3 | LL | #[rustc_attribute_should_be_reserved] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: cannot determine resolution for the macro `foo` --> $DIR/reserved-attr-on-macro.rs:10:5 @@ -22,4 +20,3 @@ LL | #[rustc_attribute_should_be_reserved] error: aborting due to 3 previous errors -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/suggestions/attribute-typos.stderr b/src/test/ui/suggestions/attribute-typos.stderr index c7c257ba5fe53..1c307f0e2c19c 100644 --- a/src/test/ui/suggestions/attribute-typos.stderr +++ b/src/test/ui/suggestions/attribute-typos.stderr @@ -1,10 +1,8 @@ -error[E0658]: attributes starting with `rustc` are reserved for use by the `rustc` compiler +error: attributes starting with `rustc` are reserved for use by the `rustc` compiler --> $DIR/attribute-typos.rs:11:3 | LL | #[rustc_err] | ^^^^^^^^^ - | - = help: add `#![feature(rustc_attrs)]` to the crate attributes to enable error: cannot find attribute `rustc_err` in this scope --> $DIR/attribute-typos.rs:11:3 @@ -31,4 +29,3 @@ LL | #[deprcated] error: aborting due to 4 previous errors -For more information about this error, try `rustc --explain E0658`. From 917289907d16e670a38c2f7eaffb46b500127694 Mon Sep 17 00:00:00 2001 From: Mazdak Farrokhzad Date: Tue, 24 Mar 2020 09:09:42 +0100 Subject: [PATCH 3/4] normalize some imports, prefer direct ones. --- src/librustc/dep_graph/dep_node.rs | 4 ++-- src/librustc/hir/map/collector.rs | 2 +- src/librustc/hir/map/mod.rs | 4 +--- src/librustc/ich/hcx.rs | 6 +++--- src/librustc/ich/impls_hir.rs | 5 +++-- src/librustc/ich/impls_ty.rs | 3 ++- src/librustc/ich/mod.rs | 1 - src/librustc/middle/cstore.rs | 2 +- src/librustc/mir/interpret/error.rs | 2 +- src/librustc/mir/mono.rs | 3 ++- src/librustc/ty/context.rs | 10 ++++------ src/librustc/ty/instance.rs | 2 +- src/librustc/ty/mod.rs | 7 +++---- src/librustc/ty/print/mod.rs | 2 +- src/librustc/ty/print/pretty.rs | 9 ++++----- src/librustc/ty/query/on_disk_cache.rs | 5 +++-- src/librustc/ty/query/plumbing.rs | 2 +- src/librustc/ty/query/profiling_support.rs | 2 +- src/librustc/ty/trait_def.rs | 2 +- src/librustc/ty/util.rs | 2 +- src/librustc_codegen_llvm/debuginfo/namespace.rs | 2 +- src/librustc_infer/infer/error_reporting/mod.rs | 3 +-- src/librustc_interface/passes.rs | 2 +- src/librustc_metadata/creader.rs | 2 +- src/librustc_metadata/rmeta/mod.rs | 3 +-- src/librustc_mir/interpret/intrinsics/type_name.rs | 2 +- src/librustc_resolve/lib.rs | 2 +- src/librustc_symbol_mangling/legacy.rs | 2 +- src/librustc_symbol_mangling/v0.rs | 2 +- 29 files changed, 45 insertions(+), 50 deletions(-) diff --git a/src/librustc/dep_graph/dep_node.rs b/src/librustc/dep_graph/dep_node.rs index fdcc1a0db0538..aab8aa19ae57c 100644 --- a/src/librustc/dep_graph/dep_node.rs +++ b/src/librustc/dep_graph/dep_node.rs @@ -49,8 +49,6 @@ //! user of the `DepNode` API of having to know how to compute the expected //! fingerprint for a given set of node parameters. -use crate::hir::map::DefPathHash; -use crate::ich::Fingerprint; use crate::mir; use crate::mir::interpret::{GlobalId, LitToConstInput}; use crate::traits; @@ -62,7 +60,9 @@ use crate::traits::query::{ use crate::ty::subst::SubstsRef; use crate::ty::{self, ParamEnvAnd, Ty, TyCtxt}; +use rustc_data_structures::fingerprint::Fingerprint; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX}; +use rustc_hir::definitions::DefPathHash; use rustc_hir::HirId; use rustc_span::symbol::Symbol; use std::hash::Hash; diff --git a/src/librustc/hir/map/collector.rs b/src/librustc/hir/map/collector.rs index c3bc9490d294e..725238f1d1a85 100644 --- a/src/librustc/hir/map/collector.rs +++ b/src/librustc/hir/map/collector.rs @@ -1,5 +1,4 @@ use crate::arena::Arena; -use crate::hir::map::definitions::{self, DefPathHash}; use crate::hir::map::{Entry, HirOwnerData, Map}; use crate::hir::{Owner, OwnerNodes, ParentedNode}; use crate::ich::StableHashingContext; @@ -11,6 +10,7 @@ use rustc_data_structures::svh::Svh; use rustc_hir as hir; use rustc_hir::def_id::CRATE_DEF_INDEX; use rustc_hir::def_id::{LocalDefId, LOCAL_CRATE}; +use rustc_hir::definitions::{self, DefPathHash}; use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor}; use rustc_hir::*; use rustc_index::vec::{Idx, IndexVec}; diff --git a/src/librustc/hir/map/mod.rs b/src/librustc/hir/map/mod.rs index eb8e57743b8f8..495c1804044f3 100644 --- a/src/librustc/hir/map/mod.rs +++ b/src/librustc/hir/map/mod.rs @@ -7,9 +7,7 @@ use rustc_ast::ast::{self, Name, NodeId}; use rustc_data_structures::svh::Svh; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, LOCAL_CRATE}; -pub use rustc_hir::definitions; -pub use rustc_hir::definitions::{DefKey, DefPath, DefPathData, DefPathHash}; -pub use rustc_hir::definitions::{Definitions, DisambiguatedDefPathData}; +use rustc_hir::definitions::{DefKey, DefPath, Definitions}; use rustc_hir::intravisit; use rustc_hir::itemlikevisit::ItemLikeVisitor; use rustc_hir::print::Nested; diff --git a/src/librustc/ich/hcx.rs b/src/librustc/ich/hcx.rs index ba3763f6ee0bd..a9466e8252de7 100644 --- a/src/librustc/ich/hcx.rs +++ b/src/librustc/ich/hcx.rs @@ -1,5 +1,4 @@ -use crate::hir::map::definitions::{DefPathHash, Definitions}; -use crate::ich::{self, CachingSourceMapView}; +use crate::ich; use crate::middle::cstore::CrateStore; use crate::ty::{fast_reject, TyCtxt}; @@ -9,10 +8,11 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_data_structures::sync::Lrc; use rustc_hir as hir; use rustc_hir::def_id::{DefId, LocalDefId}; +use rustc_hir::definitions::{DefPathHash, Definitions}; use rustc_session::Session; use rustc_span::source_map::SourceMap; use rustc_span::symbol::Symbol; -use rustc_span::{BytePos, SourceFile}; +use rustc_span::{BytePos, CachingSourceMapView, SourceFile}; use smallvec::SmallVec; use std::cmp::Ord; diff --git a/src/librustc/ich/impls_hir.rs b/src/librustc/ich/impls_hir.rs index 1722b29266ad2..f668cc99754f4 100644 --- a/src/librustc/ich/impls_hir.rs +++ b/src/librustc/ich/impls_hir.rs @@ -1,12 +1,13 @@ //! This module contains `HashStable` implementations for various HIR data //! types in no particular order. -use crate::hir::map::DefPathHash; -use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext}; +use crate::ich::{NodeIdHashingMode, StableHashingContext}; use rustc_attr as attr; +use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId, LocalDefId, CRATE_DEF_INDEX}; +use rustc_hir::definitions::DefPathHash; use smallvec::SmallVec; use std::mem; diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 433076bb8342c..41cc8cbaebb6e 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -1,10 +1,11 @@ //! This module contains `HashStable` implementations for various data types //! from rustc::ty in no particular order. -use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext}; +use crate::ich::{NodeIdHashingMode, StableHashingContext}; use crate::middle::region; use crate::mir; use crate::ty; +use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher, ToStableHashKey}; use std::cell::RefCell; diff --git a/src/librustc/ich/mod.rs b/src/librustc/ich/mod.rs index 2c4618dcd42cf..516e3ed979c7c 100644 --- a/src/librustc/ich/mod.rs +++ b/src/librustc/ich/mod.rs @@ -3,7 +3,6 @@ pub use self::hcx::{ hash_stable_trait_impls, NodeIdHashingMode, StableHashingContext, StableHashingContextProvider, }; -crate use rustc_data_structures::fingerprint::Fingerprint; use rustc_span::symbol::{sym, Symbol}; pub use rustc_span::CachingSourceMapView; diff --git a/src/librustc/middle/cstore.rs b/src/librustc/middle/cstore.rs index 3a9d3c56dcead..012390e8f74b8 100644 --- a/src/librustc/middle/cstore.rs +++ b/src/librustc/middle/cstore.rs @@ -4,7 +4,6 @@ pub use self::NativeLibraryKind::*; -use crate::hir::map::definitions::{DefKey, DefPath, DefPathHash, DefPathTable}; use crate::ty::TyCtxt; use rustc_ast::ast; @@ -12,6 +11,7 @@ use rustc_ast::expand::allocator::AllocatorKind; use rustc_data_structures::svh::Svh; use rustc_data_structures::sync::{self, MetadataRef}; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; +use rustc_hir::definitions::{DefKey, DefPath, DefPathHash, DefPathTable}; use rustc_macros::HashStable; use rustc_session::search_paths::PathKind; pub use rustc_session::utils::NativeLibraryKind; diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 8f06b9a69bd15..3e4fcf19309cc 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -1,6 +1,5 @@ use super::{AllocId, CheckInAllocMsg, Pointer, RawConst, ScalarMaybeUndef}; -use crate::hir::map::definitions::DefPathData; use crate::mir::interpret::ConstValue; use crate::ty::layout::{Align, LayoutError, Size}; use crate::ty::query::TyCtxtAt; @@ -11,6 +10,7 @@ use backtrace::Backtrace; use rustc_data_structures::sync::Lock; use rustc_errors::{struct_span_err, DiagnosticBuilder}; use rustc_hir as hir; +use rustc_hir::definitions::DefPathData; use rustc_macros::HashStable; use rustc_session::CtfeBacktrace; use rustc_span::{def_id::DefId, Pos, Span}; diff --git a/src/librustc/mir/mono.rs b/src/librustc/mir/mono.rs index 27d82d25803c7..0b64cb479d559 100644 --- a/src/librustc/mir/mono.rs +++ b/src/librustc/mir/mono.rs @@ -1,9 +1,10 @@ use crate::dep_graph::{DepConstructor, DepNode, WorkProduct, WorkProductId}; -use crate::ich::{Fingerprint, NodeIdHashingMode, StableHashingContext}; +use crate::ich::{NodeIdHashingMode, StableHashingContext}; use crate::ty::print::obsolete::DefPathBasedNames; use crate::ty::{subst::InternalSubsts, Instance, InstanceDef, SymbolName, TyCtxt}; use rustc_attr::InlineAttr; use rustc_data_structures::base_n; +use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::{CrateNum, DefId, LOCAL_CRATE}; diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index 75842fd554941..4584f649fbed4 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -4,9 +4,6 @@ use crate::arena::Arena; use crate::dep_graph::DepGraph; use crate::dep_graph::{self, DepConstructor}; use crate::hir::exports::Export; -use crate::hir::map as hir_map; -use crate::hir::map::definitions::Definitions; -use crate::hir::map::{DefPathData, DefPathHash}; use crate::ich::{NodeIdHashingMode, StableHashingContext}; use crate::infer::canonical::{Canonical, CanonicalVarInfo, CanonicalVarInfos}; use crate::lint::{struct_lint_level, LintSource}; @@ -56,6 +53,7 @@ use rustc_data_structures::sync::{self, Lock, Lrc, WorkerLocal}; use rustc_hir as hir; use rustc_hir::def::{DefKind, Res}; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, DefIdSet, LocalDefId, LOCAL_CRATE}; +use rustc_hir::definitions::{DefPathData, DefPathHash, Definitions}; use rustc_hir::{HirId, Node, TraitCandidate}; use rustc_hir::{ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet}; use rustc_index::vec::{Idx, IndexVec}; @@ -1235,7 +1233,7 @@ impl<'tcx> TyCtxt<'tcx> { self.features_query(LOCAL_CRATE) } - pub fn def_key(self, id: DefId) -> hir_map::DefKey { + pub fn def_key(self, id: DefId) -> rustc_hir::definitions::DefKey { if let Some(id) = id.as_local() { self.hir().def_key(id) } else { self.cstore.def_key(id) } } @@ -1244,7 +1242,7 @@ impl<'tcx> TyCtxt<'tcx> { /// /// Note that if `id` is not local to this crate, the result will /// be a non-local `DefPath`. - pub fn def_path(self, id: DefId) -> hir_map::DefPath { + pub fn def_path(self, id: DefId) -> rustc_hir::definitions::DefPath { if let Some(id) = id.as_local() { self.hir().def_path(id) } else { @@ -1259,7 +1257,7 @@ impl<'tcx> TyCtxt<'tcx> { } #[inline] - pub fn def_path_hash(self, def_id: DefId) -> hir_map::DefPathHash { + pub fn def_path_hash(self, def_id: DefId) -> rustc_hir::definitions::DefPathHash { if let Some(def_id) = def_id.as_local() { self.definitions.def_path_hash(def_id) } else { diff --git a/src/librustc/ty/instance.rs b/src/librustc/ty/instance.rs index ac49feaf8c2bf..fcfee0fea85af 100644 --- a/src/librustc/ty/instance.rs +++ b/src/librustc/ty/instance.rs @@ -166,7 +166,7 @@ impl<'tcx> InstanceDef<'tcx> { /// Note that this is only a hint. See the documentation for /// `generates_cgu_internal_copy` for more information. pub fn requires_inline(&self, tcx: TyCtxt<'tcx>) -> bool { - use crate::hir::map::DefPathData; + use rustc_hir::definitions::DefPathData; let def_id = match *self { ty::InstanceDef::Item(def_id) => def_id, ty::InstanceDef::DropGlue(_, Some(_)) => return false, diff --git a/src/librustc/ty/mod.rs b/src/librustc/ty/mod.rs index 78b0ee271fb74..43982439d47c8 100644 --- a/src/librustc/ty/mod.rs +++ b/src/librustc/ty/mod.rs @@ -8,8 +8,6 @@ pub use self::Variance::*; use crate::arena::Arena; use crate::hir::exports::ExportMap; -use crate::hir::map as hir_map; -use crate::ich::Fingerprint; use crate::ich::StableHashingContext; use crate::infer::canonical::Canonical; use crate::middle::cstore::CrateStoreDyn; @@ -28,6 +26,7 @@ use rustc_ast::ast::{self, Ident, Name}; use rustc_ast::node_id::{NodeId, NodeMap, NodeSet}; use rustc_attr as attr; use rustc_data_structures::captures::Captures; +use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::fx::FxIndexMap; use rustc_data_structures::sorted_map::SortedIndexMultiMap; @@ -124,7 +123,7 @@ mod sty; // Data types pub struct ResolverOutputs { - pub definitions: hir_map::Definitions, + pub definitions: rustc_hir::definitions::Definitions, pub cstore: Box, pub extern_crate_map: NodeMap, pub trait_map: TraitMap, @@ -2986,7 +2985,7 @@ impl<'tcx> TyCtxt<'tcx> { let def_key = self.def_key(id); match def_key.disambiguated_data.data { // The name of a constructor is that of its parent. - hir_map::DefPathData::Ctor => { + rustc_hir::definitions::DefPathData::Ctor => { self.item_name(DefId { krate: id.krate, index: def_key.parent.unwrap() }) } _ => def_key.disambiguated_data.data.get_opt_name().unwrap_or_else(|| { diff --git a/src/librustc/ty/print/mod.rs b/src/librustc/ty/print/mod.rs index 8d784833bd310..a932f334dde68 100644 --- a/src/librustc/ty/print/mod.rs +++ b/src/librustc/ty/print/mod.rs @@ -1,9 +1,9 @@ -use crate::hir::map::{DefPathData, DisambiguatedDefPathData}; use crate::ty::subst::{GenericArg, Subst}; use crate::ty::{self, DefIdTree, Ty, TyCtxt}; use rustc_data_structures::fx::FxHashSet; use rustc_hir::def_id::{CrateNum, DefId}; +use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; // `pretty` is a separate module only for organization. mod pretty; diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 58bff2f13eb70..8d5d6247f5c05 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -1,18 +1,17 @@ -use crate::hir::map::{DefPathData, DisambiguatedDefPathData}; use crate::middle::cstore::{ExternCrate, ExternCrateSource}; use crate::middle::region; use crate::mir::interpret::{sign_extend, truncate, AllocId, ConstValue, Pointer, Scalar}; use crate::ty::layout::{Integer, IntegerExt, Size}; use crate::ty::subst::{GenericArg, GenericArgKind, Subst}; use crate::ty::{self, DefIdTree, ParamConst, Ty, TyCtxt, TypeFoldable}; -use rustc_hir as hir; -use rustc_hir::def::{DefKind, Namespace}; -use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; - use rustc_apfloat::ieee::{Double, Single}; use rustc_apfloat::Float; use rustc_ast::ast; use rustc_attr::{SignedInt, UnsignedInt}; +use rustc_hir as hir; +use rustc_hir::def::{DefKind, Namespace}; +use rustc_hir::def_id::{CrateNum, DefId, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; use rustc_span::symbol::{kw, Symbol}; use rustc_target::spec::abi::Abi; diff --git a/src/librustc/ty/query/on_disk_cache.rs b/src/librustc/ty/query/on_disk_cache.rs index 781abea75d9f7..155f792bd9d0a 100644 --- a/src/librustc/ty/query/on_disk_cache.rs +++ b/src/librustc/ty/query/on_disk_cache.rs @@ -1,17 +1,17 @@ use crate::dep_graph::{DepNodeIndex, SerializedDepNodeIndex}; -use crate::hir::map::definitions::DefPathHash; -use crate::ich::{CachingSourceMapView, Fingerprint}; use crate::mir::interpret::{AllocDecodingSession, AllocDecodingState}; use crate::mir::{self, interpret}; use crate::ty::codec::{self as ty_codec, TyDecoder, TyEncoder}; use crate::ty::context::TyCtxt; use crate::ty::{self, Ty}; use rustc_ast::ast::Ident; +use rustc_data_structures::fingerprint::Fingerprint; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::sync::{HashMapExt, Lock, Lrc, Once}; use rustc_data_structures::thin_vec::ThinVec; use rustc_errors::Diagnostic; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, LOCAL_CRATE}; +use rustc_hir::definitions::DefPathHash; use rustc_index::vec::{Idx, IndexVec}; use rustc_serialize::{ opaque, Decodable, Decoder, Encodable, Encoder, SpecializedDecoder, SpecializedEncoder, @@ -20,6 +20,7 @@ use rustc_serialize::{ use rustc_session::{CrateDisambiguator, Session}; use rustc_span::hygiene::{ExpnId, SyntaxContext}; use rustc_span::source_map::{SourceMap, StableSourceFileId}; +use rustc_span::CachingSourceMapView; use rustc_span::{BytePos, SourceFile, Span, DUMMY_SP}; use std::mem; diff --git a/src/librustc/ty/query/plumbing.rs b/src/librustc/ty/query/plumbing.rs index 80a4e552f02d6..3aac03bd49a13 100644 --- a/src/librustc/ty/query/plumbing.rs +++ b/src/librustc/ty/query/plumbing.rs @@ -667,7 +667,7 @@ impl<'tcx> TyCtxt<'tcx> { dep_node: &DepNode, dep_node_index: DepNodeIndex, ) { - use crate::ich::Fingerprint; + use rustc_data_structures::fingerprint::Fingerprint; assert!( Some(self.dep_graph.fingerprint_of(dep_node_index)) diff --git a/src/librustc/ty/query/profiling_support.rs b/src/librustc/ty/query/profiling_support.rs index 58ace917786cf..0081794051f37 100644 --- a/src/librustc/ty/query/profiling_support.rs +++ b/src/librustc/ty/query/profiling_support.rs @@ -1,4 +1,3 @@ -use crate::hir::map::definitions::DefPathData; use crate::ty::context::TyCtxt; use crate::ty::query::caches::QueryCache; use crate::ty::query::plumbing::QueryState; @@ -6,6 +5,7 @@ use measureme::{StringComponent, StringId}; use rustc_data_structures::fx::FxHashMap; use rustc_data_structures::profiling::SelfProfiler; use rustc_hir::def_id::{CrateNum, DefId, DefIndex, CRATE_DEF_INDEX, LOCAL_CRATE}; +use rustc_hir::definitions::DefPathData; use std::fmt::Debug; use std::io::Write; diff --git a/src/librustc/ty/trait_def.rs b/src/librustc/ty/trait_def.rs index b0287be65294f..ed9054fcffd91 100644 --- a/src/librustc/ty/trait_def.rs +++ b/src/librustc/ty/trait_def.rs @@ -1,4 +1,3 @@ -use crate::hir::map::DefPathHash; use crate::ich::{self, StableHashingContext}; use crate::traits::specialization_graph; use crate::ty::fast_reject; @@ -6,6 +5,7 @@ use crate::ty::fold::TypeFoldable; use crate::ty::{Ty, TyCtxt}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId}; +use rustc_hir::definitions::DefPathHash; use rustc_hir::HirId; use rustc_data_structures::fx::FxHashMap; diff --git a/src/librustc/ty/util.rs b/src/librustc/ty/util.rs index 1f512f1dde7d6..dab367a6639ed 100644 --- a/src/librustc/ty/util.rs +++ b/src/librustc/ty/util.rs @@ -1,6 +1,5 @@ //! Miscellaneous type-system utilities that are too small to deserve their own modules. -use crate::hir::map::DefPathData; use crate::ich::NodeIdHashingMode; use crate::mir::interpret::{sign_extend, truncate}; use crate::ty::layout::{Integer, IntegerExt, Size}; @@ -17,6 +16,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir as hir; use rustc_hir::def::DefKind; use rustc_hir::def_id::DefId; +use rustc_hir::definitions::DefPathData; use rustc_macros::HashStable; use rustc_span::Span; use rustc_target::abi::TargetDataLayout; diff --git a/src/librustc_codegen_llvm/debuginfo/namespace.rs b/src/librustc_codegen_llvm/debuginfo/namespace.rs index 55a3540809b48..4e507a569dcd1 100644 --- a/src/librustc_codegen_llvm/debuginfo/namespace.rs +++ b/src/librustc_codegen_llvm/debuginfo/namespace.rs @@ -6,8 +6,8 @@ use rustc::ty::{self, Instance}; use crate::common::CodegenCx; use crate::llvm; use crate::llvm::debuginfo::DIScope; -use rustc::hir::map::DefPathData; use rustc_hir::def_id::DefId; +use rustc_hir::definitions::DefPathData; pub fn mangled_name_of_instance<'a, 'tcx>( cx: &CodegenCx<'a, 'tcx>, diff --git a/src/librustc_infer/infer/error_reporting/mod.rs b/src/librustc_infer/infer/error_reporting/mod.rs index a2ae4f53fb8f2..9c22c38583c33 100644 --- a/src/librustc_infer/infer/error_reporting/mod.rs +++ b/src/librustc_infer/infer/error_reporting/mod.rs @@ -55,7 +55,6 @@ use crate::traits::{ IfExpressionCause, MatchExpressionArmCause, ObligationCause, ObligationCauseCode, }; -use rustc::hir::map; use rustc::middle::region; use rustc::ty::error::TypeError; use rustc::ty::{ @@ -549,7 +548,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { terr: &TypeError<'tcx>, ) { use hir::def_id::CrateNum; - use map::DisambiguatedDefPathData; + use rustc_hir::definitions::DisambiguatedDefPathData; use ty::print::Printer; use ty::subst::GenericArg; diff --git a/src/librustc_interface/passes.rs b/src/librustc_interface/passes.rs index 60bb4a661fd01..99ac49454273c 100644 --- a/src/librustc_interface/passes.rs +++ b/src/librustc_interface/passes.rs @@ -5,7 +5,6 @@ use crate::util; use log::{info, log_enabled, warn}; use rustc::arena::Arena; use rustc::dep_graph::DepGraph; -use rustc::hir::map::Definitions; use rustc::middle; use rustc::middle::cstore::{CrateStore, MetadataLoader, MetadataLoaderDyn}; use rustc::ty::steal::Steal; @@ -20,6 +19,7 @@ use rustc_data_structures::{box_region_allow_access, declare_box_region_type, pa use rustc_errors::PResult; use rustc_expand::base::ExtCtxt; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; +use rustc_hir::definitions::Definitions; use rustc_hir::Crate; use rustc_lint::LintStore; use rustc_mir as mir; diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 1f551583b0c86..a807fa6b8d466 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -3,7 +3,6 @@ use crate::locator::{CrateLocator, CratePaths}; use crate::rmeta::{CrateDep, CrateMetadata, CrateNumMap, CrateRoot, MetadataBlob}; -use rustc::hir::map::Definitions; use rustc::middle::cstore::DepKind; use rustc::middle::cstore::{CrateSource, ExternCrate, ExternCrateSource, MetadataLoaderDyn}; use rustc::ty::TyCtxt; @@ -14,6 +13,7 @@ use rustc_data_structures::sync::Lrc; use rustc_errors::struct_span_err; use rustc_expand::base::SyntaxExtension; use rustc_hir::def_id::{CrateNum, LOCAL_CRATE}; +use rustc_hir::definitions::Definitions; use rustc_index::vec::IndexVec; use rustc_session::config; use rustc_session::output::validate_crate_name; diff --git a/src/librustc_metadata/rmeta/mod.rs b/src/librustc_metadata/rmeta/mod.rs index 448c1610c1368..9aae70f014b0d 100644 --- a/src/librustc_metadata/rmeta/mod.rs +++ b/src/librustc_metadata/rmeta/mod.rs @@ -2,7 +2,6 @@ use decoder::Metadata; use table::{Table, TableBuilder}; use rustc::hir::exports::Export; -use rustc::hir::map; use rustc::middle::cstore::{DepKind, ForeignModule, LinkagePreference, NativeLibrary}; use rustc::middle::exported_symbols::{ExportedSymbol, SymbolExportLevel}; use rustc::middle::lang_items; @@ -194,7 +193,7 @@ crate struct CrateRoot<'tcx> { native_libraries: Lazy<[NativeLibrary]>, foreign_modules: Lazy<[ForeignModule]>, source_map: Lazy<[rustc_span::SourceFile]>, - def_path_table: Lazy, + def_path_table: Lazy, impls: Lazy<[TraitImpls]>, interpret_alloc_index: Lazy<[u32]>, diff --git a/src/librustc_mir/interpret/intrinsics/type_name.rs b/src/librustc_mir/interpret/intrinsics/type_name.rs index 162387308040d..0d9582c7323cb 100644 --- a/src/librustc_mir/interpret/intrinsics/type_name.rs +++ b/src/librustc_mir/interpret/intrinsics/type_name.rs @@ -1,4 +1,3 @@ -use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::mir::interpret::Allocation; use rustc::ty::{ self, @@ -7,6 +6,7 @@ use rustc::ty::{ Ty, TyCtxt, }; use rustc_hir::def_id::CrateNum; +use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; use std::fmt::Write; struct AbsolutePathPrinter<'tcx> { diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 5b112677cf77f..ed304572a0621 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -17,7 +17,6 @@ pub use rustc_hir::def::{Namespace, PerNS}; use Determinacy::*; use rustc::hir::exports::ExportMap; -use rustc::hir::map::{DefKey, Definitions}; use rustc::middle::cstore::{CrateStore, MetadataLoaderDyn}; use rustc::span_bug; use rustc::ty::query::Providers; @@ -38,6 +37,7 @@ use rustc_expand::base::SyntaxExtension; use rustc_hir::def::Namespace::*; use rustc_hir::def::{self, CtorOf, DefKind, NonMacroAttrKind, PartialRes}; use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, CRATE_DEF_INDEX}; +use rustc_hir::definitions::{DefKey, Definitions}; use rustc_hir::PrimTy::{self, Bool, Char, Float, Int, Str, Uint}; use rustc_hir::{GlobMap, TraitMap}; use rustc_metadata::creader::{CStore, CrateLoader}; diff --git a/src/librustc_symbol_mangling/legacy.rs b/src/librustc_symbol_mangling/legacy.rs index 7b082309f34b5..a891d60b0687b 100644 --- a/src/librustc_symbol_mangling/legacy.rs +++ b/src/librustc_symbol_mangling/legacy.rs @@ -1,4 +1,3 @@ -use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::ich::NodeIdHashingMode; use rustc::mir::interpret::{ConstValue, Scalar}; use rustc::ty::print::{PrettyPrinter, Print, Printer}; @@ -7,6 +6,7 @@ use rustc::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; use rustc::util::common::record_time; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; use rustc_hir::def_id::CrateNum; +use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; use log::debug; diff --git a/src/librustc_symbol_mangling/v0.rs b/src/librustc_symbol_mangling/v0.rs index e22a49061bb19..fb2fde8513ac9 100644 --- a/src/librustc_symbol_mangling/v0.rs +++ b/src/librustc_symbol_mangling/v0.rs @@ -1,4 +1,3 @@ -use rustc::hir::map::{DefPathData, DisambiguatedDefPathData}; use rustc::ty::print::{Print, Printer}; use rustc::ty::subst::{GenericArg, GenericArgKind, Subst}; use rustc::ty::{self, Instance, Ty, TyCtxt, TypeFoldable}; @@ -7,6 +6,7 @@ use rustc_data_structures::base_n; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_hir as hir; use rustc_hir::def_id::{CrateNum, DefId}; +use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData}; use rustc_target::spec::abi::Abi; use std::fmt::Write; From 1a21c28e3943ccd910454f641a1612cbb43a5c3b Mon Sep 17 00:00:00 2001 From: Tyler Mandry Date: Tue, 24 Mar 2020 16:44:45 -0700 Subject: [PATCH 4/4] Add test for #66312 Closes #66312. This issue was fixed by #68884. --- src/test/ui/async-await/issue-66312.rs | 14 ++++++++++++++ src/test/ui/async-await/issue-66312.stderr | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 src/test/ui/async-await/issue-66312.rs create mode 100644 src/test/ui/async-await/issue-66312.stderr diff --git a/src/test/ui/async-await/issue-66312.rs b/src/test/ui/async-await/issue-66312.rs new file mode 100644 index 0000000000000..9224971ecb123 --- /dev/null +++ b/src/test/ui/async-await/issue-66312.rs @@ -0,0 +1,14 @@ +// edition:2018 + +trait Test { + fn is_some(self: T); //~ ERROR invalid `self` parameter type +} + +async fn f() { + let x = Some(2); + if x.is_some() { + println!("Some"); + } +} + +fn main() {} diff --git a/src/test/ui/async-await/issue-66312.stderr b/src/test/ui/async-await/issue-66312.stderr new file mode 100644 index 0000000000000..80d294a10a018 --- /dev/null +++ b/src/test/ui/async-await/issue-66312.stderr @@ -0,0 +1,12 @@ +error[E0307]: invalid `self` parameter type: T + --> $DIR/issue-66312.rs:4:22 + | +LL | fn is_some(self: T); + | ^ + | + = note: type of `self` must be `Self` or a type that dereferences to it + = help: consider changing to `self`, `&self`, `&mut self`, `self: Box`, `self: Rc`, `self: Arc`, or `self: Pin

` (where P is one of the previous types except `Self`) + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0307`.