Skip to content

Commit d0e7772

Browse files
committed
Auto merge of #3561 - RalfJung:rustup, r=RalfJung
Rustup
2 parents 7eda989 + a040df7 commit d0e7772

File tree

351 files changed

+2497
-1460
lines changed

Some content is hidden

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

351 files changed

+2497
-1460
lines changed

Cargo.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3824,7 +3824,6 @@ dependencies = [
38243824
"rustc_session",
38253825
"rustc_smir",
38263826
"rustc_span",
3827-
"rustc_symbol_mangling",
38283827
"rustc_target",
38293828
"rustc_trait_selection",
38303829
"rustc_ty_utils",
@@ -4008,7 +4007,6 @@ dependencies = [
40084007
"rustc_data_structures",
40094008
"rustc_errors",
40104009
"rustc_fluent_macro",
4011-
"rustc_graphviz",
40124010
"rustc_hir",
40134011
"rustc_hir_analysis",
40144012
"rustc_hir_pretty",
@@ -4468,7 +4466,6 @@ dependencies = [
44684466
"rustc_errors",
44694467
"rustc_fluent_macro",
44704468
"rustc_hir",
4471-
"rustc_hir_analysis",
44724469
"rustc_macros",
44734470
"rustc_middle",
44744471
"rustc_session",
@@ -4515,7 +4512,6 @@ dependencies = [
45154512
"rustc_session",
45164513
"rustc_span",
45174514
"rustc_target",
4518-
"rustc_type_ir",
45194515
"smallvec",
45204516
"thin-vec",
45214517
"tracing",

RELEASES.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ Compatibility Notes
102102
- [Change equality of higher ranked types to not rely on subtyping](https://github.com/rust-lang/rust/pull/118247)
103103
- [When called, additionally check bounds on normalized function return type](https://github.com/rust-lang/rust/pull/118882)
104104
- [Expand coverage for `arithmetic_overflow` lint](https://github.com/rust-lang/rust/pull/119432/)
105+
- [Fix detection of potential interior mutability in `const` initializers](https://github.com/rust-lang/rust/issues/121250)
106+
This code was accidentally accepted. The fix can break generic code that borrows a value of unknown type,
107+
as there is currently no way to declare "this type has no interior mutability". In the future, stabilizing
108+
the [`Freeze` trait](https://github.com/rust-lang/rust/issues/121675) will allow proper support for such code.
105109

106110
<a id="1.78.0-Internal-Changes"></a>
107111

compiler/rustc/src/main.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
#![feature(unix_sigpipe)]
2-
31
// A note about jemalloc: rustc uses jemalloc when built for CI and
42
// distribution. The obvious way to do this is with the `#[global_allocator]`
53
// mechanism. However, for complicated reasons (see
@@ -34,7 +32,6 @@
3432
// https://github.com/rust-lang/rust/commit/b90cfc887c31c3e7a9e6d462e2464db1fe506175#diff-43914724af6e464c1da2171e4a9b6c7e607d5bc1203fa95c0ab85be4122605ef
3533
// for an example of how to do so.
3634

37-
#[unix_sigpipe = "sig_dfl"]
3835
fn main() {
3936
// See the comment at the top of this file for an explanation of this.
4037
#[cfg(feature = "jemalloc-sys")]

compiler/rustc_abi/src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ use rustc_macros::{Decodable_Generic, Encodable_Generic};
2121
use std::iter::Step;
2222

2323
mod layout;
24+
#[cfg(test)]
25+
mod tests;
2426

2527
pub use layout::LayoutCalculator;
2628

compiler/rustc_abi/src/tests.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
use super::*;
2+
3+
#[test]
4+
fn align_constants() {
5+
assert_eq!(Align::ONE, Align::from_bytes(1).unwrap());
6+
assert_eq!(Align::EIGHT, Align::from_bytes(8).unwrap());
7+
}

compiler/rustc_ast_lowering/src/index.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ pub(super) fn index_hir<'hir>(
6262
if let Node::Err(span) = node.node {
6363
let hir_id = HirId { owner: item.def_id(), local_id };
6464
let msg = format!("ID {hir_id} not encountered when visiting item HIR");
65-
tcx.dcx().span_delayed_bug(*span, msg);
65+
tcx.dcx().span_delayed_bug(span, msg);
6666
}
6767
}
6868

@@ -376,7 +376,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
376376
}
377377
}
378378

379-
fn visit_array_length(&mut self, len: &'hir ArrayLen) {
379+
fn visit_array_length(&mut self, len: &'hir ArrayLen<'hir>) {
380380
match len {
381381
ArrayLen::Infer(inf) => self.insert(inf.span, inf.hir_id, Node::ArrayLenInfer(inf)),
382382
ArrayLen::Body(..) => intravisit::walk_array_len(self, len),

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1589,11 +1589,12 @@ impl<'hir> LoweringContext<'_, 'hir> {
15891589
}),
15901590
)),
15911591
)),
1592-
default: Some(hir::AnonConst {
1592+
default: Some(self.arena.alloc(hir::AnonConst {
15931593
def_id: anon_const,
15941594
hir_id: const_id,
15951595
body: const_body,
1596-
}),
1596+
span,
1597+
})),
15971598
is_host_effect: true,
15981599
},
15991600
colon_span: None,

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,14 +1178,17 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11781178
tokens: None,
11791179
};
11801180

1181-
let ct = self.with_new_scopes(span, |this| hir::AnonConst {
1182-
def_id,
1183-
hir_id: this.lower_node_id(node_id),
1184-
body: this.lower_const_body(path_expr.span, Some(&path_expr)),
1181+
let ct = self.with_new_scopes(span, |this| {
1182+
self.arena.alloc(hir::AnonConst {
1183+
def_id,
1184+
hir_id: this.lower_node_id(node_id),
1185+
body: this
1186+
.lower_const_body(path_expr.span, Some(&path_expr)),
1187+
span,
1188+
})
11851189
});
11861190
return GenericArg::Const(ConstArg {
11871191
value: ct,
1188-
span,
11891192
is_desugared_from_effects: false,
11901193
});
11911194
}
@@ -1197,7 +1200,6 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
11971200
}
11981201
ast::GenericArg::Const(ct) => GenericArg::Const(ConstArg {
11991202
value: self.lower_anon_const(ct),
1200-
span: self.lower_span(ct.value.span),
12011203
is_desugared_from_effects: false,
12021204
}),
12031205
}
@@ -2315,7 +2317,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23152317
}
23162318

