Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: upgrade to Rust 1.81 #3972

Merged
merged 2 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions crates/biome_analyze/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ use std::path::Path;
type RuleQueryResult<R> = <<R as Rule>::Query as Queryable>::Output;
type RuleServiceBag<R> = <<R as Rule>::Query as Queryable>::Services;

pub struct RuleContext<'a, R>
where
R: ?Sized + Rule,
{
pub struct RuleContext<'a, R: Rule> {
query_result: &'a RuleQueryResult<R>,
root: &'a RuleRoot<R>,
bag: &'a ServiceBag,
Expand Down
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know why this snapshot changed?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I wonder if it is not related to their change of implementation of sort and unstable_sort.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yeah, I remember. That's probably that

Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ ci ━━━━━━━━━━━━━━━━━━━━━━━━━
# Emitted Messages

```block
src/folder_3/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_1/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_3/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_1/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -34,9 +34,9 @@ src/folder_3/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_2/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_5/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_2/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_5/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -46,9 +46,9 @@ src/folder_2/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_4/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_0/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_4/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_0/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -58,9 +58,9 @@ src/folder_4/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_6/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_3/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_6/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_3/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -70,9 +70,9 @@ src/folder_6/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_7/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_2/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_7/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_2/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -82,9 +82,9 @@ src/folder_7/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_1/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_4/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_1/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_4/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -94,9 +94,9 @@ src/folder_1/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_5/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_6/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_5/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_6/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand All @@ -106,9 +106,9 @@ src/folder_5/package-lock.json project VERBOSE ━━━━━━━━━━
```

```block
src/folder_0/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
src/folder_7/package-lock.json project VERBOSE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

i The file src/folder_0/package-lock.json is protected because is handled by another tool. Biome won't process it.
i The file src/folder_7/package-lock.json is protected because is handled by another tool. Biome won't process it.

Verbose advice

Expand Down
8 changes: 1 addition & 7 deletions crates/biome_console/src/write/termcolor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ where
// Unicode is currently poorly supported on most Windows
// terminal clients, so we always strip emojis in Windows
if cfg!(windows) || !self.writer.supports_color() {
let is_ascii = grapheme_is_ascii(grapheme);
let is_ascii = grapheme.is_ascii();

if !is_ascii {
let replacement = unicode_to_ascii(grapheme.chars().nth(0).unwrap());
Expand Down Expand Up @@ -201,12 +201,6 @@ fn grapheme_is_whitespace(grapheme: &str) -> bool {
grapheme.chars().all(|c| c.is_whitespace())
}

/// Determines if a grapheme contains code points which are out of the ASCII
/// range and thus cannot be printed where unicode is not supported.
fn grapheme_is_ascii(grapheme: &str) -> bool {
grapheme.chars().all(|c| c.is_ascii())
}

/// Replace emoji characters with similar but more widely supported ASCII
/// characters
fn unicode_to_ascii(c: char) -> char {
Expand Down
6 changes: 6 additions & 0 deletions crates/biome_fs/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,27 +241,32 @@ struct AliasPath {
}

impl AliasPath {
#[allow(dead_code)]
pub fn new(name: impl Into<String>) -> Self {
Self {
name: name.into(),
prefix: vec![],
}
}

#[allow(dead_code)]
pub fn add_prefix(&mut self, prefix: impl Into<PathBuf>) {
self.prefix.push(prefix.into());
}
}

#[allow(dead_code)]
pub struct Aliases {
aliases: Vec<AliasPath>,
}

impl Aliases {
#[allow(dead_code)]
pub fn new() -> Self {
Self { aliases: vec![] }
}

#[allow(dead_code)]
pub fn with_alias<'a>(
mut self,
name: impl Into<String>,
Expand All @@ -275,6 +280,7 @@ impl Aliases {
self
}

#[allow(dead_code)]
pub fn get_paths_by_name(&self, name: &str) -> Option<&[PathBuf]> {
self.aliases
.iter()
Expand Down
4 changes: 1 addition & 3 deletions crates/biome_js_parser/src/syntax/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ pub(super) fn parse_unary_expr(p: &mut JsParser, context: ExpressionContext) ->
let mut rewriter = DeleteExpressionRewriter::default();
rewrite_events(&mut rewriter, checkpoint, p);

rewriter.result.take().map(|res| {
rewriter.result.take().inspect(|_| {
if StrictMode.is_supported(p) {
if let Some(range) = rewriter.exited_ident_expr {
kind = JS_BOGUS_EXPRESSION;
Expand All @@ -2180,8 +2180,6 @@ pub(super) fn parse_unary_expr(p: &mut JsParser, context: ExpressionContext) ->
range,
));
}

res
})
} else {
parse_unary_expr(p, context).ok()
Expand Down
4 changes: 0 additions & 4 deletions crates/biome_js_parser/src/syntax/typescript/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,6 @@ impl TypeContext {
pub const TYPE_OR_INTERFACE_DECLARATION: Self =
Self(make_bitflags!(ContextFlag::{TypeOrInterfaceDeclaration}));

pub const fn empty() -> Self {
Self(BitFlags::EMPTY)
}

pub fn contains(&self, other: impl Into<TypeContext>) -> bool {
self.0.contains(other.into().0)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/biome_rowan/src/ast/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub use mutation::{AstNodeExt, AstNodeListExt, AstSeparatedListExt};
/// bitfield here being twice as large as it needs to cover all nodes as well
/// as all token kinds
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct SyntaxKindSet<L: ?Sized + Language>([u128; 4], PhantomData<L>);
pub struct SyntaxKindSet<L: Language>([u128; 4], PhantomData<L>);

impl<L> SyntaxKindSet<L>
where
Expand Down
6 changes: 2 additions & 4 deletions crates/biome_rowan/src/cursor/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,8 @@ impl SyntaxNodeChildren {
impl Iterator for SyntaxNodeChildren {
type Item = SyntaxNode;
fn next(&mut self) -> Option<SyntaxNode> {
self.next.take().map(|next| {
self.next.take().inspect(|next| {
self.next = next.next_sibling();
next
})
}
}
Expand All @@ -501,9 +500,8 @@ impl SyntaxElementChildren {
impl Iterator for SyntaxElementChildren {
type Item = SyntaxElement;
fn next(&mut self) -> Option<SyntaxElement> {
self.next.take().map(|next| {
self.next.take().inspect(|next| {
self.next = next.next_sibling_or_token();
next
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# The default profile includes rustc, rust-std, cargo, rust-docs, rustfmt and clippy.
# https://rust-lang.github.io/rustup/concepts/profiles.html
profile = "default"
channel = "1.80.0"
channel = "1.81.0"
4 changes: 4 additions & 0 deletions xtask/coverage/src/symbols/msts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,12 +242,16 @@ struct SymbolsFile {
}

/// This function parses lines like:
///
/// ```ignore
/// >Cell : Symbol(Cell, Decl(2dArrays.ts, 0, 0))
/// | | | | \--+---> line and column ofthe first char of the leading trivia where the declaration
/// | | | \--> File where the declaration of this symbol is
/// | | \--> States that this Symbol is a declaration
/// | \--> Complete Path of the Symbol
/// \--> text of the symbol
/// ```
///
/// To understand how the Typescript codebase generate this line
/// see xtask\coverage\Typescript\src\harness\typeWriter.ts
fn parse_symbol(input: &str) -> Option<Symbol> {
Expand Down
2 changes: 1 addition & 1 deletion xtask/rules_check/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl FromStr for CodeBlockTest {
// This is based on the parsing logic for code block languages in `rustdoc`:
// https://github.com/rust-lang/rust/blob/6ac8adad1f7d733b5b97d1df4e7f96e73a46db42/src/librustdoc/html/markdown.rs#L873
let tokens = input
.split(|c| c == ',' || c == ' ' || c == '\t')
.split([',', ' ', '\t'])
.map(str::trim)
.filter(|token| !token.is_empty());

Expand Down
Loading