diff options
| author | Mazdak Farrokhzad <twingoow@gmail.com> | 2019-06-20 08:36:03 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-20 08:36:03 +0200 |
| commit | 942a7fec30e93ca466a30287c8764cfdd8158d9e (patch) | |
| tree | 5218a52f0662893cd3f4067c6349629a7205dc5f /src/test/ui/thinlto | |
| parent | 2ead0072b6a27d9b15fc22c181fdd6d129b20b08 (diff) | |
| parent | 673c3fc23ad0c78fe26420b641957e4fdfea553b (diff) | |
| download | rust-942a7fec30e93ca466a30287c8764cfdd8158d9e.tar.gz rust-942a7fec30e93ca466a30287c8764cfdd8158d9e.zip | |
Rollup merge of #61968 - eddyb:hir-noclone, r=petrochenkov
rustc: disallow cloning HIR nodes.
Besides being inefficient, cloning also risks creating broken HIR (without properly recreating all the IDs and whatnot, in which case you might as well reconstruct the entire node without ever `Clone`-ing anything).
We detect *some* detrimental situations (based on the occurrence of `HirId`s, I believe?), but it's better to statically disallow it, IMO.
One of the examples that is fixed by this PR is `tcx.hir().fn_decl{,_by_hir_id}`, which was cloning an entire `hir::FnDecl` *every single time it was called*.
r? @petrochenkov cc @rust-lang/compiler
Diffstat (limited to 'src/test/ui/thinlto')
0 files changed, 0 insertions, 0 deletions
