Skip to content

Commit 7b96a53

Browse files
authored
Merge pull request #4097 from rust-lang/rustup-2024-12-18
Automatic Rustup
2 parents 50b641e + a2336ab commit 7b96a53

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+8794
-2178
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ jobs:
220220
timeout-minutes: 10
221221
env:
222222
FORCE_COLOR: 1
223-
TYPOS_VERSION: v1.18.0
223+
TYPOS_VERSION: v1.28.3
224224
steps:
225225
- name: download typos
226226
run: curl -LsSf https://github.com/crate-ci/typos/releases/download/$TYPOS_VERSION/typos-$TYPOS_VERSION-x86_64-unknown-linux-musl.tar.gz | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

.typos.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ extend-ignore-re = [
1616
"raison d'être",
1717
"inout",
1818
"INOUT",
19-
"optin"
19+
"optin",
20+
"=Pn",
2021
]
2122

2223
[default.extend-words]
@@ -26,8 +27,12 @@ fo = "fo"
2627
ket = "ket"
2728
makro = "makro"
2829
trivias = "trivias"
30+
thir = "thir"
31+
jod = "jod"
2932

3033
[default.extend-identifiers]
34+
anc = "anc"
3135
datas = "datas"
3236
impl_froms = "impl_froms"
3337
selfs = "selfs"
38+
taits = "taits"

Cargo.lock

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ toolchain = { path = "./crates/toolchain", version = "0.0.0" }
8383
tt = { path = "./crates/tt", version = "0.0.0" }
8484
vfs-notify = { path = "./crates/vfs-notify", version = "0.0.0" }
8585
vfs = { path = "./crates/vfs", version = "0.0.0" }
86+
edition = { path = "./crates/edition", version = "0.0.0" }
8687

8788
ra-ap-rustc_lexer = { version = "0.85", default-features = false }
8889
ra-ap-rustc_parse_format = { version = "0.85", default-features = false }

crates/edition/Cargo.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
[package]
2+
name = "edition"
3+
version = "0.0.0"
4+
rust-version.workspace = true
5+
edition.workspace = true
6+
license.workspace = true
7+
authors.workspace = true
8+
repository.workspace = true
9+
10+
[dependencies]
11+
12+
[lints]
13+
workspace = true

crates/parser/src/edition.rs renamed to crates/edition/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
//! The edition of the Rust language used in a crate.
2-
// Ideally this would be defined in the span crate, but the dependency chain is all over the place
3-
// wrt to span, parser and syntax.
2+
// This should live in a separate crate because we use it in both actual code and codegen.
43
use std::fmt;
54

65
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]

crates/hir-expand/src/builtin/fn_macro.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl BuiltinFnLikeExpander {
7474
}
7575

7676
pub fn is_asm(&self) -> bool {
77-
matches!(self, Self::Asm | Self::GlobalAsm)
77+
matches!(self, Self::Asm | Self::GlobalAsm | Self::NakedAsm)
7878
}
7979
}
8080

@@ -122,6 +122,7 @@ register_builtin! {
122122
(stringify, Stringify) => stringify_expand,
123123
(asm, Asm) => asm_expand,
124124
(global_asm, GlobalAsm) => asm_expand,
125+
(naked_asm, NakedAsm) => asm_expand,
125126
(cfg, Cfg) => cfg_expand,
126127
(core_panic, CorePanic) => panic_expand,
127128
(std_panic, StdPanic) => panic_expand,

crates/hir-expand/src/inert_attr_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
237237
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
238238
experimental!(no_sanitize)
239239
),
240-
gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)),
240+
ungated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing),
241241

242242
ungated!(
243243
doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk

crates/hir-expand/src/lib.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ use rustc_hash::FxHashMap;
2828
use stdx::TupleExt;
2929
use triomphe::Arc;
3030

31+
use core::fmt;
3132
use std::hash::Hash;
3233

3334
use base_db::{ra_salsa::InternValueTrivial, CrateId};
@@ -147,6 +148,10 @@ impl ExpandError {
147148
pub fn span(&self) -> Span {
148149
self.inner.1
149150
}
151+
152+
pub fn render_to_string(&self, db: &dyn ExpandDatabase) -> RenderedExpandError {
153+
self.inner.0.render_to_string(db)
154+
}
150155
}
151156

152157
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
@@ -164,18 +169,18 @@ pub enum ExpandErrorKind {
164169
ProcMacroPanic(Box<str>),
165170
}
166171

167-
impl ExpandError {
168-
pub fn render_to_string(&self, db: &dyn ExpandDatabase) -> RenderedExpandError {
169-
self.inner.0.render_to_string(db)
170-
}
171-
}
172-
173172
pub struct RenderedExpandError {
174173
pub message: String,
175174
pub error: bool,
176175
pub kind: &'static str,
177176
}
178177

178+
impl fmt::Display for RenderedExpandError {
179+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
180+
write!(f, "{}", self.message)
181+
}
182+
}
183+
179184
impl RenderedExpandError {
180185
const GENERAL_KIND: &str = "macro-error";
181186
}

crates/hir-ty/src/display.rs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,8 +1053,21 @@ impl HirDisplay for Ty {
10531053
generic_args_sans_defaults(f, Some(generic_def_id), parameters);
10541054
assert!(params_len >= parameters.len());
10551055
let defaults = params_len - parameters.len();
1056-
let without_impl =
1057-
self_param as usize + type_ + const_ + lifetime - defaults;
1056+
1057+
// Normally, functions cannot have default parameters, but they can,
1058+
// for function-like things such as struct names or enum variants.
1059+
// The former cannot have defaults but parents, and the later cannot have
1060+
// parents but defaults.
1061+
// So, if `parent_len` > 0, it have a parent and thus it doesn't have any
1062+
// default. Therefore, we shouldn't subtract defaults because those defaults
1063+
// are from their parents.
1064+
// And if `parent_len` == 0, either parents don't exists or they don't have
1065+
// any defaults. Thus, we can - and should - subtract defaults.
1066+
let without_impl = if parent_len > 0 {
1067+
params_len - parent_len - impl_
1068+
} else {
1069+
params_len - parent_len - impl_ - defaults
1070+
};
10581071
// parent's params (those from enclosing impl or trait, if any).
10591072
let (fn_params, parent_params) = parameters.split_at(without_impl + impl_);
10601073

0 commit comments

Comments
 (0)