about summary refs log tree commit diff
path: root/src/librustc/ich
AgeCommit message (Collapse)AuthorLines
2018-07-16BinOpKindcsmoe-22/+22
2018-07-14Functions introducing procedural macros reserve a slot in the macro ↵Vadim Petrochenkov-1/+2
namespace as well
2018-07-13Add the `amdgpu-kernel` ABI.Richard Diamond-0/+1
Technically, there are requirements imposed by the LLVM `AMDGPUTargetMachine` on functions with this ABI (eg, the return type must be void), but I'm unsure exactly where this should be enforced.
2018-07-11Rollup merge of #52207 - RalfJung:unsafety-errors, r=estebankMark Rousskov-1/+1
improve error message shown for unsafe operations Add a short explanation saying why undefined behavior could arise. In particular, the error many people got for "creating a pointer to a packed field requires unsafe block" was not worded great -- it lead to people just adding the unsafe block without considering if what they are doing follows the rules. I am not sure if a "note" is the right thing, but that was the easiest thing to add... Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
2018-07-11Auto merge of #51702 - ecstatic-morse:infinite-loop-detection, r=oli-obkbors-1/+2
Infinite loop detection for const evaluation Resolves #50637. An `EvalContext` stores the transient state (stack, heap, etc.) of the MIRI virtual machine while it executing code. As long as MIRI only executes pure functions, we can detect if a program is in a state where it will never terminate by periodically taking a "snapshot" of this transient state and comparing it to previous ones. If any two states are exactly equal, the machine must be in an infinite loop. Instead of fully cloning a snapshot every time the detector is run, we store a snapshot's hash. Only when a hash collision occurs do we fully clone the interpreter state. Future snapshots which cause a collision will be compared against this clone, causing the interpreter to abort if they are equal. At the moment, snapshots are not taken until MIRI has progressed a certain amount. After this threshold, snapshots are taken every `DETECTOR_SNAPSHOT_PERIOD` steps. This means that an infinite loop with period `P` will be detected after a maximum of `2 * P * DETECTOR_SNAPSHOT_PERIOD` interpreter steps. The factor of 2 arises because we only clone a snapshot after it causes a hash collision.
2018-07-10Upgrade to LLVM's master branch (LLVM 7)Alex Crichton-0/+1
This commit upgrades the main LLVM submodule to LLVM's current master branch. The LLD submodule is updated in tandem as well as compiler-builtins. Along the way support was also added for LLVM 7's new features. This primarily includes the support for custom section concatenation natively in LLD so we now add wasm custom sections in LLVM IR rather than having custom support in rustc itself for doing so. Some other miscellaneous changes are: * We now pass `--gc-sections` to `wasm-ld` * The optimization level is now passed to `wasm-ld` * A `--stack-first` option is passed to LLD to have stack overflow always cause a trap instead of corrupting static data * The wasm target for LLVM switched to `wasm32-unknown-unknown`. * The syntax for aligned pointers has changed in LLVM IR and tests are updated to reflect this. * The `thumbv6m-none-eabi` target is disabled due to an [LLVM bug][llbug] Nowadays we've been mostly only upgrading whenever there's a major release of LLVM but enough changes have been happening on the wasm target that there's been growing motivation for quite some time now to upgrade out version of LLD. To upgrade LLD, however, we need to upgrade LLVM to avoid needing to build yet another version of LLVM on the builders. The revision of LLVM in use here is arbitrarily chosen. We will likely need to continue to update it over time if and when we discover bugs. Once LLVM 7 is fully released we can switch to that channel as well. [llbug]: https://bugs.llvm.org/show_bug.cgi?id=37382
2018-07-10improve error message shown for unsafe operations: explain why undefined ↵Ralf Jung-1/+1
behavior could arise Inspired by @gnzlbg at https://github.com/rust-lang/rust/issues/46043#issuecomment-381544673
2018-07-04Add an `InfiniteLoop` variant to `EvalErrorKind`Dylan MacKenzie-1/+2
2018-07-03store the `HirId` of the upvarNiko Matsakis-1/+1
2018-07-03Rollup merge of #51982 - michaelwoerister:hash-modules-properly, r=nikomatsakisPietro Albini-8/+41
incr.comp.: Take names of children into account when computing the ICH of a module's HIR. Fixes #40876. Red-green tracking does not make this a problem anymore. We should verify this via a perf-run though. r? @nikomatsakis
2018-07-03Avoid sorting the item_ids array the StableHash impl of hir::Mod.Michael Woerister-10/+28
2018-07-02incr.comp.: Take names of children into account when computing the ICH of a ↵Michael Woerister-7/+22
module's HIR.
2018-07-02Get rid of `TyImplTraitExistential`Oliver Schneider-1/+0
2018-07-02Auto merge of #51866 - zackmdavis:hir_making_each_day_of_the_year, ↵bors-5/+7
r=petrochenkov add modifier keyword spans to hir::Visibility; improve unreachable-pub, private-no-mangle lint suggestions #50455 pointed out that the unreachable-pub suggestion for brace-grouped `use`s was bogus; #50476 partially ameliorated this by marking the suggestion as `Applicability::MaybeIncorrect`, but this is the actual fix. Meanwhile, another application of having spans available in `hir::Visibility` is found in the private-no-mangle lints, where we can now issue a suggestion to use `pub` if the item has a more restricted visibility marker (this seems much less likely to come up in practice than not having any visibility keyword at all, but thoroughness is a virtue). While we're there, we can also add a helpful note if the item does have a `pub` (but triggered the lint presumably because enclosing modules were private). ![hir_vis](https://user-images.githubusercontent.com/1076988/42018064-ca830290-7a65-11e8-9c4c-48bc846f861f.png) r? @nrc cc @Manishearth
2018-07-01call it `hir::VisibilityKind` instead of `hir::Visibility_:*`Zack M. Davis-6/+6
It was pointed out in review that the glob-exported underscore-suffixed convention for `Spanned` HIR nodes is no longer preferred: see February 2016's #31487 for AST's migration away from this style towards properly namespaced NodeKind enums. This concerns #51968.
2018-06-30in which hir::Visibility recalls whence it came (i.e., becomes Spanned)Zack M. Davis-5/+7
There are at least a couple (and plausibly even three) diagnostics that could use the spans of visibility modifiers in order to be reliably correct (rather than hacking and munging surrounding spans to try to infer where the visibility keyword must have been). We follow the naming convention established by the other `Spanned` HIR nodes: the "outer" type alias gets the "prime" node-type name, the "inner" enum gets the name suffixed with an underscore, and the variant names are prefixed with the prime name and `pub use` exported from here (from HIR). Thanks to veteran reviewer Vadim Petrochenkov for suggesting this uniform approach. (A previous draft, based on the reasoning that `Visibility::Inherited` should not have a span, tried to hack in a named `span` field on `Visibility::Restricted` and a positional field on `Public` and `Crate`. This was ... not so uniform.)
2018-06-30Added miri error for evaluating foreign statics.Alexander Regueiro-0/+1
Updated tests accordingly.
2018-06-28Rollup merge of #51636 - oli-obk:const_diagnostics, r=eddybMark Rousskov-45/+8
Refactor error reporting of constants cc @eddyb This PR should not change any behaviour. It solely simplifies the internal handling of the errors
2018-06-28Auto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrumbors-18/+12
Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable. This PR removes most of the interior mutability from `FileMap`, which should be beneficial, especially in a multithreaded setting. This is achieved by initializing the state in question when the filemap is constructed instead of during lexing. Hopefully this doesn't degrade performance. cc @wesleywiser
2018-06-28Merge `ConstVal` and `ConstValue`Oliver Schneider-19/+2
2018-06-28Move everything over from `middle::const_val` to `mir::interpret`Oliver Schneider-4/+4
2018-06-28Move the Lrc outside the error type and name the fieldsOliver Schneider-1/+2
2018-06-28Address review commentsOliver Schneider-1/+1
2018-06-28Eliminate old CTFE's `ErrKind`Oliver Schneider-24/+3
2018-06-28Fix rebaseVadim Petrochenkov-0/+1
2018-06-28incremental: Do not hash spans for things that didn't have spans previouslyVadim Petrochenkov-9/+9
2018-06-28Support delegation in stable hashing macrosVadim Petrochenkov-269/+104
2018-06-28Use `Ident`s for associated item definitions in HIRVadim Petrochenkov-7/+7
Remove emulation of hygiene with gensyms
2018-06-28Use `Ident`s in a number of structures in HIRVadim Petrochenkov-3/+1
Namely: labels, type parameters, bindings in patterns, parameter names in functions without body. All of these do not need hygiene after lowering to HIR, only span locations.
2018-06-28Use `Ident`s for path segments in HIRVadim Petrochenkov-1/+1
2018-06-28Use `Ident`s for associated type bindings in HIRVadim Petrochenkov-1/+1
2018-06-27Auto merge of #51356 - Zoxc:encode-cleanup, r=michaelwoeristerbors-2/+3
Make opaque::Encoder append-only and make it infallible
2018-06-27Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.Michael Woerister-18/+12
2018-06-27Implement `#[macro_export(local_inner_macros)]`Vadim Petrochenkov-0/+1
2018-06-27Make opaque::Encoder append-only and make it infallibleJohn Kåre Alsaker-2/+3
2018-06-23hygiene: Merge `NameAndSpan` into `ExpnInfo`Vadim Petrochenkov-6/+2
2018-06-23Auto merge of #51727 - varkor:expragain-to-exprcontinue, r=petrochenkovbors-1/+1
Rename hir::ExprAgain to hir::ExprContinue The current name is confusing and historical. I also used this PR to clean up the annoying indentation in `check/mod.rs`. If that's viewed as too tangential a change, I'll split it up, but it seemed reasonable to slip it in to reduce @bors's work. It's easy to compare for the two commits individually. r? @petrochenkov
2018-06-23Rename ExprAgain to ExprContinuevarkor-1/+1
2018-06-21async await desugaring and testsTaylor Cramer-0/+1
2018-06-21Parse async fn header.Without Boats-4/+13
This is gated on edition 2018 & the `async_await` feature gate. The parser will accept `async fn` and `async unsafe fn` as fn items. Along the same lines as `const fn`, only `async unsafe fn` is permitted, not `unsafe async fn`.The parser will not accept `async` functions as trait methods. To do a little code clean up, four fields of the function type struct have been merged into the new `FnHeader` struct: constness, asyncness, unsafety, and ABI. Also, a small bug in HIR printing is fixed: it previously printed `const unsafe fn` as `unsafe const fn`, which is grammatically incorrect.
2018-06-22Auto merge of #51433 - scalexm:finish-rules, r=nikomatsakisbors-10/+35
[chalkify] Small refactoring and WF/FromEnv rules for types r? @nikomatsakis
2018-06-20Rename ParamBound(s) to GenericBound(s)varkor-1/+1
2018-06-20Lift attrs into hir::GenericParamvarkor-2/+2
2018-06-20Rename TraitTyParamBound to ParamBound::Traitvarkor-1/+1
2018-06-20Introduce ParamName and use it in place of LifetimeNamevarkor-4/+7
2018-06-20Remove name from GenericParamKind::Lifetimevarkor-2/+1
2018-06-20Lift name into GenericParamvarkor-4/+4
2018-06-20Lift bounds into GenericParamvarkor-7/+5
2018-06-20Refactor counting methodsvarkor-2/+2
2018-06-20Refactor hir::GenericParam as a structvarkor-17/+25