Skip to content
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

resolve: Remove an incorrect assert #65140

Merged
merged 1 commit into from
Oct 10, 2019
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
1 change: 0 additions & 1 deletion src/librustc_resolve/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,6 @@ impl<'a> Resolver<'a> {
check_consistency(self, &[seg], ident.span, kind, initial_res, res);
}
Err(..) => {
assert!(initial_binding.is_none());
let expected = kind.descr_expected();
let msg = format!("cannot find {} `{}` in this scope", expected, ident);
let mut err = self.session.struct_span_err(ident.span, &msg);
Expand Down
22 changes: 22 additions & 0 deletions src/test/ui/proc-macro/disappearing-resolution.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Regression test for issue #64803 (initial attribute resolution can disappear later).

// aux-build:test-macros.rs

#[macro_use]
extern crate test_macros;

mod m {
use test_macros::Empty;
}
use m::Empty; //~ ERROR derive macro `Empty` is private

// To resolve `empty_helper` we need to resolve `Empty`.
// During initial resolution `use m::Empty` introduces no entries, so we proceed to `macro_use`,
// successfully resolve `Empty` from there, and then resolve `empty_helper` as its helper.
// During validation `use m::Empty` introduces a `Res::Err` stub, so `Empty` resolves to it,
// and `empty_helper` can no longer be resolved.
#[empty_helper] //~ ERROR cannot find attribute `empty_helper` in this scope
#[derive(Empty)]
struct S;

fn main() {}
15 changes: 15 additions & 0 deletions src/test/ui/proc-macro/disappearing-resolution.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
error: cannot find attribute `empty_helper` in this scope
--> $DIR/disappearing-resolution.rs:18:3
|
LL | #[empty_helper]
| ^^^^^^^^^^^^

error[E0603]: derive macro `Empty` is private
--> $DIR/disappearing-resolution.rs:11:8
|
LL | use m::Empty;
| ^^^^^

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0603`.