-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Description
Motivated by this thread on URLO, I’m wondering if we shouldn’t add warnings for using items that are hidden in documentations, in particular hidden modules (but e.g. also hidden fields that can be used to make structs with public fields extensible while still supporting Struct { foo: 1, bar: 2 ..Struct::default() }
-style initialization).
Even more unfortunate is how rustc even suggests hidden re-export modules, e.g. in this playground, the compiler suggests, among other things, to add use pin_utils::core_reexport::fmt::Formatter;
or use serde::export::Formatter;
, which are semver-hazards.
Compiling playground v0.0.1 (/playground)
error[E0412]: cannot find type `Formatter` in this scope
--> src/lib.rs:2:16
|
2 | pub fn foo(_f: Formatter) {}
| ^^^^^^^^^ not found in this scope
|
help: consider importing one of these items
|
2 | use core::fmt::Formatter;
|
2 | use env_logger::fmt::Formatter;
|
2 | use pin_utils::core_reexport::fmt::Formatter;
|
2 | use serde::export::Formatter;
|
and 3 other candidates
@rustbot modify labels: C-enhancement, T-compiler, A-diagnostics, A-suggestion-diagnostics, D-invalid-suggestion
(regarging D-invalid-suggestion
: I would consider code that explicitly uses unstable internal (for macros) re-exports of another crate to be “incorrect”)