Closed
Description
While E0412 already provides suggested imports, E0433 does not. It seems like a similar problem on the face of it. Can we add suggestions for undeclared type or module?
Particularly this helps IDEs working toward rust-lang/rls#742.
For example no suggestion is currently provided for the following.
pub fn main() {
let set = HashSet::new();
}
error[E0433]: failed to resolve. Use of undeclared type or module `HashSet`
--> src/main.rs:5:15
|
5 | let set = HashSet::new();
| ^^^^^^^ Use of undeclared type or module `HashSet`
{
"children": [],
"code": {
"code": "E0433",
"explanation": "\nAn undeclared type or module was used.\n\nErroneous code example:\n\n```compile_fail,E0433\nlet map = HashMap::new();\n// error: failed to resolve. Use of undeclared type or module `HashMap`\n```\n\nPlease verify you didn't misspell the type/module's name or that you didn't\nforgot to import it:\n\n\n```\nuse std::collections::HashMap; // HashMap has been imported.\nlet map: HashMap<u32, u32> = HashMap::new(); // So it can be used!\n```\n"
},
"level": "error",
"message": "failed to resolve. Use of undeclared type or module `HashSet`",
"rendered": "error[E0433]: failed to resolve. Use of undeclared type or module `HashSet`\n --> src/main.rs:2:15\n |\n2 | let set = HashSet::new();\n | ^^^^^^^ Use of undeclared type or module `HashSet`\n\nIf you want more information on this error, try using \"rustc --explain E0433\"\n",
"spans": [{
"byte_end": 37,
"byte_start": 30,
"column_end": 22,
"column_start": 15,
"expansion": null,
"file_name": "src/main.rs",
"is_primary": true,
"label": "Use of undeclared type or module `HashSet`",
"line_end": 2,
"line_start": 2,
"suggested_replacement": null,
"text": [{
"highlight_end": 22,
"highlight_start": 15,
"text": " let set = HashSet::new();"
}]
}]
}