diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 2ba1a62e8e18..4d1eed96da38 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -662,7 +662,11 @@ pub fn create_bcx<'a, 'cfg>( } let guidance = if ws.is_ephemeral() { - String::new() + if ws.ignore_lock() { + "Try re-running cargo install with `--locked`".to_string() + } else { + String::new() + } } else { format!( "Either upgrade to rustc {} or newer, or use\n\