/src/test/incremental/hashes/trait_defs.rs

https://gitlab.com/rust-lang/rust · Rust · 1400 lines · 890 code · 292 blank · 218 comment · 0 complexity · 563f4d69dff35f0858246688d518ec09 MD5 · raw file

  1. // This test case tests the incremental compilation hash (ICH) implementation
  2. // for trait definitions.
  3. // The general pattern followed here is: Change one thing between rev1 and rev2
  4. // and make sure that the hash has changed, then change nothing between rev2 and
  5. // rev3 and make sure that the hash has not changed.
  6. // We also test the ICH for trait definitions exported in metadata. Same as
  7. // above, we want to make sure that the change between rev1 and rev2 also
  8. // results in a change of the ICH for the trait's metadata, and that it stays
  9. // the same between rev2 and rev3.
  10. // build-pass (FIXME(62277): could be check-pass?)
  11. // revisions: cfail1 cfail2 cfail3 cfail4 cfail5 cfail6
  12. // compile-flags: -Z query-dep-graph -O
  13. // [cfail1]compile-flags: -Zincremental-ignore-spans
  14. // [cfail2]compile-flags: -Zincremental-ignore-spans
  15. // [cfail3]compile-flags: -Zincremental-ignore-spans
  16. // [cfail4]compile-flags: -Zincremental-relative-spans
  17. // [cfail5]compile-flags: -Zincremental-relative-spans
  18. // [cfail6]compile-flags: -Zincremental-relative-spans
  19. #![allow(warnings)]
  20. #![feature(rustc_attrs)]
  21. #![crate_type="rlib"]
  22. #![feature(associated_type_defaults)]
  23. // Change trait visibility
  24. #[cfg(any(cfail1,cfail4))]
  25. trait TraitVisibility { }
  26. #[cfg(not(any(cfail1,cfail4)))]
  27. #[rustc_clean(cfg="cfail2")]
  28. #[rustc_clean(cfg="cfail3")]
  29. #[rustc_clean(cfg="cfail5", except="hir_owner,hir_owner_nodes")]
  30. #[rustc_clean(cfg="cfail6")]
  31. pub trait TraitVisibility { }
  32. // Change trait unsafety
  33. #[cfg(any(cfail1,cfail4))]
  34. trait TraitUnsafety { }
  35. #[cfg(not(any(cfail1,cfail4)))]
  36. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  37. #[rustc_clean(cfg="cfail3")]
  38. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  39. #[rustc_clean(cfg="cfail6")]
  40. unsafe trait TraitUnsafety { }
  41. // Add method
  42. #[cfg(any(cfail1,cfail4))]
  43. trait TraitAddMethod {
  44. }
  45. #[cfg(not(any(cfail1,cfail4)))]
  46. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail2")]
  47. #[rustc_clean(cfg="cfail3")]
  48. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail5")]
  49. #[rustc_clean(cfg="cfail6")]
  50. pub trait TraitAddMethod {
  51. fn method();
  52. }
  53. // Change name of method
  54. #[cfg(any(cfail1,cfail4))]
  55. trait TraitChangeMethodName {
  56. fn method();
  57. }
  58. #[cfg(not(any(cfail1,cfail4)))]
  59. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail2")]
  60. #[rustc_clean(cfg="cfail3")]
  61. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail5")]
  62. #[rustc_clean(cfg="cfail6")]
  63. trait TraitChangeMethodName {
  64. fn methodChanged();
  65. }
  66. // Add return type to method
  67. #[cfg(any(cfail1,cfail4))]
  68. trait TraitAddReturnType {
  69. //---------------------------------------------------------------------
  70. //--------------------------
  71. //---------------------------------------------------------------------
  72. //--------------------------
  73. fn method() ;
  74. }
  75. #[cfg(not(any(cfail1,cfail4)))]
  76. #[rustc_clean(cfg="cfail2")]
  77. #[rustc_clean(cfg="cfail3")]
  78. #[rustc_clean(cfg="cfail5")]
  79. #[rustc_clean(cfg="cfail6")]
  80. trait TraitAddReturnType {
  81. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  82. #[rustc_clean(cfg="cfail3")]
  83. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  84. #[rustc_clean(cfg="cfail6")]
  85. fn method() -> u32;
  86. }
  87. // Change return type of method
  88. #[cfg(any(cfail1,cfail4))]
  89. trait TraitChangeReturnType {
  90. // --------------------------------------------------------------------
  91. // -------------------------
  92. // --------------------------------------------------------------------
  93. // -------------------------
  94. fn method() -> u32;
  95. }
  96. #[cfg(not(any(cfail1,cfail4)))]
  97. #[rustc_clean(cfg="cfail2")]
  98. #[rustc_clean(cfg="cfail3")]
  99. #[rustc_clean(cfg="cfail5")]
  100. #[rustc_clean(cfg="cfail6")]
  101. trait TraitChangeReturnType {
  102. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  103. #[rustc_clean(cfg="cfail3")]
  104. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  105. #[rustc_clean(cfg="cfail6")]
  106. fn method() -> u64;
  107. }
  108. // Add parameter to method
  109. #[cfg(any(cfail1,cfail4))]
  110. trait TraitAddParameterToMethod {
  111. // --------------------------------------------------------------------
  112. // -------------------------
  113. // --------------------------------------------------------------------
  114. // -------------------------
  115. fn method( );
  116. }
  117. #[cfg(not(any(cfail1,cfail4)))]
  118. #[rustc_clean(cfg="cfail2")]
  119. #[rustc_clean(cfg="cfail3")]
  120. #[rustc_clean(cfg="cfail5")]
  121. #[rustc_clean(cfg="cfail6")]
  122. trait TraitAddParameterToMethod {
  123. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  124. #[rustc_clean(cfg="cfail3")]
  125. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  126. #[rustc_clean(cfg="cfail6")]
  127. fn method(a: u32);
  128. }
  129. // Change name of method parameter
  130. #[cfg(any(cfail1,cfail4))]
  131. trait TraitChangeMethodParameterName {
  132. //------------------------------------------------------
  133. //--------------------------------------------------------------
  134. //--------------------------
  135. //--------------------------------------------------------------
  136. //--------------------------
  137. fn method(a: u32);
  138. //------------------------------------------------------------------
  139. //--------------------------
  140. //------------------------------------------------------------------
  141. //--------------------------
  142. fn with_default(x: i32) {}
  143. }
  144. #[cfg(not(any(cfail1,cfail4)))]
  145. #[rustc_clean(cfg="cfail2")]
  146. #[rustc_clean(cfg="cfail3")]
  147. #[rustc_clean(cfg="cfail5")]
  148. #[rustc_clean(cfg="cfail6")]
  149. trait TraitChangeMethodParameterName {
  150. // FIXME(#38501) This should preferably always be clean.
  151. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  152. #[rustc_clean(cfg="cfail3")]
  153. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  154. #[rustc_clean(cfg="cfail6")]
  155. fn method(b: u32);
  156. #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail2")]
  157. #[rustc_clean(cfg="cfail3")]
  158. #[rustc_clean(except="hir_owner_nodes,optimized_mir", cfg="cfail5")]
  159. #[rustc_clean(cfg="cfail6")]
  160. fn with_default(y: i32) {}
  161. }
  162. // Change type of method parameter (i32 => i64)
  163. #[cfg(any(cfail1,cfail4))]
  164. trait TraitChangeMethodParameterType {
  165. // --------------------------------------------------------------------
  166. // -------------------------
  167. // --------------------------------------------------------------------
  168. // -------------------------
  169. fn method(a: i32);
  170. }
  171. #[cfg(not(any(cfail1,cfail4)))]
  172. #[rustc_clean(cfg="cfail2")]
  173. #[rustc_clean(cfg="cfail3")]
  174. #[rustc_clean(cfg="cfail5")]
  175. #[rustc_clean(cfg="cfail6")]
  176. trait TraitChangeMethodParameterType {
  177. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  178. #[rustc_clean(cfg="cfail3")]
  179. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  180. #[rustc_clean(cfg="cfail6")]
  181. fn method(a: i64);
  182. }
  183. // Change type of method parameter (&i32 => &mut i32)
  184. #[cfg(any(cfail1,cfail4))]
  185. trait TraitChangeMethodParameterTypeRef {
  186. // --------------------------------------------------------------------
  187. // -------------------------
  188. // --------------------------------------------------------------------
  189. // -------------------------
  190. fn method(a: & i32);
  191. }
  192. #[cfg(not(any(cfail1,cfail4)))]
  193. #[rustc_clean(cfg="cfail2")]
  194. #[rustc_clean(cfg="cfail3")]
  195. #[rustc_clean(cfg="cfail5")]
  196. #[rustc_clean(cfg="cfail6")]
  197. trait TraitChangeMethodParameterTypeRef {
  198. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  199. #[rustc_clean(cfg="cfail3")]
  200. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  201. #[rustc_clean(cfg="cfail6")]
  202. fn method(a: &mut i32);
  203. }
  204. // Change order of method parameters
  205. #[cfg(any(cfail1,cfail4))]
  206. trait TraitChangeMethodParametersOrder {
  207. // --------------------------------------------------------------------
  208. // -------------------------
  209. // --------------------------------------------------------------------
  210. // -------------------------
  211. fn method(a: i32, b: i64);
  212. }
  213. #[cfg(not(any(cfail1,cfail4)))]
  214. #[rustc_clean(cfg="cfail2")]
  215. #[rustc_clean(cfg="cfail3")]
  216. #[rustc_clean(cfg="cfail5")]
  217. #[rustc_clean(cfg="cfail6")]
  218. trait TraitChangeMethodParametersOrder {
  219. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  220. #[rustc_clean(cfg="cfail3")]
  221. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  222. #[rustc_clean(cfg="cfail6")]
  223. fn method(b: i64, a: i32);
  224. }
  225. // Add default implementation to method
  226. #[cfg(any(cfail1,cfail4))]
  227. trait TraitAddMethodAutoImplementation {
  228. // -----------------------------------------------------------------------------
  229. // -------------------------
  230. // -----------------------------------------------------------------------------
  231. // -------------------------
  232. fn method() ;
  233. }
  234. #[cfg(not(any(cfail1,cfail4)))]
  235. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  236. #[rustc_clean(cfg="cfail3")]
  237. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  238. #[rustc_clean(cfg="cfail6")]
  239. trait TraitAddMethodAutoImplementation {
  240. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail2")]
  241. #[rustc_clean(cfg="cfail3")]
  242. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail5")]
  243. #[rustc_clean(cfg="cfail6")]
  244. fn method() {}
  245. }
  246. // Change order of methods
  247. #[cfg(any(cfail1,cfail4))]
  248. trait TraitChangeOrderOfMethods {
  249. fn method0();
  250. fn method1();
  251. }
  252. #[cfg(not(any(cfail1,cfail4)))]
  253. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail2")]
  254. #[rustc_clean(cfg="cfail3")]
  255. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail5")]
  256. #[rustc_clean(cfg="cfail6")]
  257. trait TraitChangeOrderOfMethods {
  258. fn method1();
  259. fn method0();
  260. }
  261. // Change mode of self parameter
  262. #[cfg(any(cfail1,cfail4))]
  263. trait TraitChangeModeSelfRefToMut {
  264. // --------------------------------------------------------------------
  265. // -------------------------
  266. // --------------------------------------------------------------------
  267. // -------------------------
  268. fn method(& self);
  269. }
  270. #[cfg(not(any(cfail1,cfail4)))]
  271. #[rustc_clean(cfg="cfail2")]
  272. #[rustc_clean(cfg="cfail3")]
  273. #[rustc_clean(cfg="cfail5")]
  274. #[rustc_clean(cfg="cfail6")]
  275. trait TraitChangeModeSelfRefToMut {
  276. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  277. #[rustc_clean(cfg="cfail3")]
  278. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  279. #[rustc_clean(cfg="cfail6")]
  280. fn method(&mut self);
  281. }
  282. #[cfg(any(cfail1,cfail4))]
  283. trait TraitChangeModeSelfOwnToMut: Sized {
  284. // ----------------------------------------------------------------------------------
  285. // -------------------------
  286. // ----------------------------------------------------------------------------------
  287. // -------------------------
  288. fn method( self) {}
  289. }
  290. #[cfg(not(any(cfail1,cfail4)))]
  291. #[rustc_clean(cfg="cfail2")]
  292. #[rustc_clean(cfg="cfail3")]
  293. #[rustc_clean(cfg="cfail5")]
  294. #[rustc_clean(cfg="cfail6")]
  295. trait TraitChangeModeSelfOwnToMut: Sized {
  296. #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck,optimized_mir", cfg="cfail2")]
  297. #[rustc_clean(cfg="cfail3")]
  298. #[rustc_clean(except="hir_owner,hir_owner_nodes,typeck,optimized_mir", cfg="cfail5")]
  299. #[rustc_clean(cfg="cfail6")]
  300. fn method(mut self) {}
  301. }
  302. #[cfg(any(cfail1,cfail4))]
  303. trait TraitChangeModeSelfOwnToRef {
  304. // --------------------------------------------------------------------------------
  305. // -------------------------
  306. // --------------------------------------------------------------------------------
  307. // -------------------------
  308. fn method( self);
  309. }
  310. #[cfg(not(any(cfail1,cfail4)))]
  311. #[rustc_clean(cfg="cfail2")]
  312. #[rustc_clean(cfg="cfail3")]
  313. #[rustc_clean(cfg="cfail5")]
  314. #[rustc_clean(cfg="cfail6")]
  315. trait TraitChangeModeSelfOwnToRef {
  316. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,generics_of", cfg="cfail2")]
  317. #[rustc_clean(cfg="cfail3")]
  318. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,generics_of", cfg="cfail5")]
  319. #[rustc_clean(cfg="cfail6")]
  320. fn method(&self);
  321. }
  322. // Add unsafe modifier to method
  323. #[cfg(any(cfail1,cfail4))]
  324. trait TraitAddUnsafeModifier {
  325. // --------------------------------------------------------------------
  326. // -------------------------
  327. // --------------------------------------------------------------------
  328. // -------------------------
  329. fn method() ;
  330. }
  331. #[cfg(not(any(cfail1,cfail4)))]
  332. #[rustc_clean(cfg="cfail2")]
  333. #[rustc_clean(cfg="cfail3")]
  334. #[rustc_clean(except="hir_owner", cfg="cfail5")]
  335. #[rustc_clean(cfg="cfail6")]
  336. trait TraitAddUnsafeModifier {
  337. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  338. #[rustc_clean(cfg="cfail3")]
  339. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  340. #[rustc_clean(cfg="cfail6")]
  341. unsafe fn method();
  342. }
  343. // Add extern modifier to method
  344. #[cfg(any(cfail1,cfail4))]
  345. trait TraitAddExternModifier {
  346. // --------------------------------------------------------------------
  347. // -------------------------
  348. // --------------------------------------------------------------------
  349. // -------------------------
  350. fn method() ;
  351. }
  352. #[cfg(not(any(cfail1,cfail4)))]
  353. #[rustc_clean(cfg="cfail2")]
  354. #[rustc_clean(cfg="cfail3")]
  355. #[rustc_clean(except="hir_owner", cfg="cfail5")]
  356. #[rustc_clean(cfg="cfail6")]
  357. trait TraitAddExternModifier {
  358. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  359. #[rustc_clean(cfg="cfail3")]
  360. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  361. #[rustc_clean(cfg="cfail6")]
  362. extern "C" fn method();
  363. }
  364. // Change extern "C" to extern "stdcall"
  365. #[cfg(any(cfail1,cfail4))]
  366. trait TraitChangeExternCToRustIntrinsic {
  367. // --------------------------------------------------------------------
  368. // -------------------------
  369. // --------------------------------------------------------------------
  370. // -------------------------
  371. extern "C" fn method();
  372. }
  373. #[cfg(not(any(cfail1,cfail4)))]
  374. #[rustc_clean(cfg="cfail2")]
  375. #[rustc_clean(cfg="cfail3")]
  376. #[rustc_clean(cfg="cfail5")]
  377. #[rustc_clean(cfg="cfail6")]
  378. trait TraitChangeExternCToRustIntrinsic {
  379. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  380. #[rustc_clean(cfg="cfail3")]
  381. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  382. #[rustc_clean(cfg="cfail6")]
  383. extern "stdcall" fn method();
  384. }
  385. // Add type parameter to method
  386. #[cfg(any(cfail1,cfail4))]
  387. trait TraitAddTypeParameterToMethod {
  388. // --------------------------------------------------------------------------------
  389. // ---------------
  390. // -------------------------
  391. // --------------------------------------------------------------------------------
  392. // ---------------
  393. // -------------------------
  394. fn method ();
  395. }
  396. #[cfg(not(any(cfail1,cfail4)))]
  397. #[rustc_clean(cfg="cfail2")]
  398. #[rustc_clean(cfg="cfail3")]
  399. #[rustc_clean(cfg="cfail5")]
  400. #[rustc_clean(cfg="cfail6")]
  401. trait TraitAddTypeParameterToMethod {
  402. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
  403. cfg="cfail2")]
  404. #[rustc_clean(cfg="cfail3")]
  405. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of,type_of",
  406. cfg="cfail5")]
  407. #[rustc_clean(cfg="cfail6")]
  408. fn method<T>();
  409. }
  410. // Add lifetime parameter to method
  411. #[cfg(any(cfail1,cfail4))]
  412. trait TraitAddLifetimeParameterToMethod {
  413. // --------------------------------------------------------------------------------
  414. // -------------------------
  415. // --------------------------------------------------------------------------------
  416. // -------------------------
  417. fn method ();
  418. }
  419. #[cfg(not(any(cfail1,cfail4)))]
  420. #[rustc_clean(cfg="cfail2")]
  421. #[rustc_clean(cfg="cfail3")]
  422. #[rustc_clean(cfg="cfail5")]
  423. #[rustc_clean(cfg="cfail6")]
  424. trait TraitAddLifetimeParameterToMethod {
  425. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,generics_of", cfg="cfail2")]
  426. #[rustc_clean(cfg="cfail3")]
  427. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig,generics_of", cfg="cfail5")]
  428. #[rustc_clean(cfg="cfail6")]
  429. fn method<'a>();
  430. }
  431. // dummy trait for bound
  432. trait ReferencedTrait0 { }
  433. trait ReferencedTrait1 { }
  434. // Add trait bound to method type parameter
  435. #[cfg(any(cfail1,cfail4))]
  436. trait TraitAddTraitBoundToMethodTypeParameter {
  437. // ---------------------------------------------------------------------------
  438. // -------------------------
  439. // ---------------------------------------------------------------------------
  440. // -------------------------
  441. fn method<T >();
  442. }
  443. #[cfg(not(any(cfail1,cfail4)))]
  444. #[rustc_clean(cfg="cfail2")]
  445. #[rustc_clean(cfg="cfail3")]
  446. #[rustc_clean(cfg="cfail5")]
  447. #[rustc_clean(cfg="cfail6")]
  448. trait TraitAddTraitBoundToMethodTypeParameter {
  449. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  450. #[rustc_clean(cfg="cfail3")]
  451. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  452. #[rustc_clean(cfg="cfail6")]
  453. fn method<T: ReferencedTrait0>();
  454. }
  455. // Add builtin bound to method type parameter
  456. #[cfg(any(cfail1,cfail4))]
  457. trait TraitAddBuiltinBoundToMethodTypeParameter {
  458. // ---------------------------------------------------------------------------
  459. // -------------------------
  460. // ---------------------------------------------------------------------------
  461. // -------------------------
  462. fn method<T >();
  463. }
  464. #[cfg(not(any(cfail1,cfail4)))]
  465. #[rustc_clean(cfg="cfail2")]
  466. #[rustc_clean(cfg="cfail3")]
  467. #[rustc_clean(cfg="cfail5")]
  468. #[rustc_clean(cfg="cfail6")]
  469. trait TraitAddBuiltinBoundToMethodTypeParameter {
  470. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  471. #[rustc_clean(cfg="cfail3")]
  472. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  473. #[rustc_clean(cfg="cfail6")]
  474. fn method<T: Sized>();
  475. }
  476. // Add lifetime bound to method lifetime parameter
  477. #[cfg(any(cfail1,cfail4))]
  478. trait TraitAddLifetimeBoundToMethodLifetimeParameter {
  479. // -----------
  480. // -----------------------------------------------------------------------------
  481. // --------------
  482. //
  483. // -------------------------
  484. // -----------
  485. // -----------------------------------------------------------------------------
  486. // --------------
  487. //
  488. // -------------------------
  489. fn method<'a, 'b >(a: &'a u32, b: &'b u32);
  490. }
  491. #[cfg(not(any(cfail1,cfail4)))]
  492. #[rustc_clean(cfg="cfail2")]
  493. #[rustc_clean(cfg="cfail3")]
  494. #[rustc_clean(cfg="cfail5")]
  495. #[rustc_clean(cfg="cfail6")]
  496. trait TraitAddLifetimeBoundToMethodLifetimeParameter {
  497. #[rustc_clean(
  498. except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
  499. cfg="cfail2",
  500. )]
  501. #[rustc_clean(cfg="cfail3")]
  502. #[rustc_clean(
  503. except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
  504. cfg="cfail5",
  505. )]
  506. #[rustc_clean(cfg="cfail6")]
  507. fn method<'a, 'b: 'a>(a: &'a u32, b: &'b u32);
  508. }
  509. // Add second trait bound to method type parameter
  510. #[cfg(any(cfail1,cfail4))]
  511. trait TraitAddSecondTraitBoundToMethodTypeParameter {
  512. // ---------------------------------------------------------------------------
  513. // -------------------------
  514. // ---------------------------------------------------------------------------
  515. // -------------------------
  516. fn method<T: ReferencedTrait0 >();
  517. }
  518. #[cfg(not(any(cfail1,cfail4)))]
  519. #[rustc_clean(cfg="cfail2")]
  520. #[rustc_clean(cfg="cfail3")]
  521. #[rustc_clean(cfg="cfail5")]
  522. #[rustc_clean(cfg="cfail6")]
  523. trait TraitAddSecondTraitBoundToMethodTypeParameter {
  524. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  525. #[rustc_clean(cfg="cfail3")]
  526. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  527. #[rustc_clean(cfg="cfail6")]
  528. fn method<T: ReferencedTrait0 + ReferencedTrait1>();
  529. }
  530. // Add second builtin bound to method type parameter
  531. #[cfg(any(cfail1,cfail4))]
  532. trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
  533. // ---------------------------------------------------------------------------
  534. // -------------------------
  535. // ---------------------------------------------------------------------------
  536. // -------------------------
  537. fn method<T: Sized >();
  538. }
  539. #[cfg(not(any(cfail1,cfail4)))]
  540. #[rustc_clean(cfg="cfail2")]
  541. #[rustc_clean(cfg="cfail3")]
  542. #[rustc_clean(cfg="cfail5")]
  543. #[rustc_clean(cfg="cfail6")]
  544. trait TraitAddSecondBuiltinBoundToMethodTypeParameter {
  545. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  546. #[rustc_clean(cfg="cfail3")]
  547. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  548. #[rustc_clean(cfg="cfail6")]
  549. fn method<T: Sized + Sync>();
  550. }
  551. // Add second lifetime bound to method lifetime parameter
  552. #[cfg(any(cfail1,cfail4))]
  553. trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
  554. // -----------
  555. // -----------------------------------------------------------------------------
  556. // --------------
  557. //
  558. // -------------------------
  559. // -----------
  560. // -----------------------------------------------------------------------------
  561. // --------------
  562. //
  563. // -------------------------
  564. fn method<'a, 'b, 'c: 'a >(a: &'a u32, b: &'b u32, c: &'c u32);
  565. }
  566. #[cfg(not(any(cfail1,cfail4)))]
  567. #[rustc_clean(cfg="cfail2")]
  568. #[rustc_clean(cfg="cfail3")]
  569. #[rustc_clean(cfg="cfail5")]
  570. #[rustc_clean(cfg="cfail6")]
  571. trait TraitAddSecondLifetimeBoundToMethodLifetimeParameter {
  572. #[rustc_clean(
  573. except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
  574. cfg="cfail2",
  575. )]
  576. #[rustc_clean(cfg="cfail3")]
  577. #[rustc_clean(
  578. except="hir_owner,hir_owner_nodes,generics_of,predicates_of,fn_sig,type_of",
  579. cfg="cfail5",
  580. )]
  581. #[rustc_clean(cfg="cfail6")]
  582. fn method<'a, 'b, 'c: 'a + 'b>(a: &'a u32, b: &'b u32, c: &'c u32);
  583. }
  584. // Add associated type
  585. #[cfg(any(cfail1,cfail4))]
  586. trait TraitAddAssociatedType {
  587. //--------------------------
  588. //--------------------------
  589. // -------------
  590. //--------------------------
  591. //--------------------------
  592. //--------------------------
  593. //--------------------------
  594. fn method();
  595. }
  596. #[cfg(not(any(cfail1,cfail4)))]
  597. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail2")]
  598. #[rustc_clean(cfg="cfail3")]
  599. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail5")]
  600. #[rustc_clean(cfg="cfail6")]
  601. trait TraitAddAssociatedType {
  602. #[rustc_clean(cfg="cfail3")]
  603. #[rustc_clean(cfg="cfail6")]
  604. type Associated;
  605. #[rustc_clean(cfg="cfail2")]
  606. #[rustc_clean(cfg="cfail3")]
  607. #[rustc_clean(cfg="cfail5")]
  608. #[rustc_clean(cfg="cfail6")]
  609. fn method();
  610. }
  611. // Add trait bound to associated type
  612. #[cfg(any(cfail1,cfail4))]
  613. trait TraitAddTraitBoundToAssociatedType {
  614. // -------------------------------------------------------------
  615. // -------------------------
  616. // -------------------------------------------------------------
  617. // -------------------------
  618. type Associated ;
  619. fn method();
  620. }
  621. // Apparently the type bound contributes to the predicates of the trait, but
  622. // does not change the associated item itself.
  623. #[cfg(not(any(cfail1,cfail4)))]
  624. #[rustc_clean(cfg="cfail2")]
  625. #[rustc_clean(cfg="cfail3")]
  626. #[rustc_clean(cfg="cfail5")]
  627. #[rustc_clean(cfg="cfail6")]
  628. trait TraitAddTraitBoundToAssociatedType {
  629. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  630. #[rustc_clean(cfg="cfail3")]
  631. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  632. #[rustc_clean(cfg="cfail6")]
  633. type Associated: ReferencedTrait0;
  634. fn method();
  635. }
  636. // Add lifetime bound to associated type
  637. #[cfg(any(cfail1,cfail4))]
  638. trait TraitAddLifetimeBoundToAssociatedType<'a> {
  639. // -------------------------------------------------------------
  640. // -------------------------
  641. // -------------------------------------------------------------
  642. // -------------------------
  643. type Associated ;
  644. fn method();
  645. }
  646. #[cfg(not(any(cfail1,cfail4)))]
  647. #[rustc_clean(cfg="cfail2")]
  648. #[rustc_clean(cfg="cfail3")]
  649. #[rustc_clean(cfg="cfail5")]
  650. #[rustc_clean(cfg="cfail6")]
  651. trait TraitAddLifetimeBoundToAssociatedType<'a> {
  652. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  653. #[rustc_clean(cfg="cfail3")]
  654. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  655. #[rustc_clean(cfg="cfail6")]
  656. type Associated: 'a;
  657. fn method();
  658. }
  659. // Add default to associated type
  660. #[cfg(any(cfail1,cfail4))]
  661. trait TraitAddDefaultToAssociatedType {
  662. type Associated;
  663. fn method();
  664. }
  665. #[cfg(not(any(cfail1,cfail4)))]
  666. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  667. #[rustc_clean(cfg="cfail3")]
  668. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  669. #[rustc_clean(cfg="cfail6")]
  670. trait TraitAddDefaultToAssociatedType {
  671. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail2")]
  672. #[rustc_clean(cfg="cfail3")]
  673. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail5")]
  674. #[rustc_clean(cfg="cfail6")]
  675. type Associated = ReferenceType0;
  676. fn method();
  677. }
  678. // Add associated constant
  679. #[cfg(any(cfail1,cfail4))]
  680. trait TraitAddAssociatedConstant {
  681. fn method();
  682. }
  683. #[cfg(not(any(cfail1,cfail4)))]
  684. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail2")]
  685. #[rustc_clean(cfg="cfail3")]
  686. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item_def_ids", cfg="cfail5")]
  687. #[rustc_clean(cfg="cfail6")]
  688. trait TraitAddAssociatedConstant {
  689. const Value: u32;
  690. fn method();
  691. }
  692. // Add initializer to associated constant
  693. #[cfg(any(cfail1,cfail4))]
  694. trait TraitAddInitializerToAssociatedConstant {
  695. const Value: u32;
  696. fn method();
  697. }
  698. #[cfg(not(any(cfail1,cfail4)))]
  699. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail2")]
  700. #[rustc_clean(cfg="cfail3")]
  701. #[rustc_clean(except="hir_owner,hir_owner_nodes", cfg="cfail5")]
  702. #[rustc_clean(cfg="cfail6")]
  703. trait TraitAddInitializerToAssociatedConstant {
  704. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail2")]
  705. #[rustc_clean(cfg="cfail3")]
  706. #[rustc_clean(except="hir_owner,hir_owner_nodes,associated_item", cfg="cfail5")]
  707. #[rustc_clean(cfg="cfail6")]
  708. const Value: u32 = 1;
  709. #[rustc_clean(cfg="cfail2")]
  710. #[rustc_clean(cfg="cfail3")]
  711. #[rustc_clean(cfg="cfail5")]
  712. #[rustc_clean(cfg="cfail6")]
  713. fn method();
  714. }
  715. // Change type of associated constant
  716. #[cfg(any(cfail1,cfail4))]
  717. trait TraitChangeTypeOfAssociatedConstant {
  718. // ---------------------------------------------------------------------
  719. // -------------------------
  720. // ---------------------------------------------------------------------
  721. // -------------------------
  722. const Value: u32;
  723. // -------------------------
  724. // -------------------------
  725. // -------------------------
  726. // -------------------------
  727. fn method();
  728. }
  729. #[cfg(not(any(cfail1,cfail4)))]
  730. #[rustc_clean(cfg="cfail2")]
  731. #[rustc_clean(cfg="cfail3")]
  732. #[rustc_clean(cfg="cfail5")]
  733. #[rustc_clean(cfg="cfail6")]
  734. trait TraitChangeTypeOfAssociatedConstant {
  735. #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail2")]
  736. #[rustc_clean(cfg="cfail3")]
  737. #[rustc_clean(except="hir_owner,hir_owner_nodes,type_of", cfg="cfail5")]
  738. #[rustc_clean(cfg="cfail6")]
  739. const Value: f64;
  740. #[rustc_clean(cfg="cfail2")]
  741. #[rustc_clean(cfg="cfail3")]
  742. #[rustc_clean(cfg="cfail5")]
  743. #[rustc_clean(cfg="cfail6")]
  744. fn method();
  745. }
  746. // Add super trait
  747. #[cfg(any(cfail1,cfail4))]
  748. trait TraitAddSuperTrait { }
  749. #[cfg(not(any(cfail1,cfail4)))]
  750. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  751. #[rustc_clean(cfg="cfail3")]
  752. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  753. #[rustc_clean(cfg="cfail6")]
  754. trait TraitAddSuperTrait : ReferencedTrait0 { }
  755. // Add builtin bound (Send or Copy)
  756. #[cfg(any(cfail1,cfail4))]
  757. trait TraitAddBuiltiBound { }
  758. #[cfg(not(any(cfail1,cfail4)))]
  759. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  760. #[rustc_clean(cfg="cfail3")]
  761. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  762. #[rustc_clean(cfg="cfail6")]
  763. trait TraitAddBuiltiBound : Send { }
  764. // Add 'static lifetime bound to trait
  765. #[cfg(any(cfail1,cfail4))]
  766. trait TraitAddStaticLifetimeBound { }
  767. #[cfg(not(any(cfail1,cfail4)))]
  768. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  769. #[rustc_clean(cfg="cfail3")]
  770. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  771. #[rustc_clean(cfg="cfail6")]
  772. trait TraitAddStaticLifetimeBound : 'static { }
  773. // Add super trait as second bound
  774. #[cfg(any(cfail1,cfail4))]
  775. trait TraitAddTraitAsSecondBound : ReferencedTrait0 { }
  776. #[cfg(not(any(cfail1,cfail4)))]
  777. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  778. #[rustc_clean(cfg="cfail3")]
  779. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  780. #[rustc_clean(cfg="cfail6")]
  781. trait TraitAddTraitAsSecondBound : ReferencedTrait0 + ReferencedTrait1 { }
  782. #[cfg(any(cfail1,cfail4))]
  783. trait TraitAddTraitAsSecondBoundFromBuiltin : Send { }
  784. #[cfg(not(any(cfail1,cfail4)))]
  785. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  786. #[rustc_clean(cfg="cfail3")]
  787. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  788. #[rustc_clean(cfg="cfail6")]
  789. trait TraitAddTraitAsSecondBoundFromBuiltin : Send + ReferencedTrait0 { }
  790. // Add builtin bound as second bound
  791. #[cfg(any(cfail1,cfail4))]
  792. trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 { }
  793. #[cfg(not(any(cfail1,cfail4)))]
  794. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  795. #[rustc_clean(cfg="cfail3")]
  796. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  797. #[rustc_clean(cfg="cfail6")]
  798. trait TraitAddBuiltinBoundAsSecondBound : ReferencedTrait0 + Send { }
  799. #[cfg(any(cfail1,cfail4))]
  800. trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin : Send { }
  801. #[cfg(not(any(cfail1,cfail4)))]
  802. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  803. #[rustc_clean(cfg="cfail3")]
  804. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  805. #[rustc_clean(cfg="cfail6")]
  806. trait TraitAddBuiltinBoundAsSecondBoundFromBuiltin: Send + Copy { }
  807. // Add 'static bounds as second bound
  808. #[cfg(any(cfail1,cfail4))]
  809. trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 { }
  810. #[cfg(not(any(cfail1,cfail4)))]
  811. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  812. #[rustc_clean(cfg="cfail3")]
  813. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  814. #[rustc_clean(cfg="cfail6")]
  815. trait TraitAddStaticBoundAsSecondBound : ReferencedTrait0 + 'static { }
  816. #[cfg(any(cfail1,cfail4))]
  817. trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send { }
  818. #[cfg(not(any(cfail1,cfail4)))]
  819. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  820. #[rustc_clean(cfg="cfail3")]
  821. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  822. #[rustc_clean(cfg="cfail6")]
  823. trait TraitAddStaticBoundAsSecondBoundFromBuiltin : Send + 'static { }
  824. // Add type parameter to trait
  825. #[cfg(any(cfail1,cfail4))]
  826. trait TraitAddTypeParameterToTrait { }
  827. #[cfg(not(any(cfail1,cfail4)))]
  828. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  829. #[rustc_clean(cfg="cfail3")]
  830. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  831. #[rustc_clean(cfg="cfail6")]
  832. trait TraitAddTypeParameterToTrait<T> { }
  833. // Add lifetime parameter to trait
  834. #[cfg(any(cfail1,cfail4))]
  835. trait TraitAddLifetimeParameterToTrait { }
  836. #[cfg(not(any(cfail1,cfail4)))]
  837. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  838. #[rustc_clean(cfg="cfail3")]
  839. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  840. #[rustc_clean(cfg="cfail6")]
  841. trait TraitAddLifetimeParameterToTrait<'a> { }
  842. // Add trait bound to type parameter of trait
  843. #[cfg(any(cfail1,cfail4))]
  844. trait TraitAddTraitBoundToTypeParameterOfTrait<T> { }
  845. #[cfg(not(any(cfail1,cfail4)))]
  846. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  847. #[rustc_clean(cfg="cfail3")]
  848. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  849. #[rustc_clean(cfg="cfail6")]
  850. trait TraitAddTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
  851. // Add lifetime bound to type parameter of trait
  852. #[cfg(any(cfail1,cfail4))]
  853. trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T> { }
  854. #[cfg(not(any(cfail1,cfail4)))]
  855. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  856. #[rustc_clean(cfg="cfail3")]
  857. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  858. #[rustc_clean(cfg="cfail6")]
  859. trait TraitAddLifetimeBoundToTypeParameterOfTrait<'a, T: 'a> { }
  860. // Add lifetime bound to lifetime parameter of trait
  861. #[cfg(any(cfail1,cfail4))]
  862. trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a, 'b> { }
  863. #[cfg(not(any(cfail1,cfail4)))]
  864. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  865. #[rustc_clean(cfg="cfail3")]
  866. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  867. #[rustc_clean(cfg="cfail6")]
  868. trait TraitAddLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b> { }
  869. // Add builtin bound to type parameter of trait
  870. #[cfg(any(cfail1,cfail4))]
  871. trait TraitAddBuiltinBoundToTypeParameterOfTrait<T> { }
  872. #[cfg(not(any(cfail1,cfail4)))]
  873. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  874. #[rustc_clean(cfg="cfail3")]
  875. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  876. #[rustc_clean(cfg="cfail6")]
  877. trait TraitAddBuiltinBoundToTypeParameterOfTrait<T: Send> { }
  878. // Add second type parameter to trait
  879. #[cfg(any(cfail1,cfail4))]
  880. trait TraitAddSecondTypeParameterToTrait<T> { }
  881. #[cfg(not(any(cfail1,cfail4)))]
  882. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  883. #[rustc_clean(cfg="cfail3")]
  884. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  885. #[rustc_clean(cfg="cfail6")]
  886. trait TraitAddSecondTypeParameterToTrait<T, S> { }
  887. // Add second lifetime parameter to trait
  888. #[cfg(any(cfail1,cfail4))]
  889. trait TraitAddSecondLifetimeParameterToTrait<'a> { }
  890. #[cfg(not(any(cfail1,cfail4)))]
  891. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  892. #[rustc_clean(cfg="cfail3")]
  893. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  894. #[rustc_clean(cfg="cfail6")]
  895. trait TraitAddSecondLifetimeParameterToTrait<'a, 'b> { }
  896. // Add second trait bound to type parameter of trait
  897. #[cfg(any(cfail1,cfail4))]
  898. trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0> { }
  899. #[cfg(not(any(cfail1,cfail4)))]
  900. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  901. #[rustc_clean(cfg="cfail3")]
  902. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  903. #[rustc_clean(cfg="cfail6")]
  904. trait TraitAddSecondTraitBoundToTypeParameterOfTrait<T: ReferencedTrait0 + ReferencedTrait1> { }
  905. // Add second lifetime bound to type parameter of trait
  906. #[cfg(any(cfail1,cfail4))]
  907. trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a> { }
  908. #[cfg(not(any(cfail1,cfail4)))]
  909. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  910. #[rustc_clean(cfg="cfail3")]
  911. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  912. #[rustc_clean(cfg="cfail6")]
  913. trait TraitAddSecondLifetimeBoundToTypeParameterOfTrait<'a, 'b, T: 'a + 'b> { }
  914. // Add second lifetime bound to lifetime parameter of trait
  915. #[cfg(any(cfail1,cfail4))]
  916. trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b, 'b, 'c> { }
  917. #[cfg(not(any(cfail1,cfail4)))]
  918. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  919. #[rustc_clean(cfg="cfail3")]
  920. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  921. #[rustc_clean(cfg="cfail6")]
  922. trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTrait<'a: 'b + 'c, 'b, 'c> { }
  923. // Add second builtin bound to type parameter of trait
  924. #[cfg(any(cfail1,cfail4))]
  925. trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send> { }
  926. #[cfg(not(any(cfail1,cfail4)))]
  927. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  928. #[rustc_clean(cfg="cfail3")]
  929. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  930. #[rustc_clean(cfg="cfail6")]
  931. trait TraitAddSecondBuiltinBoundToTypeParameterOfTrait<T: Send + Sync> { }
  932. struct ReferenceType0 {}
  933. struct ReferenceType1 {}
  934. // Add trait bound to type parameter of trait in where clause
  935. #[cfg(any(cfail1,cfail4))]
  936. trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> { }
  937. #[cfg(not(any(cfail1,cfail4)))]
  938. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  939. #[rustc_clean(cfg="cfail3")]
  940. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  941. #[rustc_clean(cfg="cfail6")]
  942. trait TraitAddTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
  943. // Add lifetime bound to type parameter of trait in where clause
  944. #[cfg(any(cfail1,cfail4))]
  945. trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> { }
  946. #[cfg(not(any(cfail1,cfail4)))]
  947. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  948. #[rustc_clean(cfg="cfail3")]
  949. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  950. #[rustc_clean(cfg="cfail6")]
  951. trait TraitAddLifetimeBoundToTypeParameterOfTraitWhere<'a, T> where T: 'a { }
  952. // Add lifetime bound to lifetime parameter of trait in where clause
  953. #[cfg(any(cfail1,cfail4))]
  954. trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> { }
  955. #[cfg(not(any(cfail1,cfail4)))]
  956. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  957. #[rustc_clean(cfg="cfail3")]
  958. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  959. #[rustc_clean(cfg="cfail6")]
  960. trait TraitAddLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b> where 'a: 'b { }
  961. // Add builtin bound to type parameter of trait in where clause
  962. #[cfg(any(cfail1,cfail4))]
  963. trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> { }
  964. #[cfg(not(any(cfail1,cfail4)))]
  965. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  966. #[rustc_clean(cfg="cfail3")]
  967. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  968. #[rustc_clean(cfg="cfail6")]
  969. trait TraitAddBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
  970. // Add second trait bound to type parameter of trait in where clause
  971. #[cfg(any(cfail1,cfail4))]
  972. trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T> where T: ReferencedTrait0 { }
  973. #[cfg(not(any(cfail1,cfail4)))]
  974. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  975. #[rustc_clean(cfg="cfail3")]
  976. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  977. #[rustc_clean(cfg="cfail6")]
  978. trait TraitAddSecondTraitBoundToTypeParameterOfTraitWhere<T>
  979. where T: ReferencedTrait0 + ReferencedTrait1 { }
  980. // Add second lifetime bound to type parameter of trait in where clause
  981. #[cfg(any(cfail1,cfail4))]
  982. trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a { }
  983. #[cfg(not(any(cfail1,cfail4)))]
  984. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail2")]
  985. #[rustc_clean(cfg="cfail3")]
  986. #[rustc_clean(except="hir_owner,hir_owner_nodes,generics_of,predicates_of", cfg="cfail5")]
  987. #[rustc_clean(cfg="cfail6")]
  988. trait TraitAddSecondLifetimeBoundToTypeParameterOfTraitWhere<'a, 'b, T> where T: 'a + 'b { }
  989. // Add second lifetime bound to lifetime parameter of trait in where clause
  990. #[cfg(any(cfail1,cfail4))]
  991. trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b { }
  992. #[cfg(not(any(cfail1,cfail4)))]
  993. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  994. #[rustc_clean(cfg="cfail3")]
  995. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  996. #[rustc_clean(cfg="cfail6")]
  997. trait TraitAddSecondLifetimeBoundToLifetimeParameterOfTraitWhere<'a, 'b, 'c> where 'a: 'b + 'c { }
  998. // Add second builtin bound to type parameter of trait in where clause
  999. #[cfg(any(cfail1,cfail4))]
  1000. trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send { }
  1001. #[cfg(not(any(cfail1,cfail4)))]
  1002. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  1003. #[rustc_clean(cfg="cfail3")]
  1004. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  1005. #[rustc_clean(cfg="cfail6")]
  1006. trait TraitAddSecondBuiltinBoundToTypeParameterOfTraitWhere<T> where T: Send + Sync { }
  1007. // Change return type of method indirectly by modifying a use statement
  1008. mod change_return_type_of_method_indirectly_use {
  1009. #[cfg(any(cfail1,cfail4))]
  1010. use super::ReferenceType0 as ReturnType;
  1011. #[cfg(not(any(cfail1,cfail4)))]
  1012. use super::ReferenceType1 as ReturnType;
  1013. #[rustc_clean(cfg="cfail2")]
  1014. #[rustc_clean(cfg="cfail3")]
  1015. #[rustc_clean(cfg="cfail5")]
  1016. #[rustc_clean(cfg="cfail6")]
  1017. trait TraitChangeReturnType {
  1018. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  1019. #[rustc_clean(cfg="cfail3")]
  1020. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  1021. #[rustc_clean(cfg="cfail6")]
  1022. fn method() -> ReturnType;
  1023. }
  1024. }
  1025. // Change type of method parameter indirectly by modifying a use statement
  1026. mod change_method_parameter_type_indirectly_by_use {
  1027. #[cfg(any(cfail1,cfail4))]
  1028. use super::ReferenceType0 as ArgType;
  1029. #[cfg(not(any(cfail1,cfail4)))]
  1030. use super::ReferenceType1 as ArgType;
  1031. #[rustc_clean(cfg="cfail2")]
  1032. #[rustc_clean(cfg="cfail3")]
  1033. #[rustc_clean(cfg="cfail5")]
  1034. #[rustc_clean(cfg="cfail6")]
  1035. trait TraitChangeArgType {
  1036. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail2")]
  1037. #[rustc_clean(cfg="cfail3")]
  1038. #[rustc_clean(except="hir_owner,hir_owner_nodes,fn_sig", cfg="cfail5")]
  1039. #[rustc_clean(cfg="cfail6")]
  1040. fn method(a: ArgType);
  1041. }
  1042. }
  1043. // Change trait bound of method type parameter indirectly by modifying a use statement
  1044. mod change_method_parameter_type_bound_indirectly_by_use {
  1045. #[cfg(any(cfail1,cfail4))]
  1046. use super::ReferencedTrait0 as Bound;
  1047. #[cfg(not(any(cfail1,cfail4)))]
  1048. use super::ReferencedTrait1 as Bound;
  1049. #[rustc_clean(cfg="cfail2")]
  1050. #[rustc_clean(cfg="cfail3")]
  1051. #[rustc_clean(cfg="cfail5")]
  1052. #[rustc_clean(cfg="cfail6")]
  1053. trait TraitChangeBoundOfMethodTypeParameter {
  1054. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  1055. #[rustc_clean(cfg="cfail3")]
  1056. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  1057. #[rustc_clean(cfg="cfail6")]
  1058. fn method<T: Bound>(a: T);
  1059. }
  1060. }
  1061. // Change trait bound of method type parameter in where clause indirectly
  1062. // by modifying a use statement
  1063. mod change_method_parameter_type_bound_indirectly_by_use_where {
  1064. #[cfg(any(cfail1,cfail4))]
  1065. use super::ReferencedTrait0 as Bound;
  1066. #[cfg(not(any(cfail1,cfail4)))]
  1067. use super::ReferencedTrait1 as Bound;
  1068. #[rustc_clean(cfg="cfail2")]
  1069. #[rustc_clean(cfg="cfail3")]
  1070. #[rustc_clean(cfg="cfail5")]
  1071. #[rustc_clean(cfg="cfail6")]
  1072. trait TraitChangeBoundOfMethodTypeParameterWhere {
  1073. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  1074. #[rustc_clean(cfg="cfail3")]
  1075. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  1076. #[rustc_clean(cfg="cfail6")]
  1077. fn method<T>(a: T) where T: Bound;
  1078. }
  1079. }
  1080. // Change trait bound of trait type parameter indirectly by modifying a use statement
  1081. mod change_method_type_parameter_bound_indirectly {
  1082. #[cfg(any(cfail1,cfail4))]
  1083. use super::ReferencedTrait0 as Bound;
  1084. #[cfg(not(any(cfail1,cfail4)))]
  1085. use super::ReferencedTrait1 as Bound;
  1086. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  1087. #[rustc_clean(cfg="cfail3")]
  1088. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  1089. #[rustc_clean(cfg="cfail6")]
  1090. trait TraitChangeTraitBound<T: Bound> {
  1091. fn method(a: T);
  1092. }
  1093. }
  1094. // Change trait bound of trait type parameter in where clause indirectly
  1095. // by modifying a use statement
  1096. mod change_method_type_parameter_bound_indirectly_where {
  1097. #[cfg(any(cfail1,cfail4))]
  1098. use super::ReferencedTrait0 as Bound;
  1099. #[cfg(not(any(cfail1,cfail4)))]
  1100. use super::ReferencedTrait1 as Bound;
  1101. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail2")]
  1102. #[rustc_clean(cfg="cfail3")]
  1103. #[rustc_clean(except="hir_owner,hir_owner_nodes,predicates_of", cfg="cfail5")]
  1104. #[rustc_clean(cfg="cfail6")]
  1105. trait TraitChangeTraitBoundWhere<T> where T: Bound {
  1106. fn method(a: T);
  1107. }
  1108. }