From 757dbba891aacac23d2ed0f7015e248437843899 Mon Sep 17 00:00:00 2001 From: Goren Barak Date: Fri, 24 Nov 2023 11:42:18 -0500 Subject: [PATCH 1/2] made an error message more approachable in rust/library/core/src/str/mod.rs:116 --- compiler/rustc_ast/src/ptr.rs | 3 ++- library/core/src/str/mod.rs | 2 +- src/tools/rustfmt/tests/source/extern.rs | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/rustc_ast/src/ptr.rs b/compiler/rustc_ast/src/ptr.rs index 0140fb752bf92..6cc6d3526d65c 100644 --- a/compiler/rustc_ast/src/ptr.rs +++ b/compiler/rustc_ast/src/ptr.rs @@ -28,7 +28,8 @@ use std::{slice, vec}; use rustc_serialize::{Decodable, Decoder, Encodable, Encoder}; use rustc_data_structures::stable_hasher::{HashStable, StableHasher}; -/// An owned smart pointer. + +/// An owned smart pointer. pub struct P { ptr: Box, } diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 6aba9b6450941..e87a02d2b7a8b 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -113,7 +113,7 @@ fn slice_error_fail_rt(s: &str, begin: usize, end: usize) -> ! { // 2. begin <= end assert!( begin <= end, - "begin <= end ({} <= {}) when slicing `{}`{}", + "begin should be <= end ({} is not <= {}) when slicing `{}`{}", begin, end, s_trunc, diff --git a/src/tools/rustfmt/tests/source/extern.rs b/src/tools/rustfmt/tests/source/extern.rs index f51ba6e98c9f5..79b3b941c91f3 100644 --- a/src/tools/rustfmt/tests/source/extern.rs +++ b/src/tools/rustfmt/tests/source/extern.rs @@ -47,6 +47,7 @@ extern "Rust" { static ext: u32; extern "C" { fn syscall(number: libc::c_long /* comment 1 */, /* comm 2 */ ... /* sup? */) -> libc::c_long; + // im doing great! thanks for asking :). fn foo (x: *const c_char , ... ) -> libc::c_long; From 33e16be95fb4b6abfc8d49649e9542096adcb603 Mon Sep 17 00:00:00 2001 From: Goren Barak Date: Sat, 25 Nov 2023 10:50:48 -0500 Subject: [PATCH 2/2] removed message after sup? --- src/tools/rustfmt/tests/source/extern.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/tools/rustfmt/tests/source/extern.rs b/src/tools/rustfmt/tests/source/extern.rs index 79b3b941c91f3..f51ba6e98c9f5 100644 --- a/src/tools/rustfmt/tests/source/extern.rs +++ b/src/tools/rustfmt/tests/source/extern.rs @@ -47,7 +47,6 @@ extern "Rust" { static ext: u32; extern "C" { fn syscall(number: libc::c_long /* comment 1 */, /* comm 2 */ ... /* sup? */) -> libc::c_long; - // im doing great! thanks for asking :). fn foo (x: *const c_char , ... ) -> libc::c_long;