Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 9 pull requests #136350

Merged
merged 32 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
11de4b7
Cross-link documentation for adding a new target
madsmtm Jan 24, 2025
57b5d3a
Compiler: Finalize dyn compatibility renaming
fmease Jan 22, 2025
e586382
Support clobber_abi in BPF inline assembly
taiki-e Jan 28, 2025
0323af9
Add new output-format
GuillaumeGomez Jan 27, 2025
7fa2094
Add ui test for new rustdoc `--output-format=doctest` option
GuillaumeGomez Jan 27, 2025
43bf529
Move extracted doctest code and types into its own file
GuillaumeGomez Jan 27, 2025
5e9e27e
Mention the tracking issue of `--output-format=doctest`
GuillaumeGomez Jan 27, 2025
07c8789
Add documentation for `--output-format=doctest`
GuillaumeGomez Jan 27, 2025
a5d66e0
Improve code and add missing docs for new `doctest::extracted` module
GuillaumeGomez Jan 29, 2025
b795138
Improve check for `--output-format` combinations and add ui regressio…
GuillaumeGomez Jan 29, 2025
635c6d0
Simplify `bug!` and `span_bug!`.
nnethercote Jan 30, 2025
d6e8c7f
Delay a bug when indexing unsized slices
compiler-errors Jan 31, 2025
63a039a
Replace our `LLVMRustDIBuilderRef` with LLVM-C's `LLVMDIBuilderRef`
Zalathar Jan 31, 2025
bf15d59
Remove the temporary typedef for `LLVMRustDIFlags`
Zalathar Jan 31, 2025
be1aa7b
Add/clarify comments about hooks.
nnethercote Jan 31, 2025
4b025ca
Remove the `thir_{tree,flat}` hooks.
nnethercote Jan 31, 2025
1d2cb61
Remove the `mir_build` hook.
nnethercote Jan 31, 2025
3f5e218
Give a better explanation for having `bug_fmt` and `span_bug_fmt`.
nnethercote Jan 30, 2025
1408173
Move `find_self_call`.
nnethercote Jan 30, 2025
4ced93e
Don't export the `Trivial*` macros.
nnethercote Jan 30, 2025
0c47091
Overhaul `to_readable_str`.
nnethercote Jan 30, 2025
780cd71
triagebot: remove myself from vacation
jieyouxu Jan 31, 2025
7df38d9
Recommend adding target spec first, then std support later
madsmtm Jan 24, 2025
86595e4
Rollup merge of #134531 - GuillaumeGomez:extract-doctests, r=notriddl…
matthiaskrgr Jan 31, 2025
308ea71
Rollup merge of #135860 - fmease:compiler-mv-obj-save-dyn-compat-ii, …
matthiaskrgr Jan 31, 2025
f818842
Rollup merge of #135992 - madsmtm:new-target-docs, r=jieyouxu
matthiaskrgr Jan 31, 2025
12a7f06
Rollup merge of #136194 - taiki-e:bpf-clobber-abi, r=amanieu
matthiaskrgr Jan 31, 2025
f1daf9e
Rollup merge of #136325 - compiler-errors:indirectly, r=RalfJung
matthiaskrgr Jan 31, 2025
a5a005f
Rollup merge of #136326 - Zalathar:llvm-di-builder-ref, r=nikic
matthiaskrgr Jan 31, 2025
417aa6c
Rollup merge of #136330 - nnethercote:rm-unnecessary-hooks, r=oli-obk
matthiaskrgr Jan 31, 2025
95f746d
Rollup merge of #136336 - nnethercote:overhaul-rustc_middle-util, r=j…
matthiaskrgr Jan 31, 2025
fb67f3a
Rollup merge of #136341 - jieyouxu:unvac, r=jieyouxu
matthiaskrgr Jan 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3777,7 +3777,7 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
let tcx = self.infcx.tcx;
if let Some(Terminator { kind: TerminatorKind::Call { call_source, fn_span, .. }, .. }) =
&self.body[loan.reserve_location.block].terminator
&& let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
&& let Some((method_did, method_args)) = mir::find_self_call(
tcx,
self.body,
loan.assigned_place.local,
Expand Down
11 changes: 4 additions & 7 deletions compiler/rustc_borrowck/src/diagnostics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use rustc_middle::mir::tcx::PlaceTy;
use rustc_middle::mir::{
AggregateKind, CallSource, ConstOperand, ConstraintCategory, FakeReadCause, Local, LocalInfo,
LocalKind, Location, Operand, Place, PlaceRef, ProjectionElem, Rvalue, Statement,
StatementKind, Terminator, TerminatorKind,
StatementKind, Terminator, TerminatorKind, find_self_call,
};
use rustc_middle::ty::print::Print;
use rustc_middle::ty::{self, Ty, TyCtxt};
Expand Down Expand Up @@ -1016,12 +1016,9 @@ impl<'infcx, 'tcx> MirBorrowckCtxt<'_, 'infcx, 'tcx> {
kind: TerminatorKind::Call { fn_span, call_source, .. }, ..
}) = &self.body[location.block].terminator
{
let Some((method_did, method_args)) = rustc_middle::util::find_self_call(
self.infcx.tcx,
self.body,
target_temp,
location.block,
) else {
let Some((method_did, method_args)) =
find_self_call(self.infcx.tcx, self.body, target_temp, location.block)
else {
return normal_ret;
};

Expand Down
7 changes: 6 additions & 1 deletion compiler/rustc_const_eval/src/check_consts/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,12 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
Rvalue::RawPtr(RawPtrKind::FakeForPtrMetadata, place) => {
// These are only inserted for slice length, so the place must already be indirect.
// This implies we do not have to worry about whether the borrow escapes.
assert!(place.is_indirect(), "fake borrows are always indirect");
if !place.is_indirect() {
self.tcx.dcx().span_delayed_bug(
self.body.source_info(location).span,
"fake borrows are always indirect",
);
}
}

Rvalue::Cast(
Expand Down
1 change: 1 addition & 0 deletions compiler/rustc_data_structures/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ pub mod sync;
pub mod tagged_ptr;
pub mod temp_dir;
pub mod thinvec;
pub mod thousands;
pub mod transitive_relation;
pub mod unhash;
pub mod unord;
Expand Down
16 changes: 16 additions & 0 deletions compiler/rustc_data_structures/src/thousands/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//! This is an extremely bare-bones alternative to the `thousands` crate on
//! crates.io, for printing large numbers in a readable fashion.

#[cfg(test)]
mod tests;

// Converts the number to a string, with underscores as the thousands separator.
pub fn format_with_underscores(n: usize) -> String {
let mut s = n.to_string();
let mut i = s.len();
while i > 3 {
i -= 3;
s.insert(i, '_');
}
s
}
14 changes: 14 additions & 0 deletions compiler/rustc_data_structures/src/thousands/tests.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
use super::*;

#[test]
fn test_format_with_underscores() {
assert_eq!("0", format_with_underscores(0));
assert_eq!("1", format_with_underscores(1));
assert_eq!("99", format_with_underscores(99));
assert_eq!("345", format_with_underscores(345));
assert_eq!("1_000", format_with_underscores(1_000));
assert_eq!("12_001", format_with_underscores(12_001));
assert_eq!("999_999", format_with_underscores(999_999));
assert_eq!("1_000_000", format_with_underscores(1_000_000));
assert_eq!("12_345_678", format_with_underscores(12_345_678));
}
5 changes: 3 additions & 2 deletions compiler/rustc_driver_impl/src/pretty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use rustc_ast_pretty::pprust as pprust_ast;
use rustc_middle::bug;
use rustc_middle::mir::{write_mir_graphviz, write_mir_pretty};
use rustc_middle::ty::{self, TyCtxt};
use rustc_mir_build::thir::print::{thir_flat, thir_tree};
use rustc_session::Session;
use rustc_session::config::{OutFileName, PpHirMode, PpMode, PpSourceMode};
use rustc_smir::rustc_internal::pretty::write_smir_pretty;
Expand Down Expand Up @@ -313,7 +314,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
tcx.dcx().abort_if_errors();
debug!("pretty printing THIR tree");
for did in tcx.hir().body_owners() {
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_tree(did));
let _ = writeln!(out, "{:?}:\n{}\n", did, thir_tree(tcx, did));
}
out
}
Expand All @@ -324,7 +325,7 @@ pub fn print<'tcx>(sess: &Session, ppm: PpMode, ex: PrintExtra<'tcx>) {
tcx.dcx().abort_if_errors();
debug!("pretty printing THIR flat");
for did in tcx.hir().body_owners() {
let _ = writeln!(out, "{:?}:\n{}\n", did, tcx.thir_flat(did));
let _ = writeln!(out, "{:?}:\n{}\n", did, thir_flat(tcx, did));
}
out
}
Expand Down
3 changes: 1 addition & 2 deletions compiler/rustc_hir_analysis/src/coherence/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,9 @@ fn check_object_overlap<'tcx>(

