added some notes in comments refering to rustc code that might do what we need