]>
Commit | Line | Data |
---|---|---|
1b1a35ee XL |
1 | // NOTE: This test doesn't actually require `fulldeps` |
2 | // so we could instead use it as an `ui` test. | |
3 | // | |
4 | // Considering that all other `internal-lints` are tested here | |
5 | // this seems like the cleaner solution though. | |
6 | #![feature(rustc_attrs)] | |
7 | #![deny(rustc::ty_pass_by_reference)] | |
8 | #![allow(unused)] | |
9 | ||
10 | #[rustc_diagnostic_item = "TyCtxt"] | |
11 | struct TyCtxt<'tcx> { | |
12 | inner: &'tcx (), | |
13 | } | |
14 | ||
15 | impl<'tcx> TyCtxt<'tcx> { | |
16 | fn by_value(self) {} // OK | |
17 | fn by_ref(&self) {} //~ ERROR passing `TyCtxt<'tcx>` by reference | |
18 | } | |
19 | ||
20 | ||
21 | struct TyS<'tcx> { | |
22 | inner: &'tcx (), | |
23 | } | |
24 | ||
25 | #[rustc_diagnostic_item = "Ty"] | |
26 | type Ty<'tcx> = &'tcx TyS<'tcx>; | |
27 | ||
28 | impl<'tcx> TyS<'tcx> { | |
29 | fn by_value(self: Ty<'tcx>) {} | |
30 | fn by_ref(self: &Ty<'tcx>) {} //~ ERROR passing `Ty<'tcx>` by reference | |
31 | } | |
32 | ||
33 | fn main() {} |