}
None => {
let feat = feat_or_package;
+
+ //if this feature has already been added, then just return Ok
if !visited.insert(feat) {
- bail!("Cyclic feature dependency: feature `{}` depends \
- on itself", feat)
+ return Ok(());
}
+
used.insert(feat);
match s.features().get(feat) {
Some(recursive) => {
// This is a feature, add it recursively.
for f in recursive {
+ if f == feat {
+ bail!("Cyclic feature dependency: feature `{}` depends \
+ on itself", feat);
+ }
+
add_feature(s, f, deps, used, visited)?;
}
}
deps.entry(feat).or_insert((false, Vec::new())).0 = true;
}
}
- visited.remove(feat);
}
}
Ok(())
foo = ["bar"]
bar = ["foo"]
"#)
- .file("src/main.rs", "");
+ .file("src/main.rs", "fn main() {}");
assert_that(p.cargo_process("build"),
- execs().with_status(101).with_stderr("\
-[ERROR] Cyclic feature dependency: feature `[..]` depends on itself
-"));
+ execs().with_status(0).with_stdout(""));
}
#[test]