You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
structPG{engine:&mutEngine, -- lifetime error here
names:Vec<String>
}Q_OBJECT!{PG:
slot fn parse(String);}
To fix the code, I use a lifetime parameter for PG:
structPG<'a>{engine:&'amutEngine,// works :)names:Vec<String>}Q_OBJECT!{PG<'a>:// but now this is broken :(
slot fn parse(String);}
This is what the compiler says:
src/main.rs:52:16: 52:18 error: use of undeclared lifetime name `'a` [E0261]src/main.rs:52 Q_OBJECT! { PG<'a>: ^~
And if I don't use the lifetime parameter in the macro:
src/main.rs:52:13: 52:15 error: wrong number of lifetime parameters: expected 1, found 0 [E0107]
src/main.rs:52 Q_OBJECT! { PG:
^~
Apparently, the macro understands the type just fine, but can't find the definition of 'a. It should be as in impl, where the parameter is defined before used:
impl<'a>PG<'a>
I'm trying to find how to fix this, or how to improve Q_OBJECT, but no success so far.
The text was updated successfully, but these errors were encountered:
Problem:
To fix the code, I use a lifetime parameter for
PG
:This is what the compiler says:
And if I don't use the lifetime parameter in the macro:
src/main.rs:52:13: 52:15 error: wrong number of lifetime parameters: expected 1, found 0 [E0107] src/main.rs:52 Q_OBJECT! { PG: ^~
Apparently, the macro understands the type just fine, but can't find the definition of
'a
. It should be as inimpl
, where the parameter is defined before used:I'm trying to find how to fix this, or how to improve Q_OBJECT, but no success so far.
The text was updated successfully, but these errors were encountered: