Rust Book 12.3 - unresolved import error [E4032]

This seems to be a VSCode issue. Simply restarting VSCode makes the error go away, as discussed on this GitHub issue: https://github.com/rust-lang/vscode-rust/issues/686


There is a contradiction between the code samples for the exercise in chapter 12.3 and the earlier section in chapter 7: '7.2 -- Modules and use to control scope -- Separating modules into different files'.

Using 7.2's syntax complies:

mod lib; //.. instead of 'use minigrep'
use lib::Config; //.. instead of 'use minigrep::Config'

Neither of the above answers is correct. Using cargo clean is the correct solution. The incremental build process that produces that red underline in the IDE is a result of cached information about the program and library.

$ cargo clean

Tags:

Rust