-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.
Description
I tried this code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=7a55c241c30f1231a2711260adc95d22
mod a {
pub type Result<T> = std::result::Result<T, ()>;
}
mod inner {
pub use crate::a::*;
use std::result::Result;
}
fn f() -> inner::Result<i32> {
Ok(1)
}
I expected to see this happen: The code compiles fine, because inner::Result
resolves to a::Result
, just as it would without use std::result::Result
.
Instead, this happened:
error[E0603]: enum import `Result` is private
--> src/lib.rs:10:18
|
10 | fn f() -> inner::Result<i32> {
| ^^^^^^ private enum import
|
note: the enum import `Result` is defined here...
--> src/lib.rs:7:9
|
7 | use std::result::Result;
| ^^^^^^^^^^^^^^^^^^^
note: ...and refers to the enum `Result` which is defined here
Meta
rustc --version --verbose
:
1.59.0
I don't know if this is strictly a bug in the sense that it will break things, but it seems like an unfortunate side effect of the resolution rules ... cc @petrochenkov, do you have opinions on this?
Veykril
Metadata
Metadata
Assignees
Labels
A-resolveArea: Name/path resolution done by `rustc_resolve` specificallyArea: Name/path resolution done by `rustc_resolve` specificallyC-bugCategory: This is a bug.Category: This is a bug.