]>
git.proxmox.com Git - rustc.git/blob - src/test/ui-fulldeps/internal-lints/pass_ty_by_ref_self.rs
1 // NOTE: This test doesn't actually require `fulldeps`
2 // so we could instead use it as an `ui` test.
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)]
10 #[rustc_diagnostic_item = "TyCtxt"]
15 impl<'tcx
> TyCtxt
<'tcx
> {
16 fn by_value(self) {}
// OK
17 fn by_ref(&self) {}
//~ ERROR passing `TyCtxt<'tcx>` by reference
25 #[rustc_diagnostic_item = "Ty"]
26 type Ty
<'tcx
> = &'tcx TyS
<'tcx
>;
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