@@ -1413,23 +1413,26 @@ pub enum ExplicitSelf<'tcx> {
1413
1413
}
1414
1414
1415
1415
impl < ' tcx > ExplicitSelf < ' tcx > {
1416
- /// We wish to (for now) categorize an explicit self
1417
- /// declaration like `self: SomeType` into either ` self`,
1418
- /// `&self`, `&mut self`, or `Box<self>`. We do this here
1419
- /// by some simple pattern matching. A more precise check
1420
- /// is done later in `check_method_receiver()`.
1416
+ /// Categorizes an explicit self declaration like ` self: SomeType`
1417
+ /// into either `self`, `&self`, `&mut self`, `Box< self>`, or
1418
+ /// `Other` (meaning the arbitrary_self_types feature is used).
1419
+ /// We do this here via a combination of pattern matching and
1420
+ /// `can_eq`. A more precise check is done in `check_method_receiver()`.
1421
1421
///
1422
1422
/// Examples:
1423
1423
///
1424
1424
/// ```
1425
- /// impl Foo for &T {
1425
+ /// impl<'a> Foo for &'a T {
1426
1426
/// // Legal declarations:
1427
- /// fn method1(self: &&T); // ExplicitSelf::ByReference
1428
- /// fn method2(self: &T); // ExplicitSelf::ByValue
1429
- /// fn method3(self: Box<&T>); // ExplicitSelf::ByBox
1427
+ /// fn method1(self: &&'a T); // ExplicitSelf::ByReference
1428
+ /// fn method2(self: &'a T); // ExplicitSelf::ByValue
1429
+ /// fn method3(self: Box<&'a T>); // ExplicitSelf::ByBox
1430
+ /// fn method4(self: Rc<&'a T>); // ExplicitSelf::Other
1430
1431
///
1431
- /// // Invalid cases will be caught later by `check_method_receiver`:
1432
- /// fn method_err1(self: &mut T); // ExplicitSelf::ByReference
1432
+ /// // Invalid cases will be caught by `check_method_receiver`:
1433
+ /// fn method_err1(self: &'a mut T); // ExplicitSelf::Other
1434
+ /// fn method_err2(self: &'static T) // ExplicitSelf::ByValue
1435
+ /// fn method_err3(self: &&T) // ExplicitSelf::ByReference
1433
1436
/// }
1434
1437
/// ```
1435
1438
///
0 commit comments