Skip to content

Commit 57c0cdd

Browse files
Ian Childsfacebook-github-bot
Ian Childs
authored andcommitted
Do not allow $declared_deps and $declared in queries
Summary: This isn't properly supported, and is unused, so just get rid of this code that makes it not fail. Reviewed By: iguridi Differential Revision: D71477139 fbshipit-source-id: deb3c26bfa7601a6a4c811009951a3de00e2413d
1 parent 8a2d725 commit 57c0cdd

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

app/buck2_interpreter_for_build/src/attrs/coerce/attr_type/query.rs

-3
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,6 @@ impl QueryAttrTypeExt for QueryAttrType {
5252
fn target_pattern(&mut self, pattern: &str) -> buck2_error::Result<()> {
5353
// TODO(cjhopman): We could probably parse the pattern first. This would likely at least give a better error message when the query contains a non-literal target pattern.
5454
// We could optimize this to do less work for duplicates, but it's generally not helpful.
55-
if pattern == "$declared_deps" || pattern == "$declared" {
56-
return Ok(());
57-
}
5855
let label = self.ctx.coerce_providers_label(pattern)?;
5956

6057
/*

tests/core/query/cquery/test_cquery.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ async def test_disabling_of_execution_platforms(buck: Buck) -> None:
269269

270270
@buck_test(data_dir="deps_query")
271271
async def test_declared_deps_query(buck: Buck) -> None:
272-
# TODO(ianc) This should fail
273-
await buck.cquery(
274-
"root//:declared_deps",
272+
await expect_failure(
273+
buck.cquery(
274+
"root//:declared_deps",
275+
),
276+
stderr_regex="Invalid target pattern `\\$declared_deps` is not allowed",
275277
)

0 commit comments

Comments
 (0)