Commit Graph

124 Commits

Author SHA1 Message Date
bors
6310be458f Auto merge of #54601 - cuviper:prep-1.31, r=Mark-Simulacrum
Bump to 1.31.0 and bootstrap from 1.30 beta

Closes #54594.
2018-09-30 01:45:50 +00:00
Eduard-Mihai Burtescu
7020326bea rustc: keep a Span for each predicate in ty::GenericPredicates. 2018-09-28 17:19:35 +03:00
Josh Stone
ce034951fb Bump to 1.31.0 and bootstrap from 1.30 beta 2018-09-27 20:52:53 -07:00
Eduard-Mihai Burtescu
fa2c246384 Stabilize crate_in_paths, extern_absolute_paths and extern_prelude on all editions. 2018-09-22 09:26:40 +03:00
toidiu
731f4efae5 stabalize infer outlives requirements (RFC 2093).
Co-authored-by: nikomatsakis
2018-09-11 11:40:04 -04:00
ms2300
6c14360c32 Changing TyAnon -> TyOpaque and relevant functions 2018-09-05 13:01:16 -06:00
bors
70a21e89f1 Auto merge of #53441 - toidiu:ak-fix53419, r=nikomatsakis
fix for late-bound regions

Fix for https://github.com/rust-lang/rust/issues/53419

r? @nikomatsakis
2018-08-27 17:42:45 +00:00
bors
af2be23fd1 Auto merge of #53385 - matklad:stabilize-find-map, r=KodrAus
Stablize Iterator::find_map

Stabilization PR for https://github.com/rust-lang/rust/issues/49602
2018-08-25 08:53:04 +00:00
Niko Matsakis
73fb1622b3 check that adding infer-outlives requirement to all crates works 2018-08-24 17:10:50 -04:00
Igor Gutorov
4d81fe9243 Use optimized SmallVec implementation 2018-08-23 10:45:53 +03:00
varkor
8a5dccde2a Remove Ty prefix from Ty{Bool|Char|Int|Uint|Float|Str} 2018-08-22 16:08:49 +01:00
varkor
04fa5d3adb Remove Ty prefix from Ty{Foreign|Param} 2018-08-22 16:07:55 +01:00
varkor
6f637da50c Remove Ty prefix from Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error} 2018-08-22 16:07:44 +01:00
varkor
87c7e57020 Rename ty::Slice to ty::List 2018-08-22 16:05:27 +01:00
kennytm
b5519db323
Rollup merge of #53496 - matthiaskrgr:codespell_08_2018, r=varkor
Fix typos found by codespell.
2018-08-21 17:51:49 +08:00
Donato Sciarra
82607d2cf3 mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
Matthias Krüger
71120ef1e5 Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
Eduard-Mihai Burtescu
9b1d3c70ac rustc_resolve: don't allow paths starting with ::crate. 2018-08-17 12:59:56 +03:00
Aleksey Kladov
057878ac71 Stablize Iterator::find_map 2018-08-15 18:44:44 +03:00
memoryruins
cb49252f57 [nll] librustc_traits: enable feature(nll) for bootstrap 2018-08-09 04:10:46 -04:00
bors
023fd7e74a Auto merge of #52767 - ljedrz:avoid_format, r=petrochenkov
Prefer to_string() to format!()

Simple benchmarks suggest in some cases it can be faster by even 37%:
```
test converting_f64_long  ... bench:         339 ns/iter (+/- 199)
test converting_f64_short ... bench:         136 ns/iter (+/- 34)
test converting_i32_long  ... bench:          87 ns/iter (+/- 16)
test converting_i32_short ... bench:          87 ns/iter (+/- 49)
test converting_str       ... bench:          54 ns/iter (+/- 15)
test formatting_f64_long  ... bench:         349 ns/iter (+/- 176)
test formatting_f64_short ... bench:         145 ns/iter (+/- 14)
test formatting_i32_long  ... bench:          98 ns/iter (+/- 14)
test formatting_i32_short ... bench:          93 ns/iter (+/- 15)
test formatting_str       ... bench:          86 ns/iter (+/- 23)
```
2018-07-29 09:33:37 +00:00
ljedrz
57a5a9b054 Prefer to_string() to format!() 2018-07-27 11:11:18 +02:00
Tatsuyuki Ishi
e098985939 Deny bare_trait_objects globally 2018-07-25 10:25:29 +09:00
Tyler Mandry
e5286d9fa6 Convert implied_outlives_bounds to a query 2018-07-21 15:56:44 +03:00
bors
f686885a14 Auto merge of #52342 - nnethercote:CanonicalVar, r=nikomatsakis
Avoid most allocations in `Canonicalizer`.

Extra allocations are a significant cost of NLL, and the most common
ones come from within `Canonicalizer`. In particular, `canonical_var()`
contains this code:

    indices
	.entry(kind)
	.or_insert_with(|| {
	    let cvar1 = variables.push(info);
	    let cvar2 = var_values.push(kind);
	    assert_eq!(cvar1, cvar2);
	    cvar1
	})
	.clone()

`variables` and `var_values` are `Vec`s. `indices` is a `HashMap` used
to track what elements have been inserted into `var_values`. If `kind`
hasn't been seen before, `indices`, `variables` and `var_values` all get
a new element. (The number of elements in each container is always the
same.) This results in lots of allocations.

In practice, most of the time these containers only end up holding a few
elements. This PR changes them to avoid heap allocations in the common
case, by changing the `Vec`s to `SmallVec`s and only using `indices`
once enough elements are present. (When the number of elements is small,
a direct linear search of `var_values` is as good or better than a
hashmap lookup.)

The changes to `variables` are straightforward and contained within
`Canonicalizer`. The changes to `indices` are more complex but also
contained within `Canonicalizer`. The changes to `var_values` are more
intrusive because they require defining a new type
`SmallCanonicalVarValues` -- which is to `CanonicalVarValues` as
`SmallVec` is to `Vec -- and passing stack-allocated values of that type
in from outside.

All this speeds up a number of NLL "check" builds, the best by 2%.

r? @nikomatsakis
2018-07-18 00:45:57 +00:00
Nicholas Nethercote
7cc527770d Avoid most allocations in Canonicalizer.
Extra allocations are a significant cost of NLL, and the most common
ones come from within `Canonicalizer`. In particular, `canonical_var()`
contains this code:

    indices
	.entry(kind)
	.or_insert_with(|| {
	    let cvar1 = variables.push(info);
	    let cvar2 = var_values.push(kind);
	    assert_eq!(cvar1, cvar2);
	    cvar1
	})
	.clone()

`variables` and `var_values` are `Vec`s. `indices` is a `HashMap` used
to track what elements have been inserted into `var_values`. If `kind`
hasn't been seen before, `indices`, `variables` and `var_values` all get
a new element. (The number of elements in each container is always the
same.) This results in lots of allocations.

In practice, most of the time these containers only end up holding a few
elements. This PR changes them to avoid heap allocations in the common
case, by changing the `Vec`s to `SmallVec`s and only using `indices`
once enough elements are present. (When the number of elements is small,
a direct linear search of `var_values` is as good or better than a
hashmap lookup.)

The changes to `variables` are straightforward and contained within
`Canonicalizer`. The changes to `indices` are more complex but also
contained within `Canonicalizer`. The changes to `var_values` are more
intrusive because they require defining a new type
`SmallCanonicalVarValues` -- which is to `CanonicalVarValues` as
`SmallVec` is to `Vec -- and passing stack-allocated values of that type
in from outside.

All this speeds up a number of NLL "check" builds, the best by 2%.
2018-07-17 13:42:11 +10:00
ljedrz
5058af7003 Deny bare trait objects in the rest of rust 2018-07-12 13:50:22 +02:00
scalexm
37c5c0bf9c Change wording 2018-07-09 21:20:26 +02:00
csmoe
b9c6dba5c4 extend where clauses 2018-07-07 11:02:47 +08:00
csmoe
a6d4d2b945 refactor 2018-07-06 18:44:42 +08:00
csmoe
ff83ef0c24 merge wellformed(wc)s 2018-07-05 18:49:02 +08:00
csmoe
dabd3f6935 split IntoWellFormedGoal 2018-07-05 18:47:00 +08:00
csmoe
e2f3577131 wellformed wc 2018-07-05 18:46:43 +08:00
Niko Matsakis
90ea49b891 introduce predicates_defined_on for traits
This new query returns only the predicates *directly defined* on an
item (in contrast to the more common `predicates_of`, which returns
the predicates that must be proven to reference an item). These two
sets are almost always identical except for traits, where
`predicates_of` includes an artificial `Self: Trait<...>` predicate
(basically saying that you cannot use a trait item without proving
that the trait is implemented for the type parameters).

This new query is only used in chalk lowering, where this artificial
`Self: Trait` predicate is problematic. We encode it in metadata but
only where needed since it is kind of repetitive with existing
information.

Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 11:33:24 -04:00
Niko Matsakis
c9d4f0615f use ty::TraitRef::identity where possible
Co-authored-by: Tyler Mandry <tmandry@gmail.com>
2018-07-02 10:38:33 -04:00
Vadim Petrochenkov
f0622dfe5d Use Idents for associated item definitions in HIR
Remove emulation of hygiene with gensyms
2018-06-28 11:04:50 +03:00
Vadim Petrochenkov
1fe9b4d763 Use Idents for associated type bindings in HIR 2018-06-28 11:04:50 +03:00
Niko Matsakis
1523de34a2 rustfmt various files 2018-06-27 16:30:38 -04:00
Niko Matsakis
9b1d2229ff change the enter_canonical_trait_query method to give a fulfill cx 2018-06-27 16:04:32 -04:00
Niko Matsakis
0a0dae0964 pull out ParamEnvAnd and remove QueryKey 2018-06-27 15:45:49 -04:00
Niko Matsakis
b2e899f843 move into provide methods 2018-06-27 09:42:21 -04:00
Niko Matsakis
d49d5222a9 merge all the type_op_foo modules into one as they are so trivial 2018-06-27 06:53:54 -04:00
Niko Matsakis
66c88392b4 use query boiler plate for normalize_projection_ty too 2018-06-27 06:49:43 -04:00
Niko Matsakis
e6c8c632b7 use query boilerplate for prove-predicate -- slightly inefficient
This requires us to allocate a single entry vector we didn't use to
allocate. I doubt this makes a difference in practice, as this only
occurs for cache misses.
2018-06-27 06:49:20 -04:00
Niko Matsakis
ac40d73c6f use query boilerplate for subtype 2018-06-27 06:48:52 -04:00
Niko Matsakis
fa71af4192 use query boilerplate for normalize 2018-06-27 06:48:43 -04:00
Niko Matsakis
2fd8a312d9 extract out query boilerplate and use for Eq 2018-06-27 06:48:32 -04:00
Niko Matsakis
2a0b3d6224 introduce Normalizable trait for things directly normalizable 2018-06-26 10:59:40 -04:00
Niko Matsakis
de7e941e4e convert prove_predicate into a query 2018-06-26 10:59:40 -04:00
Niko Matsakis
4beea9943b make Subtype a true query 2018-06-26 10:59:40 -04:00