for component_def_id in component_def_ids {
if !tcx.is_dyn_compatible(component_def_id) {
// FIXME(dyn_compat_renaming): Rename test and update comment.
// Without the 'dyn_compatible_for_dispatch' feature this is an error
// which will be reported by wfcheck. Ignore it here.
// This is tested by `coherence-impl-trait-for-trait-object-safe.rs`.
// This is tested by `coherence-impl-trait-for-trait-dyn-compatible.rs`.
// With the feature enabled, the trait is not implemented automatically,
// so this is valid.
} else {
Expand Down
2 changes: 1 addition & 1 deletion compiler/rustc_lint/src/multiple_supertrait_upcastable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ declare_lint_pass!(MultipleSupertraitUpcastable => [MULTIPLE_SUPERTRAIT_UPCASTAB
impl<'tcx> LateLintPass<'tcx> for MultipleSupertraitUpcastable {
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx hir::Item<'tcx>) {
let def_id = item.owner_id.to_def_id();
// NOTE(nbdd0121): use `object_safety_violations` instead of `is_dyn_compatible` because
// NOTE(nbdd0121): use `dyn_compatibility_violations` instead of `is_dyn_compatible` because
// the latter will report `where_clause_object_safety` lint.
if let hir::ItemKind::Trait(_, _, _, _, _) = item.kind
&& cx.tcx.is_dyn_compatible(def_id)
Expand Down
Loading
Loading