In all cases of charitable gifts of real or personal estate, whether by deed or will, where the purposes of the donor cannot be literally carried into effect, a complaint may be filed for a cy pres application of the trust property; and at that time all proceedings, orders, and decrees shall be had and taken in the suit, to carry out the intents of the donor as near as may be, that the charity may not fail, and to this end application as provided may be made in the same complaint for appointment of a new trustee or trustees under or pursuant to the provisions of §§ 18-2-1 - 18-2-8, or under the general equity powers of the court.
R.I. Gen. Laws § 18-4-1