-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Always resolve type@primitive as a primitive, not a module #74078
Conversation
@bors r+ looks great
Note that smart resolution doesn't work for glob imports anyway, so shrug |
📌 Commit 8bc6b66c757839179843d13a02b0124eca2b1223 has been approved by |
Yeah, that one seemed like a bit of an edge case. It would be nice to support but I don't expect anyone to use it. |
Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with rust-lang#58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time.
|
@bors r+ |
📌 Commit e46c187 has been approved by |
Tidy is a harsh taskmaster 😠 |
Always resolve type@primitive as a primitive, not a module Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with rust-lang#58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time. Closes rust-lang#74063 r? @Manishearth
Always resolve type@primitive as a primitive, not a module Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with rust-lang#58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time. Closes rust-lang#74063 r? @Manishearth
Always resolve type@primitive as a primitive, not a module Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with rust-lang#58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time. Closes rust-lang#74063 r? @Manishearth
Always resolve type@primitive as a primitive, not a module Previously, if there were a module in scope with the same name as the primitive, that would take precedence. Coupled with rust-lang#58699, this made it impossible to link to the primitive when that module was in scope. This approach could be extended so that `struct@foo` would no longer resolve to any type, etc. However, it could not be used for glob imports: ```rust pub mod foo { pub struct Bar; } pub enum Bar {} use foo::*; // This is expected to link to `inner::Bar`, but instead it will link to the enum. /// Link to [struct@Bar] pub struct MyDocs; ``` The reason for this is that this change does not affect the resolution algorithm of rustc_resolve at all. The only reason we could special-case primitives is because we have a list of all possible primitives ahead of time. Closes rust-lang#74063 r? @Manishearth
…arth Rollup of 14 pull requests Successful merges: - rust-lang#70563 ([rustdoc] Page hash handling) - rust-lang#73856 (Edit librustc_lexer top-level docs) - rust-lang#73870 (typeck: adding type information to projection) - rust-lang#73953 (Audit hidden/short code suggestions) - rust-lang#73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]) - rust-lang#73969 (mir: mark mir construction temporaries as internal) - rust-lang#73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)) - rust-lang#74067 (rustdoc: Restore underline text decoration on hover for FQN in header) - rust-lang#74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.) - rust-lang#74078 (Always resolve type@primitive as a primitive, not a module) - rust-lang#74089 (Add rust-analyzer to the build manifest) - rust-lang#74090 (Remove unused RUSTC_DEBUG_ASSERTIONS) - rust-lang#74102 (Fix const prop ICE) - rust-lang#74112 (Expand abbreviation in core::ffi description) Failed merges: r? @ghost
…arth Rollup of 14 pull requests Successful merges: - rust-lang#70563 ([rustdoc] Page hash handling) - rust-lang#73856 (Edit librustc_lexer top-level docs) - rust-lang#73870 (typeck: adding type information to projection) - rust-lang#73953 (Audit hidden/short code suggestions) - rust-lang#73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]) - rust-lang#73969 (mir: mark mir construction temporaries as internal) - rust-lang#73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)) - rust-lang#74067 (rustdoc: Restore underline text decoration on hover for FQN in header) - rust-lang#74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.) - rust-lang#74078 (Always resolve type@primitive as a primitive, not a module) - rust-lang#74089 (Add rust-analyzer to the build manifest) - rust-lang#74090 (Remove unused RUSTC_DEBUG_ASSERTIONS) - rust-lang#74102 (Fix const prop ICE) - rust-lang#74112 (Expand abbreviation in core::ffi description) Failed merges: r? @ghost
Previously, if there were a module in scope with the same name as the
primitive, that would take precedence. Coupled with
#58699, this made it impossible
to link to the primitive when that module was in scope.
This approach could be extended so that
struct@foo
would no longer resolveto any type, etc. However, it could not be used for glob imports:
The reason for this is that this change does not affect the resolution
algorithm of rustc_resolve at all. The only reason we could special-case
primitives is because we have a list of all possible primitives ahead of time.
Closes #74063
r? @Manishearth