diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2022-09-06 08:36:08 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-06 08:36:08 +0900 |
| commit | c3faa2250c67ac040fba77828b7e042940412110 (patch) | |
| tree | b79676cb6e9b3bbd7eb11d0f40ca203141bebe4b /src | |
| parent | c633b0a72c6e1d58b7251e2011b5b8d7a1fff4b1 (diff) | |
| parent | 3b3c7063c23d43b30077fb5f997456e60e5806a6 (diff) | |
| download | rust-c3faa2250c67ac040fba77828b7e042940412110.tar.gz rust-c3faa2250c67ac040fba77828b7e042940412110.zip | |
Rollup merge of #101425 - compiler-errors:point-at-ty-param, r=spastorino
Point at type parameter in plain path expr Slightly better error message for a kinda unique use case.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/ui/typeck/point-at-type-param-in-path-expr.rs | 6 | ||||
| -rw-r--r-- | src/test/ui/typeck/point-at-type-param-in-path-expr.stderr | 17 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/typeck/point-at-type-param-in-path-expr.rs b/src/test/ui/typeck/point-at-type-param-in-path-expr.rs new file mode 100644 index 00000000000..9a21536f9b1 --- /dev/null +++ b/src/test/ui/typeck/point-at-type-param-in-path-expr.rs @@ -0,0 +1,6 @@ +fn foo<T: std::fmt::Display>() {} + +fn main() { + let x = foo::<()>; + //~^ ERROR `()` doesn't implement `std::fmt::Display` +} diff --git a/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr b/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr new file mode 100644 index 00000000000..1feaa0508bf --- /dev/null +++ b/src/test/ui/typeck/point-at-type-param-in-path-expr.stderr @@ -0,0 +1,17 @@ +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 + | + = 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 + | +LL | fn foo<T: std::fmt::Display>() {} + | ^^^^^^^^^^^^^^^^^ required by this bound in `foo` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. |
