diff --git a/compiler/rustc_codegen_llvm/src/back/lto.rs b/compiler/rustc_codegen_llvm/src/back/lto.rs index d52e34d30fb7d..b171424b46245 100644 --- a/compiler/rustc_codegen_llvm/src/back/lto.rs +++ b/compiler/rustc_codegen_llvm/src/back/lto.rs @@ -312,11 +312,7 @@ fn fat_lto( let data = bc_decoded.data(); unsafe { - if !llvm::LLVMRustLinkerAdd( - linker, - data.as_ptr() as *const libc::c_char, - data.len(), - ) { + if !llvm::LLVMRustLinkerAdd(linker, data.as_ptr(), data.len()) { llvm::LLVMRustLinkerFree(linker); write::llvm_err(dcx, LlvmError::LoadBitcode { name }) } @@ -327,10 +323,9 @@ fn fat_lto( // Internalize everything below threshold to help strip out more modules and such. unsafe { - let ptr = symbols_below_threshold.as_ptr(); llvm::LLVMRustRunRestrictionPass( llmod, - ptr as *const *const libc::c_char, + symbols_below_threshold.as_ptr(), symbols_below_threshold.len() as libc::size_t, ); } diff --git a/compiler/rustc_codegen_llvm/src/common.rs b/compiler/rustc_codegen_llvm/src/common.rs index a5a4f0b3ddb25..651082cee5d43 100644 --- a/compiler/rustc_codegen_llvm/src/common.rs +++ b/compiler/rustc_codegen_llvm/src/common.rs @@ -470,20 +470,14 @@ pub(crate) fn val_ty(v: &Value) -> &Type { } pub(crate) fn bytes_in_context<'ll>(llcx: &'ll llvm::Context, bytes: &[u8]) -> &'ll Value { - unsafe { - let ptr = bytes.as_ptr() as *const c_char; - llvm::LLVMConstStringInContext2(llcx, ptr, bytes.len(), TRUE) - } + unsafe { llvm::LLVMConstStringInContext2(llcx, bytes.as_ptr(), bytes.len(), TRUE) } } pub(crate) fn null_terminate_bytes_in_context<'ll>( llcx: &'ll llvm::Context, bytes: &[u8], ) -> &'ll Value { - unsafe { - let ptr = bytes.as_ptr() as *const c_char; - llvm::LLVMConstStringInContext2(llcx, ptr, bytes.len(), FALSE) - } + unsafe { llvm::LLVMConstStringInContext2(llcx, bytes.as_ptr(), bytes.len(), FALSE) } } pub(crate) fn named_struct<'ll>(ty: &'ll Type, elts: &[&'ll Value]) -> &'ll Value { diff --git a/compiler/rustc_codegen_llvm/src/context.rs b/compiler/rustc_codegen_llvm/src/context.rs index 1059de3c0aec0..46196ab7d360f 100644 --- a/compiler/rustc_codegen_llvm/src/context.rs +++ b/compiler/rustc_codegen_llvm/src/context.rs @@ -1,6 +1,6 @@ use std::borrow::{Borrow, Cow}; use std::cell::{Cell, RefCell}; -use std::ffi::{CStr, c_char, c_uint}; +use std::ffi::{CStr, c_uint}; use std::marker::PhantomData; use std::ops::{Deref, DerefMut}; use std::str; @@ -911,19 +911,11 @@ impl<'ll, CX: Borrow>> GenericCx<'ll, CX> { } pub(crate) fn get_md_kind_id(&self, name: &str) -> llvm::MetadataKindId { - unsafe { - llvm::LLVMGetMDKindIDInContext( - self.llcx(), - name.as_ptr() as *const c_char, - name.len() as c_uint, - ) - } + unsafe { llvm::LLVMGetMDKindIDInContext(self.llcx(), name.as_ptr(), name.len() as c_uint) } } pub(crate) fn create_metadata(&self, name: &[u8]) -> &'ll Metadata { - unsafe { - llvm::LLVMMDStringInContext2(self.llcx(), name.as_ptr() as *const c_char, name.len()) - } + unsafe { llvm::LLVMMDStringInContext2(self.llcx(), name.as_ptr(), name.len()) } } pub(crate) fn get_functions(&self) -> Vec<&'ll Value> { diff --git a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs index 68e5ed3d37741..2e76223c68c12 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/enzyme_ffi.rs @@ -329,10 +329,7 @@ pub(crate) mod Enzyme_AD { let c_fun_name = std::ffi::CString::new(fun_name) .unwrap_or_else(|err| bug!("failed to set_print_type_fun: {err}")); unsafe { - (self.EnzymeSetCLString)( - self.EnzymeFunctionToAnalyze, - c_fun_name.as_ptr() as *const c_char, - ); + (self.EnzymeSetCLString)(self.EnzymeFunctionToAnalyze, c_fun_name.as_ptr()); } } diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 7e3f2699fff0b..749ef8120da6f 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -890,7 +890,7 @@ unsafe extern "C" { pub(crate) fn LLVMContextSetDiscardValueNames(C: &Context, Discard: Bool); pub(crate) fn LLVMGetMDKindIDInContext( C: &Context, - Name: *const c_char, + Name: *const c_uchar, // See "PTR_LEN_STR". SLen: c_uint, ) -> MetadataKindId; @@ -1009,7 +1009,7 @@ unsafe extern "C" { // Operations on metadata pub(crate) fn LLVMMDStringInContext2( C: &Context, - Str: *const c_char, + Str: *const c_uchar, // See "PTR_LEN_STR". SLen: size_t, ) -> &Metadata; pub(crate) fn LLVMMDNodeInContext2<'a>( @@ -1042,7 +1042,7 @@ unsafe extern "C" { pub(crate) fn LLVMArrayType2(ElementType: &Type, ElementCount: u64) -> &Type; pub(crate) fn LLVMConstStringInContext2( C: &Context, - Str: *const c_char, + Str: *const c_uchar, // See "PTR_LEN_STR". Length: size_t, DontNullTerminate: Bool, ) -> &Value; @@ -2561,7 +2561,7 @@ unsafe extern "C" { pub(crate) fn LLVMRustLinkerNew(M: &Module) -> &mut Linker<'_>; pub(crate) fn LLVMRustLinkerAdd( linker: &Linker<'_>, - bytecode: *const c_char, + bytecode: *const c_uchar, // See "PTR_LEN_STR". bytecode_len: usize, ) -> bool; pub(crate) fn LLVMRustLinkerFree<'a>(linker: &'a mut Linker<'a>); diff --git a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs index 1614899ece03d..47d1f1b22c090 100644 --- a/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs +++ b/compiler/rustc_trait_selection/src/error_reporting/traits/fulfillment_errors.rs @@ -389,6 +389,7 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> { { self.tcx.def_span(def.did()) } + ty::Closure(def_id, _) => self.tcx.def_span(*def_id), _ => DUMMY_SP, }; if let Some(s) = label { diff --git a/library/core/src/time.rs b/library/core/src/time.rs index 6f33fdd36e53b..207ec52ce4637 100644 --- a/library/core/src/time.rs +++ b/library/core/src/time.rs @@ -278,7 +278,7 @@ impl Duration { } else { let secs = secs .checked_add((nanos / NANOS_PER_SEC) as u64) - .expect("overflow in Duration::new"); + .expect("adding carry-over seconds from nanoseconds should not exceed u64::MAX"); let nanos = nanos % NANOS_PER_SEC; // SAFETY: nanos % NANOS_PER_SEC < NANOS_PER_SEC, therefore nanos is within the valid range Duration { secs, nanos: unsafe { Nanoseconds::new_unchecked(nanos) } } @@ -1342,7 +1342,7 @@ const impl Add for Duration { #[inline] fn add(self, rhs: Duration) -> Duration { - self.checked_add(rhs).expect("overflow when adding durations") + self.checked_add(rhs).expect("adding durations should not exceed u64::MAX") } } @@ -1362,7 +1362,7 @@ const impl Sub for Duration { #[inline] fn sub(self, rhs: Duration) -> Duration { - self.checked_sub(rhs).expect("overflow when subtracting durations") + self.checked_sub(rhs).expect("subtracting durations should not be negative") } } @@ -1382,7 +1382,7 @@ const impl Mul for Duration { #[inline] fn mul(self, rhs: u32) -> Duration { - self.checked_mul(rhs).expect("overflow when multiplying duration by scalar") + self.checked_mul(rhs).expect("multiplying duration by scalar should not exceed u64::MAX") } } @@ -1414,7 +1414,7 @@ const impl Div for Duration { #[inline] #[track_caller] fn div(self, rhs: u32) -> Duration { - self.checked_div(rhs).expect("divide by zero error when dividing duration by scalar") + self.checked_div(rhs).expect("divisor should not be zero") } } @@ -1434,21 +1434,22 @@ macro_rules! sum_durations { let mut total_nanos: u64 = 0; for entry in $iter { - total_secs = - total_secs.checked_add(entry.secs).expect("overflow in iter::sum over durations"); + total_secs = total_secs + .checked_add(entry.secs) + .expect("sum over duration iterator should not overflow u64::MAX"); total_nanos = match total_nanos.checked_add(entry.nanos.as_inner() as u64) { Some(n) => n, None => { total_secs = total_secs .checked_add(total_nanos / NANOS_PER_SEC as u64) - .expect("overflow in iter::sum over durations"); + .expect("sum over duration iterator should not overflow u64::MAX"); (total_nanos % NANOS_PER_SEC as u64) + entry.nanos.as_inner() as u64 } }; } total_secs = total_secs .checked_add(total_nanos / NANOS_PER_SEC as u64) - .expect("overflow in iter::sum over durations"); + .expect("sum over duration iterator should not overflow u64::MAX"); total_nanos %= NANOS_PER_SEC as u64; Duration::new(total_secs, total_nanos as u32) }}; diff --git a/src/librustdoc/formats/cache.rs b/src/librustdoc/formats/cache.rs index 39baca1b4c0cd..ab539302396a0 100644 --- a/src/librustdoc/formats/cache.rs +++ b/src/librustdoc/formats/cache.rs @@ -18,6 +18,7 @@ use crate::formats::item_type::ItemType; use crate::html::render::{IndexItem, IndexItemInfo}; use crate::visit_lib::RustdocEffectiveVisibilities; +#[derive(Debug)] pub(crate) struct PathInfo { /// Parts of the fully qualified path. So in `foo::bar::bib`, it will /// be `["foo", "bar", "bib"]`. diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 464977d762488..9236bc952b06f 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -308,7 +308,7 @@ fn print_generic_args(generic_args: &clean::GenericArgs, cx: &Context<'_>) -> im } // Possible errors when computing href link source for a `DefId` -#[derive(PartialEq, Eq)] +#[derive(PartialEq, Eq, Debug)] pub(crate) enum HrefError { /// This item is known to rustdoc, but from a crate that does not have documentation generated. /// @@ -338,6 +338,7 @@ pub(crate) enum HrefError { } /// Type representing information of an `href` attribute. +#[derive(Debug)] pub(crate) struct HrefInfo { /// URL to the item page. pub(crate) url: String, @@ -530,6 +531,18 @@ fn generate_item_def_id_path( { def_id = trait_def_id; } else if let Some(new_def_id) = ty.ty_adt_def().map(|adt| adt.did()) { + // If the inferred item is available in the local path map, it means we're reexporting + // from the current crate, so better use the local path directly. + if cx.cache().paths.contains_key(&new_def_id) + && let Ok(mut info) = + href_with_jump_to_def_path_depth(new_def_id, cx, jump_to_def_path_depth, None) + { + let kind = ItemType::from_def_id(original_def_id, tcx); + // We need to append the anchor to the URL otherwise we're just linking to the + // parent item... + info.url = format!("{}#{kind}.{}", info.url, tcx.item_name(original_def_id)); + return Ok(info); + } def_id = new_def_id; maybe_have_impl_not_in_def_crate = !of_trait && !original_def_id.is_local() diff --git a/tests/rustdoc-html/jump-to-def/incoherent_impl-inlined.rs b/tests/rustdoc-html/jump-to-def/incoherent_impl-inlined.rs new file mode 100644 index 0000000000000..5f8c501e1a4a6 --- /dev/null +++ b/tests/rustdoc-html/jump-to-def/incoherent_impl-inlined.rs @@ -0,0 +1,21 @@ +//@ aux-build: incoherent_impl1.rs +//@ aux-build: incoherent_impl2.rs +//@ build-aux-docs +//@ compile-flags: -Zunstable-options --generate-link-to-definition + +#![crate_name = "foo"] + +extern crate incoherent_impl1; +extern crate incoherent_impl2; + +pub use incoherent_impl2::Error; + +//@ has 'src/foo/incoherent_impl-inlined.rs.html' +//@ has - '//pre//a[@href="../../foo/struct.Error.html#method.new"]' 'new' + +//@ has 'foo/struct.Error.html' +//@ has - '//*[@id="method.new"]' 'pub fn new() -> Error' + +fn foo() { + let x = Error::new(); +} diff --git a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr index 0237e7bb5eeab..1b442b27080a7 100644 --- a/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr +++ b/tests/ui/const-generics/adt_const_params/const_param_ty_bad.stderr @@ -24,7 +24,11 @@ LL | check(|| {}); | | | required by a bound introduced by this call | - = help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` +help: the nightly-only, unstable trait `ConstParamTy_` is not implemented for closure `{closure@$DIR/const_param_ty_bad.rs:8:11: 8:13}` + --> $DIR/const_param_ty_bad.rs:8:11 + | +LL | check(|| {}); + | ^^ note: required by a bound in `check` --> $DIR/const_param_ty_bad.rs:4:18 | diff --git a/tests/ui/methods/filter-relevant-fn-bounds.stderr b/tests/ui/methods/filter-relevant-fn-bounds.stderr index 976d39a3714ca..f1676facdb2d4 100644 --- a/tests/ui/methods/filter-relevant-fn-bounds.stderr +++ b/tests/ui/methods/filter-relevant-fn-bounds.stderr @@ -20,7 +20,11 @@ LL | wrapper.do_something_wrapper(|value| ()); | | | required by a bound introduced by this call | - = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` +help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}` + --> $DIR/filter-relevant-fn-bounds.rs:18:34 + | +LL | wrapper.do_something_wrapper(|value| ()); + | ^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/filter-relevant-fn-bounds.rs:1:1 | diff --git a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr index baeff76e1ffe2..59a2255bc4fbf 100644 --- a/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr +++ b/tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr @@ -6,7 +6,11 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0); | | | required by a bound introduced by this call | - = help: the trait `for<'a> FnMut(&'a {integer})` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` +help: the trait `for<'a> FnMut(&'a {integer})` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}` + --> $DIR/closure-arg-type-mismatch-issue-45727.rs:6:29 + | +LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0); + | ^^^^^^^^ = note: expected a closure with signature `for<'a> fn(&'a {integer})` found a closure with signature `fn(i32)` note: required by a bound in `find` @@ -20,7 +24,11 @@ LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); | | | required by a bound introduced by this call | - = help: the trait `for<'a> FnMut(&'a {integer})` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` +help: the trait `for<'a> FnMut(&'a {integer})` is not implemented for closure `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:9:29: 9:40}` + --> $DIR/closure-arg-type-mismatch-issue-45727.rs:9:29 + | +LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0); + | ^^^^^^^^^^^ = note: expected a closure with signature `for<'a> fn(&'a {integer})` found a closure with signature `fn(&&&i32)` note: required by a bound in `find` diff --git a/tests/ui/mismatched_types/closure-mismatch.next.stderr b/tests/ui/mismatched_types/closure-mismatch.next.stderr index a6380b7487dad..0d6ca6d7bfca8 100644 --- a/tests/ui/mismatched_types/closure-mismatch.next.stderr +++ b/tests/ui/mismatched_types/closure-mismatch.next.stderr @@ -6,7 +6,11 @@ LL | baz(|_| ()); | | | required by a bound introduced by this call | - = help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}` +help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}` + --> $DIR/closure-mismatch.rs:12:9 + | +LL | baz(|_| ()); + | ^^^ = note: expected a closure with signature `for<'a> fn(&'a ())` found a closure with signature `fn(&())` note: required for `{closure@$DIR/closure-mismatch.rs:12:9: 12:12}` to implement `Foo` @@ -30,7 +34,11 @@ LL | baz(|x| ()); | | | required by a bound introduced by this call | - = help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}` +help: the trait `for<'a> FnOnce(&'a ())` is not implemented for closure `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}` + --> $DIR/closure-mismatch.rs:16:9 + | +LL | baz(|x| ()); + | ^^^ = note: expected a closure with signature `for<'a> fn(&'a ())` found a closure with signature `fn(&())` note: required for `{closure@$DIR/closure-mismatch.rs:16:9: 16:12}` to implement `Foo` diff --git a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr index 60d0263c149b4..9a01fc20342c8 100644 --- a/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr +++ b/tests/ui/suggestions/fn-ctor-passed-as-arg-where-it-should-have-been-called.stderr @@ -24,7 +24,11 @@ LL | bar(closure); | | | required by a bound introduced by this call | - = help: the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}` +help: the trait `T` is not implemented for closure `{closure@$DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19: 18:21}` + --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:18:19 + | +LL | let closure = || S; + | ^^ note: required by a bound in `bar` --> $DIR/fn-ctor-passed-as-arg-where-it-should-have-been-called.rs:14:16 | diff --git a/tests/ui/suggestions/suggest-calling-fn-in-for-loop-issue-161564.stderr b/tests/ui/suggestions/suggest-calling-fn-in-for-loop-issue-161564.stderr index e2edaebb65c9b..4d355efc2595d 100644 --- a/tests/ui/suggestions/suggest-calling-fn-in-for-loop-issue-161564.stderr +++ b/tests/ui/suggestions/suggest-calling-fn-in-for-loop-issue-161564.stderr @@ -43,7 +43,11 @@ error[E0277]: `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:33:1 LL | for _ in closure {} | ^^^^^^^ `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:33:19: 33:21}` is not an iterator | - = help: the trait `Iterator` is not implemented for closure `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:33:19: 33:21}` +help: the trait `Iterator` is not implemented for closure `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:33:19: 33:21}` + --> $DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:33:19 + | +LL | let closure = || vec![1u8].into_iter(); + | ^^ = note: required for `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:33:19: 33:21}` to implement `IntoIterator` help: use parentheses to call this closure | @@ -56,7 +60,11 @@ error[E0277]: `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:36:1 LL | for _ in || vec![1u8].into_iter() {} | ^^^^^^^^^^^^^^^^^^^^^^^^ `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:36:14: 36:16}` is not an iterator | - = help: the trait `Iterator` is not implemented for closure `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:36:14: 36:16}` +help: the trait `Iterator` is not implemented for closure `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:36:14: 36:16}` + --> $DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:36:14 + | +LL | for _ in || vec![1u8].into_iter() {} + | ^^ = note: required for `{closure@$DIR/suggest-calling-fn-in-for-loop-issue-161564.rs:36:14: 36:16}` to implement `IntoIterator` help: use parentheses to call this closure | diff --git a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr index 19151a674c7f8..0e4c4afff7379 100644 --- a/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr +++ b/tests/ui/suggestions/use-parentheses-to-call-closure-issue-145404.stderr @@ -6,7 +6,11 @@ LL | S.call(|| "hello"); | | | required by a bound introduced by this call | - = help: the trait `std::fmt::Display` is not implemented for closure `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` +help: the trait `std::fmt::Display` is not implemented for closure `{closure@$DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12: 12:14}` + --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:12:12 + | +LL | S.call(|| "hello"); + | ^^ note: required by a bound in `S::call` --> $DIR/use-parentheses-to-call-closure-issue-145404.rs:8:28 | diff --git a/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr b/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr index 9f486cd12874f..b4bc90f0dbe31 100644 --- a/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr +++ b/tests/ui/traits/explicit-reference-cast-unrelated-leaf.stderr @@ -6,7 +6,11 @@ LL | wrapper.do_something_wrapper(|value| ()); | | | required by a bound introduced by this call | - = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` +help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` + --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:34 + | +LL | wrapper.do_something_wrapper(|value| ()); + | ^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/explicit-reference-cast-unrelated-leaf.rs:1:1 | @@ -27,7 +31,11 @@ error[E0277]: the trait bound `for<'a> _: From<<{closure@$DIR/explicit-reference LL | wrapper.do_something_wrapper(|value| ()); | ^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound | - = help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` +help: the trait `for<'a> Output<'a>` is not implemented for closure `{closure@$DIR/explicit-reference-cast-unrelated-leaf.rs:18:34: 18:41}` + --> $DIR/explicit-reference-cast-unrelated-leaf.rs:18:34 + | +LL | wrapper.do_something_wrapper(|value| ()); + | ^^^^^^^ help: this trait has no implementations, consider adding one --> $DIR/explicit-reference-cast-unrelated-leaf.rs:1:1 | diff --git a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr index 7151302879606..e64622302731c 100644 --- a/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr +++ b/tests/ui/traits/fn-pointer/bare-fn-no-impl-fn-ptr-99875.stderr @@ -24,7 +24,11 @@ LL | takes(|_: Argument| -> Return { todo!() }); | | | required by a bound introduced by this call | - = help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:16:11: 16:34}` +help: the trait `Trait` is not implemented for closure `{closure@$DIR/bare-fn-no-impl-fn-ptr-99875.rs:16:11: 16:34}` + --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:16:11 + | +LL | takes(|_: Argument| -> Return { todo!() }); + | ^^^^^^^^^^^^^^^^^^^^^^^ help: the trait `Trait` is implemented for fn pointer `fn(Argument) -> Return` --> $DIR/bare-fn-no-impl-fn-ptr-99875.rs:9:1 |