Implement DesugaringKind::FormatLiteral
This commit is contained in:
parent
8051f01265
commit
b1d18129d1
59 changed files with 261 additions and 159 deletions
|
|
@ -50,6 +50,14 @@ pub struct FormatArgs {
|
|||
///
|
||||
/// Generally only useful for lints that care about the raw bytes the user wrote.
|
||||
pub uncooked_fmt_str: (LitKind, Symbol),
|
||||
/// Was the format literal written in the source?
|
||||
/// - `format!("boo")` => true,
|
||||
/// - `format!(concat!("b", "o", "o"))` => false,
|
||||
/// - `format!(include_str!("boo.txt"))` => false,
|
||||
///
|
||||
/// If it wasn't written in the source then we have to be careful with spans pointing into it
|
||||
/// and suggestions about rewriting it.
|
||||
pub is_source_literal: bool,
|
||||
}
|
||||
|
||||
/// A piece of a format template string.
|
||||
|
|
|
|||
|
|
@ -1389,7 +1389,7 @@ macro_rules! common_visitor_and_walkers {
|
|||
|
||||
// FIXME: visit the template exhaustively.
|
||||
pub fn walk_format_args<$($lt,)? V: $Visitor$(<$lt>)?>(vis: &mut V, fmt: &$($lt)? $($mut)? FormatArgs) -> V::Result {
|
||||
let FormatArgs { span, template: _, arguments, uncooked_fmt_str: _ } = fmt;
|
||||
let FormatArgs { span, template: _, arguments, uncooked_fmt_str: _, is_source_literal: _ } = fmt;
|
||||
let args = $(${ignore($mut)} arguments.all_args_mut())? $(${ignore($lt)} arguments.all_args())? ;
|
||||
for FormatArgument { kind, expr } in args {
|
||||
match kind {
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ use rustc_ast::*;
|
|||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_hir as hir;
|
||||
use rustc_session::config::FmtDebug;
|
||||
use rustc_span::{Ident, Span, Symbol, sym};
|
||||
use rustc_span::{DesugaringKind, Ident, Span, Symbol, sym};
|
||||
|
||||
use super::LoweringContext;
|
||||
|
||||
|
|
@ -14,6 +14,13 @@ impl<'hir> LoweringContext<'_, 'hir> {
|
|||
// format_args!() had any arguments _before_ flattening/inlining.
|
||||
let allow_const = fmt.arguments.all_args().is_empty();
|
||||
let mut fmt = Cow::Borrowed(fmt);
|
||||
|
||||
let sp = self.mark_span_with_reason(
|
||||
DesugaringKind::FormatLiteral { source: fmt.is_source_literal },
|
||||
sp,
|
||||
sp.ctxt().outer_expn_data().allow_internal_unstable,
|
||||
);
|
||||
|
||||
if self.tcx.sess.opts.unstable_opts.flatten_format_args {
|
||||
fmt = flatten_format_args(fmt);
|
||||
fmt = self.inline_literals(fmt);
|
||||
|
|
|
|||
|
|
@ -606,6 +606,7 @@ fn make_format_args(
|
|||
template,
|
||||
arguments: args,
|
||||
uncooked_fmt_str,
|
||||
is_source_literal,
|
||||
}))
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1213,6 +1213,17 @@ pub enum DesugaringKind {
|
|||
Contract,
|
||||
/// A pattern type range start/end
|
||||
PatTyRange,
|
||||
/// A format literal.
|
||||
FormatLiteral {
|
||||
/// Was this format literal written in the source?
|
||||
/// - `format!("boo")` => Yes,
|
||||
/// - `format!(concat!("b", "o", "o"))` => No,
|
||||
/// - `format!(include_str!("boo.txt"))` => No,
|
||||
///
|
||||
/// If it wasn't written in the source then we have to be careful with suggestions about
|
||||
/// rewriting it.
|
||||
source: bool,
|
||||
},
|
||||
}
|
||||
|
||||
impl DesugaringKind {
|
||||
|
|
@ -1231,6 +1242,10 @@ impl DesugaringKind {
|
|||
DesugaringKind::BoundModifier => "trait bound modifier",
|
||||
DesugaringKind::Contract => "contract check",
|
||||
DesugaringKind::PatTyRange => "pattern type",
|
||||
DesugaringKind::FormatLiteral { source: true } => "format string literal",
|
||||
DesugaringKind::FormatLiteral { source: false } => {
|
||||
"expression that expanded into a format string literal"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1250,6 +1265,7 @@ impl DesugaringKind {
|
|||
DesugaringKind::BoundModifier => value == "BoundModifier",
|
||||
DesugaringKind::Contract => value == "Contract",
|
||||
DesugaringKind::PatTyRange => value == "PatTyRange",
|
||||
DesugaringKind::FormatLiteral { .. } => value == "FormatLiteral",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2872,13 +2872,23 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
_ => (),
|
||||
}
|
||||
}
|
||||
let descr = format!("required by {a} bound in `{item_name}`");
|
||||
if span.is_visible(sm) {
|
||||
let msg = format!("required by {this} in `{short_item_name}`");
|
||||
multispan.push_span_label(span, msg);
|
||||
err.span_note(multispan, descr);
|
||||
|
||||
// If this is from a format string literal desugaring,
|
||||
// we've already said "required by this formatting parameter"
|
||||
let is_in_fmt_lit = if let Some(s) = err.span.primary_span() {
|
||||
matches!(s.desugaring_kind(), Some(DesugaringKind::FormatLiteral { .. }))
|
||||
} else {
|
||||
err.span_note(tcx.def_span(item_def_id), descr);
|
||||
false
|
||||
};
|
||||
if !is_in_fmt_lit {
|
||||
let descr = format!("required by {a} bound in `{item_name}`");
|
||||
if span.is_visible(sm) {
|
||||
let msg = format!("required by {this} in `{short_item_name}`");
|
||||
multispan.push_span_label(span, msg);
|
||||
err.span_note(multispan, descr);
|
||||
} else {
|
||||
err.span_note(tcx.def_span(item_def_id), descr);
|
||||
}
|
||||
}
|
||||
if let Some(note) = note {
|
||||
err.note(note);
|
||||
|
|
@ -3973,7 +3983,15 @@ impl<'a, 'tcx> TypeErrCtxt<'a, 'tcx> {
|
|||
) = expr.kind
|
||||
{
|
||||
if Some(*span) != err.span.primary_span() {
|
||||
err.span_label(*span, "required by a bound introduced by this call");
|
||||
let msg = if span.is_desugaring(DesugaringKind::FormatLiteral { source: true })
|
||||
{
|
||||
"required by this formatting parameter"
|
||||
} else if span.is_desugaring(DesugaringKind::FormatLiteral { source: false }) {
|
||||
"required by a formatting parameter in this expression"
|
||||
} else {
|
||||
"required by a bound introduced by this call"
|
||||
};
|
||||
err.span_label(*span, msg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -855,11 +855,13 @@ impl Display for Arguments<'_> {
|
|||
#[rustc_on_unimplemented(
|
||||
on(
|
||||
crate_local,
|
||||
label = "`{Self}` cannot be formatted using `{{:?}}`",
|
||||
note = "add `#[derive(Debug)]` to `{Self}` or manually `impl {This} for {Self}`"
|
||||
),
|
||||
message = "`{Self}` doesn't implement `{This}`",
|
||||
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{This}`"
|
||||
on(
|
||||
from_desugaring = "FormatLiteral",
|
||||
label = "`{Self}` cannot be formatted using `{{:?}}` because it doesn't implement `{This}`"
|
||||
),
|
||||
message = "`{Self}` doesn't implement `{This}`"
|
||||
)]
|
||||
#[doc(alias = "{:?}")]
|
||||
#[rustc_diagnostic_item = "Debug"]
|
||||
|
|
@ -986,11 +988,14 @@ pub use macros::Debug;
|
|||
any(Self = "std::path::Path", Self = "std::path::PathBuf"),
|
||||
label = "`{Self}` cannot be formatted with the default formatter; call `.display()` on it",
|
||||
note = "call `.display()` or `.to_string_lossy()` to safely print paths, \
|
||||
as they may contain non-Unicode data"
|
||||
as they may contain non-Unicode data",
|
||||
),
|
||||
message = "`{Self}` doesn't implement `{This}`",
|
||||
label = "`{Self}` cannot be formatted with the default formatter",
|
||||
note = "in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead"
|
||||
on(
|
||||
from_desugaring = "FormatLiteral",
|
||||
note = "in format strings you may be able to use `{{:?}}` (or {{:#?}} for pretty-print) instead",
|
||||
label = "`{Self}` cannot be formatted with the default formatter",
|
||||
),
|
||||
message = "`{Self}` doesn't implement `{This}`"
|
||||
)]
|
||||
#[doc(alias = "{}")]
|
||||
#[rustc_diagnostic_item = "Display"]
|
||||
|
|
|
|||
|
|
@ -17,10 +17,8 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/issue-100154.rs:4:11
|
||||
|
|
||||
LL | foo::<()>(());
|
||||
| ^^ `()` cannot be formatted with the default formatter
|
||||
| ^^ the trait `std::fmt::Display` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `foo`
|
||||
--> $DIR/issue-100154.rs:1:16
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
||||
|
|
||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||
| ^^^^ `Self` cannot be formatted with the default formatter
|
||||
| ^^^^ the trait `std::fmt::Display` is not implemented for `Self`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `UncheckedCopy::Output`
|
||||
--> $DIR/defaults-unsound-62211-1.rs:24:86
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/defaults-unsound-62211-1.rs:24:96
|
||||
|
|
||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||
| ^^^^ `Self` cannot be formatted with the default formatter
|
||||
| ^^^^ the trait `std::fmt::Display` is not implemented for `Self`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `UncheckedCopy::Output`
|
||||
--> $DIR/defaults-unsound-62211-1.rs:24:86
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
||||
|
|
||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||
| ^^^^ `Self` cannot be formatted with the default formatter
|
||||
| ^^^^ the trait `std::fmt::Display` is not implemented for `Self`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `UncheckedCopy::Output`
|
||||
--> $DIR/defaults-unsound-62211-2.rs:24:86
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ error[E0277]: `Self` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/defaults-unsound-62211-2.rs:24:96
|
||||
|
|
||||
LL | type Output: Copy + Deref<Target = str> + AddAssign<&'static str> + From<Self> + Display = Self;
|
||||
| ^^^^ `Self` cannot be formatted with the default formatter
|
||||
| ^^^^ the trait `std::fmt::Display` is not implemented for `Self`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `UncheckedCopy::Output`
|
||||
--> $DIR/defaults-unsound-62211-2.rs:24:86
|
||||
|
|
||||
|
|
|
|||
|
|
@ -16,9 +16,8 @@ LL | fn foo(s: &i32) -> &i32 {
|
|||
| --- consider calling this function
|
||||
...
|
||||
LL | assert_eq!(foo, y);
|
||||
| ^^^^^^^^^^^^^^^^^^ `for<'a> fn(&'a i32) -> &'a i32 {foo}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `for<'a> fn(&'a i32) -> &'a i32 {foo}`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for fn item `for<'a> fn(&'a i32) -> &'a i32 {foo}`
|
||||
= help: use parentheses to call this function: `foo(/* &i32 */)`
|
||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -14,11 +14,9 @@ error[E0277]: the size for values of type `dyn Foo` cannot be known at compilati
|
|||
LL | println!("{:?}", foo);
|
||||
| ---- ^^^ doesn't have a size known at compile-time
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `Sized` is not implemented for `dyn Foo`
|
||||
note: required by an implicit `Sized` bound in `core::fmt::rt::Argument::<'_>::new_debug`
|
||||
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ LL | println!("{:?}", 0);
|
|||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
= note: this error originates in the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0015]: cannot call non-const function `_print` in constant functions
|
||||
--> $DIR/format.rs:7:5
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ LL | #[derive(Debug)]
|
|||
| ----- in this derive macro expansion
|
||||
...
|
||||
LL | x: Error
|
||||
| ^^^^^^^^ `Error` cannot be formatted using `{:?}`
|
||||
| ^^^^^^^^ the trait `Debug` is not implemented for `Error`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Error`
|
||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ LL | #[derive(Debug)]
|
|||
| ----- in this derive macro expansion
|
||||
...
|
||||
LL | Error
|
||||
| ^^^^^ `Error` cannot be formatted using `{:?}`
|
||||
| ^^^^^ the trait `Debug` is not implemented for `Error`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Error`
|
||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ LL | #[derive(Debug)]
|
|||
| ----- in this derive macro expansion
|
||||
LL | struct Struct {
|
||||
LL | x: Error
|
||||
| ^^^^^^^^ `Error` cannot be formatted using `{:?}`
|
||||
| ^^^^^^^^ the trait `Debug` is not implemented for `Error`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Error`
|
||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -5,9 +5,8 @@ LL | #[derive(Debug)]
|
|||
| ----- in this derive macro expansion
|
||||
LL | struct Struct(
|
||||
LL | Error
|
||||
| ^^^^^ `Error` cannot be formatted using `{:?}`
|
||||
| ^^^^^ the trait `Debug` is not implemented for `Error`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Error`
|
||||
= note: add `#[derive(Debug)]` to `Error` or manually `impl Debug for Error`
|
||||
help: consider annotating `Error` with `#[derive(Debug)]`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> $DIR/auxiliary/trait.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> $DIR/auxiliary/trait-debuginfo.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> $DIR/auxiliary/trait-diag.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> $DIR/auxiliary/trait-macro.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> $DIR/auxiliary/trait-debuginfo.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> remapped/errors/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> remapped/errors/auxiliary/trait-diag.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `A` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/remap-path-prefix-diagnostics.rs:LL:COL
|
||||
|
|
||||
LL | impl r#trait::Trait for A {}
|
||||
| ^ `A` cannot be formatted with the default formatter
|
||||
| ^ the trait `std::fmt::Display` is not implemented for `A`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `A`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Trait`
|
||||
--> $DIR/auxiliary/trait-macro.rs:LL:COL
|
||||
|
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ error[E0277]: `Option<{integer}>` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/format-args-argument-span.rs:15:37
|
||||
|
|
||||
LL | println!("{x:?} {x} {x:?}", x = Some(1));
|
||||
| ^^^^^^^ `Option<{integer}>` cannot be formatted with the default formatter
|
||||
| --- ^^^^^^^ `Option<{integer}>` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Option<{integer}>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
@ -22,7 +24,7 @@ error[E0277]: `DisplayOnly` doesn't implement `Debug`
|
|||
--> $DIR/format-args-argument-span.rs:18:19
|
||||
|
|
||||
LL | println!("{x} {x:?} {x}");
|
||||
| ^^^^^ `DisplayOnly` cannot be formatted using `{:?}`
|
||||
| ^^^^^ `DisplayOnly` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `DisplayOnly`
|
||||
= note: add `#[derive(Debug)]` to `DisplayOnly` or manually `impl Debug for DisplayOnly`
|
||||
|
|
@ -37,7 +39,9 @@ error[E0277]: `DisplayOnly` doesn't implement `Debug`
|
|||
--> $DIR/format-args-argument-span.rs:20:35
|
||||
|
|
||||
LL | println!("{x} {x:?} {x}", x = DisplayOnly);
|
||||
| ^^^^^^^^^^^ `DisplayOnly` cannot be formatted using `{:?}`
|
||||
| ----- ^^^^^^^^^^^ `DisplayOnly` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `DisplayOnly`
|
||||
= note: add `#[derive(Debug)]` to `DisplayOnly` or manually `impl Debug for DisplayOnly`
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `str: UpperHex` is not satisfied
|
|||
LL | format!("{:X}", "3");
|
||||
| ---- ^^^ the trait `UpperHex` is not implemented for `str`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the following other types implement trait `UpperHex`:
|
||||
&T
|
||||
|
|
@ -17,8 +17,6 @@ LL | format!("{:X}", "3");
|
|||
i32
|
||||
and 9 others
|
||||
= note: required for `&str` to implement `UpperHex`
|
||||
note: required by a bound in `core::fmt::rt::Argument::<'_>::new_upper_hex`
|
||||
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
|
||||
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
|
|
|||
13
tests/ui/fmt/non-source-literals.rs
Normal file
13
tests/ui/fmt/non-source-literals.rs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
/// Do not point at the format string if it wasn't written in the source.
|
||||
//@ forbid-output: required by this formatting parameter
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct NonDisplay;
|
||||
pub struct NonDebug;
|
||||
|
||||
fn main() {
|
||||
let _ = format!(concat!("{", "}"), NonDisplay); //~ ERROR
|
||||
let _ = format!(concat!("{", "0", "}"), NonDisplay); //~ ERROR
|
||||
let _ = format!(concat!("{:", "?}"), NonDebug); //~ ERROR
|
||||
let _ = format!(concat!("{", "0", ":?}"), NonDebug); //~ ERROR
|
||||
}
|
||||
53
tests/ui/fmt/non-source-literals.stderr
Normal file
53
tests/ui/fmt/non-source-literals.stderr
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/non-source-literals.rs:9:40
|
||||
|
|
||||
LL | let _ = format!(concat!("{", "}"), NonDisplay);
|
||||
| ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `NonDisplay`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `NonDisplay` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/non-source-literals.rs:10:45
|
||||
|
|
||||
LL | let _ = format!(concat!("{", "0", "}"), NonDisplay);
|
||||
| ^^^^^^^^^^ `NonDisplay` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `NonDisplay`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `NonDebug` doesn't implement `Debug`
|
||||
--> $DIR/non-source-literals.rs:11:42
|
||||
|
|
||||
LL | let _ = format!(concat!("{:", "?}"), NonDebug);
|
||||
| ^^^^^^^^ `NonDebug` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `NonDebug`
|
||||
= note: add `#[derive(Debug)]` to `NonDebug` or manually `impl Debug for NonDebug`
|
||||
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider annotating `NonDebug` with `#[derive(Debug)]`
|
||||
|
|
||||
LL + #[derive(Debug)]
|
||||
LL | pub struct NonDebug;
|
||||
|
|
||||
|
||||
error[E0277]: `NonDebug` doesn't implement `Debug`
|
||||
--> $DIR/non-source-literals.rs:12:47
|
||||
|
|
||||
LL | let _ = format!(concat!("{", "0", ":?}"), NonDebug);
|
||||
| ^^^^^^^^ `NonDebug` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `NonDebug`
|
||||
= note: add `#[derive(Debug)]` to `NonDebug` or manually `impl Debug for NonDebug`
|
||||
= note: this error originates in the macro `$crate::__export::format_args` which comes from the expansion of the macro `format` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider annotating `NonDebug` with `#[derive(Debug)]`
|
||||
|
|
||||
LL + #[derive(Debug)]
|
||||
LL | pub struct NonDebug;
|
||||
|
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0277`.
|
||||
|
|
@ -2,9 +2,8 @@ error[E0277]: `T` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/generic-associated-types-where.rs:18:22
|
||||
|
|
||||
LL | type Assoc2<T> = Vec<T>;
|
||||
| ^^^^^^ `T` cannot be formatted with the default formatter
|
||||
| ^^^^^^ the trait `std::fmt::Display` is not implemented for `T`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
help: consider restricting type parameter `T` with trait `Display`
|
||||
|
|
||||
LL | type Assoc2<T: std::fmt::Display> = Vec<T>;
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/doesnt-satisfy.rs:6:17
|
||||
|
|
||||
LL | fn bar() -> () {}
|
||||
| ^^ `()` cannot be formatted with the default formatter
|
||||
| ^^ the trait `std::fmt::Display` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Foo::bar::{anon_assoc#0}`
|
||||
--> $DIR/doesnt-satisfy.rs:2:22
|
||||
|
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@ error[E0277]: `T` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/wf-bounds.rs:21:26
|
||||
|
|
||||
LL | fn nya4<T>() -> impl Wf<NeedsDisplay<T>>;
|
||||
| ^^^^^^^^^^^^^^^^^^^ `T` cannot be formatted with the default formatter
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `std::fmt::Display` is not implemented for `T`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `NeedsDisplay`
|
||||
--> $DIR/wf-bounds.rs:9:24
|
||||
|
|
||||
|
|
|
|||
|
|
@ -87,18 +87,16 @@ error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
|
|||
--> $DIR/issue-59488.rs:30:5
|
||||
|
|
||||
LL | assert_eq!(Foo::Bar, i);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
|
||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `fn(usize) -> Foo {Foo::Bar}` doesn't implement `Debug`
|
||||
--> $DIR/issue-59488.rs:30:5
|
||||
|
|
||||
LL | assert_eq!(Foo::Bar, i);
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `fn(usize) -> Foo {Foo::Bar}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for fn item `fn(usize) -> Foo {Foo::Bar}`
|
||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error: aborting due to 10 previous errors
|
||||
|
|
|
|||
|
|
@ -26,9 +26,8 @@ LL | fn a() -> i32 {
|
|||
| - consider calling this function
|
||||
...
|
||||
LL | assert_eq!(a, 0);
|
||||
| ^^^^^^^^^^^^^^^^ `fn() -> i32 {a}` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for fn item `fn() -> i32 {a}`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for fn item `fn() -> i32 {a}`
|
||||
= help: use parentheses to call this function: `a()`
|
||||
= note: this error originates in the macro `assert_eq` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0599]: `*const u8` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/suggest-convert-ptr-to-ref.rs:5:22
|
||||
|
|
||||
LL | println!("{}", z.to_string());
|
||||
| ^^^^^^^^^ `*const u8` cannot be formatted with the default formatter
|
||||
| ^^^^^^^^^ method cannot be called on `*const u8` due to unsatisfied trait bounds
|
||||
|
|
||||
note: the method `to_string` exists on the type `&u8`
|
||||
--> $SRC_DIR/alloc/src/string.rs:LL:COL
|
||||
|
|
@ -11,13 +11,12 @@ note: the method `to_string` exists on the type `&u8`
|
|||
= note: the following trait bounds were not satisfied:
|
||||
`*const u8: std::fmt::Display`
|
||||
which is required by `*const u8: ToString`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
||||
error[E0599]: `*mut u8` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/suggest-convert-ptr-to-ref.rs:8:22
|
||||
|
|
||||
LL | println!("{}", t.to_string());
|
||||
| ^^^^^^^^^ `*mut u8` cannot be formatted with the default formatter
|
||||
| ^^^^^^^^^ method cannot be called on `*mut u8` due to unsatisfied trait bounds
|
||||
|
|
||||
note: the method `to_string` exists on the type `&&mut u8`
|
||||
--> $SRC_DIR/alloc/src/string.rs:LL:COL
|
||||
|
|
@ -26,7 +25,6 @@ note: the method `to_string` exists on the type `&&mut u8`
|
|||
= note: the following trait bounds were not satisfied:
|
||||
`*mut u8: std::fmt::Display`
|
||||
which is required by `*mut u8: ToString`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
||||
error[E0599]: no method named `make_ascii_lowercase` found for raw pointer `*mut u8` in the current scope
|
||||
--> $DIR/suggest-convert-ptr-to-ref.rs:9:7
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ error[E0277]: `Foo` doesn't implement `Debug`
|
|||
--> $DIR/method-help-unsatisfied-bound.rs:5:7
|
||||
|
|
||||
LL | a.unwrap();
|
||||
| ^^^^^^ `Foo` cannot be formatted using `{:?}`
|
||||
| ^^^^^^ the trait `Debug` is not implemented for `Foo`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Foo`
|
||||
= note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
|
||||
note: required by a bound in `Result::<T, E>::unwrap`
|
||||
--> $SRC_DIR/core/src/result.rs:LL:COL
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@ error[E0277]: `Dummy` doesn't implement `Debug`
|
|||
--> $DIR/issue-107649.rs:105:5
|
||||
|
|
||||
105 | dbg!(lib::Dummy);
|
||||
| ^^^^^^^^^^^^^^^^ `Dummy` cannot be formatted using `{:?}`
|
||||
| ^^^^^^^^^^^^^^^^ `Dummy` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Dummy`
|
||||
= note: add `#[derive(Debug)]` to `Dummy` or manually `impl Debug for Dummy`
|
||||
= note: required for `&Dummy` to implement `Debug`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider annotating `Dummy` with `#[derive(Debug)]`
|
||||
--> $DIR/auxiliary/dummy_lib.rs:2:1
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0277]: `Foo` doesn't implement `Debug`
|
|||
--> $DIR/no-debug.rs:10:27
|
||||
|
|
||||
LL | println!("{:?} {:?}", Foo, Bar);
|
||||
| ^^^ `Foo` cannot be formatted using `{:?}`
|
||||
| ---- ^^^ `Foo` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Foo`
|
||||
= note: add `#[derive(Debug)]` to `Foo` or manually `impl Debug for Foo`
|
||||
|
|
@ -17,7 +19,9 @@ error[E0277]: `Bar` doesn't implement `Debug`
|
|||
--> $DIR/no-debug.rs:10:32
|
||||
|
|
||||
LL | println!("{:?} {:?}", Foo, Bar);
|
||||
| ^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Bar`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
|
@ -26,7 +30,9 @@ error[E0277]: `Foo` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/no-debug.rs:11:23
|
||||
|
|
||||
LL | println!("{} {}", Foo, Bar);
|
||||
| ^^^ `Foo` cannot be formatted with the default formatter
|
||||
| -- ^^^ `Foo` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Foo`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
@ -36,7 +42,9 @@ error[E0277]: `Bar` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/no-debug.rs:11:28
|
||||
|
|
||||
LL | println!("{} {}", Foo, Bar);
|
||||
| ^^^ `Bar` cannot be formatted with the default formatter
|
||||
| -- ^^^ `Bar` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Bar`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
|
|||
|
|
@ -2,10 +2,11 @@ error[E0277]: `NotDebug` doesn't implement `Debug`
|
|||
--> $DIR/dbg-macro-requires-debug.rs:6:23
|
||||
|
|
||||
LL | let _: NotDebug = dbg!(NotDebug);
|
||||
| ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}`
|
||||
| ^^^^^^^^^^^^^^ `NotDebug` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `NotDebug`
|
||||
= note: add `#[derive(Debug)]` to `NotDebug` or manually `impl Debug for NotDebug`
|
||||
= note: required for `&NotDebug` to implement `Debug`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `dbg` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider annotating `NotDebug` with `#[derive(Debug)]`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `MyError` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/issue-71363.rs:4:28
|
||||
|
|
||||
4 | impl std::error::Error for MyError {}
|
||||
| ^^^^^^^ `MyError` cannot be formatted with the default formatter
|
||||
| ^^^^^^^ the trait `std::fmt::Display` is not implemented for `MyError`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `MyError`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `std::error::Error`
|
||||
--> $SRC_DIR/core/src/error.rs:LL:COL
|
||||
|
||||
|
|
@ -13,9 +11,8 @@ error[E0277]: `MyError` doesn't implement `Debug`
|
|||
--> $DIR/issue-71363.rs:4:28
|
||||
|
|
||||
4 | impl std::error::Error for MyError {}
|
||||
| ^^^^^^^ `MyError` cannot be formatted using `{:?}`
|
||||
| ^^^^^^^ the trait `Debug` is not implemented for `MyError`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `MyError`
|
||||
= note: add `#[derive(Debug)]` to `MyError` or manually `impl Debug for MyError`
|
||||
note: required by a bound in `std::error::Error`
|
||||
--> $SRC_DIR/core/src/error.rs:LL:COL
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@ error[E0277]: `impl Sized` doesn't implement `Debug`
|
|||
--> $DIR/bound-suggestions.rs:9:22
|
||||
|
|
||||
LL | println!("{:?}", t);
|
||||
| ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^ `impl Sized` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting opaque type `impl Sized` with trait `Debug`
|
||||
|
|
@ -14,7 +16,9 @@ error[E0277]: `T` doesn't implement `Debug`
|
|||
--> $DIR/bound-suggestions.rs:15:22
|
||||
|
|
||||
LL | println!("{:?}", t);
|
||||
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider restricting type parameter `T` with trait `Debug`
|
||||
|
|
@ -26,7 +30,9 @@ error[E0277]: `T` doesn't implement `Debug`
|
|||
--> $DIR/bound-suggestions.rs:21:22
|
||||
|
|
||||
LL | println!("{:?}", t);
|
||||
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting type parameter `T` with trait `Debug`
|
||||
|
|
@ -38,7 +44,9 @@ error[E0277]: `Y` doesn't implement `Debug`
|
|||
--> $DIR/bound-suggestions.rs:27:30
|
||||
|
|
||||
LL | println!("{:?} {:?}", x, y);
|
||||
| ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^ `Y` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting type parameter `Y` with trait `Debug`
|
||||
|
|
@ -50,7 +58,9 @@ error[E0277]: `X` doesn't implement `Debug`
|
|||
--> $DIR/bound-suggestions.rs:33:22
|
||||
|
|
||||
LL | println!("{:?}", x);
|
||||
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting type parameter `X` with trait `Debug`
|
||||
|
|
@ -62,7 +72,9 @@ error[E0277]: `X` doesn't implement `Debug`
|
|||
--> $DIR/bound-suggestions.rs:39:22
|
||||
|
|
||||
LL | println!("{:?}", x);
|
||||
| ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^ `X` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
help: consider further restricting type parameter `X` with trait `Debug`
|
||||
|
|
|
|||
|
|
@ -4,9 +4,8 @@ error[E0277]: `a::Inner<T>` doesn't implement `Debug`
|
|||
LL | #[derive(Debug)]
|
||||
| ----- in this derive macro expansion
|
||||
LL | struct Outer<T>(Inner<T>);
|
||||
| ^^^^^^^^ `a::Inner<T>` cannot be formatted using `{:?}`
|
||||
| ^^^^^^^^ the trait `Debug` is not implemented for `a::Inner<T>`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `a::Inner<T>`
|
||||
= note: add `#[derive(Debug)]` to `a::Inner<T>` or manually `impl Debug for a::Inner<T>`
|
||||
help: consider annotating `a::Inner<T>` with `#[derive(Debug)]`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,11 +2,10 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
|
|||
--> $DIR/impl-trait-with-missing-bounds.rs:6:13
|
||||
|
|
||||
LL | qux(constraint);
|
||||
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| --- ^^^^^^^^^^ the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
note: required by a bound in `qux`
|
||||
--> $DIR/impl-trait-with-missing-bounds.rs:50:16
|
||||
|
|
||||
|
|
@ -22,11 +21,10 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
|
|||
--> $DIR/impl-trait-with-missing-bounds.rs:14:13
|
||||
|
|
||||
LL | qux(constraint);
|
||||
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| --- ^^^^^^^^^^ the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
note: required by a bound in `qux`
|
||||
--> $DIR/impl-trait-with-missing-bounds.rs:50:16
|
||||
|
|
||||
|
|
@ -42,11 +40,10 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
|
|||
--> $DIR/impl-trait-with-missing-bounds.rs:22:13
|
||||
|
|
||||
LL | qux(constraint);
|
||||
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| --- ^^^^^^^^^^ the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
note: required by a bound in `qux`
|
||||
--> $DIR/impl-trait-with-missing-bounds.rs:50:16
|
||||
|
|
||||
|
|
@ -62,11 +59,10 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
|
|||
--> $DIR/impl-trait-with-missing-bounds.rs:30:13
|
||||
|
|
||||
LL | qux(constraint);
|
||||
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| --- ^^^^^^^^^^ the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
note: required by a bound in `qux`
|
||||
--> $DIR/impl-trait-with-missing-bounds.rs:50:16
|
||||
|
|
||||
|
|
@ -82,11 +78,10 @@ error[E0277]: `<impl Iterator + std::fmt::Debug as Iterator>::Item` doesn't impl
|
|||
--> $DIR/impl-trait-with-missing-bounds.rs:37:13
|
||||
|
|
||||
LL | qux(constraint);
|
||||
| --- ^^^^^^^^^^ `<impl Iterator + std::fmt::Debug as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| --- ^^^^^^^^^^ the trait `Debug` is not implemented for `<impl Iterator + std::fmt::Debug as Iterator>::Item`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `<impl Iterator + std::fmt::Debug as Iterator>::Item`
|
||||
note: required by a bound in `qux`
|
||||
--> $DIR/impl-trait-with-missing-bounds.rs:50:16
|
||||
|
|
||||
|
|
@ -102,11 +97,10 @@ error[E0277]: `<impl Iterator as Iterator>::Item` doesn't implement `Debug`
|
|||
--> $DIR/impl-trait-with-missing-bounds.rs:45:13
|
||||
|
|
||||
LL | qux(constraint);
|
||||
| --- ^^^^^^^^^^ `<impl Iterator as Iterator>::Item` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| --- ^^^^^^^^^^ the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `<impl Iterator as Iterator>::Item`
|
||||
note: required by a bound in `qux`
|
||||
--> $DIR/impl-trait-with-missing-bounds.rs:50:16
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,23 +2,17 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/issue-81098.rs:3:13
|
||||
|
|
||||
LL | fn wat() -> impl core::fmt::Display {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `()` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::fmt::Display` is not implemented for `()`
|
||||
|
||||
error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/issue-81098.rs:9:12
|
||||
|
|
||||
LL | fn ok() -> impl core::fmt::Display {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ `()` cannot be formatted with the default formatter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::fmt::Display` is not implemented for `()`
|
||||
LL | 1;
|
||||
| -- help: remove this semicolon
|
||||
| |
|
||||
| this expression has type `{integer}`, which implements `std::fmt::Display`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,10 @@ error[E0277]: `<impl IntoIterator as IntoIterator>::Item` doesn't implement `std
|
|||
--> $DIR/issue-97760.rs:4:20
|
||||
|
|
||||
LL | println!("{x}");
|
||||
| ^ `<impl IntoIterator as IntoIterator>::Item` cannot be formatted with the default formatter
|
||||
| -^-
|
||||
| ||
|
||||
| |`<impl IntoIterator as IntoIterator>::Item` cannot be formatted with the default formatter
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `<impl IntoIterator as IntoIterator>::Item`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ error[E0277]: `K` doesn't implement `Debug`
|
|||
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:12:14
|
||||
|
|
||||
LL | pub loc: Vector2<K>,
|
||||
| ^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
||||
|
|
||||
note: required by a bound in `Vector2`
|
||||
--> $DIR/missing-bound-in-derive-copy-impl-3.rs:5:23
|
||||
|
|
@ -40,7 +40,7 @@ LL | #[derive(Debug, Copy, Clone)]
|
|||
| ----- in this derive macro expansion
|
||||
LL | pub struct AABB<K: Copy>{
|
||||
LL | pub loc: Vector2<K>,
|
||||
| ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
||||
|
|
||||
help: consider further restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
|
|
@ -54,7 +54,7 @@ LL | #[derive(Debug, Copy, Clone)]
|
|||
| ----- in this derive macro expansion
|
||||
...
|
||||
LL | pub size: Vector2<K>
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
||||
|
|
||||
help: consider further restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ error[E0277]: `K` doesn't implement `Debug`
|
|||
--> $DIR/missing-bound-in-derive-copy-impl.rs:11:14
|
||||
|
|
||||
LL | pub loc: Vector2<K>,
|
||||
| ^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
||||
|
|
||||
note: required by a bound in `Vector2`
|
||||
--> $DIR/missing-bound-in-derive-copy-impl.rs:4:23
|
||||
|
|
@ -78,7 +78,7 @@ LL | #[derive(Debug, Copy, Clone)]
|
|||
| ----- in this derive macro expansion
|
||||
LL | pub struct AABB<K> {
|
||||
LL | pub loc: Vector2<K>,
|
||||
| ^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
||||
|
|
||||
help: consider restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
|
|
@ -111,7 +111,7 @@ LL | #[derive(Debug, Copy, Clone)]
|
|||
| ----- in this derive macro expansion
|
||||
...
|
||||
LL | pub size: Vector2<K>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `K` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `K`
|
||||
|
|
||||
help: consider restricting type parameter `K` with trait `Debug`
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,18 +2,23 @@ error[E0277]: `Path` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/path-display.rs:5:20
|
||||
|
|
||||
LL | println!("{}", path);
|
||||
| ^^^^ `Path` cannot be formatted with the default formatter; call `.display()` on it
|
||||
| -- ^^^^ `Path` cannot be formatted with the default formatter; call `.display()` on it
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Path`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= note: call `.display()` or `.to_string_lossy()` to safely print paths, as they may contain non-Unicode data
|
||||
= note: required for `&Path` to implement `std::fmt::Display`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: `PathBuf` doesn't implement `std::fmt::Display`
|
||||
--> $DIR/path-display.rs:9:20
|
||||
|
|
||||
LL | println!("{}", path);
|
||||
| ^^^^ `PathBuf` cannot be formatted with the default formatter; call `.display()` on it
|
||||
| -- ^^^^ `PathBuf` cannot be formatted with the default formatter; call `.display()` on it
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `PathBuf`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0277]: `Option<Option<Option<...>>>` doesn't implement `std::fmt::Display
|
|||
--> $DIR/on_unimplemented_long_types.rs:3:17
|
||||
|
|
||||
LL | pub fn foo() -> impl std::fmt::Display {
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ `Option<Option<Option<...>>>` cannot be formatted with the default formatter
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound
|
||||
LL |
|
||||
LL | / Some(Some(Some(Some(Some(Some(Some(Some(Some(S...
|
||||
LL | | Some(Some(Some(Some(Some(Some(Some(Some(So...
|
||||
|
|
@ -14,7 +14,6 @@ LL | | )))))))))))
|
|||
| |_______________- return type was inferred to be `Option<Option<Option<...>>>` here
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `Option<Option<Option<...>>>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= note: the full name for the type has been written to '$TEST_BUILD_DIR/on_unimplemented_long_types.long-type-$LONG_TYPE_HASH.txt'
|
||||
= note: consider using `--verbose` to print the full type name to the console
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `&Chars: Trait` is not satisfied
|
|||
LL | format_args!("{:?}", FlatMap(&Chars));
|
||||
| ---- ^^^^^^^^^^^^^^^ the trait `Trait` is not implemented for `&Chars`
|
||||
| |
|
||||
| required by a bound introduced by this call
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `Trait` is implemented for `Chars`
|
||||
note: required for `FlatMap<&Chars>` to implement `Debug`
|
||||
|
|
@ -14,8 +14,6 @@ LL | impl<T: Trait> std::fmt::Debug for FlatMap<T> {
|
|||
| ----- ^^^^^^^^^^^^^^^ ^^^^^^^^^^
|
||||
| |
|
||||
| unsatisfied trait bound introduced here
|
||||
note: required by a bound in `core::fmt::rt::Argument::<'_>::new_debug`
|
||||
--> $SRC_DIR/core/src/fmt/rt.rs:LL:COL
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
|
|
|
|||
|
|
@ -2,9 +2,8 @@ error[E0277]: `T` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/bounds-are-checked3.rs:9:35
|
||||
|
|
||||
LL | type Foo<T: Debug> = (impl Debug, Struct<T>);
|
||||
| ^^^^^^^^^ `T` cannot be formatted with the default formatter
|
||||
| ^^^^^^^^^ the trait `std::fmt::Display` is not implemented for `T`
|
||||
|
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `Struct`
|
||||
--> $DIR/bounds-are-checked3.rs:5:18
|
||||
|
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0277]: `T` doesn't implement `Debug`
|
|||
--> $DIR/generic_duplicate_param_use2.rs:12:5
|
||||
|
|
||||
LL | t
|
||||
| ^ `T` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^ the trait `Debug` is not implemented for `T`
|
||||
|
|
||||
note: required by a bound in an opaque type
|
||||
--> $DIR/generic_duplicate_param_use2.rs:8:23
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0277]: `U` doesn't implement `Debug`
|
|||
--> $DIR/generic_duplicate_param_use4.rs:12:5
|
||||
|
|
||||
LL | u
|
||||
| ^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^ the trait `Debug` is not implemented for `U`
|
||||
|
|
||||
note: required by a bound in an opaque type
|
||||
--> $DIR/generic_duplicate_param_use4.rs:8:23
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ error[E0277]: `U` doesn't implement `Debug`
|
|||
--> $DIR/generic_underconstrained2.rs:9:33
|
||||
|
|
||||
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `U`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained`
|
||||
--> $DIR/generic_underconstrained2.rs:5:26
|
||||
|
|
@ -18,7 +18,7 @@ error[E0277]: `V` doesn't implement `Debug`
|
|||
--> $DIR/generic_underconstrained2.rs:19:43
|
||||
|
|
||||
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `V`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained2`
|
||||
--> $DIR/generic_underconstrained2.rs:15:27
|
||||
|
|
@ -34,7 +34,7 @@ error[E0277]: `U` doesn't implement `Debug`
|
|||
--> $DIR/generic_underconstrained2.rs:9:33
|
||||
|
|
||||
LL | fn underconstrained<U>(_: U) -> Underconstrained<U> {
|
||||
| ^^^^^^^^^^^^^^^^^^^ `U` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `U`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained`
|
||||
--> $DIR/generic_underconstrained2.rs:5:26
|
||||
|
|
@ -51,7 +51,7 @@ error[E0277]: `V` doesn't implement `Debug`
|
|||
--> $DIR/generic_underconstrained2.rs:19:43
|
||||
|
|
||||
LL | fn underconstrained2<U, V>(_: U, _: V) -> Underconstrained2<V> {
|
||||
| ^^^^^^^^^^^^^^^^^^^^ `V` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the trait `Debug` is not implemented for `V`
|
||||
|
|
||||
note: required by a bound on the type alias `Underconstrained2`
|
||||
--> $DIR/generic_underconstrained2.rs:15:27
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ error[E0277]: `Bar` doesn't implement `Debug`
|
|||
--> $DIR/nested.rs:17:22
|
||||
|
|
||||
LL | println!("{:?}", bar());
|
||||
| ^^^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| ---- ^^^^^ `Bar` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `Bar`
|
||||
= note: this error originates in the macro `$crate::format_args_nl` which comes from the expansion of the macro `println` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,9 @@ LL | 42;
|
|||
| - help: remove this semicolon
|
||||
...
|
||||
LL | println!("{}", x);
|
||||
| ^ `()` cannot be formatted with the default formatter
|
||||
| -- ^ `()` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
@ -18,7 +20,9 @@ LL | let y = {};
|
|||
| -- this empty block is missing a tail expression
|
||||
...
|
||||
LL | println!("{}", y);
|
||||
| ^ `()` cannot be formatted with the default formatter
|
||||
| -- ^ `()` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
@ -31,7 +35,9 @@ LL | "hi";
|
|||
| - help: remove this semicolon
|
||||
...
|
||||
LL | println!("{}", z);
|
||||
| ^ `()` cannot be formatted with the default formatter
|
||||
| -- ^ `()` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
@ -47,7 +53,9 @@ LL | | };
|
|||
| |_____- this block is missing a tail expression
|
||||
...
|
||||
LL | println!("{}", s);
|
||||
| ^ `()` cannot be formatted with the default formatter
|
||||
| -- ^ `()` cannot be formatted with the default formatter
|
||||
| |
|
||||
| required by this formatting parameter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
|
|
|
|||
|
|
@ -26,9 +26,7 @@ LL | #[derive(Clone, Copy, PartialEq, Eq, Debug, Ord, PartialOrd, Hash, Default)
|
|||
| ----- in this derive macro expansion
|
||||
LL | #[repr(transparent)]
|
||||
LL | struct Nanoseconds(NanoI32);
|
||||
| ^^^^^^^ `(i32) is 0..=999999999` cannot be formatted using `{:?}` because it doesn't implement `Debug`
|
||||
|
|
||||
= help: the trait `Debug` is not implemented for `(i32) is 0..=999999999`
|
||||
| ^^^^^^^ the trait `Debug` is not implemented for `(i32) is 0..=999999999`
|
||||
|
||||
error[E0277]: the trait bound `(i32) is 0..=999999999: Ord` is not satisfied
|
||||
--> $DIR/derives_fail.rs:11:20
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
|||
--> $DIR/point-at-type-param-in-path-expr.rs:4:19
|
||||
|
|
||||
LL | let x = foo::<()>;
|
||||
| ^^ `()` cannot be formatted with the default formatter
|
||||
| ^^ the trait `std::fmt::Display` is not implemented for `()`
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
note: required by a bound in `foo`
|
||||
--> $DIR/point-at-type-param-in-path-expr.rs:1:11
|
||||
|
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue