Skip to content

Commit fe2f7e0

Browse files
committed
Auto merge of #64886 - Centril:rollup-30dqh8j, r=Centril
Rollup of 5 pull requests Successful merges: - #63492 (Remove redundancy from the implementation of C variadics.) - #64589 (Differentiate AArch64 bare-metal targets between hf and non-hf.) - #64799 (Fix double panic when printing query stack during an ICE) - #64824 (No StableHasherResult everywhere) - #64884 (Add pkg-config to dependency list if building for Linux on Linux) Failed merges: r? @ghost
2 parents 0bbab7d + 0d4afa1 commit fe2f7e0

Some content is hidden

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

82 files changed

+561
-909
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ or reading the [rustc guide][rustcguidebuild].
3333
* `curl`
3434
* `git`
3535
* `ssl` which comes in `libssl-dev` or `openssl-devel`
36+
* `pkg-config` if you are on compiling on Linux and targeting Linux
3637

3738
2. Clone the [source] with `git`:
3839

src/librustc/hir/intravisit.rs

-3
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,6 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty) {
633633
TyKind::Typeof(ref expression) => {
634634
visitor.visit_anon_const(expression)
635635
}
636-
TyKind::CVarArgs(ref lt) => {
637-
visitor.visit_lifetime(lt)
638-
}
639636
TyKind::Infer | TyKind::Err => {}
640637
}
641638
}

src/librustc/hir/lowering.rs

+21-10
Original file line numberDiff line numberDiff line change
@@ -1335,13 +1335,8 @@ impl<'a> LoweringContext<'a> {
13351335
}
13361336
}
13371337
}
1338-
TyKind::Mac(_) => bug!("`TyMac` should have been expanded by now"),
1339-
TyKind::CVarArgs => {
1340-
// Create the implicit lifetime of the "spoofed" `VaListImpl`.
1341-
let span = self.sess.source_map().next_point(t.span.shrink_to_lo());
1342-
let lt = self.new_implicit_lifetime(span);
1343-
hir::TyKind::CVarArgs(lt)
1344-
},
1338+
TyKind::Mac(_) => bug!("`TyKind::Mac` should have been expanded by now"),
1339+
TyKind::CVarArgs => bug!("`TyKind::CVarArgs` should have been handled elsewhere"),
13451340
};
13461341

