Skip to content

Commit 854f225

Browse files
committed
Auto merge of rust-lang#136350 - matthiaskrgr:rollup-6eqfyvh, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - rust-lang#134531 ([rustdoc] Add `--extract-doctests` command-line flag) - rust-lang#135860 (Compiler: Finalize dyn compatibility renaming) - rust-lang#135992 (Improve documentation when adding a new target) - rust-lang#136194 (Support clobber_abi in BPF inline assembly) - rust-lang#136325 (Delay a bug when indexing unsized slices) - rust-lang#136326 (Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`) - rust-lang#136330 (Remove unnecessary hooks) - rust-lang#136336 (Overhaul `rustc_middle::util`) - rust-lang#136341 (Remove myself from vacation) r? `@ghost` `@rustbot` modify labels: rollup
2 parents aa4cfd0 + fb67f3a commit 854f225

File tree

148 files changed

+838
-512
lines changed

Some content is hidden

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

148 files changed

+838
-512
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3777,7 +3777,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
37773777
let tcx = self.infcx.tcx;
37783778
if let Some(Terminator { kind: TerminatorKind::Call { call_source, fn_span, .. }, .. }) =
37793779
&self.body[loan.reserve_location.block].terminator
3780-
&& let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
3780+
&& let Some((method_did, method_args)) = mir::find_self_call(
37813781
tcx,
37823782
self.body,
37833783
loan.assigned_place.local,

compiler/rustc_borrowck/src/diagnostics/mod.rs

+4-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use rustc_middle::mir::tcx::PlaceTy;
1717
use rustc_middle::mir::{
1818
AggregateKind, CallSource, ConstOperand, ConstraintCategory, FakeReadCause, Local, LocalInfo,
1919
LocalKind, Location, Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement,
20-
StatementKind, Terminator, TerminatorKind,
20+
StatementKind, Terminator, TerminatorKind, find_self_call,
2121
};
2222
use rustc_middle::ty::print::Print;
2323
use rustc_middle::ty::{self, Ty, TyCtxt};
@@ -1016,12 +1016,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
10161016
kind: TerminatorKind::Call { fn_span, call_source, .. }, ..
10171017
}) = &self.body[location.block].terminator
10181018
{
1019-
let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
1020-
self.infcx.tcx,
1021-
self.body,
1022-
target_temp,
1023-
location.block,
1024-
) else {
1019+
let Some((method_did, method_args)) =
1020+
find_self_call(self.infcx.tcx, self.body, target_temp, location.block)
1021+
else {
10251022
return normal_ret;
10261023
};
10271024

compiler/rustc_const_eval/src/check_consts/check.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
634634
Rvalue::RawPtr(RawPtrKind::FakeForPtrMetadata, place) => {
635635
// These are only inserted for slice length, so the place must already be indirect.
636636
// This implies we do not have to worry about whether the borrow escapes.
637-
assert!(place.is_indirect(), "fake borrows are always indirect");
637+
if !place.is_indirect() {
638+
self.tcx.dcx().span_delayed_bug(
639+
self.body.source_info(location).span,
640+
"fake borrows are always indirect",
641+
);
642+
}
638643
}
639644

640645
Rvalue::Cast(

compiler/rustc_data_structures/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ pub mod sync;
7676
pub mod tagged_ptr;
7777
pub mod temp_dir;
7878
pub mod thinvec;
79+
pub mod thousands;
7980
pub mod transitive_relation;
8081
pub mod unhash;
8182
pub mod unord;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//! This is an extremely bare-bones alternative to the `thousands` crate on
2+
//! crates.io, for printing large numbers in a readable fashion.
3+
4+
#[cfg(test)]
5+
mod tests;
6+
7+
// Converts the number to a string, with underscores as the thousands separator.
8+
pub fn format_with_underscores(n: usize) -> String {
9+
let mut s = n.to_string();
10+
let mut i = s.len();
11+
while i > 3 {
12+
i -= 3;
13+
s.insert(i, '_');
14+
}
15+
s
16+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
use super::*;
2+
3+
#[test]
4+
fn test_format_with_underscores() {
5+
assert_eq!("0", format_with_underscores(0));
6+
assert_eq!("1", format_with_underscores(1));
7+
assert_eq!("99", format_with_underscores(99));
8+
assert_eq!("345", format_with_underscores(345));
9+
assert_eq!("1_000", format_with_underscores(1_000));
10+
assert_eq!("12_001", format_with_underscores(12_001));
11+
assert_eq!("999_999", format_with_underscores(999_999));
12+
assert_eq!("1_000_000", format_with_underscores(1_000_000));
13+
assert_eq!("12_345_678", format_with_underscores(12_345_678));
14+
}

compiler/rustc_driver_impl/src/pretty.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use rustc_ast_pretty::pprust as pprust_ast;
77
use rustc_middle::bug;
88
use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
99
use rustc_middle::ty::{self, TyCtxt};
10+
use rustc_mir_build::thir::print::{thir_flat, thir_tree};
1011
use rustc_session::Session;
1112
use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
1213
use rustc_smir::rustc_internal::pretty::write_smir_pretty;
@@ -313,7 +314,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
313314
tcx.dcx().abort_if_errors();
314315
debug!("pretty printing THIR tree");
315316
for did in tcx.hir().body_owners() {
316-
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_tree(did));
317+
let _ = writeln!(out, "{:?}:\n{}\n", did, thir_tree(tcx, did));
317318
}
318319
out
319320
}
@@ -324,7 +325,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
324325
tcx.dcx().abort_if_errors();
325326
debug!("pretty printing THIR flat");
326327
for did in tcx.hir().body_owners() {
327-
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_flat(did));
328+
let _ = writeln!(out, "{:?}:\n{}\n", did, thir_flat(tcx, did));
328329
}
329330
out
330331
}

compiler/rustc_hir_analysis/src/coherence/mod.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,9 @@ fn check_object_overlap<'tcx>(
199199

200200
for component_def_id in component_def_ids {
201201
if !tcx.is_dyn_compatible(component_def_id) {
202-
// FIXME(dyn_compat_renaming): Rename test and update comment.
203202
// Without the 'dyn_compatible_for_dispatch' feature this is an error
204203
// which will be reported by wfcheck. Ignore it here.
205-
// This is tested by `coherence-impl-trait-for-trait-object-safe.rs`.
204+
// This is tested by `coherence-impl-trait-for-trait-dyn-compatible.rs`.
206205
// With the feature enabled, the trait is not implemented automatically,
207206
// so this is valid.
208207
} else {

compiler/rustc_lint/src/multiple_supertrait_upcastable.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTAB
3737
impl<'tcx> LateLintPass<'tcx> for MultipleSupertraitUpcastable {
3838
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
3939
let def_id = item.owner_id.to_def_id();
40-
// NOTE(nbdd0121): use `object_safety_violations` instead of `is_dyn_compatible` because
40+
// NOTE(nbdd0121): use `dyn_compatibility_violations` instead of `is_dyn_compatible` because
4141
// the latter will report `where_clause_object_safety` lint.
4242
if let hir::ItemKind::Trait(_, _, _, _, _) = item.kind
4343
&& cx.tcx.is_dyn_compatible(def_id)

0 commit comments

Comments
 (0)