Skip to content

Commit c5e9424

Browse files
committed
Auto merge of rust-lang#3669 - rust-lang:rustup-2024-06-13, r=RalfJung
Automatic Rustup
2 parents 82c34ad + a49c659 commit c5e9424

File tree

556 files changed

+7061
-4198
lines changed

Some content is hidden

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

556 files changed

+7061
-4198
lines changed

Diff for: Cargo.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -3452,7 +3452,7 @@ dependencies = [
34523452

34533453
[[package]]
34543454
name = "run_make_support"
3455-
version = "0.0.0"
3455+
version = "0.1.0"
34563456
dependencies = [
34573457
"gimli 0.28.1",
34583458
"object 0.34.0",

Diff for: RELEASES.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ Language
147147
- [Split `refining_impl_trait` lint into `_reachable`, `_internal` variants](https://github.com/rust-lang/rust/pull/121720/)
148148
- [Remove unnecessary type inference when using associated types inside of higher ranked `where`-bounds](https://github.com/rust-lang/rust/pull/119849)
149149
- [Weaken eager detection of cyclic types during type inference](https://github.com/rust-lang/rust/pull/119989)
150-
- [`trait Trait: Auto {}`: allow upcasting from `dyn Trait` to `dyn Auto`](https://github.com/rust-lang/rust/pull/119338)
150+
- [`trait Trait: Auto {}`: allow upcasting from `dyn Trait` to `dyn Trait + Auto`](https://github.com/rust-lang/rust/pull/119338)
151151

152152
<a id="1.78.0-Compiler"></a>
153153

Diff for: compiler/rustc_abi/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#![cfg_attr(feature = "nightly", feature(step_trait))]
1+
// tidy-alphabetical-start
22
#![cfg_attr(feature = "nightly", allow(internal_features))]
33
#![cfg_attr(feature = "nightly", doc(rust_logo))]
44
#![cfg_attr(feature = "nightly", feature(rustdoc_internals))]
5+
#![cfg_attr(feature = "nightly", feature(step_trait))]
6+
// tidy-alphabetical-end
57

68
use std::fmt;
79
use std::num::{NonZeroUsize, ParseIntError};

Diff for: compiler/rustc_arena/src/lib.rs

+9-7
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,25 @@
77
//!
88
//! This crate implements several kinds of arena.
99
10+
// tidy-alphabetical-start
11+
#![allow(clippy::mut_from_ref)] // Arena allocators are one place where this pattern is fine.
12+
#![allow(internal_features)]
13+
#![cfg_attr(test, feature(test))]
14+
#![deny(unsafe_op_in_unsafe_fn)]
1015
#![doc(
1116
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
1217
test(no_crate_inject, attr(deny(warnings)))
1318
)]
1419
#![doc(rust_logo)]
15-
#![feature(rustdoc_internals)]
1620
#![feature(core_intrinsics)]
21+
#![feature(decl_macro)]
1722
#![feature(dropck_eyepatch)]
18-
#![feature(new_uninit)]
1923
#![feature(maybe_uninit_slice)]
20-
#![feature(decl_macro)]
24+
#![feature(new_uninit)]
2125
#![feature(rustc_attrs)]
22-
#![cfg_attr(test, feature(test))]
26+
#![feature(rustdoc_internals)]
2327
#![feature(strict_provenance)]
24-
#![deny(unsafe_op_in_unsafe_fn)]
25-
#![allow(internal_features)]
26-
#![allow(clippy::mut_from_ref)] // Arena allocators are one of the places where this pattern is fine.
28+
// tidy-alphabetical-end
2729

2830
use smallvec::SmallVec;
2931

Diff for: compiler/rustc_ast/src/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,22 @@
44
//!
55
//! This API is completely unstable and subject to change.
66
7+
// tidy-alphabetical-start
8+
#![allow(internal_features)]
79
#![doc(
810
html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/",
911
test(attr(deny(warnings)))
1012
)]
1113
#![doc(rust_logo)]
12-
#![allow(internal_features)]
13-
#![feature(rustdoc_internals)]
1414
#![feature(associated_type_defaults)]
1515
#![feature(box_patterns)]
1616
#![feature(if_let_guard)]
1717
#![feature(let_chains)]
18-
#![feature(never_type)]
1918
#![feature(negative_impls)]
19+
#![feature(never_type)]
20+
#![feature(rustdoc_internals)]
2021
#![feature(stmt_expr_attributes)]
22+
// tidy-alphabetical-end
2123

2224
pub mod util {
2325
pub mod case;

Diff for: compiler/rustc_ast_ir/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
// tidy-alphabetical-start
2+
#![cfg_attr(feature = "nightly", allow(internal_features))]
13
#![cfg_attr(feature = "nightly", feature(never_type))]
24
#![cfg_attr(feature = "nightly", feature(rustc_attrs))]
3-
#![cfg_attr(feature = "nightly", allow(internal_features))]
5+
// tidy-alphabetical-end
46

57
#[cfg(feature = "nightly")]
68
use rustc_macros::{Decodable, Encodable, HashStable_NoContext};

Diff for: compiler/rustc_ast_lowering/src/delegation.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,9 @@ impl<'hir> LoweringContext<'_, 'hir> {
6767
return false;
6868
};
6969
if let Some(local_sig_id) = sig_id.as_local() {
70-
self.resolver.delegation_fn_sigs[&local_sig_id].has_self
70+
// The value may be missing due to recursive delegation.
71+
// Error will be emmited later during HIR ty lowering.
72+
self.resolver.delegation_fn_sigs.get(&local_sig_id).map_or(false, |sig| sig.has_self)
7173
} else {
7274
match self.tcx.def_kind(sig_id) {
7375
DefKind::Fn => false,

Diff for: compiler/rustc_ast_lowering/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@
3030
//! get confused if the spans from leaf AST nodes occur in multiple places
3131
//! in the HIR, especially for multiple identifiers.
3232
33+
// tidy-alphabetical-start
3334
#![allow(internal_features)]
34-
#![feature(rustdoc_internals)]
3535
#![doc(rust_logo)]
3636
#![feature(assert_matches)]
3737
#![feature(box_patterns)]
3838
#![feature(let_chains)]
39+
#![feature(rustdoc_internals)]
40+
// tidy-alphabetical-end
3941

4042
use crate::errors::{AssocTyParentheses, AssocTyParenthesesSub, MisplacedImplTrait};
4143
use rustc_ast::node_id::NodeMap;

Diff for: compiler/rustc_ast_passes/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@
44
//!
55
//! The crate also contains other misc AST visitors, e.g. `node_count` and `show_span`.
66
7+
// tidy-alphabetical-start
78
#![allow(internal_features)]
89
#![doc(rust_logo)]
9-
#![feature(rustdoc_internals)]
1010
#![feature(box_patterns)]
1111
#![feature(if_let_guard)]
1212
#![feature(iter_is_partitioned)]
1313
#![feature(let_chains)]
14+
#![feature(rustdoc_internals)]
15+
// tidy-alphabetical-end
1416

1517
pub mod ast_validation;
1618
mod errors;

Diff for: compiler/rustc_ast_pretty/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// tidy-alphabetical-start
12
#![allow(internal_features)]
2-
#![feature(rustdoc_internals)]
33
#![doc(rust_logo)]
44
#![feature(box_patterns)]
5+
#![feature(rustdoc_internals)]
6+
// tidy-alphabetical-end
57

68
mod helpers;
79
pub mod pp;

Diff for: compiler/rustc_ast_pretty/src/pprust/state.rs

+9-16
Original file line numberDiff line numberDiff line change
@@ -877,18 +877,11 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
877877
}
878878

879879
fn nonterminal_to_string(&self, nt: &Nonterminal) -> String {
880-
match nt {
881-
token::NtExpr(e) => self.expr_to_string(e),
882-
token::NtMeta(e) => self.attr_item_to_string(e),
883-
token::NtTy(e) => self.ty_to_string(e),
884-
token::NtPath(e) => self.path_to_string(e),
885-
token::NtItem(e) => self.item_to_string(e),
886-
token::NtBlock(e) => self.block_to_string(e),
887-
token::NtStmt(e) => self.stmt_to_string(e),
888-
token::NtPat(e) => self.pat_to_string(e),
889-
token::NtLiteral(e) => self.expr_to_string(e),
890-
token::NtVis(e) => self.vis_to_string(e),
891-
}
880+
// We extract the token stream from the AST fragment and pretty print
881+
// it, rather than using AST pretty printing, because `Nonterminal` is
882+
// slated for removal in #124141. (This method will also then be
883+
// removed.)
884+
self.tts_to_string(&TokenStream::from_nonterminal_ast(nt))
892885
}
893886

894887
/// Print the token kind precisely, without converting `$crate` into its respective crate name.
@@ -1022,6 +1015,10 @@ pub trait PrintState<'a>: std::ops::Deref<Target = pp::Printer> + std::ops::Dere
10221015
Self::to_string(|s| s.print_attr_item(ai, ai.path.span))
10231016
}
10241017

1018+
fn tts_to_string(&self, tokens: &TokenStream) -> String {
1019+
Self::to_string(|s| s.print_tts(tokens, false))
1020+
}
1021+
10251022
fn to_string(f: impl FnOnce(&mut State<'_>)) -> String {
10261023
let mut printer = State::new();
10271024
f(&mut printer);
@@ -2068,10 +2065,6 @@ impl<'a> State<'a> {
20682065
})
20692066
}
20702067

2071-
pub(crate) fn tts_to_string(&self, tokens: &TokenStream) -> String {
2072-
Self::to_string(|s| s.print_tts(tokens, false))
2073-
}
2074-
20752068
pub(crate) fn path_segment_to_string(&self, p: &ast::PathSegment) -> String {
20762069
Self::to_string(|s| s.print_path_segment(p, false))
20772070
}

Diff for: compiler/rustc_attr/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,12 @@
44
//! The goal is to move the definition of `MetaItem` and things that don't need to be in `syntax`
55
//! to this crate.
66
7+
// tidy-alphabetical-start
78
#![allow(internal_features)]
8-
#![feature(rustdoc_internals)]
99
#![doc(rust_logo)]
1010
#![feature(let_chains)]
11+
#![feature(rustdoc_internals)]
12+
// tidy-alphabetical-end
1113

1214
mod builtin;
1315
mod session_diagnostics;

Diff for: compiler/rustc_baked_icu_data/src/lib.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020
//! --cldr-tag latest --icuexport-tag latest -o src/data
2121
//! ```
2222
23+
// tidy-alphabetical-start
24+
#![allow(elided_lifetimes_in_paths)]
2325
#![allow(internal_features)]
24-
#![feature(rustdoc_internals)]
2526
#![doc(rust_logo)]
26-
#![allow(elided_lifetimes_in_paths)]
27+
#![feature(rustdoc_internals)]
28+
// tidy-alphabetical-end
2729

2830
mod data {
2931
include!("data/mod.rs");

Diff for: compiler/rustc_borrowck/src/constraints/mod.rs

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
1-
use rustc_data_structures::graph::scc::Sccs;
1+
use crate::type_check::Locations;
22
use rustc_index::{IndexSlice, IndexVec};
33
use rustc_middle::mir::ConstraintCategory;
44
use rustc_middle::ty::{RegionVid, TyCtxt, VarianceDiagInfo};
55
use rustc_span::Span;
66
use std::fmt;
77
use std::ops::Index;
88

9-
use crate::type_check::Locations;
10-
119
pub(crate) mod graph;
1210

1311
/// A set of NLL region constraints. These include "outlives"
@@ -45,18 +43,6 @@ impl<'tcx> OutlivesConstraintSet<'tcx> {
4543
graph::ConstraintGraph::new(graph::Reverse, self, num_region_vars)
4644
}
4745

48-
/// Computes cycles (SCCs) in the graph of regions. In particular,
49-
/// find all regions R1, R2 such that R1: R2 and R2: R1 and group
50-
/// them into an SCC, and find the relationships between SCCs.
51-
pub(crate) fn compute_sccs(
52-
&self,
53-
constraint_graph: &graph::NormalConstraintGraph,
54-
static_region: RegionVid,
55-
) -> Sccs<RegionVid, ConstraintSccIndex> {
56-
let region_graph = &constraint_graph.region_graph(self, static_region);
57-
Sccs::new(region_graph)
58-
}
59-
6046
pub(crate) fn outlives(
6147
&self,
6248
) -> &IndexSlice<OutlivesConstraintIndex, OutlivesConstraint<'tcx>> {

Diff for: compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+17-4
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
557557
// for the branching codepaths that aren't covered, to point at them.
558558
let map = self.infcx.tcx.hir();
559559
let body = map.body_owned_by(self.mir_def_id());
560-
561-
let mut visitor = ConditionVisitor { spans: &spans, name: &name, errors: vec![] };
560+
let mut visitor =
561+
ConditionVisitor { tcx: self.infcx.tcx, spans: &spans, name: &name, errors: vec![] };
562562
visitor.visit_body(&body);
563563

564564
let mut show_assign_sugg = false;
@@ -4372,13 +4372,14 @@ impl<'hir> Visitor<'hir> for BreakFinder {
43724372

43734373
/// Given a set of spans representing statements initializing the relevant binding, visit all the
43744374
/// function expressions looking for branching code paths that *do not* initialize the binding.
4375-
struct ConditionVisitor<'b> {
4375+
struct ConditionVisitor<'b, 'tcx> {
4376+
tcx: TyCtxt<'tcx>,
43764377
spans: &'b [Span],
43774378
name: &'b str,
43784379
errors: Vec<(Span, String)>,
43794380
}
43804381

4381-
impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> {
4382+
impl<'b, 'v, 'tcx> Visitor<'v> for ConditionVisitor<'b, 'tcx> {
43824383
fn visit_expr(&mut self, ex: &'v hir::Expr<'v>) {
43834384
match ex.kind {
43844385
hir::ExprKind::If(cond, body, None) => {
@@ -4464,6 +4465,12 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> {
44644465
),
44654466
));
44664467
} else if let Some(guard) = &arm.guard {
4468+
if matches!(
4469+
self.tcx.hir_node(arm.body.hir_id),
4470+
hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Ret(_), .. })
4471+
) {
4472+
continue;
4473+
}
44674474
self.errors.push((
44684475
arm.pat.span.to(guard.span),
44694476
format!(
@@ -4473,6 +4480,12 @@ impl<'b, 'v> Visitor<'v> for ConditionVisitor<'b> {
44734480
),
44744481
));
44754482
} else {
4483+
if matches!(
4484+
self.tcx.hir_node(arm.body.hir_id),
4485+
hir::Node::Expr(hir::Expr { kind: hir::ExprKind::Ret(_), .. })
4486+
) {
4487+
continue;
4488+
}
44764489
self.errors.push((
44774490
arm.pat.span,
44784491
format!(

Diff for: compiler/rustc_borrowck/src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! This query borrow-checks the MIR to (further) ensure it is not broken.
22
3+
// tidy-alphabetical-start
34
#![allow(internal_features)]
4-
#![feature(rustdoc_internals)]
55
#![doc(rust_logo)]
66
#![feature(assert_matches)]
77
#![feature(box_patterns)]
@@ -10,8 +10,10 @@
1010
#![feature(min_specialization)]
1111
#![feature(never_type)]
1212
#![feature(rustc_attrs)]
13+
#![feature(rustdoc_internals)]
1314
#![feature(stmt_expr_attributes)]
1415
#![feature(try_blocks)]
16+
// tidy-alphabetical-end
1517

1618
#[macro_use]
1719
extern crate tracing;

0 commit comments

Comments
 (0)