Skip to content

Commit 8ad4336

Browse files
authored
Merge pull request rust-lang#20991 from Veykril/push-rrpwmvnskstu
Merge `text-size` into rust-analyzer
2 parents 2b05436 + 140f390 commit 8ad4336

File tree

19 files changed

+1302
-7
lines changed

19 files changed

+1302
-7
lines changed

src/tools/rust-analyzer/Cargo.lock

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ dependencies = [
730730
"syntax-bridge",
731731
"test-fixture",
732732
"test-utils",
733-
"text-size",
733+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
734734
"thin-vec",
735735
"tracing",
736736
"triomphe",
@@ -1231,7 +1231,7 @@ version = "0.1.2"
12311231
dependencies = [
12321232
"nohash-hasher",
12331233
"oorandom",
1234-
"text-size",
1234+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
12351235
]
12361236

12371237
[[package]]
@@ -1241,7 +1241,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
12411241
checksum = "3e27e0ed5a392a7f5ba0b3808a2afccff16c64933312c84b57618b49d1209bd2"
12421242
dependencies = [
12431243
"nohash-hasher",
1244-
"text-size",
1244+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
12451245
]
12461246

12471247
[[package]]
@@ -2021,7 +2021,7 @@ dependencies = [
20212021
"hashbrown 0.14.5",
20222022
"memoffset",
20232023
"rustc-hash 1.1.0",
2024-
"text-size",
2024+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
20252025
]
20262026

20272027
[[package]]
@@ -2328,6 +2328,15 @@ dependencies = [
23282328
"serde",
23292329
]
23302330

2331+
[[package]]
2332+
name = "serde_test"
2333+
version = "1.0.177"
2334+
source = "registry+https://github.com/rust-lang/crates.io-index"
2335+
checksum = "7f901ee573cab6b3060453d2d5f0bae4e6d628c23c0a962ff9b5f1d7c8d4f1ed"
2336+
dependencies = [
2337+
"serde",
2338+
]
2339+
23312340
[[package]]
23322341
name = "sharded-slab"
23332342
version = "0.1.7"
@@ -2369,7 +2378,7 @@ dependencies = [
23692378
"salsa",
23702379
"stdx",
23712380
"syntax",
2372-
"text-size",
2381+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
23732382
"vfs",
23742383
]
23752384

@@ -2388,6 +2397,12 @@ version = "1.2.0"
23882397
source = "registry+https://github.com/rust-lang/crates.io-index"
23892398
checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
23902399

2400+
[[package]]
2401+
name = "static_assertions"
2402+
version = "1.1.0"
2403+
source = "registry+https://github.com/rust-lang/crates.io-index"
2404+
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
2405+
23912406
[[package]]
23922407
name = "stdx"
23932408
version = "0.0.0"
@@ -2497,7 +2512,16 @@ dependencies = [
24972512
"profile",
24982513
"rustc-hash 2.1.1",
24992514
"stdx",
2500-
"text-size",
2515+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
2516+
]
2517+
2518+
[[package]]
2519+
name = "text-size"
2520+
version = "1.1.1"
2521+
dependencies = [
2522+
"serde",
2523+
"serde_test",
2524+
"static_assertions",
25012525
]
25022526

25032527
[[package]]
@@ -2772,7 +2796,7 @@ dependencies = [
27722796
"intern",
27732797
"ra-ap-rustc_lexer",
27742798
"stdx",
2775-
"text-size",
2799+
"text-size 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
27762800
]
27772801

27782802
[[package]]
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- master
7+
- staging
8+
- trying
9+
10+
env:
11+
RUSTFLAGS: -D warnings
12+
RUSTUP_MAX_RETRIES: 10
13+
CARGO_NET_RETRY: 10
14+
15+
jobs:
16+
rust:
17+
name: Rust
18+
runs-on: ${{ matrix.os }}
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
os: [ubuntu-latest, windows-latest, macos-latest]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v2
28+
29+
- name: Install Rust toolchain
30+
uses: actions-rs/toolchain@v1
31+
with:
32+
toolchain: stable
33+
profile: minimal
34+
35+
- name: Test
36+
run: cargo test --all-features
37+
38+
rustdoc:
39+
name: Docs
40+
runs-on: ubuntu-latest
41+
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v2
45+
46+
- name: Install Rust toolchain
47+
uses: actions-rs/toolchain@v1
48+
with:
49+
toolchain: nightly
50+
profile: minimal
51+
override: true
52+
53+
- name: Rustdoc
54+
run: cargo rustdoc --all-features -- -D warnings
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
**/*.rs.bk
3+
Cargo.lock
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Changelog
2+
3+
## 1.1.0
4+
5+
* add `TextRange::ordering` method
6+
7+
## 1.0.0 :tada:
8+
9+
* the carate is renamed to `text-size` from `text_unit`
10+
11+
Transition table:
12+
- `TextUnit::of_char(c)``TextSize::of(c)`
13+
- `TextUnit::of_str(s)``TextSize::of(s)`
14+
- `TextUnit::from_usize(size)``TextSize::try_from(size).unwrap_or_else(|| panic!(_))`
15+
- `unit.to_usize()``usize::from(size)`
16+
- `TextRange::from_to(from, to)``TextRange::new(from, to)`
17+
- `TextRange::offset_len(offset, size)``TextRange::from_len(offset, size)`
18+
- `range.start()``range.start()`
19+
- `range.end()``range.end()`
20+
- `range.len()``range.len()`
21+
- `range.is_empty()``range.is_empty()`
22+
- `a.is_subrange(b)``b.contains_range(a)`
23+
- `a.intersection(b)``a.intersect(b)`
24+
- `a.extend_to(b)``a.cover(b)`
25+
- `range.contains(offset)``range.contains(point)`
26+
- `range.contains_inclusive(offset)``range.contains_inclusive(point)`
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
[package]
2+
name = "text-size"
3+
version = "1.1.1"
4+
edition = "2018"
5+
6+
authors = [
7+
"Aleksey Kladov <aleksey.kladov@gmail.com>",
8+
"Christopher Durham (CAD97) <cad97@cad97.com>"
9+
]
10+
description = "Newtypes for text offsets"
11+
license = "MIT OR Apache-2.0"
12+
repository = "https://github.com/rust-analyzer/text-size"
13+
documentation = "https://docs.rs/text-size"
14+
15+
[dependencies]
16+
serde = { version = "1.0", optional = true, default_features = false }
17+
18+
[dev-dependencies]
19+
serde_test = "1.0"
20+
static_assertions = "1.1"
21+
22+
[[test]]
23+
name = "serde"
24+
path = "tests/serde.rs"
25+
required-features = ["serde"]

0 commit comments

Comments
 (0)