Auto merge of #150563 - JonathanBrouwer:rollup-9ncjbou, r=JonathanBrouwer
Rollup of 2 pull requests Successful merges: - rust-lang/rust#150454 (cleanup: move c-variadic arguments handling into compute_inputs_and_output) - rust-lang/rust#150529 (Update books) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
cc08b553b8
6 changed files with 59 additions and 39 deletions
|
|
@ -543,38 +543,9 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
&indices,
|
||||
);
|
||||
|
||||
let (unnormalized_output_ty, mut unnormalized_input_tys) =
|
||||
let (unnormalized_output_ty, unnormalized_input_tys) =
|
||||
inputs_and_output.split_last().unwrap();
|
||||
|
||||
// C-variadic fns also have a `VaList` input that's not listed in the signature
|
||||
// (as it's created inside the body itself, not passed in from outside).
|
||||
if let DefiningTy::FnDef(def_id, _) = defining_ty {
|
||||
if self.infcx.tcx.fn_sig(def_id).skip_binder().c_variadic() {
|
||||
let va_list_did = self
|
||||
.infcx
|
||||
.tcx
|
||||
.require_lang_item(LangItem::VaList, self.infcx.tcx.def_span(self.mir_def));
|
||||
|
||||
let reg_vid = self
|
||||
.infcx
|
||||
.next_nll_region_var(NllRegionVariableOrigin::FreeRegion, || {
|
||||
RegionCtxt::Free(sym::c_dash_variadic)
|
||||
})
|
||||
.as_var();
|
||||
|
||||
let region = ty::Region::new_var(self.infcx.tcx, reg_vid);
|
||||
let va_list_ty = self
|
||||
.infcx
|
||||
.tcx
|
||||
.type_of(va_list_did)
|
||||
.instantiate(self.infcx.tcx, &[region.into()]);
|
||||
|
||||
unnormalized_input_tys = self.infcx.tcx.mk_type_list_from_iter(
|
||||
unnormalized_input_tys.iter().copied().chain(iter::once(va_list_ty)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let fr_fn_body = self
|
||||
.infcx
|
||||
.next_nll_region_var(NllRegionVariableOrigin::FreeRegion, || {
|
||||
|
|
@ -816,7 +787,40 @@ impl<'cx, 'tcx> UniversalRegionsBuilder<'cx, 'tcx> {
|
|||
DefiningTy::FnDef(def_id, _) => {
|
||||
let sig = tcx.fn_sig(def_id).instantiate_identity();
|
||||
let sig = indices.fold_to_region_vids(tcx, sig);
|
||||
sig.inputs_and_output()
|
||||
let inputs_and_output = sig.inputs_and_output();
|
||||
|
||||
// C-variadic fns also have a `VaList` input that's not listed in the signature
|
||||
// (as it's created inside the body itself, not passed in from outside).
|
||||
if self.infcx.tcx.fn_sig(def_id).skip_binder().c_variadic() {
|
||||
let va_list_did = self
|
||||
.infcx
|
||||
.tcx
|
||||
.require_lang_item(LangItem::VaList, self.infcx.tcx.def_span(self.mir_def));
|
||||
|
||||
let reg_vid = self
|
||||
.infcx
|
||||
.next_nll_region_var(NllRegionVariableOrigin::FreeRegion, || {
|
||||
RegionCtxt::Free(sym::c_dash_variadic)
|
||||
})
|
||||
.as_var();
|
||||
|
||||
let region = ty::Region::new_var(self.infcx.tcx, reg_vid);
|
||||
let va_list_ty = self
|
||||
.infcx
|
||||
.tcx
|
||||
.type_of(va_list_did)
|
||||
.instantiate(self.infcx.tcx, &[region.into()]);
|
||||
|
||||
// The signature needs to follow the order [input_tys, va_list_ty, output_ty]
|
||||
return inputs_and_output.map_bound(|tys| {
|
||||
let (output_ty, input_tys) = tys.split_last().unwrap();
|
||||
tcx.mk_type_list_from_iter(
|
||||
input_tys.iter().copied().chain([va_list_ty, *output_ty]),
|
||||
)
|
||||
});
|
||||
}
|
||||
|
||||
inputs_and_output
|
||||
}
|
||||
|
||||
DefiningTy::Const(def_id, _) => {
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit ec78de0ffe2f8344bd0e222b17ac7a7d32dc7a26
|
||||
Subproject commit 6363385ac4ebe1763f1e6fb2063c0b1db681a072
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit 7d21279e40e8f0e91c2a22c5148dd2d745aef8b6
|
||||
Subproject commit 2e02f22a10e7eeb758e6aba484f13d0f1988a3e5
|
||||
|
|
@ -320,6 +320,10 @@ dependencies = [
|
|||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "diagnostics"
|
||||
version = "0.0.0"
|
||||
|
||||
[[package]]
|
||||
name = "digest"
|
||||
version = "0.10.7"
|
||||
|
|
@ -464,6 +468,16 @@ dependencies = [
|
|||
"wasip2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "grammar"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"diagnostics",
|
||||
"pathdiff",
|
||||
"regex",
|
||||
"walkdir",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "handlebars"
|
||||
version = "6.3.2"
|
||||
|
|
@ -774,9 +788,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "mdbook-spec"
|
||||
version = "0.1.2"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"diagnostics",
|
||||
"grammar",
|
||||
"mdbook-markdown",
|
||||
"mdbook-preprocessor",
|
||||
"once_cell",
|
||||
|
|
|
|||
|
|
@ -11,6 +11,6 @@ edition = "2021"
|
|||
clap = { version = "4.0.32", features = ["cargo"] }
|
||||
mdbook-driver = { version = "0.5.2", features = ["search"] }
|
||||
mdbook-i18n-helpers = "0.4.0"
|
||||
mdbook-spec = { path = "../../doc/reference/mdbook-spec" }
|
||||
mdbook-spec = { path = "../../doc/reference/tools/mdbook-spec" }
|
||||
mdbook-trpl = { path = "../../doc/book/packages/mdbook-trpl" }
|
||||
tracing-subscriber = { version = "0.3.20", features = ["env-filter"] }
|
||||
|
|
|
|||
|
|
@ -30,9 +30,9 @@ error: lifetime may not live long enough
|
|||
--> $DIR/variadic-ffi-4.rs:22:5
|
||||
|
|
||||
LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
|
||||
| ------- ------- has type `VaList<'2>`
|
||||
| ------- ------- has type `VaList<'1>`
|
||||
| |
|
||||
| has type `&mut VaList<'1>`
|
||||
| has type `&mut VaList<'2>`
|
||||
LL | ap0 = &mut ap1;
|
||||
| ^^^^^^^^^^^^^^ assignment requires that `'1` must outlive `'2`
|
||||
|
|
||||
|
|
@ -44,9 +44,9 @@ error: lifetime may not live long enough
|
|||
--> $DIR/variadic-ffi-4.rs:22:5
|
||||
|
|
||||
LL | pub unsafe extern "C" fn no_escape4(_: usize, mut ap0: &mut VaList, mut ap1: ...) {
|
||||
| ------- ------- has type `VaList<'2>`
|
||||
| ------- ------- has type `VaList<'1>`
|
||||
| |
|
||||
| has type `&mut VaList<'1>`
|
||||
| has type `&mut VaList<'2>`
|
||||
LL | ap0 = &mut ap1;
|
||||
| ^^^^^^^^^^^^^^ assignment requires that `'2` must outlive `'1`
|
||||
|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue