about summary refs log tree commit diff
path: root/src/librustc_passes
AgeCommit message (Collapse)AuthorLines
2020-02-27use char instead of &str for single char patternsMatthias Krüger-1/+1
2020-02-24parser: tweak item kind wordingMazdak Farrokhzad-8/+2
2020-02-22Rename CodeMap to SourceMap follow upMaxim Zholobak-4/+4
2020-02-20Auto merge of #69072 - ecstatic-morse:associated-items, r=petrochenkovbors-2/+2
O(log n) lookup of associated items by name Resolves #68957, in which compile time is quadratic in the number of associated items. This PR makes name lookup use binary search instead of a linear scan to improve its asymptotic performance. As a result, the pathological case from that issue now runs in 8 seconds on my local machine, as opposed to many minutes on the current stable. Currently, method resolution must do a linear scan through all associated items of a type to find one with a certain name. This PR changes the result of the `associated_items` query to a data structure that preserves the definition order of associated items (which is used, e.g., for the layout of trait object vtables) while adding an index of those items sorted by (unhygienic) name. When doing name lookup, we first find all items with the same `Symbol` using binary search, then run hygienic comparison to find the one we are looking for. Ideally, this would be implemented using an insertion-order preserving, hash-based multi-map, but one is not readily available. Someone who is more familiar with identifier hygiene could probably make this better by auditing the uses of the `AssociatedItems` interface. My goal was to preserve the current behavior exactly, even if it seemed strange (I left at least one FIXME to this effect). For example, some places use comparison with `ident.modern()` and some places use `tcx.hygienic_eq` which requires the `DefId` of the containing `impl`. I don't know whether those approaches are equivalent or which one should be preferred.
2020-02-20Fix broken link to the rustc guideLeSeulArtichaut-1/+1
2020-02-19Make lookup of associated item by name O(log n)Dylan MacKenzie-2/+2
2020-02-18Propagate `rustc_const_unstable` to childrenDylan MacKenzie-11/+54
2020-02-18Use early return when forbidding unstable attrsDylan MacKenzie-117/+129
2020-02-16Other crates.Camille GILLOT-1/+1
2020-02-16Make librustc_infer compile.Camille GILLOT-0/+1
2020-02-12Rollup merge of #68554 - cjgillot:lang_items, r=ZoxcYuki Okushi-1/+281
Split lang_items to crates `rustc_hir` and `rustc_passes`. As discussed in comment https://github.com/rust-lang/rust/pull/67688#discussion_r368289946
2020-02-11Merge rustc::middle::*lang_items.Camille GILLOT-1/+1
2020-02-11Move it all into rustc_hir.Camille GILLOT-6/+5
2020-02-11Move weak_lang_items checking to librustc_passes.Camille GILLOT-33/+8
2020-02-11Move weak_lang_items.rs to librustc_passes.Camille GILLOT-0/+130
2020-02-11Move get_lang_items query in librustc_passes.Camille GILLOT-0/+175
2020-02-11Move hir::check_attr::Target to librustc_lang_items.Camille GILLOT-1/+2
2020-02-11Auto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=olibors-3/+21
Hide niches under UnsafeCell Hide any niche of T from type-construction context of `UnsafeCell<T>`. Fix #68303 Fix #68206
2020-02-11Run RustFmtjumbatm-15/+10
2020-02-11Run RustFmtjumbatm-60/+51
2020-02-11Invert control in struct_lint_level.jumbatm-66/+69
Caller now passes in a `decorate` function, which is only run if the lint is allowed.
2020-02-11Auto merge of #68929 - matprec:consistent-issue-references, r=Dylan-DPCbors-2/+2
Make issue references consistent Fixes https://github.com/rust-lang/rust/issues/62976 cc https://github.com/rust-lang/rust/pull/63008 r? @varkor because you reviewed the original pr
2020-02-10Add `#[repr(no_niche)]`.Felix S. Klock II-3/+21
This repr-hint makes a struct/enum hide any niche within from its surrounding type-construction context. It is meant (at least initially) as an implementation detail for resolving issue 68303. We will not stabilize the repr-hint unless someone finds motivation for doing so. (So, declaration of `no_niche` feature lives in section of file where other internal implementation details are grouped, and deliberately leaves out the tracking issue number.) incorporated review feedback, and fixed post-rebase.
2020-02-09Make issue references consistentMatthias Prechtl-2/+2
2020-02-08Make `provided_trait_methods` use `impl Iterator`Jonas Schievink-6/+6
2020-02-08Make `associated_items` query return a sliceJonas Schievink-0/+1
2020-02-07Rollup merge of #68889 - Zoxc:hir-krate, r=eddybDylan DPC-3/+4
Move the `hir().krate()` method to a query and remove the `Krate` dep node r? @eddyb cc @michaelwoerister
2020-02-06Rollup merge of #68788 - Centril:unified-fn-bodies, r=petrochenkovDylan DPC-13/+12
Towards unified `fn` grammar Part of https://github.com/rust-lang/rust/pull/68728. - Syntactically, `fn` items in `extern { ... }` blocks can now have bodies (`fn foo() { ... }` as opposed to `fn foo();`). As above, we use semantic restrictions instead. - Syntactically, `fn` items in free contexts (directly in a file or a module) can now be without bodies (`fn foo();` as opposed to `fn foo() { ... }`. As above, we use semantic restrictions instead, including for non-ident parameter patterns. - We move towards unifying the `fn` front matter; this is fully realized in https://github.com/rust-lang/rust/pull/68728. r? @petrochenkov
2020-02-06Add a Hir wrapper typeJohn Kåre Alsaker-3/+4
2020-02-05Rollup merge of #68790 - nnethercote:improve-merge_from_succ, r=nikomatsakisDylan DPC-3/+11
Improve `merge_from_succ` A couple of small performance wins. r? @nikomatsakis
2020-02-05parser: merge `fn` grammars wrt. bodies & headersMazdak Farrokhzad-13/+12
also refactor `FnKind` and `visit_assoc_item` visitors
2020-02-04Rollup merge of #68815 - matthiaskrgr:redundant_imports, r=alexcrichtonDylan DPC-1/+0
remove redundant imports (clippy::single_component_path_imports)
2020-02-04Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbinibors-1/+0
Step stage0 to bootstrap from 1.42 This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
2020-02-04remove redundant imports (clippy::single_component_path_imports)Matthias Krüger-1/+0
2020-02-03Pull out a special case in `merge_from_succ`.Nicholas Nethercote-0/+6
This is a small perf win.
2020-02-03Fix up `merge_from_succ`.Nicholas Nethercote-3/+5
This function has a variable `changed` that is erroneously used for two related-but-different purpose: - to detect if the current element has changed; - to detect if any elements have changed. As a result, its use for the first purpose is broken, because if any prior element changed then the code always thinks the current element has changed. This is only a performance bug, not a correctness bug, because we frequently end up calling `assign_unpacked` unnecessarily to overwrite the element with itself. This commit adds `any_changed` to correctly distinguish between the two purposes. This is a small perf win for some benchmarks.
2020-02-01Move builtin attribute logic to new rustc_attr crate.Mazdak Farrokhzad-1/+2
For now, this is all the crate contains, but more attribute logic & types will be moved there over time.
2020-01-31Drop cfg(bootstrap) codeMark Rousskov-1/+0
2020-01-31Auto merge of #68080 - varkor:declared-here, r=petrochenkovbors-2/+2
Address inconsistency in using "is" with "declared here" "is" was generally used for NLL diagnostics, but not other diagnostics. Using "is" makes the diagnostics sound more natural and readable, so it seems sensible to commit to them throughout. r? @Centril
2020-01-29Make Target::from_impl_item a free function.Camille GILLOT-22/+16
2020-01-29Move upvars query to librustc_passes.Camille GILLOT-3/+5
2020-01-29Move upvars.rs to librustc_passes.Camille GILLOT-0/+110
2020-01-29Move check_mod_attr query in librustc_passes.Camille GILLOT-118/+10
2020-01-29Move check_attr.rs to librustc_passes.Camille GILLOT-0/+587
2020-01-27don't clone types that are copy, round two.Matthias Krüger-2/+2
2020-01-24Normalise notes with the/isvarkor-2/+2
2020-01-20Rollup merge of #68353 - Centril:code-liberation, r=petrochenkovDylan DPC-14/+1
Remove `rustc_error_codes` deps except in `rustc_driver` Remove dependencies on `rustc_error_codes` in all crates except for `rustc_driver`. This has some benefits: 1. Adding a new error code when hacking on the compiler only requires rebuilding at most `rustc_error_codes`, `rustc_driver`, and the reflexive & transitive closure of the crate where the new error code is being added and its reverse dependencies. This improves time-to-UI-tests (TTUT). 2. Adding an error description to an error code only requires rebuilding `rustc_error_codes` and `rustc_driver`. This should substantially improve TTUT. r? @petrochenkov cc @rust-lang/wg-diagnostics
2020-01-18remove rustc_error_codes deps except in rustc_driverMazdak Farrokhzad-14/+1
2020-01-18slice_patterns: remove internal uses of gateMazdak Farrokhzad-1/+1
2020-01-17Use named fields for `hir::ItemKind::Impl`Dylan MacKenzie-14/+14