summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2018-07-14use the adjusted type for cat_pattern in tuple patternsAriel Ben-Yehuda-1/+1
This looks like a typo introduced in #51686. Fixes #52213.
2018-07-14Fix rustdoc run failures by shutting down definitely some lintsGuillaume Gomez-1/+10
2018-06-27use `pat_ty_adjusted` from `expr_use_visitor` to type of argumentsNiko Matsakis-2/+3
2018-06-27rename `pat_ty` to `pat_ty_adjusted` for clarityNiko Matsakis-4/+4
2018-06-19Run rustfmtSantiago Pastorino-350/+598
2018-06-19Suggest that values are dropped in the opposite order they are definedSantiago Pastorino-0/+13
2018-06-19Added diagnostics for suggesting `mut x` on repeated mutations of `x`.Felix S. Klock II-0/+39
(Follow-on commits updating the test suite show the resulting changes to diagnostic output.)
2018-06-19Add `fn fn_decl` to `Hir`, for looking up the `FnDecl` of a body owner.Felix S. Klock II-0/+42
2018-06-19Thread info about form of variable bindings, including spans of arg types, ↵Felix S. Klock II-9/+54
down into `mir::LocalDecls`. As a drive-by: the ref_for_guards created by `fn declare_binding` should not have been tagged as user_variables in the first place. These secret internal locals are *pointers* to user variables, but themselves are not such (IMO. For now at least.)
2018-06-19Auto merge of #51383 - Zoxc:parallel-stuff, r=nikomatsakisbors-1/+7
Run some stuff in parallel Requires https://github.com/rust-lang/rust/pull/50699 to actually work correctly. r? @nikomatsakis
2018-06-19Add par_body_ownersJohn Kåre Alsaker-1/+7
2018-06-18Auto merge of #51248 - fabric-and-ink:newtype_index_debrujin, r=nikomatsakisbors-35/+29
Declare DebruijnIndex via newtype_index macro Part of #49887 Declare `DebruijnIndex` via the `newtype_index` macro.
2018-06-18Auto merge of #51460 - nikomatsakis:nll-perf-examination-refactor-1, r=pnkfelixbors-1/+14
Improve memoization and refactor NLL type check I have a big branch that is refactoring NLL type check with the goal of introducing canonicalization-based memoization for all of the operations it does. This PR contains an initial prefix of that branch which, I believe, stands alone. It does introduce a few smaller optimizations of its own: - Skip operations that are trivially a no-op - Cache the results of the dropck-outlives computations done by liveness - Skip resetting unifications if nothing changed r? @pnkfelix
2018-06-18Auto merge of #51414 - oli-obk:impl_trait_type_def, r=pnkfelixbors-77/+241
Add existential type definitions Note: this does not allow creating named existential types, it just desugars `impl Trait` to a less (but still very) hacky version of actual `existential type` items. r? @nikomatsakis
2018-06-17Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, ↵bors-10/+157
r=petrochenkov refactor: create multiple HIR items for imports When lowering `use` statements into HIR, they get a `Def` of the thing they're pointing at. This is great for things that need to know what was just pulled into scope. However, this is a bit misleading, because a `use` statement can pull things from multiple namespaces if their names collide. This is a problem for rustdoc, because if there are a module and a function with the same name (for example) then it will only document the module import, because that's that the lowered `use` statement points to. The current version of this PR does the following: * Whenever the resolver comes across a `use` statement, it loads the definitions into a new `import_map` instead of the existing `def_map`. This keeps the resolutions per-namespace so that all the target definitions are available. * When lowering `use` statements, it looks up the resolutions in the `import_map` and creates multiple `Item`s if there is more than one resolution. * To ensure the `NodeId`s are properly tracked in the lowered module, they need to be created in the AST, and pulled out as needed if multiple resolutions are available. Fixes https://github.com/rust-lang/rust/issues/34843
2018-06-17Auto merge of #51382 - GuillaumeGomez:intra-link-lint, r=QuietMisdreavusbors-0/+7
Add lint for intra link resolution failure This PR is almost done, just remains this note: ``` note: requested on the command line with `-W intra-link-resolution-failure` ``` I have no idea why my lint is considered as being passed through command line and wasn't able to find where it was set. If anyone has an idea, it'd be very helpful! cc @QuietMisdreavus
2018-06-16Auto merge of #51562 - SimonSapin:transparent, r=cramertjbors-8/+0
Stabilize #[repr(transparent)] Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-16Auto merge of #51550 - eddyb:queries-not-maps, r=nikomatsakisbors-155/+194
rustc: rename ty::maps to ty::query. Should've never been `maps` but "query system/engine" didn't fully settle from the start. r? @michaelwoerister or @nikomatsakis
2018-06-16Auto merge of #51411 - nnethercote:process_predicate, r=nikomatsakisbors-249/+253
Speed up obligation forest code Here are the rustc-perf benchmarks that get at least a 1% speedup on one or more of their runs with these patches applied: ``` inflate-check avg: -8.7% min: -12.1% max: 0.0% inflate avg: -5.9% min: -8.6% max: 1.1% inflate-opt avg: -1.5% min: -2.0% max: -0.3% clap-rs-check avg: -0.6% min: -1.9% max: 0.5% coercions avg: -0.2%? min: -1.3%? max: 0.6%? serde-opt avg: -0.6% min: -1.0% max: 0.1% coercions-check avg: -0.4%? min: -1.0%? max: -0.0%? ```
2018-06-15Auto merge of #51462 - Havvy:refactor-cmp, r=nikomatsakisbors-2/+4
Refactor: Rename ExistentialPredicate::cmp to ExistentialPredicate::stable_cmp See https://github.com/rust-lang/rust/pull/51276#discussion_r193549404 for rationale. Because stable_cmp takes three arguments and Ord::cmp takes two, I am confident that there is no shadowing happening here. r? @nikomatsakis
2018-06-15turn expect_full_def_from_use into an iteratorQuietMisdreavus-11/+4
2018-06-15Fix compile errorFabian Drinck-5/+5
2018-06-14create multiple HIR items for a use statementQuietMisdreavus-10/+164
2018-06-14Edit commentFabian Drinck-1/+1
2018-06-14Fix typo DebrujinIndex -> DebruijnIndexFabian Drinck-1/+1
2018-06-14Add DEBUG_FORMAT for DebruijnIndexFabian Drinck-0/+1
2018-06-14Declare DebruijnIndex via newtype_index macroFabian Drinck-36/+29
2018-06-14rustc: rename ty::maps to ty::query.Eduard-Mihai Burtescu-155/+194
2018-06-13Rename intra-doc lintGuillaume Gomez-2/+2
2018-06-13The param_env of an existential type is its function's param_envOliver Schneider-0/+6
2018-06-13Various cleanupsOliver Schneider-7/+1
2018-06-12Stabilize #[repr(transparent)]Simon Sapin-8/+0
Tracking issue FCP: https://github.com/rust-lang/rust/issues/43036#issuecomment-394094318 Reference PR: https://github.com/rust-lang-nursery/reference/pull/353
2018-06-11Fix extern prelude failure in rustdocGuillaume Gomez-0/+7
2018-06-11Auto merge of #51467 - toidiu:ak-51409, r=nikomatsakisbors-1/+3
create separate dep-nodes for predicates_of and explicit_predicates_of Fix for https://github.com/rust-lang/rust/issues/51409 - added incremental compilation test for infer_outlives_requirements - created separate dep-node for explicit_predicates_of
2018-06-10Auto merge of #51475 - GuillaumeGomez:fix-error-codes, r=Manishearthbors-12/+11
Fix error codes
2018-06-10Fix error codesGuillaume Gomez-12/+11
2018-06-10Stabilize entry-or-defaultGuillaume Gomez-1/+0
2018-06-10create separate dep-nodes for predicates_of and explicit_predicates_oftoidiu-1/+3
2018-06-09Refactor: Rename ExistentialPredicate::cmp to ExistentialPredicate::stable_cmpHavvy-2/+4
See https://github.com/rust-lang/rust/pull/51276#discussion_r193549404 for rationale.
2018-06-09introduce `any_unifications` flagNiko Matsakis-1/+14
Resetting unifications is expensive. Only do if there is something to reset.
2018-06-09Add lint for intra link resolution failureGuillaume Gomez-0/+7
2018-06-09Auto merge of #51042 - matthewjasper:reenable-trivial-bounds, r=nikomatsakisbors-16/+61
Re-enable trivial bounds cc #50825 Remove implementations from global bounds in winnowing when there is ambiguity. This results in the reverse of #24066 happening sometimes. I'm not sure if anything can be done about that though. cc #48214 r? @nikomatsakis
2018-06-08Rollup merge of #51412 - nnethercote:pending_obligations, r=estebankMark Rousskov-4/+4
Avoid useless Vec clones in pending_obligations(). The only instance of `ObligationForest` in use has an obligation type of `PendingPredicateObligation`, which contains a `PredicateObligation` and a `Vec<Ty>`. `FulfillmentContext::pending_obligations()` calls `ObligationForest::pending_obligations()`, which clones all the `PendingPredicateObligation`s. But the `Vec<Ty>` field of those cloned obligations is never touched. This patch changes `ObligationForest::pending_obligations()` to `map_pending_obligations` -- which gives callers control about which part of the obligation to clone -- and takes advantage of the change to avoid cloning the `Vec<Ty>`. The change speeds up runs of a few rustc-perf benchmarks, the best by 1%.
2018-06-08Rollup merge of #51401 - estebank:warn-repr, r=cramertjMark Rousskov-0/+6
Warn on `repr` without hints Fix #51376.
2018-06-08Rollup merge of #51394 - nnethercote:NCA-depths, r=nikomatsakisMark Rousskov-60/+70
Use scope tree depths to speed up `nearest_common_ancestor`. This patch adds depth markings to all entries in the `ScopeTree`'s `parent_map`. This change increases memory usage somewhat, but permits a much faster algorithm to be used: - If one scope has a greater depth than the other, the deeper scope is moved upward until they are at equal depths. - Then we move the two scopes upward in lockstep until they match. This avoids the need to keep track of which scopes have already been seen, which was the major part of the cost of the old algorithm. It also reduces the number of child-to-parent moves (which are hash table lookups) when the scopes start at different levels, because it never goes past the nearest common ancestor the way the old algorithm did. Finally, the case where one of the scopes is the root is now handled in advance, because that is moderately common and lets us skip everything. This change speeds up runs of several rust-perf benchmarks, the best by 6%. A selection of the bigger improvements: ``` clap-rs-check avg: -2.6% min: -6.6% max: 0.0% syn-check avg: -2.2% min: -5.0% max: 0.0% style-servo-check avg: -2.9%? min: -4.8%? max: 0.0%? cargo-check avg: -1.3% min: -2.8% max: 0.0% sentry-cli-check avg: -1.0% min: -2.1% max: 0.0% webrender-check avg: -0.9% min: -2.0% max: 0.0% style-servo avg: -0.9%? min: -1.8%? max: -0.0%? ripgrep-check avg: -0.7% min: -1.8% max: 0.1% clap-rs avg: -0.9% min: -1.6% max: -0.2% regex-check avg: -0.2% min: -1.3% max: 0.1% syn avg: -0.6% min: -1.3% max: 0.1% hyper-check avg: -0.5% min: -1.1% max: 0.0% ``` The idea came from multiple commenters on my blog and on Reddit. Thank you! r? @nikomatsakis
2018-06-08Rollup merge of #50143 - petrochenkov:mexuniq, r=nikomatsakisMark Rousskov-0/+13
Add deprecation lint for duplicated `macro_export`s cc https://github.com/rust-lang/rust/issues/35896#issuecomment-381370556
2018-06-08Reenable trivial boundsMatthew Jasper-16/+61
Removes extra global bounds at the winnowing stage rather than when normalizing the param_env. This avoids breaking inference when there is a global bound.
2018-06-08Avoid useless Vec clones in pending_obligations().Nicholas Nethercote-4/+4
The only instance of `ObligationForest` in use has an obligation type of `PendingPredicateObligation`, which contains a `PredicateObligation` and a `Vec<Ty>`. `FulfillmentContext::pending_obligations()` calls `ObligationForest::pending_obligations()`, which clones all the `PendingPredicateObligation`s. But the `Vec<Ty>` field of those cloned obligations is never touched. This patch changes `ObligationForest::pending_obligations()` to `map_pending_obligations` -- which gives callers control about which part of the obligation to clone -- and takes advantage of the change to avoid cloning the `Vec<Ty>`. The change speeds up runs of a few rustc-perf benchmarks, the best by 1%.
2018-06-07Add existential type definitonsOliver Schneider-76/+240
2018-06-07Introduce `ProcessResult`.Nicholas Nethercote-37/+41
A tri-valued enum is nicer than Result<Option<T>>, and it's slightly faster.