Skip to content

Commit 72c6b8d

Browse files
committed
Auto merge of #114565 - matthiaskrgr:rollup-p7cjs3m, r=matthiaskrgr
Rollup of 6 pull requests Successful merges: - #114535 (bump schannel, miow to drop windows-sys 0.42) - #114542 (interpret: use ConstPropNonsense for more const-prop induced issues) - #114543 (add tests for some fixed ConstProp ICEs) - #114550 (Generate better function argument names in global_allocator expansion) - #114556 (Issue numbers are enforced on active features; remove FIXME) - #114558 (Remove FIXME about NLL diagnostic that is already improved) Failed merges: - #114485 (Add trait decls to SMIR) r? `@ghost` `@rustbot` modify labels: rollup
2 parents f362387 + f44f027 commit 72c6b8d

File tree

15 files changed

+103
-123
lines changed

15 files changed

+103
-123
lines changed

Cargo.lock

+26-83
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ version = "1.0.0"
154154
source = "registry+https://github.com/rust-lang/crates.io-index"
155155
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
156156
dependencies = [
157-
"windows-sys 0.48.0",
157+
"windows-sys",
158158
]
159159

160160
[[package]]
@@ -164,7 +164,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
164164
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
165165
dependencies = [
166166
"anstyle",
167-
"windows-sys 0.48.0",
167+
"windows-sys",
168168
]
169169

170170
[[package]]
@@ -797,7 +797,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
797797
checksum = "2a011bbe2c35ce9c1f143b7af6f94f29a167beb4cd1d29e6740ce836f723120e"
798798
dependencies = [
799799
"nix",
800-
"windows-sys 0.48.0",
800+
"windows-sys",
801801
]
802802

803803
[[package]]
@@ -1108,7 +1108,7 @@ checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
11081108
dependencies = [
11091109
"errno-dragonfly",
11101110
"libc",
1111-
"windows-sys 0.48.0",
1111+
"windows-sys",
11121112
]
11131113

11141114
[[package]]
@@ -1191,7 +1191,7 @@ dependencies = [
11911191
"cfg-if",
11921192
"libc",
11931193
"redox_syscall 0.2.16",
1194-
"windows-sys 0.48.0",
1194+
"windows-sys",
11951195
]
11961196

11971197
[[package]]
@@ -1910,7 +1910,7 @@ checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2"
19101910
dependencies = [
19111911
"hermit-abi 0.3.2",
19121912
"libc",
1913-
"windows-sys 0.48.0",
1913+
"windows-sys",
19141914
]
19151915

19161916
[[package]]
@@ -1927,7 +1927,7 @@ checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb"
19271927
dependencies = [
19281928
"hermit-abi 0.3.2",
19291929
"rustix 0.38.2",
1930-
"windows-sys 0.48.0",
1930+
"windows-sys",
19311931
]
19321932

19331933
[[package]]
@@ -2320,16 +2320,16 @@ checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2"
23202320
dependencies = [
23212321
"libc",
23222322
"wasi",
2323-
"windows-sys 0.48.0",
2323+
"windows-sys",
23242324
]
23252325

23262326
[[package]]
23272327
name = "miow"
2328-
version = "0.5.0"
2328+
version = "0.6.0"
23292329
source = "registry+https://github.com/rust-lang/crates.io-index"
2330-
checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123"
2330+
checksum = "359f76430b20a79f9e20e115b3428614e654f04fab314482fc0fda0ebd3c6044"
23312331
dependencies = [
2332-
"windows-sys 0.42.0",
2332+
"windows-sys",
23332333
]
23342334

23352335
[[package]]
@@ -4561,7 +4561,7 @@ dependencies = [
45614561
"io-lifetimes",
45624562
"libc",
45634563
"linux-raw-sys 0.3.8",
4564-
"windows-sys 0.48.0",
4564+
"windows-sys",
45654565
]
45664566

45674567
[[package]]
@@ -4574,7 +4574,7 @@ dependencies = [
45744574
"errno",
45754575
"libc",
45764576
"linux-raw-sys 0.4.3",
4577-
"windows-sys 0.48.0",
4577+
"windows-sys",
45784578
]
45794579

