about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser
diff options
context:
space:
mode:
authorMazdak Farrokhzad <twingoow@gmail.com>2019-06-20 08:36:03 +0200
committerGitHub <noreply@github.com>2019-06-20 08:36:03 +0200
commit942a7fec30e93ca466a30287c8764cfdd8158d9e (patch)
tree5218a52f0662893cd3f4067c6349629a7205dc5f /src/libsyntax/parse/parser
parent2ead0072b6a27d9b15fc22c181fdd6d129b20b08 (diff)
parent673c3fc23ad0c78fe26420b641957e4fdfea553b (diff)
downloadrust-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/libsyntax/parse/parser')
0 files changed, 0 insertions, 0 deletions