Skip to content

Commit ce2eb73

Browse files
Improve the namespacing selected by rustc used for gencode types in errors.
We create an 'entry point' .rs file which collects all of the other files (one .rs per input .proto file) and re-emits them. Today this causes error messages that have an `internal_do_not_use` in the namespace. By pulling it in as not-pub it causes the compiler to not use the implementation-detail module in the spelling of the types in error messages. PiperOrigin-RevId: 890019733
1 parent 32ed4a5 commit ce2eb73

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/google/protobuf/compiler/rust/generator.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,12 @@ void EmitEntryPointRsFile(GeneratorContext* generator_context,
138138
{"mod_name", RustInternalModuleName(*file)}},
139139
R"rs(
140140
#[path="$file_path$"]
141-
#[allow(nonstandard_style, unused)]
142-
pub mod internal_do_not_use_$mod_name$;
141+
#[allow(nonstandard_style, unused, unreachable_pub)]
142+
#[doc(hidden)]
143+
mod internal_do_not_use_$mod_name$;
143144
144145
#[allow(nonstandard_style, unused)]
146+
#[doc(inline)]
145147
pub use internal_do_not_use_$mod_name$::*;
146148
)rs");
147149
}

0 commit comments

Comments
 (0)