Added compiler lint ban on DOMRefCell

This commit is contained in:
Yoav Alon 2016-03-09 23:48:32 +02:00
parent 25c6c29a27
commit 444eddb4a1
4 changed files with 29 additions and 0 deletions

View file

@ -37,5 +37,11 @@ impl EarlyLintPass for BanPass {
.is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type Cell<JSVal> detected. Use MutHeap<JSVal> instead")
}
if match_ty_unwrap(ty, &["dom", "bindings", "cell", "DOMRefCell"])
.and_then(|t| t.get(0))
.and_then(|t| match_ty_unwrap(&**t, &["dom", "bindings", "js", "JS"]))
.is_some() {
cx.span_lint(BANNED_TYPE, ty.span, "Banned type DOMRefCell<JS<T>> detected. Use MutHeap<JS<T>> instead")
}
}
}