23172319
#[allow(rustc::untranslatable_diagnostic)] // FIXME: make this translatable
2318-
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen {
2320+
fn lower_array_length(&mut self, c: &AnonConst) -> hir::ArrayLen<'hir> {
23192321
match c.value.kind {
23202322
ExprKind::Underscore => {
23212323
if self.tcx.features().generic_arg_infer {
@@ -2338,12 +2340,13 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
23382340
}
23392341
}
23402342

2341-
fn lower_anon_const(&mut self, c: &AnonConst) -> hir::AnonConst {
2342-
self.with_new_scopes(c.value.span, |this| hir::AnonConst {
2343+
fn lower_anon_const(&mut self, c: &AnonConst) -> &'hir hir::AnonConst {
2344+
self.arena.alloc(self.with_new_scopes(c.value.span, |this| hir::AnonConst {
23432345
def_id: this.local_def_id(c.id),
23442346
hir_id: this.lower_node_id(c.id),
23452347
body: this.lower_const_body(c.value.span, Some(&c.value)),
2346-
})
2348+
span: this.lower_span(c.value.span),
2349+
}))
23472350
}
23482351

23492352
fn lower_unsafe_source(&mut self, u: UnsafeSource) -> hir::UnsafeSource {
@@ -2650,8 +2653,7 @@ impl<'hir> GenericArgsCtor<'hir> {
26502653

26512654
lcx.children.push((def_id, hir::MaybeOwner::NonOwner(hir_id)));
26522655
self.args.push(hir::GenericArg::Const(hir::ConstArg {
2653-
value: hir::AnonConst { def_id, hir_id, body },
2654-
span,
2656+
value: lcx.arena.alloc(hir::AnonConst { def_id, hir_id, body, span }),
26552657
is_desugared_from_effects: true,
26562658
}))
26572659
}

compiler/rustc_builtin_macros/src/format.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn make_format_args(
307307
return ExpandResult::Ready(Err(guar));
308308
}
309309

310-
let to_span = |inner_span: rustc_parse_format::InnerSpan| {
310+
let to_span = |inner_span: parse::InnerSpan| {
311311
is_source_literal.then(|| {
312312
fmt_span.from_inner(InnerSpan { start: inner_span.start, end: inner_span.end })
313313
})
@@ -577,7 +577,7 @@ fn make_format_args(
577577
fn invalid_placeholder_type_error(
578578
ecx: &ExtCtxt<'_>,
579579
ty: &str,
580-
ty_span: Option<rustc_parse_format::InnerSpan>,
580+
ty_span: Option<parse::InnerSpan>,
581581
fmt_span: Span,
582582
) {
583583
let sp = ty_span.map(|sp| fmt_span.from_inner(InnerSpan::new(sp.start, sp.end)));

compiler/rustc_codegen_gcc/src/context.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ use gccjit::{
66
use rustc_codegen_ssa::base::wants_msvc_seh;
77
use rustc_codegen_ssa::errors as ssa_errors;
88
use rustc_codegen_ssa::traits::{BackendTypes, BaseTypeMethods, MiscMethods};
9-
use rustc_data_structures::base_n;
9+
use rustc_data_structures::base_n::ToBaseN;
10+
use rustc_data_structures::base_n::ALPHANUMERIC_ONLY;
1011
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
1112
use rustc_middle::mir::mono::CodegenUnit;
1213
use rustc_middle::span_bug;
@@ -621,7 +622,7 @@ impl<'b, 'tcx> CodegenCx<'b, 'tcx> {
621622
let mut name = String::with_capacity(prefix.len() + 6);
622623
name.push_str(prefix);
623624
name.push_str(".");
624-
base_n::push_str(idx as u128, base_n::ALPHANUMERIC_ONLY, &mut name);
625+
name.push_str(&(idx as u64).to_base(ALPHANUMERIC_ONLY));
625626
name
626627
}
627628
}

0 commit comments

Comments
 (0)