-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
As stated above: my LSP doens't give auto completion for a constant that's typed by the inherent_associated_types feature.
Rustc does compile the program when using the feature.
UPDATE: After some testing I found that this only happens for const values and not variables defined with let (regardless of scope).
Code example
My repo is public so if my code examples aren't clear enough you can always take a look:
Current commit when writing this issue. (Bumping the nightly version from 2023-11-19 to 2023-12-29 has nothing to do with this issue).
// /core/src/hardware/bus.rs
use std::ops;
pub struct MemoryBus(/* ... */);
impl MemoryBus {
pub type Addr = u16;
// Also tried replacing MemoryBus::Addr with just plain u16 but didn't work
// Moving it outside impl and just doing a plain old type does work
pub type Region = ops::RangeInclusive<MemoryBus::Addr>;
}
pub mod regions {
pub const OAM: MemoryBus::Region = 0xFE00..=0xFE9F
}// /core/src/io/graphics/objects.rs
use crate::hardware::bus;
mod oam {
struct ObjectAttributes<'a>(bytes: &'a [u8; 4]);
impl<'a> ObjectAttributes<'a> {
pub fn from_bus(&memory_bus: &bus::MemoryBus) -> [ObjectAttributes; 40] {
// Function I was working on while encountering this issue.
bus::regions::OAM./* I'd want my LSP to provide me with auto completion here */
}
}
}Toolchain versions
rust-analyzer
$ rust-analyzer --version --verbose
rust-analyzer 1.77.0-nightly (fb5ed72 2023-12-28)
rustc
$ rustc --version --verbose
rustc 1.77.0-nightly (fb5ed72 2023-12-28)
binary: rustc
commit-hash: fb5ed72
commit-date: 2023-12-28
host: x86_64-unknown-linux-gnu
release: 1.77.0-nightly
LLVM version: 17.0.6