Skip to content

Commit c9fba88

Browse files
author
The Miri Conjob Bot
committed
Merge from rustc
2 parents 42ce2e5 + 71ffdf7 commit c9fba88

File tree

279 files changed

+2584
-1959
lines changed

Some content is hidden

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

279 files changed

+2584
-1959
lines changed

compiler/rustc_abi/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ fn univariant<
958958
#[cfg(feature = "randomize")]
959959
{
960960
use rand::{seq::SliceRandom, SeedableRng};
961-
// `ReprOptions.layout_seed` is a deterministic seed we can use to randomize field
961+
// `ReprOptions.field_shuffle_seed` is a deterministic seed we can use to randomize field
962962
// ordering.
963963
let mut rng =
964964
rand_xoshiro::Xoshiro128StarStar::seed_from_u64(repr.field_shuffle_seed);

compiler/rustc_abi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bitflags! {
4141
// Internal only for now. If true, don't reorder fields.
4242
const IS_LINEAR = 1 << 3;
4343
// If true, the type's layout can be randomized using
44-
// the seed stored in `ReprOptions.layout_seed`
44+
// the seed stored in `ReprOptions.field_shuffle_seed`
4545
const RANDOMIZE_LAYOUT = 1 << 4;
4646
// Any of these flags being set prevent field reordering optimisation.
4747
const IS_UNOPTIMISABLE = ReprFlags::IS_C.bits()

compiler/rustc_ast/src/ast.rs

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,23 +1296,10 @@ impl Expr {
12961296
ExprKind::Yeet(..) => ExprPrecedence::Yeet,
12971297
ExprKind::FormatArgs(..) => ExprPrecedence::FormatArgs,
12981298
ExprKind::Become(..) => ExprPrecedence::Become,
1299-
ExprKind::Err => ExprPrecedence::Err,
1299+
ExprKind::Err(_) | ExprKind::Dummy => ExprPrecedence::Err,
13001300
}
13011301
}
13021302

1303-
pub fn take(&mut self) -> Self {
1304-
mem::replace(
1305-
self,
1306-
Expr {
1307-
id: DUMMY_NODE_ID,
1308-
kind: ExprKind::Err,
1309-
span: DUMMY_SP,
1310-
attrs: AttrVec::new(),
1311-
tokens: None,
1312-
},
1313-
)
1314-
}
1315-
13161303
/// To a first-order approximation, is this a pattern?
13171304
pub fn is_approximately_pattern(&self) -> bool {
13181305
matches!(
@@ -1531,7 +1518,10 @@ pub enum ExprKind {
15311518
FormatArgs(P<FormatArgs>),
15321519

15331520
/// Placeholder for an expression that wasn't syntactically well formed in some way.
1534-
Err,
1521+
Err(ErrorGuaranteed),
1522+
1523+
/// Acts as a null expression. Lowering it will always emit a bug.
1524+
Dummy,
15351525
}
15361526

15371527
/// Used to differentiate between `for` loops and `for await` loops.

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1526,7 +1526,7 @@ pub fn noop_visit_expr<T: MutVisitor>(
15261526
}
15271527
ExprKind::Try(expr) => vis.visit_expr(expr),
15281528
ExprKind::TryBlock(body) => vis.visit_block(body),
1529-
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) | ExprKind::Err => {}
1529+
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) | ExprKind::Err(_) | ExprKind::Dummy => {}
15301530
}
15311531
vis.visit_id(id);
15321532
vis.visit_span(span);
@@ -1642,7 +1642,7 @@ impl DummyAstNode for Expr {
16421642
fn dummy() -> Self {
16431643
Expr {
16441644
id: DUMMY_NODE_ID,
1645-
kind: ExprKind::Err,
1645+
kind: ExprKind::Dummy,
16461646
span: Default::default(),
16471647
attrs: Default::default(),
16481648
tokens: Default::default(),

compiler/rustc_ast/src/util/classify.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ pub fn expr_trailing_brace(mut expr: &ast::Expr) -> Option<&ast::Expr> {
8989
| Paren(_)
9090
| Try(_)
9191
| Yeet(None)
92-
| Err => break None,
92+
| Err(_)
93+
| Dummy => break None,
9394
}
9495
}
9596
}

compiler/rustc_ast/src/visit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ pub fn walk_expr<'a, V: Visitor<'a>>(visitor: &mut V, expression: &'a Expr) -> V
10631063
}
10641064
ExprKind::Try(subexpression) => try_visit!(visitor.visit_expr(subexpression)),
10651065
ExprKind::TryBlock(body) => try_visit!(visitor.visit_block(body)),
1066-
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) | ExprKind::Err => {}
1066+
ExprKind::Lit(_) | ExprKind::IncludedBytes(..) | ExprKind::Err(_) | ExprKind::Dummy => {}
10671067
}
10681068

