tcx.create_def
tcx.at(span).create_def
gen
For more information about how rustc works, see the rustc dev guide.