Special note for str in auto traits
This commit is contained in:
parent
3560e65c44
commit
53fb433652
2 changed files with 2 additions and 1 deletions
|
@ -3107,6 +3107,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
||||||
self.tcx.def_span(def_id),
|
self.tcx.def_span(def_id),
|
||||||
"required because it's used within this closure",
|
"required because it's used within this closure",
|
||||||
),
|
),
|
||||||
|
ty::Str => err.note("`str` is considered to contain a `[u8]` slice for auto trait purposes"),
|
||||||
_ => err.note(&msg),
|
_ => err.note(&msg),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@ error[E0277]: the trait bound `[u8]: AutoTrait` is not satisfied in `str`
|
||||||
LL | needs_auto_trait::<str>();
|
LL | needs_auto_trait::<str>();
|
||||||
| ^^^ within `str`, the trait `AutoTrait` is not implemented for `[u8]`
|
| ^^^ within `str`, the trait `AutoTrait` is not implemented for `[u8]`
|
||||||
|
|
|
|
||||||
= note: required because it appears within the type `str`
|
= note: `str` is considered to contain a `[u8]` slice for auto trait purposes
|
||||||
note: required by a bound in `needs_auto_trait`
|
note: required by a bound in `needs_auto_trait`
|
||||||
--> $DIR/str-contains-slice-conceptually.rs:8:24
|
--> $DIR/str-contains-slice-conceptually.rs:8:24
|
||||||
|
|
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue