-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Completion check_stability
doesn't look at the attributes on the parent modules
#15802
Comments
Until two weeks ago we didn't suggest |
This comment was marked as spam.
This comment was marked as spam.
pl
autocompletition on stable?check_stability
doesn't look at the attributes on the parent modules
are the two places where we need to look at the stability of all segments of the import.import_path .
|
Tentative, non-working patch at lnicola@873d34b. |
Actually, after having worked on #15871 just now, I think we can forego looking at the attributes entirely for this in completions again (the linked PRs changes unrelated to the idea). We know the stability of an import path when calculating it in rust-analyzer/crates/hir-def/src/find_path.rs Line 329 in ba61766
find_path_inner where we map the stability away. LocatedImport 's import paths being looked for here rust-analyzer/crates/ide-db/src/imports/import_assets.rs Lines 603 to 613 in ba61766
|
But my proposed change (which doesn't actually work for struct S;
mod m {
#![unstable]
impl super::S {
pub fn foo(&self) {}
}
}
We currently suggest |
Right, my idea won't cover method calls. Aside from that I don't think there really is a point in checking the parent module of anything though, since any other completion would require the thing in question to already be in scope, and hence the user should have the feature enabled anyways? Walking up the ancestors also has the problem of re-exports through unstable modules not being recognized as unstable actually. (I think rustc itself currently fails this as well, or used to iirc) |
Why this suggest me nightly(?) feature on a stable version
![image](https://private-user-images.githubusercontent.com/75776246/278036376-feb87937-709a-43c3-92fe-3b0fdc6e0c93.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzOTE2ODQsIm5iZiI6MTczOTM5MTM4NCwicGF0aCI6Ii83NTc3NjI0Ni8yNzgwMzYzNzYtZmViODc5MzctNzA5YS00M2MzLTkyZmUtM2IwZmRjNmUwYzkzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEyVDIwMTYyNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJjMGI3YTI5NGExY2ZlNjgxMDc2MjM0NWIxYWM5MjNiODVmNDg2OTNkY2Y0MjUzMGM3YzdkYzFmMWE2Zjg1ODcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.14zkQcSGtc30tFCqDNzacsk5e0AOLxBRSiO6EgMLFVo)
It should suggest me
println!
not aplace!
rust-analyzer --verstion
outputPreviously, about two weeks ago, it suggests a
println!
on first place, i dont think this is correct work.The text was updated successfully, but these errors were encountered: