Commit Graph

80043 Commits

Author SHA1 Message Date
bors
c20824323c Auto merge of #51835 - tmccombs:stable-int-to-from-bytes, r=joshtriplett
Stabilize to_bytes and from_bytes for integers.

Fixes #49792
2018-06-27 09:21:34 +00:00
Oliver Schneider
eb9043bc67 Fix rebase fallout 2018-06-27 11:17:55 +02:00
Oliver Schneider
0e775a3b86 Don't visit the impl Trait item twice 2018-06-27 11:17:55 +02:00
Oliver Schneider
37cc714aa7 Don't use println in the compiler 2018-06-27 11:17:55 +02:00
Oliver Schneider
d5efa9636b Update tests 2018-06-27 11:17:55 +02:00
Oliver Schneider
62a5610791 Don't generate DefIds for impl trait in trait methods 2018-06-27 11:17:55 +02:00
Oliver Schneider
9eb75613f0 Generate DefIds for the impl trait of async functions 2018-06-27 11:17:55 +02:00
Oliver Schneider
2ec5eab368 Also place method impl trait into the surrounding module 2018-06-27 11:17:55 +02:00
Oliver Schneider
1b202426dc fixup 2018-06-27 11:17:55 +02:00
Oliver Schneider
013fca8698 Generate DefIds for impl Trait in the def_collector 2018-06-27 11:17:25 +02:00
Oliver Schneider
f8e83a6062 Don't generate a new NodeId for universal impl Trait 2018-06-27 11:17:25 +02:00
Oliver Schneider
b2e2c32105 Generate the NodeId for existential type in the AST 2018-06-27 11:17:25 +02:00
Oliver Schneider
bdcace0eb4 Cleanup in preparation of generic extraction 2018-06-27 11:17:25 +02:00
bors
971f7d34d4 Auto merge of #51815 - oli-obk:lowering_cleanups2, r=nikomatsakis
Lowering cleanups [2/N]

Double indirections are unnecessary
2018-06-27 07:16:13 +00:00
Joshua Liebow-Feeser
851cc39503 Optimize RefCell refcount tracking 2018-06-27 00:07:18 -07:00
Thayne McCombs
c8f9b84b39 Stabilize to_bytes and from_bytes for integers.
Fixes #49792
2018-06-26 23:17:56 -06:00
Michal 'vorner' Vaner
771748d0ba
Fix the error reference for LocalKey::try_with 2018-06-27 07:13:28 +02:00
Wesley Wiser
63ab0cba7d Inline abi::Size::bytes()
This save an additional 6 seconds on the test program.
2018-06-27 00:33:38 -04:00
bors
612c28004c Auto merge of #51598 - Pazzaz:master, r=sfackler
Optimize sum of Durations by using custom function

The current `impl Sum for Duration` uses `fold` to perform several `add`s (or really `checked_add`s) of durations. In doing so, it has to guarantee the number of nanoseconds is valid after every addition. If you squeese the current implementation into a single function it looks kind of like this:
````rust
fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration {
    let mut sum = Duration::new(0, 0);
    for rhs in iter {
        if let Some(mut secs) = sum.secs.checked_add(rhs.secs) {
            let mut nanos = sum.nanos + rhs.nanos;
            if nanos >= NANOS_PER_SEC {
                nanos -= NANOS_PER_SEC;
                if let Some(new_secs) = secs.checked_add(1) {
                    secs = new_secs;
                } else {
                    panic!("overflow when adding durations");
                }
            }
            sum = Duration { secs, nanos }
        } else {
            panic!("overflow when adding durations");
        }
    }
    sum
}
````
We only need to check if `nanos` is in the correct range when giving our final answer so we can have a more optimized version like so:
````rust
fn sum<I: Iterator<Item = Duration>>(iter: I) -> Duration {
    let mut total_secs: u64 = 0;
    let mut total_nanos: u64 = 0;

    for entry in iter {
        total_secs = total_secs
            .checked_add(entry.secs)
            .expect("overflow in iter::sum over durations");
        total_nanos = match total_nanos.checked_add(entry.nanos as u64) {
            Some(n) => n,
            None => {
                total_secs = total_secs
                    .checked_add(total_nanos / NANOS_PER_SEC as u64)
                    .expect("overflow in iter::sum over durations");
                (total_nanos % NANOS_PER_SEC as u64) + entry.nanos as u64
            }
        };
    }
    total_secs = total_secs
        .checked_add(total_nanos / NANOS_PER_SEC as u64)
        .expect("overflow in iter::sum over durations");
    total_nanos = total_nanos % NANOS_PER_SEC as u64;
    Duration {
        secs: total_secs,
        nanos: total_nanos as u32,
    }
}
````
We now only convert `total_nanos` to `total_secs` (1) if `total_nanos` overflows and (2) at the end of the function when we have to output a valid `Duration`. This gave a 5-22% performance improvement when I benchmarked it, depending on how big the `nano` value of the `Duration`s in `iter` were.
2018-06-27 04:02:05 +00:00
Wesley Wiser
202aea5acd Speed up compilation of large constant arrays
This is a different approach to #51672 as suggested by @oli-obk. Rather
than write each repeated value one-by-one, we write the first one and
then copy its value directly into the remaining memory.
2018-06-26 23:04:17 -04:00
bors
d6e2239a07 Auto merge of #51773 - oli-obk:cleanup_impl_trait, r=nikomatsakis
Don't inspect the generated existential type items

r? @nikomatsakis

