about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-11-23make `./x.py bench` againMazdak Farrokhzad-61/+59
2019-11-22Allow miri allocation interning to work im generic MachinesWesley Wiser-1/+1
This is necessary so that the `ComstPropMachine` can intern allocations.
2019-11-23Auto merge of #66507 - ecstatic-morse:const-if-match, r=oli-obkbors-2/+15
Enable `if` and `match` in constants behind a feature flag This PR is an initial implementation of #49146. It introduces a `const_if_match` feature flag and does the following if it is enabled: - Allows `Downcast` projections, `SwitchInt` terminators and `FakeRead`s for matched places through the MIR const-checker. - Allows `if` and `match` expressions through the HIR const-checker. - Stops converting `&&` to `&` and `||` to `|` in `const` and `static` items. As a result, the following operations are now allowed in a const context behind the feature flag: - `if` and `match` - short circuiting logic operators (`&&` and `||`) - the `assert` and `debug_assert` macros (if the `const_panic` feature flag is also enabled) However, the following operations remain forbidden: - `while`, `loop` and `for` (see #52000) - the `?` operator (calls `From::from` on its error variant) - the `assert_eq` and `assert_ne` macros, along with their `debug` variants (calls `fmt::Debug`) This PR is possible now that we use dataflow for const qualification (see #64470 and #66385). r? @oli-obk cc @rust-lang/wg-const-eval @eddyb
2019-11-22remove the 'dereferenceable' attribute from BoxRalf Jung-1/+7
2019-11-22Retire impl_stable_hash_for.Camille GILLOT-117/+6
2019-11-22Retire impl_stable_hash_for_spanned.Camille GILLOT-31/+0
2019-11-22Derives for ast.Camille GILLOT-21/+0
2019-11-22Invert implementations for TokenKind.Camille GILLOT-49/+9
Also export a bunch of Token-related impls.
2019-11-22Export HashStable for DelimSpan, Lit and Path.Camille GILLOT-23/+0
2019-11-22Derive HashStable_Generic for Ident.Camille GILLOT-5/+0
2019-11-22Derive HashStable_Generic for ExpnData.Camille GILLOT-11/+0
2019-11-22Rollup merge of #66637 - RalfJung:typo, r=CentrilMazdak Farrokhzad-1/+1
fix reoccuring typo: dereferencable -> dereferenceable
2019-11-22Rollup merge of #66587 - matthewjasper:handle-static-as-const, r=oli-obkMazdak Farrokhzad-24/+83
Handle statics in MIR as const pointers This is the first PR towards the goal of removing `PlaceBase::Static`. In this PR: * Statics are lowered to dereferencing a const pointer. * The temporaries holding such pointers are tracked in MIR, for the most part this is only used for diagnostics. There are two exceptions: * The borrow checker has some checks for thread-locals that directly use this data. * Const checking will suppress "cannot dereference raw pointer" diagnostics for pointers to `static mut`/`extern static`. This is to maintain the current behaviour (12 tests fail otherwise). The following are left to future PRs (I think that @spastorino will be working on the first 3): * Applying the same treatments to promoted statics. * Removing `PlaceBase::Static`. * Replacing `PlaceBase` with `Local`. * Moving the ever growing collection of metadata that we have for diagnostics in MIR passes somewhere more appropriate. r? @oli-obk
2019-11-22Rollup merge of #66575 - Mark-Simulacrum:no-uii, r=petrochenkovMazdak Farrokhzad-110/+7
Remove pretty printing of specific nodes in AST The ability to print a specific item as identified by NodeId or path seems not particularly useful, and certainly carries quite a bit of complexity with it. This is intended to simplify our CLI parsing a bit and remove a non-uncomplicated piece of it; I largely did this to remove the dependency on NodeId from librustc/session but it's not really necessary to do so in this invasive a way. The alternative is moving it to librustc_interface or driver, probably.
2019-11-22Invert flow in impl HashStable of Span.Camille GILLOT-11/+10
2019-11-22Add StableHashingContextLike to HashStable_Generic derive.Camille GILLOT-0/+4
2019-11-22Add support for tracking origins of uninitialized memoryTomasz Miąsko-0/+19
2019-11-22Add support for sanitizer recoveryTomasz Miąsko-9/+42
2019-11-22fix reoccuring typo: dereferencable -> dereferenceableRalf Jung-1/+1
2019-11-22Auto merge of #66460 - cjgillot:hashstable_generic, r=Zoxcbors-379/+1
Add a proc-macro to derive HashStable in librustc dependencies A second proc-macro is added to derive HashStable for crates librustc depends on. This proc-macro HashStable_Generic (to bikeshed) allows to decouple code and some librustc's boilerplate. Not everything is migrated, because `Span` and `TokenKind` require to be placed inside librustc. Types using them stay there too. Split out of #66279 r? @Zoxc
2019-11-22Auto merge of #66565 - Mark-Simulacrum:syntax-cfg-mod, r=petrochenkovbors-7/+1
Move process_configure_mod to rustc_parse This removes the hack in favor of perhaps a less principled, but less painful, approach. This also supports my work to decouple `Session` from librustc, as `ParseSess` currently has `Attribute` as "part" of it but after this PR will no longer do so.
2019-11-22Auto merge of #66282 - Centril:simplify-try, r=oli-obkbors-9/+9
[mir-opt] asking `?`s in a more optimized fashion This PR works towards https://github.com/rust-lang/rust/issues/66234 by providing two optimization passes meant to run in sequence: - `SimplifyArmIdentity` which transforms something like: ```rust _LOCAL_TMP = ((_LOCAL_1 as Variant ).FIELD: TY ); ((_LOCAL_0 as Variant).FIELD: TY) = move _LOCAL_TMP; discriminant(_LOCAL_0) = VAR_IDX; ``` into: ```rust _LOCAL_0 = move _LOCAL_1 ``` - `SimplifyBranchSame` which transforms `SwitchInt`s to identical basic blocks into a `goto` to the first reachable target. Together, these are meant to simplify the following into just `res`: ```rust match res { Ok(x) => Ok(x), Err(x) => Err(x), } ``` It should be noted however that the desugaring of `?` includes a function call and so the first pass in this PR relies on inlining to substitute that function call for identity on `x`. Inlining requires `mir-opt-level=2` so this might not have any effect in perf-bot but let's find out. r? @oli-obk -- This is WIP, but I'd appreciate feedback. :)
2019-11-21Make `name` work for `MatchSource`Dylan MacKenzie-2/+15
2019-11-21Address review commentsMatthew Jasper-7/+4
2019-11-21Auto merge of #66610 - alexreg:trait-upcasting-cosmetic, r=Centrilbors-335/+344
Aggregation of drive-by cosmetic changes for trait-upcasting PR Cherry-picked from #60900. As requested by @Centril (and @nikomatsakis, I believe). r? @Centril
2019-11-21Track pointers to statics in MIRMatthew Jasper-16/+60
2019-11-21Fix rebaseMatthew Jasper-3/+3
2019-11-21Readjust const qualification to detect statics againSantiago Pastorino-1/+19
2019-11-21Introduce MIR optimizations for simplifying `x?` on `Result`s.Mazdak Farrokhzad-9/+9
This optimization depends on inlining for the identity conversions introduced by the lowering of the `?`. To take advantage of `SimplifyArmIdentity`, `-Z mir-opt-level=2` is required because that triggers the inlining MIR optimization.
2019-11-21Applied suggestions from code review.Alexander Regueiro-79/+80
2019-11-21Aggregation of drive-by cosmetic changes.Alexander Regueiro-307/+315
2019-11-21Auto merge of #66389 - estebank:type-err-labels, r=petrochenkovbors-78/+190
Specific labels when referring to "expected" and "found" types
2019-11-21Rollup merge of #66515 - Centril:cheaper-inline-asm, r=oli-obkMazdak Farrokhzad-36/+43
Reduce size of `hir::Expr` by boxing more of `hir::InlineAsm` r? @oli-obk
2019-11-21Rollup merge of #66468 - RalfJung:simd-cleanup, r=oli-obkMazdak Farrokhzad-6/+16
Cleanup Miri SIMD intrinsics r? @oli-obk @eddyb Cc @gnzlbg
2019-11-21Rollup merge of #65730 - csmoe:return-lifetime, r=nikomatsakisMazdak Farrokhzad-19/+37
Suggest to add lifetime constraint at explicit ouput of functions Closes #62097
2019-11-21Gate fallback via `#![feature(never_type_fallback)]`.Mazdak Farrokhzad-1/+5
2019-11-21Stabilize the `never_type`, written `!`.Mazdak Farrokhzad-6/+2
2019-11-20Fix cycle when debug-printing opaque typesAaron Hill-38/+65
Fixes #61577 When printing an opaque type in non-verbose mode, we use the `tcx.predicates_of` query to retrieve the opaque type's bounds for pretty-printing. However, the pervasiveness of logging within librustc means that we may already be executing `tcx.predicates_of` for the opaque type we're trying to print, leading to a cycle error. This commit adds a new 'no queries' thread-local flag to the pretty printer. This flag is enabled during the computation of `predicates_of` for opaque types, and causes us to print the opaque type in 'verbose' mode (which does not require computing any additinal queries). This should only affect debug logging for highly nested log messages, not any user-visible output.
2019-11-21reduce size of hir::ExprKindMazdak Farrokhzad-36/+43
2019-11-20Delete ProcessCfgModMark Rousskov-7/+1
The previous commit removes the use of this, and now we cleanup.
2019-11-20Rollup merge of #66457 - cjgillot:just_hashstable, r=ZoxcMazdak Farrokhzad-285/+53
Just derive Hashstable in librustc Split out of #66279 r? @Zoxc
2019-11-20Rollup merge of #66060 - traxys:test_65401, r=michaelwoeristerMazdak Farrokhzad-0/+6
Making ICEs and test them in incremental This adds: - A way to make the compiler ICE - A way to check for ICE in `cfail` tests with `should-ice` - A regression test for issue #65401 I am not sure the attribute added `should-ice` is the best for this job
2019-11-20Remove pretty printing of specific nodes in ASTMark Rousskov-110/+7
The ability to print a specific item as identified by NodeId or path seems not particularly useful, and certainly carries quite a bit of complexity with it.
2019-11-20Rollup merge of #66532 - cuviper:dwarf-aranges, r=michaelwoeristerMazdak Farrokhzad-0/+2
Generate DWARF address ranges for faster lookups This adds a new option `-Zgenerate-arange-section`, enabled by default, corresponding to LLVM's `-generate-arange-section`. This creates a `.debug_aranges` section with DWARF address ranges, which some tools depend on to optimize address lookups (elfutils [22288], [25173]). This only has effect when debuginfo is enabled, and the additional data is small compared to the other debug sections. For example, libstd.so with full debuginfo is about 11MB, with just 61kB in aranges. [22288]: https://sourceware.org/bugzilla/show_bug.cgi?id=22288 [25173]: https://sourceware.org/bugzilla/show_bug.cgi?id=25173 Closes #45246. r? @michaelwoerister
2019-11-20Auto merge of #66104 - yodaldevoid:generic-arg-disambiguation, r=petrochenkovbors-5/+94
Generic arg disambiguation Using the tactic suggested by @petrochenkov in https://github.com/rust-lang/rust/issues/60804#issuecomment-516769465 and on [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation), this change checks type arguments to see if they are really incorrectly-parsed const arguments. it should be noted that `segments.len() == 1 && segments[0].arg.is_none()` was reduced to `segments.len() == 1` as suggested by @petrochenkov in [zulip](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/generic.20argument.20disambiguation/near/177848002). This change allowed a few more existing tests to have their braces removed. There are a couple of "problems" with these changes that I should note. First, there was a regression in the error messages found in "src/test/ui/privacy-ns1.rs" and "src/test/ui/privacy-ns1.rs". Second, some braces were unable to be removed from "src/test/ui/const-generics/fn-const-param-infer.rs". Those on line 24 caused the statement to stop equating when removed, and those on line 20 cause a statement that should not equate to produce no error when removed. I have not looked further into any of these issues yet, though I would be willing to look into them before landing this. I simply wanted to get some other eyes on this before going further. Fixes #60804 cc @varkor @jplatte
2019-11-19Fix derive syntax.Camille GILLOT-1/+1
2019-11-19Fix project syntax.Camille GILLOT-1/+1
2019-11-19Derive HashStable more.Camille GILLOT-29/+6
2019-11-19More HashStable.Camille GILLOT-94/+15
2019-11-19More HashStable.Camille GILLOT-144/+25