Skip to content

Commit d60d4a5

Browse files
author
The Miri Cronjob Bot
committed
Merge ref '6244effd0372' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 6244eff Filtered ref: 2b788f903ef58db43f16530dbf73f4a0502e4452 Upstream diff: rust-lang/rust@96fe3c3...6244eff This merge was created using https://github.com/rust-lang/josh-sync.
2 parents d521a79 + c6acffe commit d60d4a5

File tree

214 files changed

+4607
-3438
lines changed

Some content is hidden

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

214 files changed

+4607
-3438
lines changed

Cargo.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,9 @@ dependencies = [
9595

9696
[[package]]
9797
name = "anstyle"
98-
version = "1.0.11"
98+
version = "1.0.13"
9999
source = "registry+https://github.com/rust-lang/crates.io-index"
100-
checksum = "862ed96ca487e809f1c8e5a8447f6ee2cf102f846893800b20cebdf541fc6bbd"
100+
checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78"
101101

102102
[[package]]
103103
name = "anstyle-lossy"
@@ -3757,6 +3757,8 @@ name = "rustc_errors"
37573757
version = "0.0.0"
37583758
dependencies = [
37593759
"annotate-snippets 0.11.5",
3760+
"anstream",
3761+
"anstyle",
37603762
"derive_setters",
37613763
"rustc_abi",
37623764
"rustc_ast",
@@ -3773,7 +3775,6 @@ dependencies = [
37733775
"rustc_span",
37743776
"serde",
37753777
"serde_json",
3776-
"termcolor",
37773778
"termize",
37783779
"tracing",
37793780
"windows 0.61.3",
@@ -4327,7 +4328,6 @@ dependencies = [
43274328
"rustc_macros",
43284329
"rustc_session",
43294330
"rustc_span",
4330-
"termcolor",
43314331
"thin-vec",
43324332
"tracing",
43334333
"unicode-normalization",

compiler/rustc_ast/src/ast.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2579,6 +2579,9 @@ pub enum TyPatKind {
25792579
/// A range pattern (e.g., `1...2`, `1..2`, `1..`, `..2`, `1..=2`, `..=2`).
25802580
Range(Option<Box<AnonConst>>, Option<Box<AnonConst>>, Spanned<RangeEnd>),
25812581

2582+
/// A `!null` pattern for raw pointers.
2583+
NotNull,
2584+
25822585
Or(ThinVec<TyPat>),
25832586

25842587
/// Placeholder for a pattern that wasn't syntactically well formed in some way.

compiler/rustc_ast_lowering/src/pat.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
143143
}
144144
// return inner to be processed in next loop
145145
PatKind::Paren(inner) => pattern = inner,
146-
PatKind::MacCall(_) => panic!("{:?} shouldn't exist here", pattern.span),
146+
PatKind::MacCall(_) => {
147+
panic!("{pattern:#?} shouldn't exist here")
148+
}
147149
PatKind::Err(guar) => break hir::PatKind::Err(*guar),
148150
}
149151
};
@@ -460,6 +462,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
460462
)
461463
}),
462464
),
465+
TyPatKind::NotNull => hir::TyPatKind::NotNull,
463466
TyPatKind::Or(variants) => {
464467
hir::TyPatKind::Or(self.arena.alloc_from_iter(
465468
variants.iter().map(|pat| self.lower_ty_pat_mut(pat, base_type)),

compiler/rustc_ast_pretty/src/pprust/state.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,6 +1232,7 @@ impl<'a> State<'a> {
12321232
self.print_expr_anon_const(end, &[]);
12331233
}
12341234
}
1235+
rustc_ast::TyPatKind::NotNull => self.word("!null"),
12351236
rustc_ast::TyPatKind::Or(variants) => {
12361237
let mut first = true;
12371238
for pat in variants {

compiler/rustc_attr_parsing/src/attributes/crate_level.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@ impl<S: Stage> SingleAttributeParser<S> for CrateNameParser {
2020
return None;
2121
};
2222

23-
Some(AttributeKind::CrateName {
24-
name,
25-
name_span: n.value_span,
26-
attr_span: cx.attr_span,
27-
style: cx.attr_style,
28-
})
23+
Some(AttributeKind::CrateName { name, name_span: n.value_span, attr_span: cx.attr_span })
2924
}
3025
}
3126

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ builtin_macros_requires_cfg_pattern =
283283
macro requires a cfg-pattern as an argument
284284
.label = cfg-pattern required
285285
286-
builtin_macros_source_uitls_expected_item = expected item, found `{$token}`
286+
builtin_macros_source_utils_expected_item = expected item, found `{$token}`
287287
288288
builtin_macros_takes_no_arguments = {$name} takes no arguments
289289

compiler/rustc_builtin_macros/src/errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ pub(crate) struct AttributeOnlyUsableWithCrateType<'a> {
952952
}
953953

954954
#[derive(Diagnostic)]
955-
#[diag(builtin_macros_source_uitls_expected_item)]
955+
#[diag(builtin_macros_source_utils_expected_item)]
956956
pub(crate) struct ExpectedItem<'a> {
957957
#[primary_span]
958958
pub span: Span,

compiler/rustc_builtin_macros/src/pattern_type.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,21 @@ fn parse_pat_ty<'a>(
3030
let ty = parser.parse_ty()?;
3131
parser.expect_keyword(exp!(Is))?;
3232

33-
let pat = pat_to_ty_pat(
34-
cx,
35-
parser.parse_pat_no_top_guard(
36-
None,
37-
RecoverComma::No,
38-
RecoverColon::No,
39-
CommaRecoveryMode::EitherTupleOrPipe,
40-
)?,
41-
);
33+
let start = parser.token.span;
34+
let pat = if parser.eat(exp!(Bang)) {
35+
parser.expect_keyword(exp!(Null))?;
36+
ty_pat(TyPatKind::NotNull, start.to(parser.token.span))
37+
} else {
38+
pat_to_ty_pat(
39+
cx,
40+
parser.parse_pat_no_top_guard(
41+
None,
42+
RecoverComma::No,
43+
RecoverColon::No,
44+
CommaRecoveryMode::EitherTupleOrPipe,
45+
)?,
46+
)
47+
};
4248

4349
if parser.token != token::Eof {
4450
parser.unexpected()?;

compiler/rustc_codegen_cranelift/src/base.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -829,13 +829,6 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
829829
fx.bcx.ins().nop();
830830
}
831831
}
832-
Rvalue::ShallowInitBox(ref operand, content_ty) => {
833-
let content_ty = fx.monomorphize(content_ty);
834-
let box_layout = fx.layout_of(Ty::new_box(fx.tcx, content_ty));
835-
let operand = codegen_operand(fx, operand);
836-
let operand = operand.load_scalar(fx);
837-
lval.write_cvalue(fx, CValue::by_val(operand, box_layout));
838-
}
839832
Rvalue::NullaryOp(ref null_op, ty) => {
840833
assert!(lval.layout().ty.is_sized(fx.tcx, fx.typing_env()));
841834
let layout = fx.layout_of(fx.monomorphize(ty));
@@ -924,6 +917,7 @@ fn codegen_stmt<'tcx>(fx: &mut FunctionCx<'_, '_, 'tcx>, cur_block: Block, stmt:
924917
lval.write_cvalue_transmute(fx, operand);
925918
}
926919
Rvalue::CopyForDeref(_) => bug!("`CopyForDeref` in codegen"),
920+
Rvalue::ShallowInitBox(..) => bug!("`ShallowInitBox` in codegen"),
927921
}
928922
}
929923
StatementKind::StorageLive(_)

compiler/rustc_codegen_cranelift/src/unsize.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ pub(crate) fn coerce_unsized_into<'tcx>(
131131
dst.write_cvalue(fx, CValue::by_val_pair(base, info, dst.layout()));
132132
};
133133
match (&src_ty.kind(), &dst_ty.kind()) {
134+
(ty::Pat(a, _), ty::Pat(b, _)) => {
135+
let src = src.cast_pat_ty_to_base(fx.layout_of(*a));
136+
let dst = dst.place_transmute_type(fx, *b);
137+
return coerce_unsized_into(fx, src, dst);
138+
}
134139
(&ty::Ref(..), &ty::Ref(..))
135140
| (&ty::Ref(..), &ty::RawPtr(..))
136141
| (&ty::RawPtr(..), &ty::RawPtr(..)) => coerce_ptr(),

0 commit comments

Comments
 (0)