Skip to content

Commit d84b903

Browse files
committed
Auto merge of #125294 - matthiaskrgr:rollup-w42c829, r=matthiaskrgr
Rollup of 4 pull requests Successful merges: - #124948 (chore: Remove repeated words (extension of #124924)) - #124992 (Add example to IsTerminal::is_terminal) - #125279 (make `Debug` impl for `Term` simpler) - #125286 (Miri subtree update) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 1d1283e + 7a45322 commit d84b903

File tree

93 files changed

+1372
-650
lines changed

Some content is hidden

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

93 files changed

+1372
-650
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3426,9 +3426,9 @@ dependencies = [
34263426

34273427
[[package]]
34283428
name = "rustc-build-sysroot"
3429-
version = "0.4.7"
3429+
version = "0.5.2"
34303430
source = "registry+https://github.com/rust-lang/crates.io-index"
3431-
checksum = "ab1dbbd1bdf65fdac44c885f6cca147ba179108ce284b60a08ccc04b1f1dbac0"
3431+
checksum = "fa3ca63cc537c1cb69e4c2c0afc5fda2ccd36ac84c97d5a4ae05e69b1c834afb"
34323432
dependencies = [
34333433
"anyhow",
34343434
"rustc_version",

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
652652
}
653653

654654
// FIXME: We make sure that this is a normal top-level binding,
655-
// but we could suggest `todo!()` for all uninitialized bindings in the pattern pattern
655+
// but we could suggest `todo!()` for all uninitialized bindings in the pattern
656656
if let hir::StmtKind::Let(hir::LetStmt { span, ty, init: None, pat, .. }) =
657657
&ex.kind
658658
&& let hir::PatKind::Binding(..) = pat.kind

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
31123112

31133113
let true_errors = ocx.select_where_possible();
31143114

3115-
// Do a leak check -- we can't really report report a useful error here,
3115+
// Do a leak check -- we can't really report a useful error here,
31163116
// but it at least avoids an ICE when the error has to do with higher-ranked
31173117
// lifetimes.
31183118
self.leak_check(outer_universe, Some(snapshot))?;

compiler/rustc_lint/src/non_local_def.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ declare_lint! {
3838
///
3939
/// Creating non-local definitions go against expectation and can create discrepancies
4040
/// in tooling. It should be avoided. It may become deny-by-default in edition 2024
41-
/// and higher, see see the tracking issue <https://github.com/rust-lang/rust/issues/120363>.
41+
/// and higher, see the tracking issue <https://github.com/rust-lang/rust/issues/120363>.
4242
///
4343
/// An `impl` definition is non-local if it is nested inside an item and neither
4444
/// the type nor the trait are at the same nesting level as the `impl` block.

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -536,14 +536,10 @@ unsafe impl<'tcx> Sync for Term<'tcx> where &'tcx (Ty<'tcx>, Const<'tcx>): Sync
536536

537537
impl Debug for Term<'_> {
538538
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
539-
let data = if let Some(ty) = self.ty() {
540-
format!("Term::Ty({ty:?})")
541-
} else if let Some(ct) = self.ct() {
542-
format!("Term::Ct({ct:?})")
543-
} else {
544-
unreachable!()
545-
};
546-
f.write_str(&data)
539+
match self.unpack() {
540+
TermKind::Ty(ty) => write!(f, "Term::Ty({ty:?})"),
541+
TermKind::Const(ct) => write!(f, "Term::Const({ct:?})"),
542+
}
547543
}
548544
}
549545

compiler/rustc_sanitizers/src/cfi/typeid/itanium_cxx_abi/transform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ fn trait_object_ty<'tcx>(tcx: TyCtxt<'tcx>, poly_trait_ref: ty::PolyTraitRef<'tc
269269
/// if a function is member of the group derived from this type id. Therefore, in the first call to
270270
/// typeid_for_fnabi (when type ids are attached to functions and methods), it can only include at
271271
/// most as much information that would be available in the second call (i.e., during code
272-
/// generation at call sites); otherwise, the type ids would not not match.
272+
/// generation at call sites); otherwise, the type ids would not match.
273273
///
274274
/// For this, it:
275275
///

library/portable-simd/crates/core_simd/src/ops.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ macro_rules! for_base_types {
122122
#[inline]
123123
#[must_use = "operator returns a new vector without mutating the inputs"]
124124
// TODO: only useful for int Div::div, but we hope that this
125-
// will essentially always always get inlined anyway.
125+
// will essentially always get inlined anyway.
126126
#[track_caller]
127127
fn $call(self, rhs: Self) -> Self::Output {
128128
$macro_impl!(self, rhs, $inner, $scalar)

library/std/src/io/stdio.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,41 @@ pub trait IsTerminal: crate::sealed::Sealed {
11611161
/// starting with `msys-` or `cygwin-` and ending in `-pty` will be considered terminals.
11621162
/// Note that this [may change in the future][changes].
11631163
///
1164+
/// # Examples
1165+
///
1166+
/// An example of a type for which `IsTerminal` is implemented is [`Stdin`]:
1167+
///
1168+
/// ```no_run
1169+
/// use std::io::{self, IsTerminal, Write};
1170+
///
1171+
/// fn main() -> io::Result<()> {
1172+
/// let stdin = io::stdin();
1173+
///
1174+
/// // Indicate that the user is prompted for input, if this is a terminal.
1175+
/// if stdin.is_terminal() {
1176+
/// print!("> ");
1177+
/// io::stdout().flush()?;
1178+
/// }
1179+
///
1180+
/// let mut name = String::new();
1181+
/// let _ = stdin.read_line(&mut name)?;
1182+
///
1183+
/// println!("Hello {}", name.trim_end());
1184+
///
1185+
/// Ok(())
1186+
/// }
1187+
/// ```
1188+
///
1189+
/// The example can be run in two ways:
1190+
///
1191+
/// - If you run this example by piping some text to it, e.g. `echo "foo" | path/to/executable`
1192+
/// it will print: `Hello foo`.
1193+
/// - If you instead run the example interactively by running the executable directly, it will
1194+
/// panic with the message "Expected input to be piped to the process".
1195+
///
1196+
///
11641197
/// [changes]: io#platform-specific-behavior
1198+
/// [`Stdin`]: crate::io::Stdin
11651199
#[stable(feature = "is_terminal", since = "1.70.0")]
11661200
fn is_terminal(&self) -> bool;
11671201
}

src/tools/clippy/clippy_lints/src/methods/needless_collect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ pub(super) fn check<'tcx>(
127127
}
128128
}
129129

130-
/// checks for for collecting into a (generic) method or function argument
130+
/// checks for collecting into a (generic) method or function argument
131131
/// taking an `IntoIterator`
132132
fn check_collect_into_intoiterator<'tcx>(
133133
cx: &LateContext<'tcx>,

src/tools/clippy/tests/ui/ptr_arg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ mod issue_9218 {
282282
todo!()
283283
}
284284

285-
// These two's return types don't use use 'a so it's not okay
285+
// These two's return types don't use 'a so it's not okay
286286
fn cow_bad_ret_ty_1<'a>(input: &'a Cow<'a, str>) -> &'static str {
287287
//~^ ERROR: using a reference to `Cow` is not recommended
288288
todo!()

0 commit comments

Comments
 (0)