Skip to content

Conversation

ntBre
Copy link
Contributor

@ntBre ntBre commented Aug 20, 2025

Summary

I ran into a problem earlier when trying to run this command:

$ cargo test -p ruff_source_file --all-features
error[E0277]: the trait bound `TextSize: GetSize` is not satisfied
  --> crates/ruff_source_file/src/line_index.rs:23:41

It looks like we just needed to activate the get-size feature of ruff_text_size when ruff_source_file activates its feature of the same name.

While I was at it, I looked for other cases with the same problem:

for crate in crates/*; do
    if ! cargo test -p ${crate#*/} --all-features > /dev/null; then
        echo "$crate failed"
        break
    fi
done

and fixed those too. I also tried with no features enabled, since I know we've run into similar problems with that before, but that didn't find anything except for some unreachable pub warnings for TestDb in ty_project. But TestDb is conditionally re-exported, so I don't think we can get rid of those warnings easily, unless we just want to allow the warnings.

Should we consider throwing something like the script above into a daily/weekly cron job in CI? I don't think we necessarily need to run it on every PR.

Test Plan

Same commands above, which now succeed

ntBre added 4 commits August 20, 2025 18:24
Summary
--

I ran into this earlier when trying to run

```shell
$ cargo test -p ruff_source_file --all-features
error[E0277]: the trait bound `TextSize: GetSize` is not satisfied
  --> crates/ruff_source_file/src/line_index.rs:23:41
```

It looks like we just needed to activate the `get-size` feature of
`ruff_text_size` when `ruff_source_file` activates its feature of the same name.

While I was at it, I ran this shell command to look for other cases with the
same problem:

```shell
for crate in crates/*; do
    if ! cargo test -p ${crate#*/} --all-features > /dev/null; then
        echo "$crate failed"
        break
    fi
done
```

and fixed those too. I also tried with no features enabled, since I know we've
run into similar problems with that before, but that didn't find anything except
for some unreachable `pub` warnings in for `TestDb` in `ty_project`. But
`TestDb` is conditionally re-exported, so I don't think we can get rid of those
warnings easily.

Should we consider throwing something like that into a daily/weekly cron job in
CI? I don't think we necessarily need to run it on every PR.

Test Plan
--

Same command above, which now works
@ntBre ntBre added the testing Related to testing Ruff itself label Aug 20, 2025
Copy link
Contributor

Diagnostic diff on typing conformance tests

No changes detected when running ty on typing conformance tests ✅

Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅
No memory usage changes detected ✅

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

@MichaReiser MichaReiser changed the title Fix a few features Fix rust feature activation Aug 21, 2025
@MichaReiser MichaReiser merged commit a5cbca1 into main Aug 21, 2025
49 of 50 checks passed
@MichaReiser MichaReiser deleted the brent/get-size-feature branch August 21, 2025 07:26
dcreager added a commit that referenced this pull request Aug 21, 2025
* main:
  [ty] Use `dedent` in cursor tests (#20019)
  Fix rust feature activation (#20012)
  [ty] Avoid unnecessary argument type expansion (#19999)
  [ty] Add link for namespaces being partial (#20015)
second-ed pushed a commit to second-ed/ruff that referenced this pull request Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Related to testing Ruff itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants