about summary refs log tree commit diff
path: root/src/librustc/traits/specialize/specialization_graph.rs
AgeCommit message (Collapse)AuthorLines
2020-02-16Move librustc/{traits,infer} to librustc_infer.Camille GILLOT-350/+0
2020-02-11Don't run coherence twice for future-compat lintsJonas Schievink-30/+43
2020-02-09Remove vestigial #43355-compat codeJonas Schievink-24/+6
This was previously a future-compat warning that has since been turned into hard error, but without actually removing all the code. Avoids a call to `traits::overlapping_impls`, which is expensive.
2020-02-06lint impls that will become incoherent when leak-check is removedNiko Matsakis-2/+22
2020-02-05Move specialization_graph definition in traits::types.Camille GILLOT-196/+4
2020-01-09Don't discard marker trait impls when inference variables are presentAaron Hill-1/+1
Fixes #61651 Previously, we would unconditionally discard impl candidates for marker traits during trait selection. However, if the predicate had inference variables, this could have the effect of constrainting inference variables (due to a successful trait selection) when we would have otherwise failed due to mutliple applicable impls, This commit prevents marker trait impls from being discarded while the obligation predicate has any inference variables, ensuring that discarding impls will never cause us to incorrectly constraint inference variables.
2020-01-05Remove rustc_hir reexports in rustc::hir.Mazdak Farrokhzad-1/+1
2020-01-04DefId{Map,Set} -> rustc::hir::def_idMazdak Farrokhzad-2/+1
2020-01-04canonicalize FxHash{Map,Set} importsMazdak Farrokhzad-1/+2
2019-12-22Format the worldMark Rousskov-62/+52
2019-11-29allow customising ty::TraitRef's printing behaviorMikhail Babenko-1/+1
fix clippy allow customising ty::TraitRef's printing behavior fix clippy stylistic fix
2019-11-19More HashStable.Camille GILLOT-6/+1
2019-10-05Add comment to `Type` and `OpaqueTy` matchJonas Schievink-1/+1
2019-10-05Deny specializing items not in the parent implJonas Schievink-24/+39
2019-09-28Switch over all StableHash impls to new formatMark Rousskov-5/+2
2019-09-27Remove global_tcx from TyCtxtMark Rousskov-1/+0
The non-global context was removed; there's only one context now. This is a noop method that only serves to confuse readers -- remove it.
2019-09-25Rename surviving uses of `sty`varkor-9/+9
2019-09-25Rename non-`TyS` uses of `sty`varkor-2/+2
2019-09-24Fix coherence checking for impl trait in type aliasesAaron Hill-1/+1
Fixes #63677 RFC #2071 (impl-trait-existential-types) does not explicitly state how impl trait type alises should interact with coherence. However, there's only one choice which makes sense - coherence should look at the underlying type (i.e. the 'defining' type of the impl trait) of the type alias, just like we do for non-impl-trait type aliases. Specifically, impl trait type alises which resolve to a local type should be treated like a local type with respect to coherence (e.g. impl trait type aliases which resolve to a forieign type should be treated as a foreign type, and those that resolve to a local type should be treated as a local type). Since neither inherent impls nor direct trait impl (i.e. `impl MyType` or `impl MyTrait for MyType`) are allowd for type aliases, this usually does not come up. Before we ever attempt to do coherence checking, we will have errored out if an impl trait type alias was used directly in an 'impl' clause. However, during trait selection, we sometimes need to prove bounds like 'T: Sized' for some type 'T'. If 'T' is an impl trait type alias, this requires to know the coherence behavior for impl trait type aliases when we perform coherence checking. Note: Since determining the underlying type of an impl trait type alias requires us to perform body type checking, this commit causes us to type check some bodies easlier than we otherwise would have. However, since this is done through a query, this shouldn't cause any problems For completeness, I've added an additional test of the coherence-related behavior of impl trait type aliases.
2019-08-02Replace "existential" by "opaque"varkor-2/+2
2019-06-14Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-6/+1
2019-06-14Unify all uses of 'gcx and 'tcx.Eduard-Mihai Burtescu-13/+13
2019-06-12Run `rustfmt --file-lines ...` for changes from previous commits.Eduard-Mihai Burtescu-28/+25
2019-06-12rustc: replace `TyCtxt<'tcx, 'gcx, 'tcx>` with `TyCtxt<'gcx, 'tcx>`.Eduard-Mihai Burtescu-8/+8
2019-06-12Fix fallout from `deny(unused_lifetimes)`.Eduard-Mihai Burtescu-3/+3
2019-06-12rustc: replace `TyCtxt<'a, 'gcx, 'tcx>` with `TyCtxt<'tcx, 'gcx, 'tcx>`.Eduard-Mihai Burtescu-10/+10
2019-05-26Rename "Associated*" to "Assoc*"Andrew Xu-4/+4
We are going to uniform the terminology of all associated items. Methods that may or may not have `self` are called "associated functions". Because `AssociatedFn` is a bit long, we rename `Associated` to `Assoc`.
2019-04-05Introduce an arena type which may be used to allocate a list of types with ↵John Kåre Alsaker-7/+6
destructors
2019-02-10rustc: doc commentsAlexander Regueiro-2/+2
2019-02-05move librustc to 2018Mark Mansi-8/+8
2019-01-04implement a hack to make traitobject 0.1.0 compileAriel Ben-Yehuda-5/+39
2019-01-04Revert "add coherence future-compat warnings for marker-only trait objects"Ariel Ben-Yehuda-41/+3
This reverts commit 760639635facb6c9a0926ac9278bcba71880b0b3.
2019-01-02try to detect affected code and direct people to #56105Niko Matsakis-0/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-18Auto merge of #56481 - arielb1:dynamic-order, r=nikomatsakisbors-3/+41
add coherence future-compat warnings for marker-only trait objects The future-compat warnings break code that assumes that `dyn Send + Sync != dyn Sync + Send`, and are the first step in making them equal. cc #33140. Note: this lint should be made to default-warn before we merge. It is deny only for the crater run. r? @nikomatsakis / @scalexm . cc @Centril & @alexreg.
2018-12-14add coherence future-compat warnings for marker-only trait objectsAriel Ben-Yehuda-3/+41
The future-compat warnings break code that assumes that `dyn Send + Sync != dyn Sync + Send`, and are the first step in making them equal. cc #33140. It should be possible to revert this commit when we're done with the warnings.
2018-12-12specialize: remove Boxes used by Children::insertljedrz-8/+33
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-13/+14
2018-11-15Auto merge of #54906 - qnighy:fix-issue-50452, r=nikomatsakisbors-8/+19
Reattach all grandchildren when constructing specialization graph. Specialization graphs are constructed by incrementally adding impls in the order of declaration. If the impl being added has its specializations in the graph already, they should be reattached under the impl. However, the current implementation only reattaches the one found first. Therefore, in the following specialization graph, ``` Tr1 | I3 / \ I1 I2 ``` If `I1`, `I2`, and `I3` are declared in this order, the compiler mistakenly constructs the following graph: ``` Tr1 / \ I3 I2 | I1 ``` This patch fixes the reattach procedure to include all specializing grandchildren-to-be. Fixes #50452.
2018-11-12Avoid the Box in `TyCtxt::associated_items`.Niko Matsakis-1/+1
This reduces instruction counts on packed_simd by 2%.
2018-10-08Reattach all grandchildren when constructing specialization graph.Masaki Hara-8/+19
This commit fixes the issue #50452.
2018-09-29don't elide lifetimes in paths in librustc/Zack M. Davis-2/+2
This seemed like a good way to kick the tires on the elided-lifetimes-in-paths lint (#52069)—seems to work! This was also pretty tedious—it sure would be nice if `cargo fix` worked on this codebase (#53896)!
2018-09-18A few cleanups and minor improvements to rustc/traitsljedrz-4/+5
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-16/+8
2018-07-28Auto merge of #52546 - nikomatsakis:issue-52050, r=pnkfelixbors-21/+78
do not overwrite child def-id in place but rather remove/insert When inserting a node N into the tree of impls, we sometimes find than an existing node C should be replaced with N. We used to overwrite C in place with the new def-id N -- but since the lists of def-ids are separated by simplified type, that could lead to N being inserted in the wrong place. This meant we might miss conflicts. We are now not trying to be so smart -- we remove C and then add N later. Fixes #52050 r? @aturon -- do you still remember this code at all? :)
2018-07-25Add type system canaries for potential future bugsOliver Schneider-1/+5
2018-07-23Implement associated existential typesOliver Schneider-3/+9
2018-07-21do not overwrite child def-id in place but rather remove/insertNiko Matsakis-21/+78
When inserting a node N into the tree of impls, we sometimes find than an existing node C should be replaced with N. We used to overwrite C in place with the new def-id N -- but since the lists of def-ids are separated by simplified type, that could lead to N being inserted in the wrong place. This meant we might miss conflicts. We are now not trying to be so smart -- we remove C and then add N later.
2018-06-28Use `Ident`s for associated item definitions in HIRVadim Petrochenkov-3/+3
Remove emulation of hygiene with gensyms
2018-06-28Use `Ident`s for associated type bindings in HIRVadim Petrochenkov-1/+1