-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Propagate lifetime resolution errors into tcx.type_of
Fixes #69136 Previously, lifetime resolution errors would cause an error to be emitted, but would not mark the parent type as 'tainted' in any way. We usually abort compilation before this becomes an issue - however, opaque types can cause us to type-check function bodies before such an abort occurs. Ths can result in trying to instantiate opaque types that have invalid computed generics. Currently, this only causes issues for nested opaque types, but there's no reason to expect the computed generics to be sane when we had unresolved lifetimes (which can result in extra lifetime parameters getting added to the generics). This commit tracks 'unresolved lifetime' errors that occur during lifetime resolution. When we type-check an item, we bail out and return `tcx.types.err` if a lifetime error was reported for that type. This causes us to skip type-checking of types affected by the lifetime error, while still checking unrelated types. Additionally, we now check for errors in 'parent' opaque types (if such a 'parent' exists) when collecting constraints for opaque types. This reflects the fact that opaque types inherit generics from 'parent' opaque types - if an error ocurred while type-checking the parent, we don't attempt to type-check the child.
- Loading branch information
Showing
9 changed files
with
122 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.