Skip to content

Commit 6368208

Browse files
committed
Auto merge of rust-lang#137988 - tgross35:rollup-l9pl7oh, r=tgross35
Rollup of 10 pull requests Successful merges: - rust-lang#134063 (dec2flt: Clean up float parsing modules) - rust-lang#136581 (Retire the legacy `Makefile`-based `run-make` test infra) - rust-lang#136975 (Look for `python3` first on MacOS, not `py`) - rust-lang#137147 (Add exclude to config.toml) - rust-lang#137240 (Slightly reformat `std::fs::remove_dir_all` error docs) - rust-lang#137303 (Remove `MaybeForgetReturn` suggestion) - rust-lang#137327 (Undeprecate env::home_dir) - rust-lang#137463 ([illumos] attempt to use posix_spawn to spawn processes) - rust-lang#137534 ([rustdoc] hide item that is not marked as doc(inline) and whose src is doc(hidden)) - rust-lang#137829 (Stabilize [T]::split_off... methods) r? `@ghost` `@rustbot` modify labels: rollup
2 parents fd17dea + acdf367 commit 6368208

Some content is hidden

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

64 files changed

+1031
-1505
lines changed

compiler/rustc_errors/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,6 @@ pub enum StashKey {
626626
MaybeFruTypo,
627627
CallAssocMethod,
628628
AssociatedTypeSuggestion,
629-
MaybeForgetReturn,
630629
/// Query cycle detected, stashing in favor of a better error.
631630
Cycle,
632631
UndeterminedMacroResolution,

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

-5
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
669669

670670
if !errors.is_empty() {
671671
self.adjust_fulfillment_errors_for_expr_obligation(&mut errors);
672-
let errors_causecode = errors
673-
.iter()
674-
.map(|e| (e.obligation.cause.span, e.root_obligation.cause.code().clone()))
675-
.collect::<Vec<_>>();
676672
self.err_ctxt().report_fulfillment_errors(errors);
677-
self.collect_unused_stmts_for_coerce_return_ty(errors_causecode);
678673
}
679674
}
680675

compiler/rustc_hir_typeck/src/fn_ctxt/checks.rs

+1-59
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ use std::{fmt, iter, mem};
33
use itertools::Itertools;
44
use rustc_data_structures::fx::FxIndexSet;
55
use rustc_errors::codes::*;
6-
use rustc_errors::{
7-
Applicability, Diag, ErrorGuaranteed, MultiSpan, StashKey, a_or_an, listify, pluralize,
8-
};
6+
use rustc_errors::{Applicability, Diag, ErrorGuaranteed, MultiSpan, a_or_an, listify, pluralize};
97
use rustc_hir::def::{CtorOf, DefKind, Res};
108
use rustc_hir::def_id::DefId;
119
use rustc_hir::intravisit::Visitor;
@@ -2193,62 +2191,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21932191
}
21942192
}
21952193

2196-
pub(super) fn collect_unused_stmts_for_coerce_return_ty(
2197-
&self,
2198-
errors_causecode: Vec<(Span, ObligationCauseCode<'tcx>)>,
2199-
) {
2200-
for (span, code) in errors_causecode {
2201-
self.dcx().try_steal_modify_and_emit_err(span, StashKey::MaybeForgetReturn, |err| {
2202-
if let Some(fn_sig) = self.body_fn_sig()
2203-
&& let ObligationCauseCode::WhereClauseInExpr(_, _, binding_hir_id, ..) = code
2204-
&& !fn_sig.output().is_unit()
2205-
{
2206-
let mut block_num = 0;
2207-
let mut found_semi = false;
2208-
for (hir_id, node) in self.tcx.hir_parent_iter(binding_hir_id) {
2209-
// Don't proceed into parent bodies
2210-
if hir_id.owner != binding_hir_id.owner {
2211-
break;
2212-
}
2213-
match node {
2214-
hir::Node::Stmt(stmt) => {
2215-
if let hir::StmtKind::Semi(expr) = stmt.kind {
2216-
let expr_ty = self.typeck_results.borrow().expr_ty(expr);
2217-
let return_ty = fn_sig.output();
2218-
if !matches!(expr.kind, hir::ExprKind::Ret(..))
2219-
&& self.may_coerce(expr_ty, return_ty)
2220-
{
2221-
found_semi = true;
2222-
}
2223-
}
2224-
}
2225-
hir::Node::Block(_block) => {
2226-
if found_semi {
2227-
block_num += 1;
2228-
}
2229-
}
2230-
hir::Node::Item(item) => {
2231-
if let hir::ItemKind::Fn { .. } = item.kind {
2232-
break;
2233-
}
2234-
}
2235-
_ => {}
2236-
}
2237-
}
2238-
if block_num > 1 && found_semi {
2239-
err.span_suggestion_verbose(
2240-
// use the span of the *whole* expr
2241-
self.tcx.hir().span(binding_hir_id).shrink_to_lo(),
2242-
"you might have meant to return this to infer its type parameters",
2243-
"return ",
2244-
Applicability::MaybeIncorrect,
2245-
);
2246-
}
2247-
}
2248-
});
2249-
}
2250-
}
2251-
22522194
/// Given a vector of fulfillment errors, try to adjust the spans of the
22532195
/// errors to more accurately point at the cause of the failure.
22542196
///

compiler/rustc_trait_selection/src/error_reporting/traits/ambiguity.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
use std::ops::ControlFlow;
22

3-
use rustc_errors::{
4-
Applicability, Diag, E0283, E0284, E0790, MultiSpan, StashKey, struct_span_code_err,
5-
};
3+
use rustc_errors::{Applicability, Diag, E0283, E0284, E0790, MultiSpan, struct_span_code_err};
64
use rustc_hir as hir;
75
use rustc_hir::LangItem;
86
use rustc_hir::def::{DefKind, Res};
@@ -197,7 +195,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
197195
// be ignoring the fact that we don't KNOW the type works
198196
// out. Though even that would probably be harmless, given that
199197
// we're only talking about builtin traits, which are known to be
200-
// inhabited. We used to check for `self.tcx.sess.has_errors()` to
198+
// inhabited. We used to check for `self.tainted_by_errors()` to
201199
// avoid inundating the user with unnecessary errors, but we now
202200
// check upstream for type errors and don't add the obligations to
203201
// begin with in those cases.
@@ -211,7 +209,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
211209
TypeAnnotationNeeded::E0282,
212210
false,
213211
);
214-
return err.stash(span, StashKey::MaybeForgetReturn).unwrap();
212+
return err.emit();
215213
}
216214
Some(e) => return e,
217215
}

