Merge pull request #21002 from Veykril/veykril/push-nztxvpnntmrx
lib: Bump editions to 2024 and remove legacy files
This commit is contained in:
parent
219268d848
commit
a7e4e45027
21 changed files with 38 additions and 423 deletions
127
src/tools/rust-analyzer/lib/smol_str/.github/ci.rs
vendored
127
src/tools/rust-analyzer/lib/smol_str/.github/ci.rs
vendored
|
|
@ -1,127 +0,0 @@
|
|||
use std::{
|
||||
env, fs,
|
||||
process::{self, Command, ExitStatus, Stdio},
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
type Error = Box<dyn std::error::Error>;
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
fn main() {
|
||||
if let Err(err) = try_main() {
|
||||
eprintln!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn try_main() -> Result<()> {
|
||||
let cwd = env::current_dir()?;
|
||||
let cargo_toml = cwd.join("Cargo.toml");
|
||||
assert!(
|
||||
cargo_toml.exists(),
|
||||
"Cargo.toml not found, cwd: {}",
|
||||
cwd.display()
|
||||
);
|
||||
|
||||
{
|
||||
let _s = Section::new("BUILD_NO_DEFAULT_FEATURES");
|
||||
shell("cargo test --all-features --workspace --no-run --no-default-features")?;
|
||||
}
|
||||
|
||||
{
|
||||
let _s = Section::new("BUILD");
|
||||
shell("cargo test --all-features --workspace --no-run")?;
|
||||
}
|
||||
|
||||
{
|
||||
let _s = Section::new("TEST");
|
||||
shell("cargo test --all-features --workspace")?;
|
||||
shell("cargo test --no-default-features --workspace")?;
|
||||
}
|
||||
|
||||
{
|
||||
let _s = Section::new("TEST_BENCHES");
|
||||
shell("cargo test --benches --all-features")?;
|
||||
}
|
||||
|
||||
let current_branch = shell_output("git branch --show-current")?;
|
||||
if ¤t_branch == "master" {
|
||||
let _s = Section::new("PUBLISH");
|
||||
let manifest = fs::read_to_string(&cargo_toml)?;
|
||||
let version = get_field(&manifest, "version")?;
|
||||
let tag = format!("v{}", version);
|
||||
let tags = shell_output("git tag --list")?;
|
||||
|
||||
if !tags.contains(&tag) {
|
||||
let token = env::var("CRATES_IO_TOKEN").unwrap();
|
||||
shell(&format!("git tag v{}", version))?;
|
||||
shell(&format!("cargo publish --token {}", token))?;
|
||||
shell("git push --tags")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_field<'a>(text: &'a str, name: &str) -> Result<&'a str> {
|
||||
for line in text.lines() {
|
||||
let words = line.split_ascii_whitespace().collect::<Vec<_>>();
|
||||
match words.as_slice() {
|
||||
[n, "=", v, ..] if n.trim() == name => {
|
||||
assert!(v.starts_with('"') && v.ends_with('"'));
|
||||
return Ok(&v[1..v.len() - 1]);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
Err(format!("can't find `{}` in\n----\n{}\n----\n", name, text))?
|
||||
}
|
||||
|
||||
fn shell(cmd: &str) -> Result<()> {
|
||||
let status = command(cmd).status()?;
|
||||
check_status(status)
|
||||
}
|
||||
|
||||
fn shell_output(cmd: &str) -> Result<String> {
|
||||
let output = command(cmd).stderr(Stdio::inherit()).output()?;
|
||||
check_status(output.status)?;
|
||||
let res = String::from_utf8(output.stdout)?;
|
||||
let res = res.trim().to_string();
|
||||
println!("{}", res);
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
fn command(cmd: &str) -> Command {
|
||||
eprintln!("> {}", cmd);
|
||||
let words = cmd.split_ascii_whitespace().collect::<Vec<_>>();
|
||||
let (cmd, args) = words.split_first().unwrap();
|
||||
let mut res = Command::new(cmd);
|
||||
res.args(args);
|
||||
res
|
||||
}
|
||||
|
||||
fn check_status(status: ExitStatus) -> Result<()> {
|
||||
if !status.success() {
|
||||
Err(format!("$status: {}", status))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct Section {
|
||||
name: &'static str,
|
||||
start: Instant,
|
||||
}
|
||||
|
||||
impl Section {
|
||||
fn new(name: &'static str) -> Section {
|
||||
println!("::group::{}", name);
|
||||
let start = Instant::now();
|
||||
Section { name, start }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Section {
|
||||
fn drop(&mut self) {
|
||||
eprintln!("{}: {:.2?}", self.name, self.start.elapsed());
|
||||
println!("::endgroup::");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- staging
|
||||
- trying
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CI: 1
|
||||
RUST_BACKTRACE: short
|
||||
RUSTFLAGS: -D warnings
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
|
||||
jobs:
|
||||
rust:
|
||||
name: Rust
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
cache: false
|
||||
|
||||
- run: rustc ./.github/ci.rs && ./ci
|
||||
env:
|
||||
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
/target
|
||||
/ci
|
||||
/.vscode
|
||||
Cargo.lock
|
||||
|
|
@ -5,7 +5,7 @@ description = "small-string optimized string type with O(1) clone"
|
|||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-lang/rust-analyzer/tree/master/lib/smol_str"
|
||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>", "Lukas Wirth <lukastw97@gmail.com>"]
|
||||
edition = "2021"
|
||||
edition = "2024"
|
||||
rust-version = "1.89"
|
||||
|
||||
[package.metadata.docs.rs]
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use criterion::{Criterion, criterion_group, criterion_main};
|
||||
use rand::distr::{Alphanumeric, SampleString};
|
||||
use smol_str::{format_smolstr, SmolStr, StrExt, ToSmolStr};
|
||||
use smol_str::{SmolStr, StrExt, ToSmolStr, format_smolstr};
|
||||
use std::hint::black_box;
|
||||
|
||||
/// 12: small (inline)
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
status = [ "Rust" ]
|
||||
delete_merged_branches = true
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{Repr, SmolStr, INLINE_CAP};
|
||||
use crate::{INLINE_CAP, Repr, SmolStr};
|
||||
use alloc::string::{String, ToString};
|
||||
use borsh::{
|
||||
io::{Error, ErrorKind, Read, Write},
|
||||
BorshDeserialize, BorshSerialize,
|
||||
io::{Error, ErrorKind, Read, Write},
|
||||
};
|
||||
use core::mem::transmute;
|
||||
|
||||
|
|
|
|||
|
|
@ -434,8 +434,7 @@ impl FromStr for SmolStr {
|
|||
const INLINE_CAP: usize = InlineSize::_V23 as usize;
|
||||
const N_NEWLINES: usize = 32;
|
||||
const N_SPACES: usize = 128;
|
||||
const WS: &str =
|
||||
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ";
|
||||
const WS: &str = "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n ";
|
||||
const _: () = {
|
||||
assert!(WS.len() == N_NEWLINES + N_SPACES);
|
||||
assert!(WS.as_bytes()[N_NEWLINES - 1] == b'\n');
|
||||
|
|
@ -690,24 +689,24 @@ impl StrExt for str {
|
|||
#[inline]
|
||||
fn replacen_smolstr(&self, from: &str, to: &str, mut count: usize) -> SmolStr {
|
||||
// Fast path for replacing a single ASCII character with another inline.
|
||||
if let [from_u8] = from.as_bytes() {
|
||||
if let [to_u8] = to.as_bytes() {
|
||||
return if self.len() <= count {
|
||||
// SAFETY: `from_u8` & `to_u8` are ascii
|
||||
unsafe { replacen_1_ascii(self, |b| if b == from_u8 { *to_u8 } else { *b }) }
|
||||
} else {
|
||||
unsafe {
|
||||
replacen_1_ascii(self, |b| {
|
||||
if b == from_u8 && count != 0 {
|
||||
count -= 1;
|
||||
*to_u8
|
||||
} else {
|
||||
*b
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
if let [from_u8] = from.as_bytes()
|
||||
&& let [to_u8] = to.as_bytes()
|
||||
{
|
||||
return if self.len() <= count {
|
||||
// SAFETY: `from_u8` & `to_u8` are ascii
|
||||
unsafe { replacen_1_ascii(self, |b| if b == from_u8 { *to_u8 } else { *b }) }
|
||||
} else {
|
||||
unsafe {
|
||||
replacen_1_ascii(self, |b| {
|
||||
if b == from_u8 && count != 0 {
|
||||
count -= 1;
|
||||
*to_u8
|
||||
} else {
|
||||
*b
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
let mut result = SmolStrBuilder::new();
|
||||
|
|
|
|||
|
|
@ -1,54 +0,0 @@
|
|||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- staging
|
||||
- trying
|
||||
|
||||
env:
|
||||
RUSTFLAGS: -D warnings
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
CARGO_NET_RETRY: 10
|
||||
|
||||
jobs:
|
||||
rust:
|
||||
name: Rust
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
|
||||
- name: Test
|
||||
run: cargo test --all-features
|
||||
|
||||
rustdoc:
|
||||
name: Docs
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- name: Rustdoc
|
||||
run: cargo rustdoc --all-features -- -D warnings
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/target
|
||||
**/*.rs.bk
|
||||
Cargo.lock
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
[package]
|
||||
name = "text-size"
|
||||
version = "1.1.1"
|
||||
edition = "2018"
|
||||
edition = "2024"
|
||||
|
||||
authors = [
|
||||
"Aleksey Kladov <aleksey.kladov@gmail.com>",
|
||||
|
|
@ -13,7 +13,7 @@ repository = "https://github.com/rust-analyzer/text-size"
|
|||
documentation = "https://docs.rs/text-size"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "1.0", optional = true, default_features = false }
|
||||
serde = { version = "1.0", optional = true, default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
serde_test = "1.0"
|
||||
|
|
@ -23,3 +23,6 @@ static_assertions = "1.1"
|
|||
name = "serde"
|
||||
path = "tests/serde.rs"
|
||||
required-features = ["serde"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
status = [
|
||||
"Rust (ubuntu-latest)",
|
||||
"Rust (windows-latest)",
|
||||
"Rust (macos-latest)",
|
||||
]
|
||||
delete_merged_branches = true
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
use {
|
||||
crate::{TextRange, TextSize},
|
||||
serde::{de, Deserialize, Deserializer, Serialize, Serializer},
|
||||
serde::{Deserialize, Deserializer, Serialize, Serializer, de},
|
||||
};
|
||||
|
||||
impl Serialize for TextSize {
|
||||
|
|
|
|||
114
src/tools/rust-analyzer/lib/ungrammar/.github/ci.rs
vendored
114
src/tools/rust-analyzer/lib/ungrammar/.github/ci.rs
vendored
|
|
@ -1,114 +0,0 @@
|
|||
use std::{
|
||||
env, fs,
|
||||
process::{self, Command, ExitStatus, Stdio},
|
||||
time::Instant,
|
||||
};
|
||||
|
||||
type Error = Box<dyn std::error::Error>;
|
||||
type Result<T> = std::result::Result<T, Error>;
|
||||
|
||||
fn main() {
|
||||
if let Err(err) = try_main() {
|
||||
eprintln!("{}", err);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
fn try_main() -> Result<()> {
|
||||
let cwd = env::current_dir()?;
|
||||
let cargo_toml = cwd.join("Cargo.toml");
|
||||
assert!(
|
||||
cargo_toml.exists(),
|
||||
"Cargo.toml not found, cwd: {}",
|
||||
cwd.display()
|
||||
);
|
||||
|
||||
{
|
||||
let _s = Section::new("BUILD");
|
||||
shell("cargo test --workspace --no-run")?;
|
||||
}
|
||||
|
||||
{
|
||||
let _s = Section::new("TEST");
|
||||
shell("cargo test --workspace")?;
|
||||
}
|
||||
|
||||
let current_branch = shell_output("git branch --show-current")?;
|
||||
if ¤t_branch == "master" {
|
||||
let _s = Section::new("PUBLISH");
|
||||
let manifest = fs::read_to_string(&cargo_toml)?;
|
||||
let version = get_field(&manifest, "version")?;
|
||||
let tag = format!("v{}", version);
|
||||
let tags = shell_output("git tag --list")?;
|
||||
|
||||
if !tags.contains(&tag) {
|
||||
let token = env::var("CRATES_IO_TOKEN").unwrap();
|
||||
shell(&format!("git tag v{}", version))?;
|
||||
shell(&format!("cargo publish --token {}", token))?;
|
||||
shell("git push --tags")?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn get_field<'a>(text: &'a str, name: &str) -> Result<&'a str> {
|
||||
for line in text.lines() {
|
||||
let words = line.split_ascii_whitespace().collect::<Vec<_>>();
|
||||
match words.as_slice() {
|
||||
[n, "=", v, ..] if n.trim() == name => {
|
||||
assert!(v.starts_with('"') && v.ends_with('"'));
|
||||
return Ok(&v[1..v.len() - 1]);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
Err(format!("can't find `{}` in\n----\n{}\n----\n", name, text))?
|
||||
}
|
||||
|
||||
fn shell(cmd: &str) -> Result<()> {
|
||||
let status = command(cmd).status()?;
|
||||
check_status(status)
|
||||
}
|
||||
|
||||
fn shell_output(cmd: &str) -> Result<String> {
|
||||
let output = command(cmd).stderr(Stdio::inherit()).output()?;
|
||||
check_status(output.status)?;
|
||||
let res = String::from_utf8(output.stdout)?;
|
||||
Ok(res.trim().to_string())
|
||||
}
|
||||
|
||||
fn command(cmd: &str) -> Command {
|
||||
eprintln!("> {}", cmd);
|
||||
let words = cmd.split_ascii_whitespace().collect::<Vec<_>>();
|
||||
let (cmd, args) = words.split_first().unwrap();
|
||||
let mut res = Command::new(cmd);
|
||||
res.args(args);
|
||||
res
|
||||
}
|
||||
|
||||
fn check_status(status: ExitStatus) -> Result<()> {
|
||||
if !status.success() {
|
||||
Err(format!("$status: {}", status))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
struct Section {
|
||||
name: &'static str,
|
||||
start: Instant,
|
||||
}
|
||||
|
||||
impl Section {
|
||||
fn new(name: &'static str) -> Section {
|
||||
println!("::group::{}", name);
|
||||
let start = Instant::now();
|
||||
Section { name, start }
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for Section {
|
||||
fn drop(&mut self) {
|
||||
eprintln!("{}: {:.2?}", self.name, self.start.elapsed());
|
||||
println!("::endgroup::");
|
||||
}
|
||||
}
|
||||
|
|
@ -1,36 +0,0 @@
|
|||
name: CI
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- staging
|
||||
- trying
|
||||
|
||||
env:
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_NET_RETRY: 10
|
||||
CI: 1
|
||||
RUST_BACKTRACE: short
|
||||
RUSTFLAGS: -D warnings
|
||||
RUSTUP_MAX_RETRIES: 10
|
||||
|
||||
jobs:
|
||||
rust:
|
||||
name: Rust
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Install Rust toolchain
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
profile: minimal
|
||||
override: true
|
||||
|
||||
- run: rustc ./.github/ci.rs && ./ci
|
||||
env:
|
||||
CRATES_IO_TOKEN: ${{ secrets.CRATES_IO_TOKEN }}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
/ci
|
||||
/Cargo.lock
|
||||
/target
|
||||
|
|
@ -4,10 +4,10 @@ description = "A DSL for describing concrete syntax trees"
|
|||
version = "1.16.1"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/rust-analyzer/ungrammar"
|
||||
edition = "2018"
|
||||
|
||||
exclude = ["/bors.toml", "/.github"]
|
||||
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
# nope
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
|||
|
|
@ -1,2 +0,0 @@
|
|||
status = [ "Rust" ]
|
||||
delete_merged_branches = true
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
//! Simple hand-written ungrammar lexer
|
||||
use crate::error::{bail, Result};
|
||||
use crate::error::{Result, bail};
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
pub(crate) enum TokenKind {
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::{
|
||||
error::{bail, format_err, Result},
|
||||
lexer::{self, TokenKind},
|
||||
Grammar, Node, NodeData, Rule, Token, TokenData,
|
||||
error::{Result, bail, format_err},
|
||||
lexer::{self, TokenKind},
|
||||
};
|
||||
|
||||
macro_rules! bail {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ version = "1.0.0"
|
|||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/matklad/ungrammar"
|
||||
authors = ["Aleksey Kladov <aleksey.kladov@gmail.com>"]
|
||||
edition = "2018"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
write-json = "0.1.1"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue