Commit Graph

75350 Commits

Author SHA1 Message Date
Manish Goregaokar
457975369b
Rollup merge of #48808 - Zoxc:reg-diag, r=michaelwoerister
Move REGISTERED_DIAGNOSTICS to a ParseSess field

r? @michaelwoerister
2018-03-08 11:26:02 -08:00
Manish Goregaokar
d17eb8f68e
Rollup merge of #48789 - GuillaumeGomez:horizontal-scroll, r=QuietMisdreavus
Fix sidebar horizontal scroll

Just like @onur said.

r? @QuietMisdreavus
2018-03-08 11:26:00 -08:00
Manish Goregaokar
c8a73e438a
Rollup merge of #48752 - alexcrichton:fix-target-feature, r=michaelwoerister
rustc: Fix ICE with `#[target_feature]` on module

This commit fixes an ICE in rustc when `#[target_feature]` was applied to items
other than functions due to the way the feature was validated.
2018-03-08 11:25:59 -08:00
Manish Goregaokar
7c581b08fa
Rollup merge of #48738 - Songbird0:parseinterror_potential_cause, r=joshtriplett
Add a potential cause raising `ParseIntError`.

Initially, I wanted to add it directly to the documentation of `str. parse()` method, I finally found that it was more relevant (I hope so?) to directly document the structure in question. I've added a scenario, in which we could all get caught at least once, to make it easier to diagnose the problem when parsing integers.
2018-03-08 11:25:58 -08:00
Manish Goregaokar
6d0d34336d
Rollup merge of #48699 - frewsxcv:frewsxcv-impl-trait, r=nikomatsakis
Replace iterator structures with `impl Trait`.

Two commits:

* Replace iterator structures with `impl Trait`.
* Run rustfmt on `src/librustc_data_structures/graph/mod.rs`.
2018-03-08 11:25:57 -08:00
Manish Goregaokar
d7f44ac52c
Rollup merge of #48682 - spastorino:make_causal_lazy, r=nikomatsakis
[NLL] Make causal tracking lazy

Close #46590

cc @nikomatsakis
2018-03-08 11:25:56 -08:00
Manish Goregaokar
f12d5aa517
Rollup merge of #48292 - topecongiro:from_str-for-path-and-pathbuf, r=alexcrichton
Implement FromStr for PathBuf

Closes #44431.
2018-03-08 11:25:54 -08:00
Basile Desloges
4af749f074 Add a map of DefId to Span in the Definitions struct 2018-03-08 11:22:49 +01:00
bors
c90f68224b Auto merge of #46882 - oli-obk:miri3, r=eddyb
Replace all const evaluation with miri

* error reporting in constants prints a stacktrace through all called const fns
* Trivial constant propagation and folding in MIR (always active, irrelevant of the optimization level)
* can now use floating constants in patterns (previously only floating point literals were allowed)
    * the future compat lint is still produced for both cases
* can index into constant arrays during const eval (previously feature gated)
* can create a constant union value with field `a` and read from field `b`
* can dereference references into constants
* can create references inside constants (`const X: &u32 = &22`)
* Tuple struct constructors can be used in constants
* regression in const eval errors spans (some of these need improvements in mir debug info)
* can cast floats to ints and vice versa (in constants, and even nan/inf constants)
* Mir dump prints false/true instead of 0u8/1u8
* `1i8 >> [8][0]` does not lint about exceeding bitshifts anymore.
    * Needs const propagation across projections
* `foo[I]` produces a const eval lint if `foo: [T; N]` and `N < I`
    * Essentially all builtin panics produce lints if they can be statically proven to trigger at runtime. This is on a best effort basis, so there might be some complex cases that don't trigger. (The runtime panic stays there, irrelevant of whether the lint is produced or not)
* can use `union`s to implement `transmute` for `Copy` types in constants without a feature gate. With all the greatness and nasal demons that come with this.
* can convert integers to `&'static T` in constants (useful for embedded)

fixes #34997 (stack overflow with many constants)
fixes #25574 (deref byte strings in patterns)
fixes #27918 (broken mir ICE)
fixes #46114 (ICE on struct constructors in patterns)
fixes #37448 (`SomeStruct { foo } as SomeStruct`)
fixes #43754 (`return` in const fn)
fixes #41898 (tuple struct constructors)
fixes #31364 (infinite recursion with const fn, fixed by miri's recursion limit)
closes #29947 (const indexing stabilization)
fixes #45044 (pattern matching repeat expressions)
fixes #47971 (ICE on const fn + references)
fixes #48081 (ICE on cyclic assoc const error)
fixes #48746 (nonhelpful error message with unions)

r? @eddyb

