8000 Rollup of 14 pull requests by m-ou-se · Pull Request #81102 · rust-lang/rust · GitHub
[go: up one dir, main page]

Skip to content

Rollup of 14 pull requests #81102

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

Closed
wants to merge 108 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
c06793b
Add Roadmap for 2021
flip1995 Dec 15, 2020
469281c
Check if never type feature is enabled by TyCtxt before suggesting em…
nahuakang Dec 28, 2020
83a458a
Enable never type in empty enum ui test; run cargo dev bless
nahuakang Dec 28, 2020
275988c
Add additional lint doc to known problems section
nahuakang Dec 28, 2020
af480a6
Ensure `Copy` exception in trait definition for `wrong_self_conventio…
ThibsG Dec 30, 2020
0afe2db
Update CHANGELOG for Rust 1.50
phansch Dec 30, 2020
b81111b
Address review comments
phansch Dec 30, 2020
6b37932
Fix blessing of test output in subdirectories
phansch Dec 31, 2020
6909055
s/test_dir/test_suite_dir
phansch Dec 31, 2020
5d48b91
field_reassign_with_default: don't expand macros in suggestion
matthiaskrgr Jan 1, 2021
ba4bf4f
Merge commit '1fcc74cc9e03bc91eaa80ecf92976b0b14b3aeb6' into clippyup
flip1995 Jan 2, 2021
1853f8b
Add lint
Jarcho Jan 2, 2021
78f6009
Auto merge of #6520 - phansch:update-changelog, r=flip1995
bors Jan 2, 2021
053afe4
Use bootstrap rustc for versioncheck in Clippy
flip1995 Jan 2, 2021
9427e03
Fix clone_on_copy test
Jarcho Jan 2, 2021
d37ee6f
Fix lint errors
Jarcho Jan 2, 2021
b498870
use hir::Place instead of Symbol in closure_kind_origin
roxelo Dec 3, 2020
592f7eb
Auto merge of #6531 - matthiaskrgr:6522, r=ebroto
bors Jan 2, 2021
a02806e
Auto merge of #6518 - ThibsG:CopyException, r=ebroto
bors Jan 2, 2021
7b5f549
Fix docs: use type inference
Jarcho Jan 3, 2021
8951916
Auto merge of #6525 - phansch:fix-bless-in-subdirs, r=flip1995
bors Jan 4, 2021
d141cdc
Add prioritization chapter and remove unresolved questions
flip1995 Jan 4, 2021
6dcec6a
collapsible_if: split collapsible_else_if into its own lint so we can…
matthiaskrgr Jan 4, 2021
dd1929e
Auto merge of #6544 - matthiaskrgr:else_if, r=flip1995
bors Jan 4, 2021
ba87acb
Implemented needless question mark lint
bengsparks Dec 26, 2020
ae9ae97
Auto merge of #6507 - bengsparks:lint/issue6410, r=flip1995
bors Jan 4, 2021
7acfa44
Add ui-internal to cargo dev bless
camsteffen Dec 31, 2020
cbbb188
Bless only updated since clippy build
camsteffen Dec 31, 2020
445eb99
Auto merge of #6548 - camsteffen:bless-internal, r=flip1995
bors Jan 4, 2021
bc97f5d
Address flip1995's review comments
nahuakang Jan 4, 2021
a8d47b4
Run cargo dev fmt
nahuakang Jan 4, 2021
976850b
Auto merge of #6538 - Jarcho:vec_init_then_push, r=llogiq
bors Jan 4, 2021
4b478a5
Add a new lint `ptr_as_ptr`,
rail-rain Jan 3, 2021
dfa5d7e
Fix the MSRV and add the tests for MSRV
rail-rain Jan 4, 2021
dd52066
Auto merge of #6547 - camsteffen:curse-outdated, r=phansch
bors Jan 5, 2021
311186b
Auto merge of #6513 - nahuakang:fix/empty_enum_lint_never_type, r=fli…
bors Jan 5, 2021
a6b72d3
Auto merge of #6542 - rail-rain:ptr_as_ptr, r=flip1995
bors Jan 5, 2021
ea885d9
Tiny Symbol cleanup
phansch Jan 5, 2021
42b9e92
Auto merge of #6551 - phansch:tiny-symbol-cleanup, r=flip1995
bors Jan 5, 2021
a8825e9
Use existing 'is_automatically_derived' helper
phansch Jan 5, 2021
03c0e58
Revert "Auto merge of #79637 - spastorino:revert-trait-inheritance-se…
spastorino Dec 3, 2020
92f2bbb
Fix macro issues with field_reassign_with_default
phansch Jan 5, 2021
455a0e1
Use Symbol instead of Ident as an assoc_name to prevent ICEs
spastorino Jan 5, 2021
efccfe8
Auto merge of #6553 - phansch:field-reassign-with-default-macros, r=f…
bors Jan 6, 2021
8a45ffa
Fix typo: `which which can be` -> `which can be`
sozysozbot Jan 6, 2021
8e5c5a6
Auto merge of #6554 - sozysozbot:master, r=flip1995
bors Jan 6, 2021
f50ded0
Catch `pointer::cast` too in `cast_ptr_alignment`
rail-rain Jan 7, 2021
547ce0d
Change env var used for testing Clippy
flip1995 Jan 7, 2021
2b3c0ad
Fix typo: `irrevelent` -> `irrelevant`
stanislav-tkach Jan 7, 2021
e15bef9
Auto merge of #6558 - stanislav-tkach:patch-2, r=flip1995
bors Jan 7, 2021
7d42172
Reintroduce hir::ExprKind::If
c410-f3r Jan 1, 2021
aa9adbf
Small fixes of doc in `needless_question_mark`
giraffate Jan 7, 2021
0e14a75
Reduce the span in `from_over_into` to impl header
giraffate Jan 7, 2021
ee9b47d
Move `is_hir_ty_cfg_dependant` to `util`,
rail-rain Jan 8, 2021
2950c8e
Auto merge of #6566 - giraffate:reduce_the_span_in_from_over_into, r=…
bors Jan 8, 2021
24c700b
Use DefId in interning defined symbol lint
camsteffen Dec 30, 2020
121c65f
Add keywords to interning defined symbol lint
camsteffen Dec 29, 2020
76ccfb4
Fix unnecessary keyword intern dogfood
camsteffen Dec 29, 2020
cc26919
Add unnecessary symbol string lint
camsteffen Dec 30, 2020
7871eba
Fix symbol string comparison dogfood
camsteffen Dec 29, 2020
68bcd20
Auto merge of #6569 - camsteffen:symbol-comparison, r=Manishearth
bors Jan 8, 2021
8a6fea4
Fix FP for `boxed_local` lint in default trait fn impl
ThibsG Jan 9, 2021
ee0598e
Auto merge of #6571 - ThibsG:BoxedLocalTrait, r=phansch
bors Jan 9, 2021
583715f
Auto merge of #6565 - giraffate:small_fixes_of_doc_in_needless_questi…
bors Jan 9, 2021
9e45a23
ast: Remove some indirection layers from values in key-value attributes
petrochenkov Dec 19, 2020
2c6dc88
Rework diagnostics for wrong number of generic args
Patryk27 Jan 2, 2021
1eed27f
Auto merge of #6575 - flip1995:stop_linting_deps, r=Manishearth
bors Jan 11, 2021
b7071b2
resolve: Simplify collection of traits in scope
petrochenkov Jan 6, 2021
53f8731
Simplify `cast_ptr_alignment` `pointer::casr` case
rail-rain Jan 11, 2021
7f4599a
Auto merge of #6557 - rail-rain:extending_cast_ptr_alignment, r=phansch
bors Jan 11, 2021
13ca5c8
Auto merge of #6462 - flip1995:roadmap, r=flip1995,llogiq,killercup,M…
bors Jan 12, 2021
ea02849
Make a reference a link in doc
giraffate Jan 13, 2021
dfb41f4
Separate out a `hir::Impl` struct
jyn514 Nov 22, 2020
00586df
Auto merge of #6584 - giraffate:make_references_to_issues_links, r=ll…
bors Jan 13, 2021
61a6468
Update rust-analyzer
lnicola Jan 13, 2021
dcd8c8e
Auto merge of #77524 - Patryk27:fixes/66228, r=estebank
bors Jan 13, 2021
7b3af41
Auto merge of #79328 - c410-f3r:hir-if, r=matthewjasper
bors Jan 14, 2021
9bd037d
Merge remote-tracking branch 'upstream/master' into rustup
flip1995 Jan 15, 2021
0c5ba9a
Bump nightly version to 2021-01-15
flip1995 Jan 15, 2021
f18cf82
Don't trigger needless_return lint in macros
flip1995 Jan 15, 2021
953f024
Auto merge of #6586 - flip1995:rustup, r=flip1995
bors Jan 15, 2021
3e236b3
Merge commit '953f024793dab92745fee9cd2c4dee6a60451771' into clippyup
flip1995 Jan 15, 2021
6766070
Allow downloading LLVM on Windows
jyn514 Jan 12, 2021
5c4adbe
Add all tier 1 platforms to supported platforms for "if-available"
jyn514 Jan 13, 2021
8b702e0
Support non-stage0 check
Mark-Simulacrum Jan 16, 2021
c17ed34
Print which stage is being checked (now that it may not be stage0)
jyn514 Jan 16, 2021
53989e4
Allow configuring the default stage for `x.py check`
jyn514 Jan 16, 2021
50ee0b2
BTreeMap: clean up a few more comments
ssomers Nov 18, 2020
65b5e43
Use PlaceRef more consistently in rustc_mir
oliviacrain Jan 10, 2021
28501c0
rustc_parse_format: Fix character indices in find_skips
osa1 Jan 16, 2021
15f0921
correctly deal with late-bound lifetimes in anon consts
lcnr Nov 22, 2020
76003f3
Use Option::map instead of open-coding it
LingMan Dec 30, 2020
5a706cf
Use Option::unwrap_or instead of open-coding it
LingMan Jan 16, 2021
7f9a2cf
resolve: Reject ambiguity built-in attr vs different built-in attr
petrochenkov Dec 13, 2020
f6f754a
Rollup merge of #79298 - lcnr:new-elysium, r=matthewjasper
m-ou-se Jan 16, 2021
c06ff92
Rollup merge of #80031 - petrochenkov:builtina, r=estebank
m-ou-se Jan 16, 2021
803d616
Rollup merge of #80635 - sexxi-goose:use-place-instead-of-symbol, r=n…
m-ou-se Jan 16, 2021
8000
d2009f0
Rollup merge of #80732 - spastorino:trait-inheritance-self2, r=nikoma…
m-ou-se Jan 16, 2021
589864d
Rollup merge of #80765 - petrochenkov:traitsinscope, r=matthewjasper
m-ou-se Jan 16, 2021
42801b4
Rollup merge of #80865 - oliviacrain:proj_based, r=RalfJung
m-ou-se Jan 16, 2021
b2d8614
Rollup merge of #80932 - jyn514:download-windows-llvm, r=Mark-Simulacrum
m-ou-se Jan 16, 2021
ab62218
Rollup merge of #80984 - lnicola:bump-rust-analyzer, r=jonas-schievink
m-ou-se Jan 16, 2021
f25652d
Rollup merge of #81038 - flip1995:clippyup, r=Manishearth
m-ou-se Jan 16, 2021
85c6462
Rollup merge of #81064 - Mark-Simulacrum:support-stage1-check, r=jyn514
m-ou-se Jan 16, 2021
a5a259f
Rollup merge of #81071 - osa1:fix_81006, r=estebank
m-ou-se Jan 16, 2021
5bc3f8c
Rollup merge of #81082 - ssomers:btree_cleanup_comments, r=Mark-Simul…
m-ou-se Jan 16, 2021
6b66591
Rollup merge of #81084 - LingMan:map, r=oli-obk
m-ou-se Jan 16, 2021
576c3d5
Rollup merge of #81095 - LingMan:unwrap, r=oli-obk
m-ou-se Jan 16, 2021
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
2 changes: 1 addition & 1 deletion compiler/rustc_resolve/src/build_reduced_graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ impl<'a> Resolver<'a> {
self.get_module(parent_id)
}

crate fn get_module(&mut self, def_id: DefId) -> Module<'a> {
pub fn get_module(&mut self, def_id: DefId) -> Module<'a> {
// If this is a local module, it will be in `module_map`, no need to recalculate it.
if let Some(def_id) = def_id.as_local() {
return self.module_map[&def_id];
Expand Down
72 changes: 10 additions & 62 deletions compiler/rustc_resolve/src/late.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use crate::{ResolutionError, Resolver, Segment, UseError};
use rustc_ast::ptr::P;
use rustc_ast::visit::{self, AssocCtxt, FnCtxt, FnKind, Visitor};
use rustc_ast::*;
use rustc_ast::{unwrap_or, walk_list};
use rustc_ast_lowering::ResolverAstLowering;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_errors::DiagnosticId;
Expand Down Expand Up @@ -1911,7 +1910,7 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
// it needs to be added to the trait map.
if ns == ValueNS {
let item_name = path.last().unwrap().ident;
let traits = self.get_traits_containing_item(item_name, ns);
let traits = self.traits_in_scope(item_name, ns);
self.r.trait_map.insert(id, traits);
}

Expand Down Expand Up @@ -2371,12 +2370,12 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
// field, we need to add any trait methods we find that match
// the field name so that we can do some nice error reporting
// later on in typeck.
let traits = self.get_traits_containing_item(ident, ValueNS);
let traits = self.traits_in_scope(ident, ValueNS);
self.r.trait_map.insert(expr.id, traits);
}
ExprKind::MethodCall(ref segment, ..) => {
debug!("(recording candidate traits for expr) recording traits for {}", expr.id);
let traits = self.get_traits_containing_item(segment.ident, ValueNS);
let traits = self.traits_in_scope(segment.ident, ValueNS);
self.r.trait_map.insert(expr.id, traits);
}
_ => {
Expand All @@ -2385,64 +2384,13 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
}
}

fn get_traits_containing_item(
&mut self,
mut ident: Ident,
ns: Namespace,
) -> Vec<TraitCandidate> {
debug!("(getting traits containing item) looking for '{}'", ident.name);

let mut found_traits = Vec::new();
// Look for the current trait.
if let Some((module, _)) = self.current_trait_ref {
if self
.r
.resolve_ident_in_module(
ModuleOrUniformRoot::Module(module),
ident,
ns,
&self.parent_scope,
false,
module.span,
)
.is_ok()
{
let def_id = module.def_id().unwrap();
found_traits.push(TraitCandidate { def_id, import_ids: smallvec![] });
}
}

ident.span = ident.span.normalize_to_macros_2_0();
let mut search_module = self.parent_scope.module;
loop {
self.r.get_traits_in_module_containing_item(
ident,
ns,
search_module,
&mut found_traits,
&self.parent_scope,
);
let mut span_data = ident.span.data();
search_module = unwrap_or!(
self.r.hygienic_lexical_parent(search_module, &mut span_data.ctxt),
break
);
ident.span = span_data.span();
}

if let Some(prelude) = self.r.prelude {
if !search_module.no_implicit_prelude {
self.r.get_traits_in_module_containing_item(
ident,
ns,
prelude,
&mut found_traits,
&self.parent_scope,
);
}
}

found_traits
fn traits_in_scope(&mut self, ident: Ident, ns: Namespace) -> Vec<TraitCandidate> {
self.r.traits_in_scope(
self.current_trait_ref.as_ref().map(|(module, _)| *module),
&self.parent_scope,
ident.span.ctxt(),
Some((ident.name, ns)),
)
}
}

Expand Down
127 changes: 63 additions & 64 deletions compiler/rustc_resolve/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ use rustc_index::vec::IndexVec;
use rustc_metadata::creader::{CStore, CrateLoader};
use rustc_middle::hir::exports::ExportMap;
use rustc_middle::middle::cstore::{CrateStore, MetadataLoaderDyn};
use rustc_middle::span_bug;
use rustc_middle::ty::query::Providers;
use rustc_middle::ty::{self, DefIdTree, ResolverOutputs};
use rustc_middle::{bug, span_bug};
use rustc_session::lint;
use rustc_session::lint::{BuiltinLintDiagnostics, LintBuffer};
use rustc_session::Session;
Expand Down Expand Up @@ -1477,49 +1477,76 @@ impl<'a> Resolver<'a> {
self.crate_loader.postprocess(krate);
}

fn get_traits_in_module_containing_item(
pub fn traits_in_scope(
&mut self,
current_trait: Option<Module<'a>>,
parent_scope: &ParentScope<'a>,
ctxt: SyntaxContext,
assoc_item: Option<(Symbol, Namespace)>,
) -> Vec<TraitCandidate> {
let mut found_traits = Vec::new();

if let Some(module) = current_trait {
if self.trait_may_have_item(Some(module), assoc_item) {
let def_id = module.def_id().unwrap();
found_traits.push(TraitCandidate { def_id, import_ids: smallvec![] });
}
}

self.visit_scopes(ScopeSet::All(TypeNS, false), parent_scope, ctxt, |this, scope, _, _| {
match scope {
Scope::Module(module) => {
this.traits_in_module(module, assoc_item, &mut found_traits);
}
Scope::StdLibPrelude => {
if let Some(module) = this.prelude {
this.traits_in_module(module, assoc_item, &mut found_traits);
}
}
Scope::ExternPrelude | Scope::ToolPrelude | Scope::BuiltinTypes => {}
_ => unreachable!(),
}
None::<()>
});

found_traits
}

fn traits_in_module(
&mut self,
ident: Ident,
ns: Namespace,
module: Module<'a>,
assoc_item: Option<(Symbol, Namespace)>,
found_traits: &mut Vec<TraitCandidate>,
parent_scope: &ParentScope<'a>,
) {
assert!(ns == TypeNS || ns == ValueNS);
module.ensure_traits(self);
let traits = module.traits.borrow();
for (trait_name, trait_binding) in traits.as_ref().unwrap().iter() {
if self.trait_may_have_item(trait_binding.module(), assoc_item) {
let def_id = trait_binding.res().def_id();
let import_ids = self.find_transitive_imports(&trait_binding.kind, *trait_name);
found_traits.push(TraitCandidate { def_id, import_ids });
}
}
}

for &(trait_name, binding) in traits.as_ref().unwrap().iter() {
// Traits have pseudo-modules that can be used to search for the given ident.
if let Some(module) = binding.module() {
let mut ident = ident;
if ident.span.glob_adjust(module.expansion, binding.span).is_none() {
continue;
}
if self
.resolve_ident_in_module_unadjusted(
ModuleOrUniformRoot::Module(module),
ident,
ns,
parent_scope,
false,
module.span,
)
.is_ok()
{
let import_ids = self.find_transitive_imports(&binding.kind, trait_name);
let trait_def_id = module.def_id().unwrap();
found_traits.push(TraitCandidate { def_id: trait_def_id, import_ids });
}
} else if let Res::Def(DefKind::TraitAlias, _) = binding.res() {
// For now, just treat all trait aliases as possible candidates, since we don't
// know if the ident is somewhere in the transitive bounds.
let import_ids = self.find_transitive_imports(&binding.kind, trait_name);
let trait_def_id = binding.res().def_id();
found_traits.push(TraitCandidate { def_id: trait_def_id, import_ids });
} else {
bug!("candidate is not trait or trait alias?")
// List of traits in scope is pruned on best effort basis. We reject traits not having an
// associated item with the given name and namespace (if specified). This is a conservative
// optimization, proper hygienic type-based resolution of associated items is done in typeck.
// We don't reject trait aliases (`trait_module == None`) because we don't have access to their
// associated items.
fn trait_may_have_item(
&mut self,
trait_module: Option<Module<'a>>,
assoc_item: Option<(Symbol, Namespace)>,
) -> bool {
match (trait_module, assoc_item) {
(Some(trait_module), Some((name, ns))) => {
self.resolutions(trait_module).borrow().iter().any(|resolution| {
let (&BindingKey { ident: assoc_ident, ns: assoc_ns, .. }, _) = resolution;
assoc_ns == ns && assoc_ident.name == name
})
}
_ => true,
}
}

Expand Down Expand Up @@ -3227,34 +3254,6 @@ impl<'a> Resolver<'a> {
})
}

/// This is equivalent to `get_traits_in_module_containing_item`, but without filtering by the associated item.
///
/// This is used by rustdoc for intra-doc links.
pub fn traits_in_scope(&mut self, module_id: DefId) -> Vec<TraitCandidate> {
let module = self.get_module(module_id);
module.ensure_traits(self);
let traits = module.traits.borrow();
let to_candidate =
|this: &mut Self, &(trait_name, binding): &(Ident, &NameBinding<'_>)| TraitCandidate {
def_id: binding.res().def_id(),
import_ids: this.find_transitive_imports(&binding.kind, trait_name),
};

let mut candidates: Vec<_> =
traits.as_ref().unwrap().iter().map(|x| to_candidate(self, x)).collect();

if let Some(prelude) = self.prelude {
if !module.no_implicit_prelude {
prelude.ensure_traits(self);
candidates.extend(
prelude.traits.borrow().as_ref().unwrap().iter().map(|x| to_candidate(self, x)),
);
}
}

candidates
}

/// Rustdoc uses this to resolve things in a recoverable way. `ResolutionError<'a>`
/// isn't something that can be returned because it can't be made to live that long,
/// and also it's a private type. Fortunately rustdoc doesn't need to know the error,
Expand Down
9 changes: 7 additions & 2 deletions src/librustdoc/passes/collect_intra_doc_links.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use rustc_session::lint::{
builtin::{BROKEN_INTRA_DOC_LINKS, PRIVATE_INTRA_DOC_LINKS},
Lint,
};
use rustc_span::hygiene::MacroKind;
use rustc_span::hygiene::{MacroKind, SyntaxContext};
use rustc_span::symbol::Ident;
use rustc_span::symbol::Symbol;
use rustc_span::DUMMY_SP;
Expand Down Expand Up @@ -770,7 +770,12 @@ fn traits_implemented_by(cx: &DocContext<'_>, type_: DefId, module: DefId) -> Fx
let mut cache = cx.module_trait_cache.borrow_mut();
let in_scope_traits = cache.entry(module).or_insert_with(|| {
cx.enter_resolver(|resolver| {
resolver.traits_in_scope(module).into_iter().map(|candidate| candidate.def_id).collect()
let parent_scope = &ParentScope::module(resolver.get_module(module), resolver);
resolver
.traits_in_scope(None, parent_scope, SyntaxContext::root(), None)
.into_iter()
.map(|candidate| candidate.def_id)
.collect()
})
});

Expand Down
53 changes: 53 additions & 0 deletions src/test/ui/hygiene/traits-in-scope.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Macros with def-site hygiene still bring traits into scope.
// It is not clear whether this is desirable behavior or not.
// It is also not clear how to prevent it if it is not desirable.

// check-pass

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

mod traits {
pub trait Trait1 {
fn simple_import(&self) {}
}
pub trait Trait2 {
fn renamed_import(&self) {}
}
pub trait Trait3 {
fn underscore_import(&self) {}
}
pub trait Trait4 {
fn trait_alias(&self) {}
}

impl Trait1 for () {}
impl Trait2 for () {}
impl Trait3 for () {}
impl Trait4 for () {}
}

macro m1() {
use traits::Trait1;
}
macro m2() {
use traits::Trait2 as Alias;
}
macro m3() {
use traits::Trait3 as _;
}
macro m4() {
trait Alias = traits::Trait4;
}

fn main() {
m1!();
m2!();
m3!();
m4!();

().simple_import();
().renamed_import();
().underscore_import();
().trait_alias();
}
10 changes: 5 additions & 5 deletions src/test/ui/underscore-imports/hygiene.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Make sure that underscore imports have the same hygiene considerations as
// other imports.
// Make sure that underscore imports have the same hygiene considerations as other imports.

// check-pass

#![feature(decl_macro)]

mod x {
pub use std::ops::Deref as _;
}


macro glob_import() {
pub use crate::x::*;
}
Expand Down Expand Up @@ -35,6 +35,6 @@ fn main() {
53F4 use crate::z::*;
glob_import!();
underscore_import!();
(&()).deref(); //~ ERROR no method named `deref`
(&mut ()).deref_mut(); //~ ERROR no method named `deref_mut`
(&()).deref();
(&mut ()).deref_mut();
}
Loading
0