Skip to content
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
6 changes: 1 addition & 5 deletions compiler/rustc_resolve/src/ident.rs
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
ignore_import: Option<Import<'ra>>,
) -> Result<Decl<'ra>, Determinacy> {
// Make sure `self`, `super` etc produce an error when passed to here.
if !matches!(scope_set, ScopeSet::Module(..)) && ident.name.is_path_segment_keyword() {
Comment thread
petrochenkov marked this conversation as resolved.
if ident.name.is_path_segment_keyword() {
return Err(Determinacy::Determined);
}

Expand Down Expand Up @@ -1077,10 +1077,6 @@ impl<'ra, 'tcx> Resolver<'ra, 'tcx> {
{
let module = self.resolve_crate_root(ident);
return Ok(module.self_decl.unwrap());
} else if ident.name == kw::Super {
// FIXME: Implement these with renaming requirements so that e.g.
// `use super;` doesn't work, but `use super as name;` does.
// Fall through here to get an error from `early_resolve_...`.
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: `env!()` takes 1 or 2 arguments
--> $DIR/macro-determinacy-non-module-issue-160195.rs:12:22
|
LL | include!(concat!(env!()));
| ^^^^^^

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: `env!()` takes 1 or 2 arguments
--> $DIR/macro-determinacy-non-module-issue-160195.rs:12:22
|
LL | include!(concat!(env!()));
| ^^^^^^

error: aborting due to 1 previous error

21 changes: 21 additions & 0 deletions tests/ui/resolve/macro-determinacy-non-module-issue-160195.rs
Comment thread
mu001999 marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//@ revisions: env_first env_second

#[cfg(env_first)]
pub mod env {
#[derive(Default)]
pub struct BusinessData;
}

pub mod interface {
use crate::env::{self};

include!(concat!(env!())); //~ ERROR `env!()` takes 1 or 2 arguments
}

#[cfg(env_second)]
pub mod env {
#[derive(Default)]
pub struct BusinessData;
}

fn main() {}
Loading