45804580
[[package]]
@@ -4611,11 +4611,11 @@ dependencies = [
46114611

46124612
[[package]]
46134613
name = "schannel"
4614-
version = "0.1.21"
4614+
version = "0.1.22"
46154615
source = "registry+https://github.com/rust-lang/crates.io-index"
4616-
checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3"
4616+
checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88"
46174617
dependencies = [
4618-
"windows-sys 0.42.0",
4618+
"windows-sys",
46194619
]
46204620

46214621
[[package]]
@@ -5044,7 +5044,7 @@ dependencies = [
50445044
"fastrand",
50455045
"redox_syscall 0.3.5",
50465046
"rustix 0.37.22",
5047-
"windows-sys 0.48.0",
5047+
"windows-sys",
50485048
]
50495049

50505050
[[package]]
@@ -5085,7 +5085,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
50855085
checksum = "8e6bf6f19e9f8ed8d4048dc22981458ebcf406d67e94cd422e5ecd73d63b3237"
50865086
dependencies = [
50875087
"rustix 0.37.22",
5088-
"windows-sys 0.48.0",
5088+
"windows-sys",
50895089
]
50905090

50915091
[[package]]
@@ -5264,7 +5264,7 @@ dependencies = [
52645264
"num_cpus",
52655265
"pin-project-lite",
52665266
"socket2",
5267-
"windows-sys 0.48.0",
5267+
"windows-sys",
52685268
]
52695269

52705270
[[package]]
@@ -5872,21 +5872,6 @@ version = "0.49.0"
58725872
source = "registry+https://github.com/rust-lang/crates.io-index"
58735873
checksum = "2f5bca94a32bf1e6a376522b6601275a3b611ee885ec0f1b6a05f17e8cfd3385"
58745874

5875-
[[package]]
5876-
name = "windows-sys"
5877-
version = "0.42.0"
5878-
source = "registry+https://github.com/rust-lang/crates.io-index"
5879-
checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
5880-
dependencies = [
5881-
"windows_aarch64_gnullvm 0.42.2",
5882-
"windows_aarch64_msvc 0.42.2",
5883-
"windows_i686_gnu 0.42.2",
5884-
"windows_i686_msvc 0.42.2",
5885-
"windows_x86_64_gnu 0.42.2",
5886-
"windows_x86_64_gnullvm 0.42.2",
5887-
"windows_x86_64_msvc 0.42.2",
5888-
]
5889-
58905875
[[package]]
58915876
name = "windows-sys"
58925877
version = "0.48.0"
@@ -5902,13 +5887,13 @@ version = "0.48.1"
59025887
source = "registry+https://github.com/rust-lang/crates.io-index"
59035888
checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f"
59045889
dependencies = [
5905-
"windows_aarch64_gnullvm 0.48.0",
5906-
"windows_aarch64_msvc 0.48.0",
5907-
"windows_i686_gnu 0.48.0",
5908-
"windows_i686_msvc 0.48.0",
5909-
"windows_x86_64_gnu 0.48.0",
5910-
"windows_x86_64_gnullvm 0.48.0",
5911-
"windows_x86_64_msvc 0.48.0",
5890+
"windows_aarch64_gnullvm",
5891+
"windows_aarch64_msvc",
5892+
"windows_i686_gnu",
5893+
"windows_i686_msvc",
5894+
"windows_x86_64_gnu",
5895+
"windows_x86_64_gnullvm",
5896+
"windows_x86_64_msvc",
59125897
]
59135898

59145899
[[package]]
@@ -5917,84 +5902,42 @@ version = "0.48.0"
59175902
source = "registry+https://github.com/rust-lang/crates.io-index"
59185903
checksum = "b34c9a3b28cb41db7385546f7f9a8179348dffc89923dde66857b1ba5312f6b4"
59195904

5920-
[[package]]
5921-
name = "windows_aarch64_gnullvm"
5922-
version = "0.42.2"
5923-
source = "registry+https://github.com/rust-lang/crates.io-index"
5924-
checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8"
5925-
59265905
[[package]]
59275906
name = "windows_aarch64_gnullvm"
59285907
version = "0.48.0"
59295908
source = "registry+https://github.com/rust-lang/crates.io-index"
59305909
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
59315910

5932-
[[package]]
5933-
name = "windows_aarch64_msvc"
5934-
version = "0.42.2"
5935-
source = "registry+https://github.com/rust-lang/crates.io-index"
5936-
checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43"
5937-
59385911
[[package]]
59395912
name = "windows_aarch64_msvc"
59405913
version = "0.48.0"
59415914
source = "registry+https://github.com/rust-lang/crates.io-index"
59425915
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
59435916

5944-
[[package]]
5945-
name = "windows_i686_gnu"
5946-
version = "0.42.2"
5947-
source = "registry+https://github.com/rust-lang/crates.io-index"
5948-
checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f"
5949-
59505917
[[package]]
59515918
name = "windows_i686_gnu"
59525919
version = "0.48.0"
59535920
source = "registry+https://github.com/rust-lang/crates.io-index"
59545921
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
59555922

5956-
[[package]]
5957-
name = "windows_i686_msvc"
5958-
version = "0.42.2"
5959-
source = "registry+https://github.com/rust-lang/crates.io-index"
5960-
checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060"
5961-
59625923
[[package]]
59635924
name = "windows_i686_msvc"
59645925
version = "0.48.0"
59655926
source = "registry+https://github.com/rust-lang/crates.io-index"
59665927
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
59675928

5968-
[[package]]
5969-
name = "windows_x86_64_gnu"
5970-
version = "0.42.2"
5971-
source = "registry+https://github.com/rust-lang/crates.io-index"
5972-
checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36"
5973-
59745929
[[package]]
59755930
name = "windows_x86_64_gnu"
59765931
version = "0.48.0"
59775932
source = "registry+https://github.com/rust-lang/crates.io-index"
59785933
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
59795934

5980-
[[package]]
5981-
name = "windows_x86_64_gnullvm"
5982-
version = "0.42.2"
5983-
source = "registry+https://github.com/rust-lang/crates.io-index"
5984-
checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3"
5985-
59865935
[[package]]
59875936
name = "windows_x86_64_gnullvm"
59885937
version = "0.48.0"
59895938
source = "registry+https://github.com/rust-lang/crates.io-index"
59905939
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
59915940

5992-
[[package]]
5993-
name = "windows_x86_64_msvc"
5994-
version = "0.42.2"
5995-
source = "registry+https://github.com/rust-lang/crates.io-index"
5996-
checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0"
5997-
59985941
[[package]]
59995942
name = "windows_x86_64_msvc"
60005943
version = "0.48.0"

compiler/rustc_ast/src/expand/allocator.rs

+17-5
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,41 @@ pub enum AllocatorTy {
3333

3434
pub struct AllocatorMethod {
3535
pub name: Symbol,
36-
pub inputs: &'static [AllocatorTy],
36+
pub inputs: &'static [AllocatorMethodInput],
3737
pub output: AllocatorTy,
3838
}
3939

40+
pub struct AllocatorMethodInput {
41+
pub name: &'static str,
42+
pub ty: AllocatorTy,
43+
}
44+
4045
pub static ALLOCATOR_METHODS: &[AllocatorMethod] = &[
4146
AllocatorMethod {
4247
name: sym::alloc,
43-
inputs: &[AllocatorTy::Layout],
48+
inputs: &[AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout }],
4449
output: AllocatorTy::ResultPtr,
4550
},
4651
AllocatorMethod {
4752
name: sym::dealloc,
48-
inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout],
53+
inputs: &[
54+
AllocatorMethodInput { name: "ptr", ty: AllocatorTy::Ptr },
55+
AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout },
56+
],
4957
output: AllocatorTy::Unit,
5058
},
5159
AllocatorMethod {
5260
name: sym::realloc,
53-
inputs: &[AllocatorTy::Ptr, AllocatorTy::Layout, AllocatorTy::Usize],
61+
inputs: &[
62+
AllocatorMethodInput { name: "ptr", ty: AllocatorTy::Ptr },
63+
AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout },
64+
AllocatorMethodInput { name: "new_size", ty: AllocatorTy::Usize },
65+
],
5466
output: AllocatorTy::ResultPtr,
5567
},
5668
AllocatorMethod {
5769
name: sym::alloc_zeroed,
58-
inputs: &[AllocatorTy::Layout],
70+
inputs: &[AllocatorMethodInput { name: "layout", ty: AllocatorTy::Layout }],
5971
output: AllocatorTy::ResultPtr,
6072
},
6173
];