10691069
visitor.visit_expr_post(expression)

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ use rustc_ast::*;
1414
use rustc_data_structures::stack::ensure_sufficient_stack;
1515
use rustc_hir as hir;
1616
use rustc_hir::def::{DefKind, Res};
17+
use rustc_middle::span_bug;
1718
use rustc_session::errors::report_lit_error;
1819
use rustc_span::source_map::{respan, Spanned};
1920
use rustc_span::symbol::{kw, sym, Ident, Symbol};
@@ -328,9 +329,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
328329
)
329330
}
330331
ExprKind::Yield(opt_expr) => self.lower_expr_yield(e.span, opt_expr.as_deref()),
331-
ExprKind::Err => {
332-
hir::ExprKind::Err(self.dcx().span_delayed_bug(e.span, "lowered ExprKind::Err"))
332+
ExprKind::Err(guar) => hir::ExprKind::Err(*guar),
333+
334+
ExprKind::Dummy => {
335+
span_bug!(e.span, "lowered ExprKind::Dummy")
333336
}
337+
334338
ExprKind::Try(sub_expr) => self.lower_expr_try(e.span, sub_expr),
335339

336340
ExprKind::Paren(_) | ExprKind::ForLoop { .. } => {

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,8 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
331331
ExprKind::Lit(..)
332332
| ExprKind::ConstBlock(..)
333333
| ExprKind::IncludedBytes(..)
334-
| ExprKind::Err => {}
334+
| ExprKind::Err(_)
335+
| ExprKind::Dummy => {}
335336
ExprKind::Path(..) if allow_paths => {}
336337
ExprKind::Unary(UnOp::Neg, inner) if matches!(inner.kind, ExprKind::Lit(_)) => {}
337338
_ => {

compiler/rustc_ast_pretty/src/pprust/state/expr.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,16 @@ impl<'a> State<'a> {
893893
self.word_nbsp("try");
894894
self.print_block_with_attrs(blk, attrs)
895895
}
896-
ast::ExprKind::Err => {
896+
ast::ExprKind::Err(_) => {
897897
self.popen();
898898
self.word("/*ERROR*/");
899899
self.pclose()
900900
}
901+
ast::ExprKind::Dummy => {
902+
self.popen();
903+
self.word("/*DUMMY*/");
904+
self.pclose();
905+
}
901906
}
902907

903908
self.ann.post(self, AnnNode::Expr(expr));

compiler/rustc_borrowck/src/type_check/relate_tys.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
use rustc_data_structures::fx::FxHashMap;
22
use rustc_errors::ErrorGuaranteed;
33
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
4-
use rustc_infer::infer::{NllRegionVariableOrigin, ObligationEmittingRelation};
4+
use rustc_infer::infer::NllRegionVariableOrigin;
5+
use rustc_infer::infer::{ObligationEmittingRelation, StructurallyRelateAliases};
56
use rustc_infer::traits::{Obligation, PredicateObligations};
67
use rustc_middle::mir::ConstraintCategory;
78
use rustc_middle::traits::query::NoSolution;
@@ -548,6 +549,10 @@ impl<'bccx, 'tcx> ObligationEmittingRelation<'tcx> for NllTypeRelating<'_, 'bccx
548549
self.locations.span(self.type_checker.body)
549550
}
550551

552+
fn structurally_relate_aliases(&self) -> StructurallyRelateAliases {
553+
StructurallyRelateAliases::No
554+
}
555+
551556
fn param_env(&self) -> ty::ParamEnv<'tcx> {
552557
self.type_checker.param_env
553558
}

0 commit comments

Comments
 (0)