My debugging led me to the `hir::ItemExistential(..)` checks, which are entirely unnecessary because we never use the items directly. The issue was that items were iterated over in a random order (due to hashmaps), so if you checked the `ItemExistential` before the function that has the actual return `impl Trait`, you'd run into those ICEs you encountered.
2018-06-27 01:49:56 +00:00
mark
75d33cfa64 add edition compiletest header + fix tests 2018-06-26 19:32:00 -05:00
mark
9f6bdb9409 lower case some feature gate messages 2018-06-26 19:06:01 -05:00
bors
0cf0691ea1 Auto merge of #51149 - zackmdavis:․․․_to_․․=, r=nikomatsakis
lint to favor `..=` over `...` range patterns; migrate to `..=` throughout codebase

We probably need an RFC to actually deprecate the `...` syntax, but here's a candidate implementation for the lint considered in #51043. (My local build is super flaky, but hopefully I got all of the test revisions.)
2018-06-26 23:15:30 +00:00
bors
84804c3874 Auto merge of #51814 - MajorBreakfast:local-task-obj, r=cramertj
Add `LocalTaskObj` to `core::task`

- Splits `libcore/task.rs` into submodules
- Adds `LocalTaskObj` and `SpawnLocalObjError` (-> [Commit for this](433e6b31a7))

Note: To make reviewing easy, both actions have their own commit

r? @cramertj
2018-06-26 21:09:52 +00:00
Josef Reinhard Brandl
b39ea1d18f Move spawn errors into executor.rs 2018-06-26 21:13:36 +02:00
Josef Reinhard Brandl
c055fef010 Nested LocalTaskObj in TaskObj, remove SpawnErrorObj conversions 2018-06-26 21:06:20 +02:00
bors
9cc3d44b93 Auto merge of #51756 - nielx:fix/librustdoc, r=GuillaumeGomez
Haiku: set stack size to 16 MB on Haiku, use 32 MB on other platforms

The maximum stack size on Haiku is set to 16 MB (see [the Haiku source](https://git.haiku-os.org/haiku/tree/headers/private/system/thread_defs.h#n17)). With this change rustdoc will also work on Haiku.
2018-06-26 18:55:09 +00:00
Niko Matsakis
e98d376e6f do not re-create the LocationTable for every path
🤦
2018-06-26 13:18:27 -04:00
Niko Matsakis
82169b6134 convert query-type-op to create query-region-constraint directly 2018-06-26 13:18:27 -04:00
Niko Matsakis
a583269af5 add a streamlined instantiate_query_result method for NLL queries 2018-06-26 13:18:25 -04:00
Niko Matsakis
e895f3aded convert dropck_outlives type-op to use the query 2018-06-26 12:41:47 -04:00
Niko Matsakis
977f3fc940 introduce QueryKey separation 2018-06-26 12:41:47 -04:00
Niko Matsakis
f24e90ec25 extract more helpers from instantiating query result 2018-06-26 12:41:47 -04:00
Niko Matsakis
7bab9f0974 WIP fix error messages for propagate_approximated_shorter_to_static_no_bound 2018-06-26 12:41:47 -04:00
bors
7008a953eb Auto merge of #51725 - Mark-Simulacrum:no-llvm, r=kennytm
Do not build LLVM tools for any of the tools

None of the tools in the list should need LLVM tools themselves as far as I can
tell; if this is incorrect, we can re-enable the tool building later.

The primary reason for doing this is that rust-central-station uses the
BuildManifest tool and building LLVM there is not cached: it takes ~1.5
hours on the 2 core machine. This commit should make nightlies and
stable releases much faster.

Followup to https://github.com/rust-lang/rust/pull/51459, r? @kennytm

I'm mostly relying on CI to test this so probably don't roll it up; I'm not sure how to (and not particularly inclined to) wait for multiple hours to test this locally. I imagine that the failures should be fairly obvious when/if encountered.
2018-06-26 16:26:00 +00:00
Oliver Schneider
e65947d701 Update rustdoc 2018-06-26 17:43:46 +02:00
Oliver Schneider
174b761432 Flatten some occurrences of [P<T>] to [T] 2018-06-26 17:07:53 +02:00
Josef Reinhard Brandl
433e6b31a7 Add LocalTaskObj 2018-06-26 17:06:20 +02:00
Niko Matsakis
7c72e778ab instantiate closure requirements as query-region-constraints [WIP]
Marked as WIP because it invalidates some tests.
2018-06-26 10:59:40 -04:00
Niko Matsakis
3e32d42532 transition to Fallible 2018-06-26 10:59:40 -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
d6136837b7 convert predicates to operate on 1 predicate at a time 2018-06-26 10:59:40 -04:00
Niko Matsakis
4beea9943b make Subtype a true query 2018-06-26 10:59:40 -04:00
Niko Matsakis
71ce2e7eb6 make Eq a true query 2018-06-26 10:59:40 -04:00
Niko Matsakis
1acffada44 introduce canonicalize_hr_query_hack
As the comment explains, this is needed to prevent subtype from going
awry in higher-ranked cases, due to #33684. The proper fix here is
introducing universes (#48536).
2018-06-26 10:59:40 -04:00
Niko Matsakis
2655522580 move type_op into rustc 2018-06-26 10:59:40 -04:00
Niko Matsakis
3b446b4b91 introduce QueryTypeOp trait and use it for eq 2018-06-26 10:59:40 -04:00
Niko Matsakis
1d664622b6 remove Canonicalization trait, which serves no purpose 2018-06-26 10:59:38 -04:00