Skip to main content

prelude_type_names

Function prelude_type_names 

Source
pub fn prelude_type_names(targets: Targets) -> Vec<PreludeTypeName>
Expand description

The prelude types the requested targets name without a path.

A generated type of one of these names does not duplicate any item, so no collision check sees it. It shadows the prelude inside the file, and every use of the shadowed type stops compiling, so crate::lower::check_prelude_shadowing rejects it up front.

Ok, Err, Some, and None are absent, and belong in no list, but the reason is narrow. Those name values, and a braced struct, an enum, and an alias each take a type name only. A tuple or unit struct would take the value name too, and a model named Ok would then hide the prelude variant. The emitter writes pub struct #name {..} at every site, and every_generated_struct_is_braced holds it there. Fixture combined_prelude_value_names compiles the adversarial case: an operation references each of the four names, so none is pruned, and a server and a client then write Ok(..), Err(..), Some(..), and None without a path beside models of those names.