-
-
Couldn't load subscription status.
- Fork 34
Open
Labels
design neededThe feature requires more design effortThe feature requires more design effortpapercutA non-critical issue that is annoyingA non-critical issue that is annoying
Description
With #[builder]:
#[builder]
pub fn f<RefIntoIter, Paths, P>(#[builder(start_fn)] paths: Paths)
where
Paths: AsRef<RefIntoIter> + Send + 'static,
for<'a> &'a RefIntoIter: IntoIterator<Item = P>,
P: AsRef<Path>,
{
()
}
#[test]
fn test() {
let paths = vec![PathBuf::from("test.txt")];
f::<Vec<_>, _, _>(paths).call();
}Calling any setters and call() will cause a "no method named ..." error:
error[E0599]: no method named `call` found for struct `FBuilder<Vec<PathBuf>, Vec<PathBuf>, &PathBuf>` in the current scope
--> src\time.rs:341:34
|
328 | #[builder]
| ---------- method `call` not found for this struct
...
341 | f::<Vec<_>, _, _>(paths).call();
| ^^^^ method not found in `FBuilder<Vec<PathBuf>, Vec<PathBuf>, &PathBuf>`
|
= note: the method was found for
- `FBuilder<RefIntoIter, Paths, P, S>`
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `call`, perhaps you need to implement it:
candidate #1: `Fn`While without #[builder]:
pub fn f<RefIntoIter, Paths, P>(paths: Paths)
where
Paths: AsRef<RefIntoIter> + Send + 'static,
for<'a> &'a RefIntoIter: IntoIterator<Item = P>,
P: AsRef<Path>,
{
()
}
#[test]
fn test() {
let paths = vec![PathBuf::from("test.txt")];
f::<Vec<_>, _, _>(paths);
}error[E0308]: mismatched types
--> src\time.rs:340:9
|
340 | f::<Vec<_>, _, _>(paths);
| ^^^^^^^^^^^^^^^^^ one type is more general than the other
|
= note: expected reference `&'a PathBuf`
found reference `&PathBuf`It's much clearer to see there is a 'a missed.
Metadata
Metadata
Assignees
Labels
design neededThe feature requires more design effortThe feature requires more design effortpapercutA non-critical issue that is annoyingA non-critical issue that is annoying