Repository navigation
Fix --line-range from the end skipping later absolute ranges - #4097
Open
Huang-404-Q wants to merge 2 commits into
Open
Huang-404-Q wants to merge 2 commits into
Huang-404-Q wants to merge 2 commits into
Conversation
RangeCheck::AfterLastRange stopped the read loop as soon as a line was past the from-end cutoff, even when another range had a larger absolute upper bound. Keep that early exit only when no absolute upper bound extends past the cutoff. Signed-off-by: huang <13165998033@163.com>
Author
|
The i686-unknown-linux-gnu failure is in |
Author
|
The rerun failed identically: |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LineRanges::checkreturnedAfterLastRangeas soon as a line was past the from-end cutoff, without considering a larger absolute upper bound from another range.controller.rsthen stopped reading, so a later absolute--line-rangewas never printed.For a 10-line file:
before this change prints lines 1-8 and drops line 10. Ranges should be unioned, so line 10 must be printed as well.
The fix makes
largest_absolute_upper_boundoptional. The early exit still applies when there is no absolute upper bound (pure from-end ranges), but is skipped when a later line is still covered by an absolute range.Tests
Added
line_range_offset_from_end_and_later_absolute_rangetotests/integration_tests.rs.Verified with
cargo +1.95.0-x86_64-pc-windows-gnu test --locked --test integration_tests:line 10