Skip to content

Commit 06ca3ab

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents f5bb34f + ac1b857 commit 06ca3ab

File tree

496 files changed

+5437
-2559
lines changed

Some content is hidden

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

496 files changed

+5437
-2559
lines changed

.reuse/dep5

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Copyright: 2019 The Crossbeam Project Developers
5252
The Rust Project Developers (see https://thanks.rust-lang.org)
5353
License: MIT OR Apache-2.0
5454

55-
Files: library/std/src/sys/locks/mutex/fuchsia.rs
55+
Files: library/std/src/sys/sync/mutex/fuchsia.rs
5656
Copyright: 2016 The Fuchsia Authors
5757
The Rust Project Developers (see https://thanks.rust-lang.org)
5858
License: BSD-2-Clause AND (MIT OR Apache-2.0)

compiler/rustc_abi/src/layout.rs

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -816,15 +816,37 @@ where
816816
break;
817817
}
818818
};
819-
if let Some(pair) = common_prim {
820-
// This is pretty conservative. We could go fancier
821-
// by conflating things like i32 and u32, or even
822-
// realising that (u8, u8) could just cohabit with
823-
// u16 or even u32.
824-
if pair != (prim, offset) {
819+
if let Some((old_prim, common_offset)) = common_prim {
820+
// All variants must be at the same offset
821+
if offset != common_offset {
825822
common_prim = None;
826823
break;
827824
}
825+
// This is pretty conservative. We could go fancier
826+
// by realising that (u8, u8) could just cohabit with
827+
// u16 or even u32.
828+
let new_prim = match (old_prim, prim) {
829+
// Allow all identical primitives.
830+
(x, y) if x == y => x,
831+
// Allow integers of the same size with differing signedness.
832+
// We arbitrarily choose the signedness of the first variant.
833+
(p @ Primitive::Int(x, _), Primitive::Int(y, _)) if x == y => p,
834+
// Allow integers mixed with pointers of the same layout.
835+
// We must represent this using a pointer, to avoid
836+
// roundtripping pointers through ptrtoint/inttoptr.
837+
(p @ Primitive::Pointer(_), i @ Primitive::Int(..))
838+
| (i @ Primitive::Int(..), p @ Primitive::Pointer(_))
839+
if p.size(dl) == i.size(dl) && p.align(dl) == i.align(dl) =>
840+
{
841+
p
842+
}
843+
_ => {
844+
common_prim = None;
845+
break;
846+
}
847+
};
848+
// We may be updating the primitive here, for example from int->ptr.
849+
common_prim = Some((new_prim, common_offset));
828850
} else {
829851
common_prim = Some((prim, offset));
830852
}

compiler/rustc_ast/src/ast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ impl Stmt {
10211021
#[derive(Clone, Encodable, Decodable, Debug)]
10221022
pub enum StmtKind {
10231023
/// A local (let) binding.
1024-
Local(P<Local>),
1024+
Let(P<Local>),
10251025
/// An item definition.
10261026
Item(P<Item>),
10271027
/// Expr without trailing semi-colon.

compiler/rustc_ast/src/ast_traits.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl<T: HasTokens> HasTokens for Option<T> {
182182
impl HasTokens for StmtKind {
183183
fn tokens(&self) -> Option<&LazyAttrTokenStream> {
184184
match self {
185-
StmtKind::Local(local) => local.tokens.as_ref(),
185+
StmtKind::Let(local) => local.tokens.as_ref(),
186186
StmtKind::Item(item) => item.tokens(),
187187
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.tokens(),
188188
StmtKind::Empty => return None,
@@ -191,7 +191,7 @@ impl HasTokens for StmtKind {
191191
}
192192
fn tokens_mut(&mut self) -> Option<&mut Option<LazyAttrTokenStream>> {
193193
match self {
194-
StmtKind::Local(local) => Some(&mut local.tokens),
194+
StmtKind::Let(local) => Some(&mut local.tokens),
195195
StmtKind::Item(item) => item.tokens_mut(),
196196
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.tokens_mut(),
197197
StmtKind::Empty => return None,
@@ -355,7 +355,7 @@ impl HasAttrs for StmtKind {
355355

356356
fn attrs(&self) -> &[Attribute] {
357357
match self {
358-
StmtKind::Local(local) => &local.attrs,
358+
StmtKind::Let(local) => &local.attrs,
359359
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.attrs(),
360360
StmtKind::Item(item) => item.attrs(),
361361
StmtKind::Empty => &[],
@@ -365,7 +365,7 @@ impl HasAttrs for StmtKind {
365365

366366
fn visit_attrs(&mut self, f: impl FnOnce(&mut AttrVec)) {
367367
match self {
368-
StmtKind::Local(local) => f(&mut local.attrs),
368+
StmtKind::Let(local) => f(&mut local.attrs),
369369
StmtKind::Expr(expr) | StmtKind::Semi(expr) => expr.visit_attrs(f),
370370
StmtKind::Item(item) => item.visit_attrs(f),
371371
StmtKind::Empty => {}

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@ pub fn noop_flat_map_stmt_kind<T: MutVisitor>(
15671567
vis: &mut T,
15681568
) -> SmallVec<[StmtKind; 1]> {
15691569
match kind {
1570-
StmtKind::Local(mut local) => smallvec![StmtKind::Local({
1570+
StmtKind::Let(mut local) => smallvec![StmtKind::Let({
15711571
vis.visit_local(&mut local);
15721572
local
15731573
})],

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ pub fn walk_block<'a, V: Visitor<'a>>(visitor: &mut V, block: &'a Block) -> V::R
787787

788788
pub fn walk_stmt<'a, V: Visitor<'a>>(visitor: &mut V, statement: &'a Stmt) -> V::Result {
789789
match &statement.kind {
790-
StmtKind::Local(local) => try_visit!(visitor.visit_local(local)),
790+
StmtKind::Let(local) => try_visit!(visitor.visit_local(local)),
791791
StmtKind::Item(item) => try_visit!(visitor.visit_item(item)),
792792
StmtKind::Expr(expr) | StmtKind::Semi(expr) => try_visit!(visitor.visit_expr(expr)),
793793
StmtKind::Empty => {}

compiler/rustc_ast_lowering/src/asm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
196196
.get_partial_res(sym.id)
197197
.and_then(|res| res.full_res())
198198
.and_then(|res| match res {
199-
Res::Def(DefKind::Static(_), def_id) => Some(def_id),
199+
Res::Def(DefKind::Static { .. }, def_id) => Some(def_id),
200200
_ => None,
201201
});
202202

compiler/rustc_ast_lowering/src/block.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
3232
let mut expr = None;
3333
while let [s, tail @ ..] = ast_stmts {
3434
match &s.kind {
35-
StmtKind::Local(local) => {
35+
StmtKind::Let(local) => {
3636
let hir_id = self.lower_node_id(s.id);
3737
let local = self.lower_local(local);
3838
self.alias_attrs(hir_id, local.hir_id);
39-
let kind = hir::StmtKind::Local(local);
39+
let kind = hir::StmtKind::Let(local);
4040
let span = self.lower_span(s.span);
4141
stmts.push(hir::Stmt { hir_id, kind, span });
4242
}

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2356,7 +2356,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23562356
span: self.lower_span(span),
23572357
ty: None,
23582358
};
2359-
self.stmt(span, hir::StmtKind::Local(self.arena.alloc(local)))
2359+
self.stmt(span, hir::StmtKind::Let(self.arena.alloc(local)))
23602360
}
23612361

23622362
fn block_expr(&mut self, expr: &'hir hir::Expr<'hir>) -> &'hir hir::Block<'hir> {

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1212,7 +1212,7 @@ impl<'a> State<'a> {
12121212
fn print_stmt(&mut self, st: &ast::Stmt) {
12131213
self.maybe_print_comment(st.span.lo());
12141214
match &st.kind {
1215-
ast::StmtKind::Local(loc) => {
1215+
ast::StmtKind::Let(loc) => {
12161216
self.print_outer_attributes(&loc.attrs);
12171217
self.space_if_not_bol();
12181218
self.ibox(INDENT_UNIT);

0 commit comments

Comments
 (0)