diff --git a/ffi/README.md b/ffi/README.md index c7adea791..be4cb06ea 100644 --- a/ffi/README.md +++ b/ffi/README.md @@ -174,8 +174,11 @@ refused, and the census counts why. name. A type instance's methods are named through it, and a function instance appends its arguments' names, a reference's by what it borrows. An `exclude` of a type or method by the generic type's path leaves it out of every instance, and by the instance's path - (`"catalog::Producer::stats"`) out of that one; a - `rename` by the generic item's path renames each of its instances. + (`"catalog::Producer::stats"`) out of that one. A + `rename` matches paths as `exclude` does: by the generic item's path it renames each of + its instances, and by an instance's path (`"catalog::Producer"`) + that one alone, whose arguments then add nothing to its name, while the others keep + theirs. The longer path wins, and at one length, the instance's. ## C++ diff --git a/ffi/fixtures/api/ffi.toml b/ffi/fixtures/api/ffi.toml index d1d95c012..c763b1e16 100644 --- a/ffi/fixtures/api/ffi.toml +++ b/ffi/fixtures/api/ffi.toml @@ -20,9 +20,12 @@ exclude = [ "Timed", ] -# The field `Retry::limit`, whose name its method takes. +# The field `Retry::limit`, whose name its method takes, and one instance each of `Pair` +# and `Counter::seeded`, whose other instances keep their names. [rename] +"Counter::seeded" = "counter_from_size" "field@Retry::limit" = "retry_limit_setting" +"Pair" = "size_tag" # Exported into the same library: `grow` names its types. [crates.dep-fixture] diff --git a/ffi/fixtures/reject/expected.txt b/ffi/fixtures/reject/expected.txt index 6a79b9967..b85787689 100644 --- a/ffi/fixtures/reject/expected.txt +++ b/ffi/fixtures/reject/expected.txt @@ -85,4 +85,5 @@ fixtures/reject/src/lib.rs:92:1: rust2-ffi: cannot export fn `retext`: 'static b fixtures/reject/src/lib.rs:92:15: note: `'a` is `'static`, as a handle outlives every call fixtures/reject/src/lib.rs:97:1: rust2-ffi: cannot export fn `first`: borrowed return that is not Clone `Opaque`; exclude it in the config to leave it out fixtures/reject/src/lib.rs:9:1: rust2-ffi: cannot export fn `pair`: tuple of references `(&str, u8)`; exclude it in the config to leave it out +no span: rust2-ffi: rename `Cell` in the config names nothing exported no span: rust2-ffi: rename `field@Limit::min` in the config names nothing exported diff --git a/ffi/fixtures/reject/ffi.toml b/ffi/fixtures/reject/ffi.toml index 17ff99bfe..b26b0a24b 100644 --- a/ffi/fixtures/reject/ffi.toml +++ b/ffi/fixtures/reject/ffi.toml @@ -3,8 +3,9 @@ prefix = "reject" # An exclusion leaves an item or an instance out, so nothing refuses it. exclude = ["Cell", "Excluded", "Held"] -# A field that is none: `min` names nothing of `Limit`. +# A field that is none: `min` names nothing of `Limit`. An instance the config leaves out. [rename] +"Cell" = "short_cell" "field@Limit::min" = "limit_min" # Another export, whose `Size` claims the same C name as this one's. diff --git a/ffi/src/abi.rs b/ffi/src/abi.rs index 233275063..f983bf813 100644 --- a/ffi/src/abi.rs +++ b/ffi/src/abi.rs @@ -12,6 +12,7 @@ use std::collections::{BTreeMap, HashMap}; use rustc_span::Span; +use crate::config; use crate::ir::{Access, Api, Dyn, Function, Int, Receiver, Type}; /// A C name claimed twice: the name, then what claimed it first and second. @@ -92,7 +93,7 @@ pub struct Abi<'a> { pub api: &'a Api, pub prefix: String, /// C names for Rust paths, each starting with its crate's name, in place of the - /// rule's: an item's, and its methods' through it. + /// rule's: an item's, and its methods' through it, or an instance's alone. rename: &'a BTreeMap, /// The renamed paths some name went through. renamed: std::cell::RefCell>, @@ -134,34 +135,52 @@ impl<'a> Abi<'a> { /// The C name for a Rust path, which starts with its crate's name. pub fn name(&self, path: &[String]) -> String { - std::iter::once(self.prefix.clone()) - .chain(self.segments(path)) - .collect::>() - .join("_") + self.named(path).0 } - /// The segments of a Rust path's C name after the prefix: a renamed part as one, then - /// each segment past it in snake case. - fn segments(&self, path: &[String]) -> Vec { + /// The C name for the item at `shown`, its path with its instances' arguments, and + /// whether a rename named the instance it is alone, which no suffix then names. + fn named(&self, shown: &[String]) -> (String, bool) { + let (segments, alone) = self.segments(shown); + let name = std::iter::once(self.prefix.clone()).chain(segments).collect::>(); + (name.join("_"), alone) + } + + /// The segments of the C name of the item at `shown` after the prefix: the longest + /// renamed part, as `exclude` matches it, as one, then each segment past it in snake + /// case; and whether the rename named the instance it is alone. + fn segments(&self, shown: &[String]) -> (Vec, bool) { let mut segments = Vec::new(); - let mut rest = &path[1..]; - for len in (2..=path.len()).rev() { - let key = path[..len].join("::"); + let mut rest = &shown[1..]; + let mut alone = false; + for (len, key) in config::keys(shown).take_while(|&(len, _)| len >= 2) { if let Some(renamed) = self.rename.get(&key) { + alone = len == shown.len() && key.ends_with('>'); self.renamed.borrow_mut().insert(key); segments.push(renamed.clone()); - rest = &path[len..]; + rest = &shown[len..]; break; } // No config names a foreign type, which is named by its role instead. if key == "serde_json::Value" { segments.push("json".to_string()); - rest = &path[len..]; + rest = &shown[len..]; break; } } - segments.extend(rest.iter().map(|segment| snake(segment))); - segments + segments.extend( + rest.iter() + .map(|segment| snake(segment.split('<').next().unwrap_or(segment))), + ); + (segments, alone) + } + + /// The key, with `prefix` before it, of the rename naming the item at `shown` itself + /// rather than a module or type it is in. + fn renames(&self, shown: &[String], prefix: &str) -> Option { + (config::keys(shown).take_while(|&(len, _)| len == shown.len())) + .map(|(_, key)| format!("{prefix}{key}")) + .find(|key| self.rename.contains_key(key)) } /// The config's renames that name nothing exported. @@ -180,22 +199,29 @@ impl<'a> Abi<'a> { } pub fn record(&self, i: usize) -> String { - self.type_instance(&self.api.records[i].path, &self.api.records[i].args) + let item = &self.api.records[i]; + self.type_instance(&item.path, &item.shown, &item.args) } pub fn enumeration(&self, i: usize) -> String { - self.type_instance(&self.api.enums[i].path, &self.api.enums[i].args) + let item = &self.api.enums[i]; + self.type_instance(&item.path, &item.shown, &item.args) } pub fn object(&self, i: usize) -> String { - self.type_instance(&self.api.objects[i].path, &self.api.objects[i].args) + let item = &self.api.objects[i]; + self.type_instance(&item.path, &item.shown, &item.args) } - /// The C name of the instance of the type at `path` at `args`, among the type's every - /// instance, whichever kind each is. - fn type_instance(&self, path: &[String], args: &[Type]) -> String { + /// The C name of the instance of the type at `path` at `args`, shown as `shown`, among + /// the type's every instance, whichever kind each is. + fn type_instance(&self, path: &[String], shown: &[String], args: &[Type]) -> String { let api = self.api; - self.instance(false, self.name(path), args, || { + let (name, alone) = self.named(shown); + if alone { + return name; + } + self.instance(false, name, args, || { let records = api.records.iter().map(|r| (&r.path, &r.args)); let enums = api.enums.iter().map(|e| (&e.path, &e.args)); let objects = api.objects.iter().map(|o| (&o.path, &o.args)); @@ -232,14 +258,17 @@ impl<'a> Abi<'a> { /// instance's name, so two items whose instances name each other, as `A>` and /// `B>`, name each without the other. fn arg_forms(&self, ty: &Type) -> Vec { - let (path, args) = match ty { - Type::Record(i) => (&self.api.records[*i].path, &self.api.records[*i].args), - Type::Enum(i) => (&self.api.enums[*i].path, &self.api.enums[*i].args), - Type::Object(i) => (&self.api.objects[*i].path, &self.api.objects[*i].args), + let (shown, args) = match ty { + Type::Record(i) => (&self.api.records[*i].shown, &self.api.records[*i].args), + Type::Enum(i) => (&self.api.enums[*i].shown, &self.api.enums[*i].args), + Type::Object(i) => (&self.api.objects[*i].shown, &self.api.objects[*i].args), Type::Ref(_, inner) | Type::Box(inner) => return self.arg_forms(inner), ty => return vec![self.key(ty)], }; - let segments = self.segments(path); + let (segments, alone) = self.segments(shown); + if alone { + return segments; + } let nested: Vec> = args.iter().map(|arg| self.arg_forms(arg)).collect(); let steps = nested.iter().map(Vec::len).max().unwrap_or(1); let form = |len: usize, step: usize| { @@ -266,11 +295,11 @@ impl<'a> Abi<'a> { let Access::Field { shared, set } = function.access else { return self.method_name(function, owner_name, false); }; - let key = format!("field@{}", function.path.join("::")); - let name = match self.rename.get(&key) { - Some(renamed) => { + let name = match self.renames(&function.shown, "field@") { + Some(key) => { + let renamed = format!("{}_{}", self.prefix, self.rename[&key]); self.renamed.borrow_mut().insert(key); - format!("{}_{renamed}", self.prefix) + renamed } None => self.method_name(function, owner_name, shared), }; @@ -285,14 +314,16 @@ impl<'a> Abi<'a> { } /// A function's C name through its type's, unless renamed by its path and no method - /// or constant `shared` its name, then each argument of the instance it is. + /// or constant `shared` its name, then each argument of the instance it is, unless + /// renamed alone. fn method_name(&self, function: &Function, owner: Option<&str>, shared: bool) -> String { - let path = function.path.join("::"); - let name = match owner { - Some(owner) if shared || !self.rename.contains_key(&path) => format!("{owner}_{}", snake(function.name())), - _ => self.name(&function.path), + let (name, alone) = match owner { + Some(owner) if shared || self.renames(&function.shown, "").is_none() => { + (format!("{owner}_{}", snake(function.name())), false) + } + _ => self.named(&function.shown), }; - let Some(instance) = &function.instance else { + let Some(instance) = function.instance.as_ref().filter(|_| !alone) else { return name; }; self.instance(true, name, &instance.named, || { diff --git a/ffi/src/collect.rs b/ffi/src/collect.rs index 4438c48ab..8e58925c5 100644 --- a/ffi/src/collect.rs +++ b/ffi/src/collect.rs @@ -25,6 +25,7 @@ use rustc_trait_selection::infer::InferCtxtExt; use rustc_trait_selection::traits::ObligationCtxt; use rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt as _; +use crate::config; use crate::ir::{ Access, Api, Callback, Constant, Dyn, Enum, Family, Field, Function, Int, Literal, Mutability, Object, Param, Path, Receiver, Record, Traits, Type, Variant, @@ -283,12 +284,9 @@ impl<'tcx> Collector<'tcx> { /// Whether the config excludes `path`, counting the exclusion. A member of an instance /// is left out by its instance's path or its type's, which leaves it out of each. fn exclude(&mut self, path: &[String]) -> bool { - let generic: Vec<&str> = path[1..].iter().map(|s| s.split('<').next().unwrap_or(s)).collect(); - let generic = generic.join("::"); - let (report, joined) = self.report(path); - for (excluded, count) in &mut report.excluded { - let covers = |path: &str| path == excluded || path.starts_with(&format!("{excluded}::")); - if covers(&joined) || covers(&generic) { + let (report, _) = self.report(path); + for (_, key) in config::keys(&path[1..]) { + if let Some((_, count)) = report.excluded.iter_mut().find(|(excluded, _)| *excluded == key) { *count += 1; return true; } @@ -830,12 +828,13 @@ impl<'tcx> Collector<'tcx> { continue; }; let api = &mut self.api; - let (path, docs) = (site.path, docs.clone()); + let (path, shown, docs) = (site.path, site.shown, docs.clone()); match decl { Decl::Record(i) => { *i = api.records.len(); api.records.push(Record { path, + shown, args: Vec::new(), span, docs, @@ -849,6 +848,7 @@ impl<'tcx> Collector<'tcx> { *i = api.enums.len(); api.enums.push(Enum { path, + shown, args: Vec::new(), span, docs, @@ -866,6 +866,7 @@ impl<'tcx> Collector<'tcx> { let lifetimes = tcx.generics_of(def_id).own_counts().lifetimes; api.objects.push(Object { path, + shown, args: Vec::new(), span, docs, @@ -914,6 +915,7 @@ impl<'tcx> Collector<'tcx> { }; let parse = |docs: &str| Function { path: path("parse"), + shown: path("parse"), span, docs: docs.to_string(), receiver: None, @@ -948,6 +950,7 @@ impl<'tcx> Collector<'tcx> { parse("Parse a JSON document, failing with why it is not one."), Function { path: path("to_text"), + shown: path("to_text"), span, docs: "The document as JSON text.".to_string(), receiver: Some(Receiver::Ref), @@ -966,6 +969,7 @@ impl<'tcx> Collector<'tcx> { }; Object { path: path(""), + shown: path(""), args: Vec::new(), span, docs: docs.to_string(), @@ -1437,6 +1441,7 @@ impl<'tcx> Collector<'tcx> { Ok((get, set)) => { let accessor = |receiver, params, ok, set| Function { path: [&site.path[..], std::slice::from_ref(&name)].concat(), + shown: shown.clone(), span, docs: docs(tcx, field.did), receiver: Some(receiver), @@ -1624,7 +1629,9 @@ impl<'tcx> Collector<'tcx> { let function = self .instantiate(item.def_id, None) .and_then(|instances| match &instances[..] { - [one] if one.named.is_empty() => self.function(item.def_id, method, Some(self_ty), one), + [one] if one.named.is_empty() => { + self.function(item.def_id, method.clone(), method, Some(self_ty), one) + } _ => Err(vec![why("generic parameter", name.to_string())]), }); match function { @@ -1676,18 +1683,19 @@ impl<'tcx> Collector<'tcx> { let Some(shown) = self.shown(shown, instance) else { continue; }; - let function = self.function(def_id, path.clone(), self_ty, instance); + let function = self.function(def_id, path.clone(), shown.clone(), self_ty, instance); functions.push((function, shown, !instance.named.is_empty())); } functions } - /// A function or method's signature at one of its instances: a method's receiver is - /// `self_ty`. + /// A function or method's signature at one of its instances, which the config names by + /// `shown`: a method's receiver is `self_ty`. fn function( &self, def_id: DefId, path: Path, + shown: Path, self_ty: Option>, instance: &Instantiation<'tcx>, ) -> Result> { @@ -1841,6 +1849,7 @@ impl<'tcx> Collector<'tcx> { match (errs.is_empty(), ok) { (true, Some(ok)) => Ok(Function { path, + shown, span: tcx.def_span(def_id), docs: docs(tcx, def_id), receiver, @@ -2828,7 +2837,8 @@ impl<'tcx> Collector<'tcx> { }; match self.ty(ty, Pos::Return) { Ok(ok) => Some(Function { - path, + path: path.clone(), + shown: path, span, docs: docs(tcx, def_id), receiver: None, diff --git a/ffi/src/config.rs b/ffi/src/config.rs index 289b62a51..318381cdd 100644 --- a/ffi/src/config.rs +++ b/ffi/src/config.rs @@ -22,7 +22,8 @@ pub struct Config { pub exclude: Vec, /// C names, without the prefix, for paths from the crate root whose names the rule /// makes clash: `"session::Stats" = "session_stats_snapshot"`. A type's methods are - /// named through its new name. A field is named by its path as `exclude` names it. + /// named through its new name. Paths match as `exclude`'s do, so an instance's renames + /// it alone, and a field is named by its path as `exclude` names it. #[serde(default)] pub rename: BTreeMap, /// Other packages exported into the same library, each a dependency of `package`, by @@ -42,6 +43,18 @@ pub struct Items { pub rename: BTreeMap, } +/// The keys `exclude` and `rename` name the item at `shown` by, its path with its +/// instances' arguments, longest first: each prefix of it as is, then without the +/// arguments, which names the generic item's every instance. Each comes with its length. +pub fn keys(shown: &[String]) -> impl Iterator + '_ { + (1..=shown.len()).rev().flat_map(move |len| { + let exact = shown[..len].join("::"); + let generic: Vec<&str> = shown[..len].iter().map(|s| s.split('<').next().unwrap_or(s)).collect(); + let generic = Some(generic.join("::")).filter(|generic| *generic != exact); + std::iter::once(exact).chain(generic).map(move |key| (len, key)) + }) +} + impl Config { pub fn load(path: &Path) -> Result { let text = std::fs::read_to_string(path).map_err(|err| format!("reading {}: {err}", path.display()))?; diff --git a/ffi/src/ir.rs b/ffi/src/ir.rs index 6a93fa33d..2bca690ee 100644 --- a/ffi/src/ir.rs +++ b/ffi/src/ir.rs @@ -55,6 +55,9 @@ pub type Path = Vec; /// A struct whose fields are all `pub`: a value, copied across. pub struct Record { pub path: Path, + /// Its path with its instance's arguments, which the config names it by, such as + /// `moq_mux::catalog::Producer`. + pub shown: Path, /// The type arguments of the instance it is, empty unless the type is generic. pub args: Vec, pub span: Span, @@ -77,6 +80,7 @@ pub struct Field { /// enumeration. pub struct Enum { pub path: Path, + pub shown: Path, pub args: Vec, pub span: Span, pub docs: String, @@ -106,6 +110,7 @@ impl Enum { /// an `Arc`, whose receivers borrow it as Rust's do, checked at run time. pub struct Object { pub path: Path, + pub shown: Path, pub args: Vec, pub span: Span, pub docs: String, @@ -143,6 +148,9 @@ pub struct Traits { pub struct Function { /// Its path, ending in its own name: a method's goes through its type's. pub path: Path, + /// Its path with the arguments of its type's instance and its own, which the config + /// names it by: `moq_mux::catalog::Producer::stats`. + pub shown: Path, pub span: Span, /// Its doc comment, as Markdown. pub docs: String, diff --git a/ffi/tests/api.c b/ffi/tests/api.c index 12c5cf135..eed3db17f 100644 --- a/ffi/tests/api.c +++ b/ffi/tests/api.c @@ -555,8 +555,9 @@ static int script(void) { api_pair_u32 twins = {.left = 7, .right = 7}; printf("even %s %s\n", api_pair_u32_even(&pair) ? "true" : "false", api_pair_u32_even(&twins) ? "true" : "false"); - api_pair_size_u8 sizes = api_tag((api_size){.width = 1, .height = 2}, 3); - api_pair_u8_size flipped = api_pair_size_u8_swap(&sizes); + /* An instance renamed alone, beside another of `Pair` that keeps its name. */ + api_size_tag sizes = api_tag((api_size){.width = 1, .height = 2}, 3); + api_pair_u8_size flipped = api_size_tag_swap(&sizes); printf("sized %u %u ", flipped.left, flipped.right.width); print("", api_pair_u8_size_debug(&flipped), "\n"); api_pair_u32 byte = {.left = 258, .right = 9}; @@ -581,7 +582,7 @@ static int script(void) { /* Generic functions and methods, at each implementation of the trait bounding them, by reference, which leaves C its handle. */ api_counter *from_point = api_counter_seeded_point(str("p"), (api_point){.x = -3, .y = 4}); - api_counter *from_size = api_counter_seeded_size(str("s"), (api_size){.width = 5, .height = 6}); + api_counter *from_size = api_counter_from_size(str("s"), (api_size){.width = 5, .height = 6}); api_counter *from_counter = api_counter_seeded_counter(str("c"), from_point); /* Two instances whose arguments share a last segment: one takes its module too. */ api_counter *from_polar = api_counter_seeded_polar_point(str("q"), (api_polar_point){.turns = 1, .distance = 2}); diff --git a/ffi/tests/api.cpp b/ffi/tests/api.cpp index 619365bef..841e736f0 100644 --- a/ffi/tests/api.cpp +++ b/ffi/tests/api.cpp @@ -456,7 +456,8 @@ int script() { print("", pair.debug(), " "); std::printf("%s\n", yes(pair == swapped)); std::printf("even %s %s\n", yes(pair.even()), yes(api::pair_u32{7, 7}.even())); - api::pair_size_u8 sizes = api::tag({1, 2}, 3); + // An instance renamed alone, beside another of `Pair` that keeps its name. + api::size_tag sizes = api::tag({1, 2}, 3); api::pair_u8_size flipped = sizes.swap(); std::printf("sized %u %u ", flipped.left, flipped.right.width); print("", flipped.debug(), "\n"); @@ -478,7 +479,7 @@ int script() { // by reference, which leaves C++ its handle. Two arguments sharing a last segment // name their instances apart by the module of one. api::counter from_point = api::counter::seeded_point("p", {-3, 4}); - api::counter from_size = api::counter::seeded_size("s", {5, 6}); + api::counter from_size = api::counter::from_size("s", {5, 6}); api::counter from_counter = api::counter::seeded_counter("c", from_point); api::counter from_polar = api::counter::seeded_polar_point("q", {1, 2}); std::printf("seeded %llu %llu %llu %llu past %llu seeds %llu\n", ull(from_point.get()), ull(from_size.get()), diff --git a/ffi/tests/api.kt b/ffi/tests/api.kt index 6738b5298..ed41807cb 100644 --- a/ffi/tests/api.kt +++ b/ffi/tests/api.kt @@ -265,8 +265,9 @@ fun script() { val swapped = pair.swap() println("pair ${swapped.left} ${swapped.right} sum ${pair.sum()} ${pair.debug()} ${pair == swapped}") println("even ${pair.even()} ${PairU32(7u, 7u).even()}") - val sized = tag(Size(1u, 2u), 3u) - val flipped = sized.swap() + // An instance renamed alone, beside another of `Pair` that keeps its name. + val sized: SizeTag = tag(Size(1u, 2u), 3u) + val flipped: PairU8Size = sized.swap() println("sized ${flipped.left} ${flipped.right.width} ${flipped.debug()}") val beside = PairU32(258u, 9u).besideSize(sized.left) println("beside ${beside.left} ${beside.debug()}") @@ -280,7 +281,7 @@ fun script() { // Generic functions and methods, at each implementation of the trait bounding them, by // reference, which leaves Kotlin its handle. val fromPoint = Counter.seededPoint("p", Point(-3, 4)) - val fromSize = Counter.seededSize("s", Size(5u, 6u)) + val fromSize = Counter.fromSize("s", Size(5u, 6u)) val fromCounter = Counter.seededCounter("c", fromPoint) val fromPolar = Counter.seededPolarPoint("q", PolarPoint(1u, 2u)) println( diff --git a/quest/m3/README.md b/quest/m3/README.md index 1215ab2db..c8096c923 100644 --- a/quest/m3/README.md +++ b/quest/m3/README.md @@ -28,6 +28,5 @@ generic std gap is planned here even when moq never calls it. - [Drop order in std's folds and iterators](/quest/m3/ts-drop-order.md) - the values that drop still refused in std's folds, zips, flattens, and collects drop as std's do - [Ordering in std](/quest/m3/ts-ordering.md) - `cmp::max`/`min`, `is_sorted`, and `BinaryHeap`, and #173's cost on integers measured - [Debug and Display of Arc and ranges](/quest/m3/ts-fmt-wrappers.md) - `Arc` formats as `T`, and ranges as std's `Debug` -- [Rename one instance](/quest/m3/ffi-instance-rename.md) - `rename` by an instance's path, once a consumer's clash needs it - [Into targets through a chain of From implementations](/quest/m3/ffi-from-chains.md) - `sources` follows more than one level, once a consumer's parameter needs it - [Port the workflow guard to kixelated/quest](/quest/m3/quest-workflow-guard.md) - quest's environment guard parses YAML as this repository's does diff --git a/quest/m3/ffi-instance-rename.md b/quest/m3/ffi-instance-rename.md deleted file mode 100644 index 260a7b950..000000000 --- a/quest/m3/ffi-instance-rename.md +++ /dev/null @@ -1,20 +0,0 @@ -# [XS] Rename one instance - -## Goal - -A `rename` keyed by an instance's path, such as -`"catalog::Producer"`, renames that instance alone, as -`exclude` already takes an instance's path. Today `rename` takes only the generic item's -path, which renames every instance. - -## Plan - -Suggested by [#152](https://github.com/moq-dev/rust2/pull/152) on 2026-10-27. No consumer -needs it yet: a clash between an instance and an unrelated item is fixed today by renaming -the unrelated item or the generic one. Start once a consumer's clash can't be fixed that -way. - -- Prefer a naming rule that avoids the clash over a new config key, since every config key - a consumer needs is a gap; take this only if no rule does. - -Public API: `ffi.toml`'s `rename` keys.