1
Fork 0

Treat str as containing [u8] for auto trait purposes

This commit is contained in:
Michael Goulet 2023-02-11 23:01:22 +00:00
parent 31448badfd
commit 3560e65c44
4 changed files with 35 additions and 2 deletions

View file

@ -2300,12 +2300,14 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
| ty::Float(_)
| ty::FnDef(..)
| ty::FnPtr(_)
| ty::Str
| ty::Error(_)
| ty::Infer(ty::IntVar(_) | ty::FloatVar(_))
| ty::Never
| ty::Char => ty::Binder::dummy(Vec::new()),
// Treat this like `struct str([u8]);`
ty::Str => ty::Binder::dummy(vec![self.tcx().mk_slice(self.tcx().types.u8)]),
ty::Placeholder(..)
| ty::Dynamic(..)
| ty::Param(..)