Merge pull request #19826 from lnicola/sync-from-rust

minor: Sync from downstream
This commit is contained in:
Laurențiu Nicola 2025-05-20 07:15:48 +00:00 committed by GitHub
commit 96a253112c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
13 changed files with 53 additions and 28 deletions

28
Cargo.lock generated
View File

@ -1750,9 +1750,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_abi"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "912228bd8ed3beff1f6f9e5e2d4b37c0827ba3e2070060bf3858a311d0e29e30"
checksum = "c33b8fa229789975647ca5426be432c7c327ebde89ab15889928185dbcee3230"
dependencies = [
"bitflags 2.9.0",
"ra-ap-rustc_hashes",
@ -1762,18 +1762,18 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_hashes"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba520764daf057a9d963fa769f4762eaf87ac5d4900ae76195eeead64cd35afd"
checksum = "0d68a3e389927002f552938a90b04787f6435f55b46fc5691360470d1cb2e99d"
dependencies = [
"rustc-stable-hash",
]
[[package]]
name = "ra-ap-rustc_index"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b76b5f9ee55f2d0e5a65bea23f6d738893349ce8d3d17a6720933e647ab04978"
checksum = "32502273df2838d0ca13f1c67e2a48feef940e591f9771869f07e2db2acede53"
dependencies = [
"ra-ap-rustc_index_macros",
"smallvec",
@ -1781,9 +1781,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_index_macros"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ddd972eb1face2fcaa0d94c01d97862fb955b5561d4f5932003bce8a6cadd8c6"
checksum = "8a32f081864ae34c7ae6634edfa7a95ab9260ba85015e8b1d347580eda79d14f"
dependencies = [
"proc-macro2",
"quote",
@ -1792,9 +1792,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_lexer"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ba3a9876456fb2521097deef33ddeac1c18260c8eafb68054d986f8b9d6ce9fa"
checksum = "ed34c51974718c5bd90d876d1364d9725159fc8030c2382b9cb837034152ed68"
dependencies = [
"memchr",
"unicode-properties",
@ -1803,9 +1803,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_parse_format"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e85de58dfcc60a5f9d5ec0157a657e3f84abd8f22c8a0c4d707cfb42c9011f4"
checksum = "ff0440e5d27facbf4ff13ea651e48c2f6e360b3dbfc56251b41d60719b965fb8"
dependencies = [
"ra-ap-rustc_lexer",
"rustc-literal-escaper",
@ -1813,9 +1813,9 @@ dependencies = [
[[package]]
name = "ra-ap-rustc_pattern_analysis"
version = "0.110.0"
version = "0.113.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ceadf9db550db67deff7eff2e2765109b860c9d7e5bdfca144863020289c823d"
checksum = "a6056efa57aba3aa0cc69a0bf1a8281624c23ad25b05748d11ebcd4668037bfc"
dependencies = [
"ra-ap-rustc_index",
"rustc-hash 2.1.1",

View File

@ -85,11 +85,11 @@ vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
vfs = { path = "./crates/vfs", version = "0.0.0" }
edition = { path = "./crates/edition", version = "0.0.0" }
ra-ap-rustc_lexer = { version = "0.110", default-features = false }
ra-ap-rustc_parse_format = { version = "0.110", default-features = false }
ra-ap-rustc_index = { version = "0.110", default-features = false }
ra-ap-rustc_abi = { version = "0.110", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.110", default-features = false }
ra-ap-rustc_lexer = { version = "0.113", default-features = false }
ra-ap-rustc_parse_format = { version = "0.113", default-features = false }
ra-ap-rustc_index = { version = "0.113", default-features = false }
ra-ap-rustc_abi = { version = "0.113", default-features = false }
ra-ap-rustc_pattern_analysis = { version = "0.113", default-features = false }
# local crates that aren't published to crates.io. These should not have versions.
@ -132,7 +132,10 @@ pulldown-cmark-to-cmark = "10.0.4"
pulldown-cmark = { version = "0.9.6", default-features = false }
rayon = "1.10.0"
rowan = "=0.15.15"
salsa = { version = "0.21.1", default-features = false, features = ["rayon","salsa_unstable"] }
salsa = { version = "0.21.1", default-features = false, features = [
"rayon",
"salsa_unstable",
] }
salsa-macros = "0.21.1"
semver = "1.0.26"
serde = { version = "1.0.219" }

View File

@ -224,7 +224,7 @@ impl ExprCollector<'_> {
curarg = parser.curarg;
let to_span = |inner_span: rustc_parse_format::InnerSpan| {
let to_span = |inner_span: std::ops::Range<usize>| {
is_direct_literal.then(|| {
TextRange::new(
inner_span.start.try_into().unwrap(),

View File

@ -214,7 +214,7 @@ pub(crate) fn parse(
};
}
let to_span = |inner_span: parse::InnerSpan| {
let to_span = |inner_span: std::ops::Range<usize>| {
is_source_literal.then(|| {
TextRange::new(inner_span.start.try_into().unwrap(), inner_span.end.try_into().unwrap())
})
@ -297,7 +297,8 @@ pub(crate) fn parse(
unfinished_literal.clear();
}
let span = parser.arg_places.get(placeholder_index).and_then(|&s| to_span(s));
let span =
parser.arg_places.get(placeholder_index).and_then(|s| to_span(s.clone()));
placeholder_index += 1;
let position_span = to_span(position_span);

View File

@ -301,6 +301,7 @@ impl<'db> MatchCheckCtx<'db> {
// ignore this issue.
Ref => PatKind::Deref { subpattern: subpatterns.next().unwrap() },
Slice(_) => unimplemented!(),
DerefPattern(_) => unimplemented!(),
&Str(void) => match void {},
Wildcard | NonExhaustive | Hidden | PrivateUninhabited => PatKind::Wild,
Never => PatKind::Never,
@ -351,6 +352,7 @@ impl PatCx for MatchCheckCtx<'_> {
},
Ref => 1,
Slice(..) => unimplemented!(),
DerefPattern(..) => unimplemented!(),
Never | Bool(..) | IntRange(..) | F16Range(..) | F32Range(..) | F64Range(..)
| F128Range(..) | Str(..) | Opaque(..) | NonExhaustive | PrivateUninhabited
| Hidden | Missing | Wildcard => 0,
@ -411,6 +413,7 @@ impl PatCx for MatchCheckCtx<'_> {
}
},
Slice(_) => unreachable!("Found a `Slice` constructor in match checking"),
DerefPattern(_) => unreachable!("Found a `DerefPattern` constructor in match checking"),
Never | Bool(..) | IntRange(..) | F16Range(..) | F32Range(..) | F64Range(..)
| F128Range(..) | Str(..) | Opaque(..) | NonExhaustive | PrivateUninhabited
| Hidden | Missing | Wildcard => {

View File

@ -5789,7 +5789,7 @@ The tracking issue for this feature is: [#120301]
------------------------
Add the methods `from_mins`, `from_hours` and `from_days` to `Duration`.
Add the methods `from_days` and `from_weeks` to `Duration`.
"##,
default_severity: Severity::Allow,
warn_since: None,

View File

@ -179,6 +179,18 @@ impl<'a> Converter<'a> {
COMMENT
}
rustc_lexer::TokenKind::Frontmatter {
has_invalid_preceding_whitespace,
invalid_infostring,
} => {
if *has_invalid_preceding_whitespace {
err = "invalid preceding whitespace for frontmatter opening"
} else if *invalid_infostring {
err = "invalid infostring for frontmatter"
}
FRONTMATTER
}
rustc_lexer::TokenKind::Whitespace => WHITESPACE,
rustc_lexer::TokenKind::Ident if token_text == "_" => UNDERSCORE,

File diff suppressed because one or more lines are too long

View File

@ -173,7 +173,6 @@ fn test_fn_like_macro_clone_raw_ident() {
}
#[test]
#[cfg(not(bootstrap))]
fn test_fn_like_fn_like_span_join() {
assert_expand(
"fn_like_span_join",
@ -200,7 +199,6 @@ fn test_fn_like_fn_like_span_join() {
}
#[test]
#[cfg(not(bootstrap))]
fn test_fn_like_fn_like_span_ops() {
assert_expand(
"fn_like_span_ops",

View File

@ -133,6 +133,7 @@ Meta =
SourceFile =
'#shebang'?
'#frontmatter'?
Attr*
Item*

View File

@ -1524,6 +1524,10 @@ impl ast::HasAttrs for SourceFile {}
impl ast::HasDocComments for SourceFile {}
impl ast::HasModuleItem for SourceFile {}
impl SourceFile {
#[inline]
pub fn frontmatter_token(&self) -> Option<SyntaxToken> {
support::token(&self.syntax, T![frontmatter])
}
#[inline]
pub fn shebang_token(&self) -> Option<SyntaxToken> { support::token(&self.syntax, T![shebang]) }
}

View File

@ -1 +1 @@
6e23095adf9209614a45f7f75fea36dad7b92afb
a8e4c68dcb4dc1e48a0db294c5323cab0227fcb9

View File

@ -670,6 +670,7 @@ fn generate_syntax_kinds(grammar: KindsSrc) -> String {
[ident] => { $crate::SyntaxKind::IDENT };
[string] => { $crate::SyntaxKind::STRING };
[shebang] => { $crate::SyntaxKind::SHEBANG };
[frontmatter] => { $crate::SyntaxKind::FRONTMATTER };
}
impl ::core::marker::Copy for SyntaxKind {}