Skip to content

Commit 4e69b65

Browse files
author
The Miri Cronjob Bot
committed
Merge from rustc
2 parents cfc3924 + a122dde commit 4e69b65

File tree

305 files changed

+4832
-3697
lines changed

Some content is hidden

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

305 files changed

+4832
-3697
lines changed

.gitattributes

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@
44
*.cpp rust
55
*.h rust
66
*.rs rust diff=rust
7-
*.fixed linguist-language=Rust
8-
*.mir linguist-language=Rust
7+
*.fixed linguist-language=Rust -merge
8+
*.mir linguist-language=Rust -merge
9+
*.stderr -merge
10+
*.stdout -merge
911
src/etc/installer/gfx/* binary
1012
src/vendor/** -text
1113
Cargo.lock linguist-generated=false

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
[submodule "src/llvm-project"]
3434
path = src/llvm-project
3535
url = https://github.com/rust-lang/llvm-project.git
36-
branch = rustc/19.1-2024-09-17
36+
branch = rustc/19.1-2024-12-03
3737
shallow = true
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book

compiler/rustc_ast/src/ast.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2566,6 +2566,18 @@ pub enum SelfKind {
25662566
Explicit(P<Ty>, Mutability),
25672567
}
25682568

2569+
impl SelfKind {
2570+
pub fn to_ref_suggestion(&self) -> String {
2571+
match self {
2572+
SelfKind::Region(None, mutbl) => mutbl.ref_prefix_str().to_string(),
2573+
SelfKind::Region(Some(lt), mutbl) => format!("&{lt} {}", mutbl.prefix_str()),
2574+
SelfKind::Value(_) | SelfKind::Explicit(_, _) => {
2575+
unreachable!("if we had an explicit self, we wouldn't be here")
2576+
}
2577+
}
2578+
}
2579+
}
2580+
25692581
pub type ExplicitSelf = Spanned<SelfKind>;
25702582

25712583
impl Param {

compiler/rustc_ast/src/mut_visit.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,9 +1625,10 @@ pub fn walk_expr<T: MutVisitor>(vis: &mut T, Expr { kind, id, span, attrs, token
16251625
visit_thin_exprs(vis, call_args);
16261626
vis.visit_span(span);
16271627
}
1628-
ExprKind::Binary(_binop, lhs, rhs) => {
1628+
ExprKind::Binary(binop, lhs, rhs) => {
16291629
vis.visit_expr(lhs);
16301630
vis.visit_expr(rhs);
1631+
vis.visit_span(&mut binop.span);
16311632
}
16321633
ExprKind::Unary(_unop, ohs) => vis.visit_expr(ohs),
16331634
ExprKind::Cast(expr, ty) => {
@@ -1785,20 +1786,21 @@ pub fn noop_filter_map_expr<T: MutVisitor>(vis: &mut T, mut e: P<Expr>) -> Optio
17851786

17861787
pub fn walk_flat_map_stmt<T: MutVisitor>(
17871788
vis: &mut T,
1788-
Stmt { kind, mut span, mut id }: Stmt,
1789+
Stmt { kind, span, mut id }: Stmt,
17891790
) -> SmallVec<[Stmt; 1]> {
17901791
vis.visit_id(&mut id);
1791-
let stmts: SmallVec<_> = walk_flat_map_stmt_kind(vis, kind)
1792+
let mut stmts: SmallVec<[Stmt; 1]> = walk_flat_map_stmt_kind(vis, kind)
17921793
.into_iter()
17931794
.map(|kind| Stmt { id, kind, span })
17941795
.collect();
1795-
if stmts.len() > 1 {
1796-
panic!(
1796+
match stmts.len() {
1797+
0 => {}
1798+
1 => vis.visit_span(&mut stmts[0].span),
1799+
2.. => panic!(
17971800
"cloning statement `NodeId`s is prohibited by default, \
17981801
the visitor should implement custom statement visiting"
1799-
);
1802+
),
18001803
}
1801-
vis.visit_span(&mut span);
18021804
stmts
18031805
}
18041806

compiler/rustc_ast_passes/messages.ftl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,6 @@ ast_passes_precise_capturing_duplicated = duplicate `use<...>` precise capturing
207207
208208
ast_passes_precise_capturing_not_allowed_here = `use<...>` precise capturing syntax not allowed in {$loc}
209209
210-
ast_passes_show_span = {$msg}
211-
212210
ast_passes_stability_outside_std = stability attributes may not be used outside of the standard library
213211
214212
ast_passes_static_without_body =

compiler/rustc_ast_passes/src/errors.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -779,14 +779,6 @@ pub(crate) struct IncompatibleFeatures {
779779
pub f2: Symbol,
780780
}
781781

782-
#[derive(Diagnostic)]
783-
#[diag(ast_passes_show_span)]
784-
pub(crate) struct ShowSpan {
785-
#[primary_span]
786-
pub span: Span,
787-
pub msg: &'static str,
788-
}
789-
790782
#[derive(Diagnostic)]
791783
#[diag(ast_passes_negative_bound_not_supported)]
792784
pub(crate) struct NegativeBoundUnsupported {

compiler/rustc_ast_passes/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
//! The `rustc_ast_passes` crate contains passes which validate the AST in `syntax`
22
//! parsed by `rustc_parse` and then lowered, after the passes in this crate,
33
//! by `rustc_ast_lowering`.
4-
//!
5-
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
64
75
// tidy-alphabetical-start
86
#![allow(internal_features)]
@@ -18,6 +16,5 @@
1816
pub mod ast_validation;
1917
mod errors;
2018
pub mod feature_gate;
21-
pub mod show_span;
2219

2320
rustc_fluent_macro::fluent_messages! { "../messages.ftl" }

compiler/rustc_ast_passes/src/show_span.rs

Lines changed: 0 additions & 68 deletions
This file was deleted.

compiler/rustc_borrowck/src/region_infer/mod.rs

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -973,25 +973,20 @@ impl<'tcx> RegionInferenceContext<'tcx> {
973973
propagated_outlives_requirements: &mut Vec<ClosureOutlivesRequirement<'tcx>>,
974974
) -> bool {
975975
let tcx = infcx.tcx;
976-
977-
let TypeTest { generic_kind, lower_bound, span: _, verify_bound: _ } = type_test;
976+
let TypeTest { generic_kind, lower_bound, span: blame_span, ref verify_bound } = *type_test;
978977

979978
let generic_ty = generic_kind.to_ty(tcx);
980979
let Some(subject) = self.try_promote_type_test_subject(infcx, generic_ty) else {
981980
return false;
982981
};
983982

984-
debug!("subject = {:?}", subject);
985-
986-
let r_scc = self.constraint_sccs.scc(*lower_bound);
987-
983+
let r_scc = self.constraint_sccs.scc(lower_bound);
988984
debug!(
989985
"lower_bound = {:?} r_scc={:?} universe={:?}",
990986
lower_bound,
991987
r_scc,
992988
self.constraint_sccs.annotation(r_scc).min_universe()
993989
);
994-
995990
// If the type test requires that `T: 'a` where `'a` is a
996991
// placeholder from another universe, that effectively requires
997992
// `T: 'static`, so we have to propagate that requirement.
@@ -1004,7 +999,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
1004999
propagated_outlives_requirements.push(ClosureOutlivesRequirement {
10051000
subject,
10061001
outlived_free_region: static_r,
1007-
blame_span: type_test.span,
1002+
blame_span,
10081003
category: ConstraintCategory::Boring,
10091004
});
10101005

@@ -1031,12 +1026,12 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10311026
// where `ur` is a local bound -- we are sometimes in a
10321027
// position to prove things that our caller cannot. See
10331028
// #53570 for an example.
1034-
if self.eval_verify_bound(infcx, generic_ty, ur, &type_test.verify_bound) {
1029+
if self.eval_verify_bound(infcx, generic_ty, ur, &verify_bound) {
10351030
continue;
10361031
}
10371032

10381033
let non_local_ub = self.universal_region_relations.non_local_upper_bounds(ur);
1039-
debug!("try_promote_type_test: non_local_ub={:?}", non_local_ub);
1034+
debug!(?non_local_ub);
10401035

10411036
// This is slightly too conservative. To show T: '1, given `'2: '1`
10421037
// and `'3: '1` we only need to prove that T: '2 *or* T: '3, but to
@@ -1049,10 +1044,10 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10491044
let requirement = ClosureOutlivesRequirement {
10501045
subject,
10511046
outlived_free_region: upper_bound,
1052-
blame_span: type_test.span,
1047+
blame_span,
10531048
category: ConstraintCategory::Boring,
10541049
};
1055-
debug!("try_promote_type_test: pushing {:#?}", requirement);
1050+
debug!(?requirement, "adding closure requirement");
10561051
propagated_outlives_requirements.push(requirement);
10571052
}
10581053
}
@@ -1063,44 +1058,14 @@ impl<'tcx> RegionInferenceContext<'tcx> {
10631058
/// variables in the type `T` with an equal universal region from the
10641059
/// closure signature.
10651060
/// This is not always possible, so this is a fallible process.
1066-
#[instrument(level = "debug", skip(self, infcx))]
1061+
#[instrument(level = "debug", skip(self, infcx), ret)]
10671062
fn try_promote_type_test_subject(
10681063
&self,
10691064
infcx: &InferCtxt<'tcx>,
10701065
ty: Ty<'tcx>,
10711066
) -> Option<ClosureOutlivesSubject<'tcx>> {
10721067
let tcx = infcx.tcx;
1073-
1074-
// Opaque types' args may include useless lifetimes.
1075-
// We will replace them with ReStatic.
1076-
struct OpaqueFolder<'tcx> {
1077-
tcx: TyCtxt<'tcx>,
1078-
}
1079-
impl<'tcx> ty::TypeFolder<TyCtxt<'tcx>> for OpaqueFolder<'tcx> {
1080-
fn cx(&self) -> TyCtxt<'tcx> {
1081-
self.tcx
1082-
}
1083-
fn fold_ty(&mut self, t: Ty<'tcx>) -> Ty<'tcx> {
1084-
use ty::TypeSuperFoldable as _;
1085-
let tcx = self.tcx;
1086-
let &ty::Alias(ty::Opaque, ty::AliasTy { args, def_id, .. }) = t.kind() else {
1087-
return t.super_fold_with(self);
1088-
};
1089-
let args = std::iter::zip(args, tcx.variances_of(def_id)).map(|(arg, v)| {
1090-
match (arg.unpack(), v) {
1091-
(ty::GenericArgKind::Lifetime(_), ty::Bivariant) => {
1092-
tcx.lifetimes.re_static.into()
1093-
}
1094-
_ => arg.fold_with(self),
1095-
}
1096-
});
1097-
Ty::new_opaque(tcx, def_id, tcx.mk_args_from_iter(args))
1098-
}
1099-
}
1100-
1101-
let ty = ty.fold_with(&mut OpaqueFolder { tcx });
11021068
let mut failed = false;
1103-
11041069
let ty = fold_regions(tcx, ty, |r, _depth| {
11051070
let r_vid = self.to_region_vid(r);
11061071
let r_scc = self.constraint_sccs.scc(r_vid);

compiler/rustc_builtin_macros/messages.ftl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ builtin_macros_cfg_accessible_indeterminate = cannot determine whether the path
9494
builtin_macros_cfg_accessible_literal_path = `cfg_accessible` path cannot be a literal
9595
builtin_macros_cfg_accessible_multiple_paths = multiple `cfg_accessible` paths are specified
9696
builtin_macros_cfg_accessible_unspecified_path = `cfg_accessible` path is not specified
97+
98+
builtin_macros_coerce_pointee_requires_maybe_sized = `derive(CoercePointee)` requires `{$name}` to be marked `?Sized`
99+
100+
builtin_macros_coerce_pointee_requires_one_field = `CoercePointee` can only be derived on `struct`s with at least one field
101+
102+
builtin_macros_coerce_pointee_requires_one_generic = `CoercePointee` can only be derived on `struct`s that are generic over at least one type
103+
104+
builtin_macros_coerce_pointee_requires_one_pointee = exactly one generic type parameter must be marked as `#[pointee]` to derive `CoercePointee` traits
105+
106+
builtin_macros_coerce_pointee_requires_transparent = `CoercePointee` can only be derived on `struct`s with `#[repr(transparent)]`
107+
108+
builtin_macros_coerce_pointee_too_many_pointees = only one type parameter can be marked as `#[pointee]` when deriving `CoercePointee` traits
109+
.label = here another type parameter is marked as `#[pointee]`
110+
111+
97112
builtin_macros_concat_bytes_array = cannot concatenate doubly nested array
98113
.note = byte strings are treated as arrays of bytes
99114
.help = try flattening the array

0 commit comments

Comments
 (0)