compiler/rustc_builtin_macros/src/global_allocator.rs

+14-19
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::util::check_builtin_macro_attribute;
22

33
use crate::errors;
44
use rustc_ast::expand::allocator::{
5-
global_fn_name, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS,
5+
global_fn_name, AllocatorMethod, AllocatorMethodInput, AllocatorTy, ALLOCATOR_METHODS,
66
};
77
use rustc_ast::ptr::P;
88
use rustc_ast::{self as ast, AttrVec, Expr, FnHeader, FnSig, Generics, Param, StmtKind};
@@ -70,13 +70,7 @@ struct AllocFnFactory<'a, 'b> {
7070
impl AllocFnFactory<'_, '_> {
7171
fn allocator_fn(&self, method: &AllocatorMethod) -> Stmt {
7272
let mut abi_args = ThinVec::new();
73-
let mut i = 0;
74-
let mut mk = || {
75-
let name = Ident::from_str_and_span(&format!("arg{i}"), self.span);
76-
i += 1;
77-
name
78-
};
79-
let args = method.inputs.iter().map(|ty| self.arg_ty(ty, &mut abi_args, &mut mk)).collect();
73+
let args = method.inputs.iter().map(|input| self.arg_ty(input, &mut abi_args)).collect();
8074
let result = self.call_allocator(method.name, args);
8175
let output_ty = self.ret_ty(&method.output);
8276
let decl = self.cx.fn_decl(abi_args, ast::FnRetTy::Ty(output_ty));
@@ -113,18 +107,19 @@ impl AllocFnFactory<'_, '_> {
113107
thin_vec![self.cx.attr_word(sym::rustc_std_internal_symbol, self.span)]
114108
}
115109

116-
fn arg_ty(
117-
&self,
118-
ty: &AllocatorTy,
119-
args: &mut ThinVec<Param>,
120-
ident: &mut dyn FnMut() -> Ident,
121-
) -> P<Expr> {
122-
match *ty {
110+
fn arg_ty(&self, input: &AllocatorMethodInput, args: &mut ThinVec<Param>) -> P<Expr> {
111+
match input.ty {
123112
AllocatorTy::Layout => {
113+
// If an allocator method is ever introduced having multiple
114+
// Layout arguments, these argument names need to be
115+
// disambiguated somehow. Currently the generated code would
116+
// fail to compile with "identifier is bound more than once in
117+
// this parameter list".
118+
let size = Ident::from_str_and_span("size", self.span);
119+
let align = Ident::from_str_and_span("align", self.span);
120+
124121
let usize = self.cx.path_ident(self.span, Ident::new(sym::usize, self.span));
125122
let ty_usize = self.cx.ty_path(usize);
126-
let size = ident();
127-
let align = ident();
128123
args.push(self.cx.param(self.span, size, ty_usize.clone()));
129124
args.push(self.cx.param(self.span, align, ty_usize));
130125

@@ -138,13 +133,13 @@ impl AllocFnFactory<'_, '_> {
138133
}
139134

140135
AllocatorTy::Ptr => {
141-
let ident = ident();
136+
let ident = Ident::from_str_and_span(input.name, self.span);
142137
args.push(self.cx.param(self.span, ident, self.ptr_u8()));
143138
self.cx.expr_ident(self.span, ident)
144139
}
145140

146141
AllocatorTy::Usize => {
147-
let ident = ident();
142+
let ident = Ident::from_str_and_span(input.name, self.span);
148143
args.push(self.cx.param(self.span, ident, self.usize()));
149144
self.cx.expr_ident(self.span, ident)
150145
}

compiler/rustc_codegen_cranelift/src/allocator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ fn codegen_inner(
3939
if kind == AllocatorKind::Default {
4040
for method in ALLOCATOR_METHODS {
4141
let mut arg_tys = Vec::with_capacity(method.inputs.len());
42-
for ty in method.inputs.iter() {
43-
match *ty {
42+
for input in method.inputs.iter() {
43+
match input.ty {
4444
AllocatorTy::Layout => {
4545
arg_tys.push(usize_ty); // size
4646
arg_tys.push(usize_ty); // align

0 commit comments

Comments
 (0)