nandi/rustnimpublic Fork
⑂ 9a32146
Commits
⬇ Clone ▾
git clone https://git.rickub.com/nandi/rustnim.git
git clone ssh://git@rickub.com/nandi/rustnim.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

Recognise a `&mut` receiver as a generic parameter

`input.checkpoint()` where `input: &mut Input` and `Input: Stream` is the
shape most of winnow's combinators are written in, and the trait-bound
dispatch never fired on it: the receiver's type is `var Input`, whose rendered
name is not the parameter's. Unwrapped before the name is taken.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
nandithebull committed 2026-09-19T19:40:32-07:00 Browse files
9a32146 parent: 0822ec3
modified src/lower.rs +3 -1
@@ -7220,9 +7220,11 @@ impl Lowerer {
72207220 // Nim at instantiation, so the call just needs the right proc
72217221 // name. Every impl of a trait method shares one, so any
72227222 // candidate with this method name gives it.
7223+ // `.unvar()` first: a `&mut Input` receiver is `var Input`,
7224+ // whose rendered name is not the parameter's.
72237225 let recv_param = rt
72247226 .as_ref()
7225- .map(type_name)
7227+ .map(|t| type_name(&t.clone().unvar()))
72267228 .filter(|n| self.fn_generics.iter().any(|g| g == n));
72277229
72287230 // The receiver's type is a generic parameter and one of its
@@ -7220,9 +7220,11 @@ impl Lowerer {
7220 // Nim at instantiation, so the call just needs the right proc7220 // Nim at instantiation, so the call just needs the right proc
7221 // name. Every impl of a trait method shares one, so any7221 // name. Every impl of a trait method shares one, so any
7222 // candidate with this method name gives it.7222 // candidate with this method name gives it.
7223+ // `.unvar()` first: a `&mut Input` receiver is `var Input`,
7224+ // whose rendered name is not the parameter's.
7223 let recv_param = rt7225 let recv_param = rt
7224 .as_ref()7226 .as_ref()
7225- .map(type_name)7227+ .map(|t| type_name(&t.clone().unvar()))
7226 .filter(|n| self.fn_generics.iter().any(|g| g == n));7228 .filter(|n| self.fn_generics.iter().any(|g| g == n));
7227 7229
7228 // The receiver's type is a generic parameter and one of its7230 // The receiver's type is a generic parameter and one of its