config.example.toml

+4
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,10 @@
425425
# a specific version.
426426
#ccache = false
427427

428+
# List of paths to exclude from the build and test processes.
429+
# For example, exclude = ["tests/ui", "src/tools/tidy"].
430+
#exclude = []
431+
428432
# =============================================================================
429433
# General install configuration options
430434
# =============================================================================

library/Cargo.lock

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ dependencies = [
151151

152152
[[package]]
153153
name = "libc"
154-
version = "0.2.169"
154+
version = "0.2.170"
155155
source = "registry+https://github.com/rust-lang/crates.io-index"
156-
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
156+
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
157157
dependencies = [
158158
"rustc-std-workspace-core",
159159
]

library/core/src/num/dec2flt/common.rs

+15-12
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ pub(crate) trait ByteSlice {
88
/// Writes a 64-bit integer as 8 bytes in little-endian order.
99
fn write_u64(&mut self, value: u64);
1010

11-
/// Calculate the offset of a slice from another.
11+
/// Calculate the difference in length between two slices.
1212
fn offset_from(&self, other: &Self) -> isize;
1313

1414
/// Iteratively parse and consume digits from bytes.
15-
/// Returns the same bytes with consumed digits being
16-
/// elided.
15+
///
16+
/// Returns the same bytes with consumed digits being elided. Breaks on invalid digits.
1717
fn parse_digits(&self, func: impl FnMut(u8)) -> &Self;
1818
}
1919

@@ -39,11 +39,11 @@ impl ByteSlice for [u8] {
3939
fn parse_digits(&self, mut func: impl FnMut(u8)) -> &Self {
4040
let mut s = self;
4141

42-
while let Some((c, s_next)) = s.split_first() {
42+
while let Some((c, rest)) = s.split_first() {
4343
let c = c.wrapping_sub(b'0');
4444
if c < 10 {
4545
func(c);
46-
s = s_next;
46+
s = rest;
4747
} else {
4848
break;
4949
}
@@ -53,27 +53,30 @@ impl ByteSlice for [u8] {
5353
}
5454
}
5555

56-
/// Determine if 8 bytes are all decimal digits.
56+
/// Determine if all characters in an 8-byte byte string (represented as a `u64`) are all decimal
57+
/// digits.
58+
///
5759
/// This does not care about the order in which the bytes were loaded.
5860
pub(crate) fn is_8digits(v: u64) -> bool {
5961
let a = v.wrapping_add(0x4646_4646_4646_4646);
6062
let b = v.wrapping_sub(0x3030_3030_3030_3030);
6163
(a | b) & 0x8080_8080_8080_8080 == 0
6264
}
6365

64-
/// A custom 64-bit floating point type, representing `f * 2^e`.
65-
/// e is biased, so it be directly shifted into the exponent bits.
66+
/// A custom 64-bit floating point type, representing `m * 2^p`.
67+
/// p is biased, so it be directly shifted into the exponent bits.
6668
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default)]
6769
pub struct BiasedFp {
6870
/// The significant digits.
69-
pub f: u64,
71+
pub m: u64,
7072
/// The biased, binary exponent.
71-
pub e: i32,
73+
pub p_biased: i32,
7274
}
7375

7476
impl BiasedFp {
77+
/// Represent `0 ^ p`
7578
#[inline]
76-
pub const fn zero_pow2(e: i32) -> Self {
77-
Self { f: 0, e }
79+
pub const fn zero_pow2(p_biased: i32) -> Self {
80+
Self { m: 0, p_biased }
7881
}
7982
}

0 commit comments

Comments
 (0)