diff options
| author | Waffle <waffle.lapkin@gmail.com> | 2021-09-13 16:36:14 +0300 |
|---|---|---|
| committer | Waffle <waffle.lapkin@gmail.com> | 2021-09-13 16:36:14 +0300 |
| commit | 6ec7255d7b9c96c4cc0feafec6f26a2a9db3b7aa (patch) | |
| tree | 333ca825ed2b1c1fef21c3d404a0abec64a749ea /compiler/rustc_mir_transform/src/coverage/query.rs | |
| parent | d2dfb0eb8e30d188fb1731e540bc1b418bcd046d (diff) | |
| download | rust-6ec7255d7b9c96c4cc0feafec6f26a2a9db3b7aa.tar.gz rust-6ec7255d7b9c96c4cc0feafec6f26a2a9db3b7aa.zip | |
Highlight the const function if error happened because of a bound on the impl block
Currently, for the following code, the compiler produces the errors like the
following error:
```rust
struct Type<T>
impl<T: Clone> Type<T> {
fn const f() {}
}
```
```text
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
--> ./test.rs:3:6
|
3 | impl<T: Clone> Type<T> {
| ^
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
```
This can be confusing (especially to newcomers) since the error mentions
"const fn parameters", but highlights only the impl.
This commits adds function highlighting, changing the error to the following:
```text
error[E0658]: trait bounds other than `Sized` on const fn parameters are unstable
--> ./test.rs:3:6
|
3 | impl<T: Clone> Type<T> {
| ^
4 | pub const fn f() {}
| ---------------- function declared as const here
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
= help: add `#![feature(const_fn_trait_bound)]` to the crate attributes to enable
```
Diffstat (limited to 'compiler/rustc_mir_transform/src/coverage/query.rs')
0 files changed, 0 insertions, 0 deletions
