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

Name resolution 2.0 does not handle imports in modules #3314

Open
1 task
matthewjasper opened this issue Dec 20, 2024 · 0 comments
Open
1 task

Name resolution 2.0 does not handle imports in modules #3314

matthewjasper opened this issue Dec 20, 2024 · 0 comments

Comments

@matthewjasper
Copy link
Contributor

Summary

Imports don't appear to work in modules with name resolution 2.0

Reproducer

I tried this code:

fn f() {}

mod a {
    fn g() {}

    use super::f;
    use self::g as g1;
    use g as g2;  // (2018 edition+)
}

Does the code make use of any (1.49) nightly feature ?

  • Nightly

Godbolt link

https://godbolt.org/z/oT5eYY1vs

Actual behavior

The current behavior is...
Code has multiple errors:

<source>:8:9: error: too many leading 'super' keywords [E0433]
    8 |     use super::f;
      |         ^~~~~
<source>:8:9: error: too many leading 'super' keywords [E0433]
<source>:8:9: error: too many leading 'super' keywords [E0433]
<source>:10:9: error: unresolved import 'g' [E0433]
   10 |     use g as g2;
      |         ^
<source>:9:15: error: unresolved import 'self::g' [E0433]
    9 |     use self::g as g1;
      |               ^
<source>:8:16: error: unresolved import 'super::f' [E0433]
    8 |     use super::f;
      |                ^
Compiler returned: 1

Expected behavior

I expected to see...
No errors, maybe unused code warnings

GCC Version

gccrs (Compiler-Explorer-Build-gcc-b5c354d038f800695a8d730c56c4a4f744134adb-binutils-2.42) 14.0.1 20240309 (experimental)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant