Skip to content

rust 2024, rust version 1.85 #19233

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ jobs:
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
run: cargo test ${{ env.USE_SYSROOT_ABI }} -- --nocapture --quiet

- name: Doc Test
if: matrix.os == 'ubuntu-latest' || matrix.os == 'windows-latest' || github.event_name == 'push'
run: cargo test ${{ env.USE_SYSROOT_ABI }} --doc -- --nocapture --quiet

- name: Switch to stable toolchain
run: |
rustup update --no-self-update stable
Expand Down
34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ exclude = ["crates/proc-macro-srv/proc-macro-test/imp"]
resolver = "2"

[workspace.package]
rust-version = "1.84"
edition = "2021"
rust-version = "1.85"
edition = "2024"
license = "MIT OR Apache-2.0"
authors = ["rust-analyzer team"]
repository = "https://github.com/rust-lang/rust-analyzer"
Expand Down Expand Up @@ -115,7 +115,7 @@ dot = "0.1.4"
either = "1.9.0"
expect-test = "1.4.0"
hashbrown = { version = "0.14", features = [
"inline-more",
"inline-more",
], default-features = false }
indexmap = "2.1.0"
itertools = "0.12.0"
Expand All @@ -125,11 +125,11 @@ memmap2 = "0.5.4"
nohash-hasher = "0.2.0"
oorandom = "11.1.3"
object = { version = "0.33.0", default-features = false, features = [
"std",
"read_core",
"elf",
"macho",
"pe",
"std",
"read_core",
"elf",
"macho",
"pe",
] }
process-wrap = { version = "8.0.2", features = ["std"] }
pulldown-cmark-to-cmark = "10.0.4"
Expand All @@ -141,21 +141,21 @@ serde = { version = "1.0.192" }
serde_derive = { version = "1.0.192" }
serde_json = "1.0.108"
smallvec = { version = "1.10.0", features = [
"const_new",
"union",
"const_generics",
"const_new",
"union",
"const_generics",
] }
smol_str = "0.3.2"
text-size = "1.1.1"
tracing = "0.1.40"
tracing-tree = "0.3.0"
tracing-subscriber = { version = "0.3.18", default-features = false, features = [
"registry",
"fmt",
"local-time",
"std",
"time",
"tracing-log",
"registry",
"fmt",
"local-time",
"std",
"time",
"tracing-log",
] }
triomphe = { version = "0.1.14", default-features = false, features = ["std"] }
url = "2.3.1"
Expand Down
6 changes: 1 addition & 5 deletions crates/base-db/src/change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,5 @@ impl FileChange {
}

fn durability(source_root: &SourceRoot) -> Durability {
if source_root.is_library {
Durability::HIGH
} else {
Durability::LOW
}
if source_root.is_library { Durability::HIGH } else { Durability::LOW }
}
88 changes: 50 additions & 38 deletions crates/base-db/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use la_arena::{Arena, Idx, RawIdx};
use rustc_hash::{FxHashMap, FxHashSet};
use span::{Edition, EditionedFileId};
use triomphe::Arc;
use vfs::{file_set::FileSet, AbsPathBuf, AnchoredPath, FileId, VfsPath};
use vfs::{AbsPathBuf, AnchoredPath, FileId, VfsPath, file_set::FileSet};

pub type ProcMacroPaths = FxHashMap<CrateId, Result<(String, AbsPathBuf), String>>;

Expand Down Expand Up @@ -59,7 +59,7 @@ impl SourceRoot {
self.file_set.resolve_path(path)
}