even though 1k loc are added in tests, this PR reduces the loc in this repository by 700
2018-03-08 08:52:23 +00:00
Oliver Schneider
52dec0e1c9
Don't derive traits on packed structs 2018-03-08 08:35:39 +01:00
Oliver Schneider
47e0bb59db
Clean up the binary hex lint 2018-03-08 08:35:39 +01:00
Oliver Schneider
c0fc6a8b6b
simplify constant value pair field access 2018-03-08 08:35:39 +01:00
Oliver Schneider
b5ace9a906
Unify the const folding errors
before they differed depending on whether optimizations were on or not
2018-03-08 08:35:39 +01:00
Oliver Schneider
edc5f73433
Correct the shift overflow check in miri 2018-03-08 08:35:39 +01:00
Oliver Schneider
aedd4c61ea
Regenerate tests 2018-03-08 08:35:38 +01:00
Oliver Schneider
6cfda078bf
Use clearer name for integer bit width helper function 2018-03-08 08:35:38 +01:00
Oliver Schneider
eb18d39a04
Reuse Integer::from_attr 2018-03-08 08:35:38 +01:00
Oliver Schneider
273025675d
Remove unused error code 2018-03-08 08:35:38 +01:00
Oliver Schneider
3dc7e93db6
Generator assertions are unconditionally triggered 2018-03-08 08:35:38 +01:00
Oliver Schneider
47913ee8f4
Address review comments 2018-03-08 08:35:38 +01:00
Oliver Schneider
208d764833
Adjust test which differs between 32 bit and 64 bit
The differences are not part of what the test is testing, so they were simply removed.
2018-03-08 08:35:38 +01:00
Oliver Schneider
e8d357f070
Decide signdedness on the layout instead of the type 2018-03-08 08:35:37 +01:00
Oliver Schneider
889a4ebfa9
Deduplicate some code 2018-03-08 08:34:18 +01:00
Oliver Schneider
df283df887
Don't use the undefined bytes of PrimVal::Bytes 2018-03-08 08:34:18 +01:00
Oliver Schneider
7218836500
Fix mozjs crater failure 2018-03-08 08:34:18 +01:00
Oliver Schneider
134c2910ec
Const eval will oom together with rustc now 2018-03-08 08:34:18 +01:00
Oliver Schneider
0ca4b45a0c
Step limit is now terminator limit 2018-03-08 08:34:17 +01:00
Oliver Schneider
b63c6bbfee
Add regression test 2018-03-08 08:34:17 +01:00
Oliver Schneider
d98a2b90b2
Rebase fallout 2018-03-08 08:34:17 +01:00
Oliver Schneider
2f0e077300
Report tcx errors with the span of the currently evaluating statement 2018-03-08 08:34:17 +01:00
Oliver Schneider
1e653aa96b
Report a best guess span if no stack is available anymore 2018-03-08 08:34:17 +01:00
Oliver Schneider
f363e08c9d
Update compile-fail tests 2018-03-08 08:34:17 +01:00
Oliver Schneider
f68dc0190a
Add a test for transmuting via unions in constants 2018-03-08 08:34:17 +01:00
Oliver Schneider
0a1278aea8
Typo 2018-03-08 08:34:17 +01:00
Oliver Schneider
5b698a1040
Unregress error spans in constant errors 2018-03-08 08:34:17 +01:00
Oliver Schneider
421622d8f7
Stage 2 doesn't see suggestion_approximate 2018-03-08 08:34:16 +01:00
Oliver Schneider
f5cc5ca8c7
Remove dead code 2018-03-08 08:34:16 +01:00
Oliver Schneider
1f9d846a58
Add some documentation to pattern/const conversions 2018-03-08 08:34:16 +01:00
Oliver Schneider
b985399831
Reduce code duplication 2018-03-08 08:34:16 +01:00
Oliver Schneider
3c663d0607
Tidy fix 2018-03-08 08:34:16 +01:00
Oliver Schneider
8500c2fab2
Const eval error refactoring 2018-03-08 08:34:16 +01:00
Oliver Schneider
bd03371f71
Add stack traces to miri errors 2018-03-08 08:34:16 +01:00
Oliver Schneider
8c53d54b98
Update tests 2018-03-08 08:34:16 +01:00
Oliver Schneider
d2f363ba89
Report all errors other than those about insufficient type information 2018-03-08 08:34:15 +01:00
Oliver Schneider
64fbf5d5ad
Compute the ParamEnv only once and use it to call tcx.const_eval 2018-03-08 08:34:15 +01:00
Oliver Schneider
a678044c77
Add regression test for const prop 2018-03-08 08:34:15 +01:00
Oliver Schneider
dde68dcfe5
Can only const prop temporaries
Variables might error in branches that are not reachable due to the variable value.
2018-03-08 08:34:15 +01:00
Oliver Schneider
05a03d7537
Update tests 2018-03-08 08:34:15 +01:00
Oliver Schneider
1561b4ad50
Simplify const propagator by removing unused code paths 2018-03-08 08:34:15 +01:00
Oliver Schneider
411fcf58fd
Rename OptimizationFinder and don't propagate any borrows 2018-03-08 08:34:15 +01:00