13471342
hir::Ty {
@@ -2093,7 +2088,14 @@ impl<'a> LoweringContext<'a> {
20932088
}
20942089

20952090
fn lower_fn_params_to_names(&mut self, decl: &FnDecl) -> hir::HirVec<Ident> {
2096-
decl.inputs
2091+
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
2092+
// as they are not explicit in HIR/Ty function signatures.
2093+
// (instead, the `c_variadic` flag is set to `true`)
2094+
let mut inputs = &decl.inputs[..];
2095+
if decl.c_variadic() {
2096+
inputs = &inputs[..inputs.len() - 1];
2097+
}
2098+
inputs
20972099
.iter()
20982100
.map(|param| match param.pat.kind {
20992101
PatKind::Ident(_, ident, _) => ident,
@@ -2130,10 +2132,19 @@ impl<'a> LoweringContext<'a> {
21302132
self.anonymous_lifetime_mode
21312133
};
21322134

2135+
let c_variadic = decl.c_variadic();
2136+
21332137
// Remember how many lifetimes were already around so that we can
21342138
// only look at the lifetime parameters introduced by the arguments.
21352139
let inputs = self.with_anonymous_lifetime_mode(lt_mode, |this| {
2136-
decl.inputs
2140+
// Skip the `...` (`CVarArgs`) trailing arguments from the AST,
2141+
// as they are not explicit in HIR/Ty function signatures.
2142+
// (instead, the `c_variadic` flag is set to `true`)
2143+
let mut inputs = &decl.inputs[..];
2144+
if c_variadic {
2145+
inputs = &inputs[..inputs.len() - 1];
2146+
}
2147+
inputs
21372148
.iter()
21382149
.map(|param| {
21392150
if let Some((_, ibty)) = &mut in_band_ty_params {
@@ -2168,7 +2179,7 @@ impl<'a> LoweringContext<'a> {
21682179
P(hir::FnDecl {
21692180
inputs,
21702181
output,
2171-
c_variadic: decl.c_variadic,
2182+
c_variadic,
21722183
implicit_self: decl.inputs.get(0).map_or(
21732184
hir::ImplicitSelfKind::None,
21742185
|arg| {

src/librustc/hir/lowering/expr.rs

-2
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,6 @@ impl LoweringContext<'_> {
450450
let ast_decl = FnDecl {
451451
inputs: vec![],
452452
output,
453-
c_variadic: false
454453
};
455454
let decl = self.lower_fn_decl(&ast_decl, None, /* impl trait allowed */ false, None);
456455
let body_id = self.lower_fn_body(&ast_decl, |this| {
@@ -739,7 +738,6 @@ impl LoweringContext<'_> {
739738
let outer_decl = FnDecl {
740739
inputs: decl.inputs.clone(),
741740
output: FunctionRetTy::Default(fn_decl_span),
742-
c_variadic: false,
743741
};
744742
// We need to lower the declaration outside the new scope, because we
745743
// have to conserve the state of being inside a loop condition for the

src/librustc/hir/map/collector.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use syntax_pos::Span;
1717
use std::iter::repeat;
1818

1919
use crate::ich::StableHashingContext;
20-
use rustc_data_structures::stable_hasher::{HashStable, StableHasher, StableHasherResult};
20+
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
2121

2222
/// A visitor that walks over the HIR and collects `Node`s into a HIR map.
2323
pub(super) struct NodeCollector<'a, 'hir> {
@@ -602,9 +602,7 @@ impl<'hir, T> HashStable<StableHashingContext<'hir>> for HirItemLike<T>
602602
where
603603
T: HashStable<StableHashingContext<'hir>>,
604604
{
605-
fn hash_stable<W: StableHasherResult>(&self,
606-
hcx: &mut StableHashingContext<'hir>,
607-
hasher: &mut StableHasher<W>) {
605+
fn hash_stable(&self, hcx: &mut StableHashingContext<'hir>, hasher: &mut StableHasher) {
608606
hcx.while_hashing_hir_bodies(self.hash_bodies, |hcx| {
609607
self.item_like.hash_stable(hcx, hasher);
610608
});

src/librustc/hir/mod.rs

-3
Original file line numberDiff line numberDiff line change
@@ -2016,9 +2016,6 @@ pub enum TyKind {
20162016
Infer,
20172017
/// Placeholder for a type that has failed to be defined.
20182018
Err,
2019-
/// Placeholder for C-variadic arguments. We "spoof" the `VaListImpl` created
2020-
/// from the variadic arguments. This type is only valid up to typeck.
2021-
CVarArgs(Lifetime),
20222019
}
20232020

20242021
#[derive(Copy, Clone, RustcEncodable, RustcDecodable, Debug, HashStable)]

src/librustc/hir/print.rs

-3
Original file line numberDiff line numberDiff line change
@@ -361,9 +361,6 @@ impl<'a> State<'a> {
361361
self.s.word("/*ERROR*/");
362362
self.pclose();
363363
}
364-
hir::TyKind::CVarArgs(_) => {
365-
self.s.word("...");
366-
}
367364
}
368365
self.end()
369366
}

src/librustc/hir/ptr.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use std::{slice, vec};
99

1010
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
1111

12-
use rustc_data_structures::stable_hasher::{StableHasher, StableHasherResult,
13-
HashStable};
12+
use rustc_data_structures::stable_hasher::{StableHasher, HashStable};
1413
/// An owned smart pointer.
1514
#[derive(Hash, PartialEq, Eq)]
1615
pub struct P<T: ?Sized> {
@@ -133,9 +132,7 @@ impl<T: Decodable> Decodable for P<[T]> {
133132
impl<CTX, T> HashStable<CTX> for P<T>
134133
where T: ?Sized + HashStable<CTX>
135134
{
136-
fn hash_stable<W: StableHasherResult>(&self,
137-
hcx: &mut CTX,
138-
hasher: &mut StableHasher<W>) {
135+
fn hash_stable(&self, hcx: &mut CTX, hasher: &mut StableHasher) {
139136
(**self).hash_stable(hcx, hasher);
140137
}
141138
}

src/librustc/ich/hcx.rs

+9-23
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use syntax_pos::{Span, DUMMY_SP};
2020
use syntax_pos::hygiene;
2121

2222
use rustc_data_structures::stable_hasher::{
23-
HashStable, StableHasher, StableHasherResult, ToStableHashKey,
23+
HashStable, StableHasher, ToStableHashKey,
2424
};
2525
use rustc_data_structures::fx::{FxHashSet, FxHashMap};
2626
use smallvec::SmallVec;
@@ -219,9 +219,7 @@ impl<'a> StableHashingContextProvider<'a> for StableHashingContext<'a> {
219219
impl<'a> crate::dep_graph::DepGraphSafe for StableHashingContext<'a> {}
220220

221221
impl<'a> HashStable<StableHashingContext<'a>> for hir::BodyId {
222-
fn hash_stable<W: StableHasherResult>(&self,
223-
hcx: &mut StableHashingContext<'a>,
224-
hasher: &mut StableHasher<W>) {
222+
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
225223
if hcx.hash_bodies() {
226224
hcx.body_resolver.body(*self).hash_stable(hcx, hasher);
227225
}
@@ -230,9 +228,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for hir::BodyId {
230228

231229
impl<'a> HashStable<StableHashingContext<'a>> for hir::HirId {
232230
#[inline]
233-
fn hash_stable<W: StableHasherResult>(&self,
234-
hcx: &mut StableHashingContext<'a>,
235-
hasher: &mut StableHasher<W>) {
231+
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
236232
match hcx.node_id_hashing_mode {
237233
NodeIdHashingMode::Ignore => {
238234
// Don't do anything.
@@ -263,9 +259,7 @@ impl<'a> ToStableHashKey<StableHashingContext<'a>> for hir::HirId {
263259
}
264260

265261
impl<'a> HashStable<StableHashingContext<'a>> for ast::NodeId {
266-
fn hash_stable<W: StableHasherResult>(&self,
267-
hcx: &mut StableHashingContext<'a>,
268-
hasher: &mut StableHasher<W>) {
262+
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
269263
match hcx.node_id_hashing_mode {
270264
NodeIdHashingMode::Ignore => {
271265
// Don't do anything.
@@ -298,9 +292,7 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
298292
/// codepoint offsets. For the purpose of the hash that's sufficient.
299293
/// Also, hashing filenames is expensive so we avoid doing it twice when the
300294
/// span starts and ends in the same file, which is almost always the case.
301-
fn hash_stable<W: StableHasherResult>(&self,
302-
hcx: &mut StableHashingContext<'a>,
303-
hasher: &mut StableHasher<W>) {
295+
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
304296
const TAG_VALID_SPAN: u8 = 0;
305297
const TAG_INVALID_SPAN: u8 = 1;
306298
const TAG_EXPANSION: u8 = 0;
@@ -379,24 +371,18 @@ impl<'a> HashStable<StableHashingContext<'a>> for Span {
379371
}
380372

381373
impl<'a> HashStable<StableHashingContext<'a>> for DelimSpan {
382-
fn hash_stable<W: StableHasherResult>(
383-
&self,
384-
hcx: &mut StableHashingContext<'a>,
385-
hasher: &mut StableHasher<W>,
386-
) {
374+
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
387375
self.open.hash_stable(hcx, hasher);
388376
self.close.hash_stable(hcx, hasher);
389377
}
390378
}
391379

392-
pub fn hash_stable_trait_impls<'a, W>(
380+
pub fn hash_stable_trait_impls<'a>(
393381
hcx: &mut StableHashingContext<'a>,
394-
hasher: &mut StableHasher<W>,
382+
hasher: &mut StableHasher,
395383
blanket_impls: &[DefId],
396384
non_blanket_impls: &FxHashMap<fast_reject::SimplifiedType, Vec<DefId>>,
397-
) where
398-
W: StableHasherResult,
399-
{
385+
) {
400386
{
401387
let mut blanket_impls: SmallVec<[_; 8]> = blanket_impls
402388
.iter()

0 commit comments

Comments
 (0)