pub fn iter(&self) -> impl Iterator<Item = FileId> + '_ {
pub fn iter(&self) -> impl Iterator<Item = FileId> + use<'_> {
self.file_set.iter()
}
}
Expand Down Expand Up @@ -105,11 +105,7 @@ impl CrateName {
/// Dashes are not allowed in the crate names,
/// hence the input string is returned as `Err` for those cases.
pub fn new(name: &str) -> Result<CrateName, &str> {
if name.contains('-') {
Err(name)
} else {
Ok(Self(Symbol::intern(name)))
}
if name.contains('-') { Err(name) } else { Ok(Self(Symbol::intern(name))) }
}

/// Creates a crate name, unconditionally replacing the dashes with underscores.
Expand Down Expand Up @@ -413,19 +409,19 @@ impl CrateGraph {
self.arena.len()
}

pub fn iter(&self) -> impl Iterator<Item = CrateId> + '_ {
pub fn iter(&self) -> impl Iterator<Item = CrateId> + use<'_> {
self.arena.iter().map(|(idx, _)| idx)
}

// FIXME: used for fixing up the toolchain sysroot, should be removed and done differently
#[doc(hidden)]
pub fn iter_mut(&mut self) -> impl Iterator<Item = (CrateId, &mut CrateData)> + '_ {
pub fn iter_mut(&mut self) -> impl Iterator<Item = (CrateId, &'_ mut CrateData)> + use<'_> {
self.arena.iter_mut()
}

/// Returns an iterator over all transitive dependencies of the given crate,
/// including the crate itself.
pub fn transitive_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId> {
pub fn transitive_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId> + use<> {
let mut worklist = vec![of];
let mut deps = FxHashSet::default();

Expand All @@ -442,7 +438,7 @@ impl CrateGraph {

/// Returns all transitive reverse dependencies of the given crate,
/// including the crate itself.
pub fn transitive_rev_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId> {
pub fn transitive_rev_deps(&self, of: CrateId) -> impl Iterator<Item = CrateId> + use<> {
let mut worklist = vec![of];
let mut rev_deps = FxHashSet::default();
rev_deps.insert(of);
Expand Down Expand Up @@ -731,15 +727,21 @@ mod tests {
false,
None,
);
assert!(graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_ok());
assert!(graph
.add_dep(crate2, Dependency::new(CrateName::new("crate3").unwrap(), crate3,))
.is_ok());
assert!(graph
.add_dep(crate3, Dependency::new(CrateName::new("crate1").unwrap(), crate1,))
.is_err());
assert!(
graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_ok()
);
assert!(
graph
.add_dep(crate2, Dependency::new(CrateName::new("crate3").unwrap(), crate3,))
.is_ok()
);
assert!(
graph
.add_dep(crate3, Dependency::new(CrateName::new("crate1").unwrap(), crate1,))
.is_err()
);
}

#[test]
Expand Down Expand Up @@ -769,12 +771,16 @@ mod tests {
false,
None,
);
assert!(graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_ok());
assert!(graph
.add_dep(crate2, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_err());
assert!(
graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_ok()
);
assert!(
graph
.add_dep(crate2, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_err()
);
}

#[test]
Expand Down Expand Up @@ -816,12 +822,16 @@ mod tests {
false,
None,
);
assert!(graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_ok());
assert!(graph
.add_dep(crate2, Dependency::new(CrateName::new("crate3").unwrap(), crate3,))
.is_ok());
assert!(
graph
.add_dep(crate1, Dependency::new(CrateName::new("crate2").unwrap(), crate2,))
.is_ok()
);
assert!(
graph
.add_dep(crate2, Dependency::new(CrateName::new("crate3").unwrap(), crate3,))
.is_ok()
);
}

#[test]
Expand Down Expand Up @@ -851,12 +861,14 @@ mod tests {
false,
None,
);
assert!(graph
.add_dep(
crate1,
Dependency::new(CrateName::normalize_dashes("crate-name-with-dashes"), crate2,)
)
.is_ok());
assert!(
graph
.add_dep(
crate1,
Dependency::new(CrateName::normalize_dashes("crate-name-with-dashes"), crate2,)
)
.is_ok()
);
assert_eq!(
graph[crate1].dependencies,
vec![Dependency::new(CrateName::new("crate_name_with_dashes").unwrap(), crate2,)]
Expand Down
4 changes: 2 additions & 2 deletions crates/base-db/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::panic;
use ra_salsa::Durability;
use rustc_hash::FxHashMap;
use span::EditionedFileId;
use syntax::{ast, Parse, SourceFile, SyntaxError};
use syntax::{Parse, SourceFile, SyntaxError, ast};
use triomphe::Arc;
use vfs::FileId;

Expand All @@ -21,7 +21,7 @@ pub use crate::{
},
};
pub use ra_salsa::{self, Cancelled};
pub use vfs::{file_set::FileSet, AnchoredPath, AnchoredPathBuf, VfsPath};
pub use vfs::{AnchoredPath, AnchoredPathBuf, VfsPath, file_set::FileSet};

pub use semver::{BuildMetadata, Prerelease, Version, VersionReq};

Expand Down
2 changes: 1 addition & 1 deletion crates/cfg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use std::fmt;

use rustc_hash::FxHashSet;

use intern::{sym, Symbol};
use intern::{Symbol, sym};

pub use cfg_expr::{CfgAtom, CfgExpr};
pub use dnf::DnfExpr;
Expand Down
9 changes: 5 additions & 4 deletions crates/cfg/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use arbitrary::{Arbitrary, Unstructured};
use expect_test::{expect, Expect};
use expect_test::{Expect, expect};
use intern::Symbol;
use syntax::{ast, AstNode, Edition};
use syntax::{AstNode, Edition, ast};
use syntax_bridge::{
dummy_test_span_utils::{DummyTestSpanMap, DUMMY},
syntax_node_to_token_tree, DocCommentDesugarMode,
DocCommentDesugarMode,
dummy_test_span_utils::{DUMMY, DummyTestSpanMap},
syntax_node_to_token_tree,
};

use crate::{CfgAtom, CfgExpr, CfgOptions, DnfExpr};
Expand Down
14 changes: 7 additions & 7 deletions crates/hir-def/src/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@ use base_db::CrateId;
use cfg::{CfgExpr, CfgOptions};
use either::Either;
use hir_expand::{
attrs::{collect_attrs, Attr, AttrId, RawAttrs},
HirFileId, InFile,
attrs::{Attr, AttrId, RawAttrs, collect_attrs},
};
use intern::{sym, Symbol};
use intern::{Symbol, sym};
use la_arena::{ArenaMap, Idx, RawIdx};
use mbe::DelimiterKind;
use syntax::{
ast::{self, HasAttrs},
AstPtr,
ast::{self, HasAttrs},
};
use triomphe::Arc;
use tt::iter::{TtElement, TtIter};

use crate::{
AdtId, AttrDefId, GenericParamId, HasModule, ItemTreeLoc, LocalFieldId, Lookup, MacroId,
VariantId,
db::DefDatabase,
item_tree::{AttrOwner, FieldParent, ItemTreeNode},
lang_item::LangItem,
nameres::{ModuleOrigin, ModuleSource},
src::{HasChildSource, HasSource},
AdtId, AttrDefId, GenericParamId, HasModule, ItemTreeLoc, LocalFieldId, Lookup, MacroId,
VariantId,
};

/// Desugared attributes of an item post `cfg_attr` expansion.
Expand Down Expand Up @@ -649,8 +649,8 @@ mod tests {

use hir_expand::span_map::{RealSpanMap, SpanMap};
use span::FileId;
use syntax::{ast, AstNode, TextRange};
use syntax_bridge::{syntax_node_to_token_tree, DocCommentDesugarMode};
use syntax::{AstNode, TextRange, ast};
use syntax_bridge::{DocCommentDesugarMode, syntax_node_to_token_tree};

use crate::attr::{DocAtom, DocExpr};

Expand Down
2 changes: 1 addition & 1 deletion crates/hir-def/src/builtin_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use std::fmt;

use hir_expand::name::{AsName, Name};
use intern::{sym, Symbol};
use intern::{Symbol, sym};
/// Different signed int types.
#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum BuiltinInt {
Expand Down
Loading
Loading