about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-09-09Shrink `ObligationCauseCode` by boxing `MatchExpressionArm`.Nicholas Nethercote-26/+32
The reduction in `memcpy` calls greatly outweighs the cost of the extra allocations, for a net performance win.
2019-09-09Add some assertions on obligation type sizes.Nicholas Nethercote-0/+12
These are types that get memcpy'd a lot.
2019-09-08Refactor PluralisationV1shvesh-6/+1
Modify files performing pluralisation checks to incorporate the dedicated macro located in `syntax::errors`.
2019-09-08Rollup merge of #64255 - varkor:bool-to-option, r=CentrilMazdak Farrokhzad-0/+1
Add methods for converting `bool` to `Option<T>` This provides a reference implementation for https://github.com/rust-lang/rfcs/pull/2757.
2019-09-08Rollup merge of #64066 - petrochenkov:softstab, r=matthewjasperMazdak Farrokhzad-7/+25
Support "soft" feature-gating using a lint Use it for feature-gating `#[bench]`. Closes https://github.com/rust-lang/rust/issues/63798.
2019-09-07Support "soft" feature-gating using a lintVadim Petrochenkov-7/+25
Use it for feature-gating `#[bench]`
2019-09-07Rollup merge of #64227 - alexreg:rush-pr-4, r=centrilMazdak Farrokhzad-893/+908
Aggregation of cosmetic changes made during work on REPL PRs: librustc Factored out from hacking on rustc for work on the REPL. r? @Centril
2019-09-07Rollup merge of #64139 - Mark-Simulacrum:strip-legacy-proc-macro, r=petrochenkovMazdak Farrokhzad-18/+12
Migrate internal diagnostic registration to macro_rules Review is best done commit-by-commit. Fixes #64132.
2019-09-07Apply suggestions from code reviewAlexander Regueiro-60/+54
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-07Aggregation of cosmetic changes made during work on REPL PRs: librustcAlexander Regueiro-923/+944
2019-09-07Add "bool" lang itemvarkor-0/+1
2019-09-07Rollup merge of #64233 - varkor:correct-pluralisation, r=estebankMazdak Farrokhzad-1/+3
Correct pluralisation of various diagnostic messages
2019-09-07Rollup merge of #64231 - matthewjasper:move-ast-cfg, r=CentrilMazdak Farrokhzad-717/+0
Move the HIR CFG to `rustc_ast_borrowck` No new code should be using it.
2019-09-07Rollup merge of #63919 - matthewjasper:remove-gensymmed, r=petrochenkovMazdak Farrokhzad-21/+33
Use hygiene for AST passes AST passes are now able to have resolve consider their expansions as if they were opaque macros defined either in some module in the current crate, or a fake empty module with `#[no_implicit_prelude]`. * Add an ExpnKind for AST passes. * Remove gensyms in AST passes. * Remove gensyms in`#[test]`, `#[bench]` and `#[test_case]`. * Allow opaque macros to define tests. * Move tests for unit tests to their own directory. * Remove `Ident::{gensym, is_gensymed}` - `Ident::gensym_if_underscore` still exists. cc #60869, #61019 r? @petrochenkov
2019-09-06Correct pluralisation of various diagnostic messagesvarkor-1/+3
2019-09-06Move the HIR cfg to `rustc_ast_borrowck`Matthew Jasper-717/+0
No new code should be using it.
2019-09-06Rollup merge of #64202 - alexreg:rush-pr-1, r=CentrilMazdak Farrokhzad-19/+20
Fixed grammar/style in some error messages Factored out from hacking on rustc for work on the REPL. r? @Centril
2019-09-06Auto merge of #64211 - oli-obk:miri, r=eddybbors-0/+28
Fix miri fixes #64109 cc @HeroicKatora cc @RalfJung
2019-09-06Fix miriOliver Scherer-0/+28
2019-09-06Rollup merge of #64111 - Centril:ast-only-patkind-or, r=petrochenkovMazdak Farrokhzad-46/+72
or-patterns: Uniformly use `PatKind::Or` in AST & Fix/Cleanup resolve Following up on work in https://github.com/rust-lang/rust/pull/63693 and https://github.com/rust-lang/rust/pull/61708, in this PR we: - Uniformly use `PatKind::Or(...)` in AST: - Change `ast::Arm.pats: Vec<P<Pat>>` => `ast::Arm.pat: P<Pat>` - Change `ast::ExprKind::Let.0: Vec<P<Pat>>` => `ast::ExprKind::Let.0: P<Pat>` - Adjust `librustc_resolve/late.rs` to correctly handle or-patterns at any level of nesting as a result. In particular, the already-bound check which rejects e.g. `let (a, a);` now accounts for or-patterns. The consistency checking (ensures no missing bindings and binding mode consistency) also now accounts for or-patterns. In the process, a bug was found in the current compiler which allowed: ```rust enum E<T> { A(T, T), B(T) } use E::*; fn foo() { match A(0, 1) { B(mut a) | A(mut a, mut a) => {} } } ``` The new algorithms took a few iterations to get right. I tried several clever schemes but ultimately a version based on a stack of hashsets and recording product/sum contexts was chosen since it is more clearly correct. - Clean up `librustc_resolve/late.rs` by, among other things, using a new `with_rib` function to better ensure stack dicipline. - Do not push the change in AST to HIR for now to avoid doing too much in this PR. To cope with this, we introduce a temporary hack in `rustc::hir::lowering` (clearly marked in the diff). cc https://github.com/rust-lang/rust/issues/54883 cc @dlrobertson @matthewjasper r? @petrochenkov
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-19/+20
2019-09-05Remove rustc_diagnostic_macros featureMark Rousskov-1/+0
2019-09-05Replace diagnostic plugins with macro_rulesMark Rousskov-10/+1
2019-09-05Restrict error code length to 80 columnsMark Rousskov-7/+11
The global restriction is 100, but since error codes are printed out via --explain we want to restrict them to just 80 columns.
2019-09-05Don't call `diag_span_note_once` for suppressed lintsMatthew Jasper-20/+24
2019-09-05Add an ExpnKind for AST passesMatthew Jasper-1/+9
2019-09-05Auto merge of #64172 - Centril:rollup-8i8oh54, r=Centrilbors-2/+9
Rollup of 11 pull requests Successful merges: - #62848 (Use unicode-xid crate instead of libcore) - #63774 (Fix `window.hashchange is not a function`) - #63930 (Account for doc comments coming from proc macros without spans) - #64003 (place: Passing `align` = `layout.align.abi`, when also passing `layout`) - #64030 (Fix unlock ordering in SGX synchronization primitives) - #64041 (use TokenStream rather than &[TokenTree] for built-in macros) - #64051 (Add x86_64-linux-kernel target) - #64063 (Fix const_err with `-(-0.0)`) - #64083 (Point at appropriate arm on type error on if/else/match with one non-! arm) - #64100 (Fix const eval bug breaking run-pass tests in Miri) - #64157 (Opaque type locations in error message for clarity.) Failed merges: r? @ghost
2019-09-05Rollup merge of #64157 - gilescope:opaque-type-location, r=cramertj,CentrilMazdak Farrokhzad-2/+9
Opaque type locations in error message for clarity. Attempts to fix #63167
2019-09-05Auto merge of #62800 - albins:polonius-initialization-1, r=nikomatsakisbors-1/+1
Extend Polonius fact generation for (some) move tracking This PR will extend rustc to emit facts used for tracking moves and initialization in Polonius. It is most likely the final part of my master's thesis work.
2019-09-05or-patterns: adjust lowering of `ast::Arm` & `ast::ExprKind::Let`.Mazdak Farrokhzad-46/+72
Introduces a temporary hack to keep `Vec<P<Pat>>` in `hir::Arm.pats` so that we keep the changes more incremental.
2019-09-05Opaque type locations in error message for clarity.Giles Cope-2/+9
2019-09-05Rollup merge of #64141 - nnethercote:minimize-LocalInternedString, ↵Mazdak Farrokhzad-40/+16
r=petrochenkov Minimize uses of `LocalInternedString` `LocalInternedString` is described as "An alternative to `Symbol` and `InternedString`, useful when the chars within the symbol need to be accessed. It is best used for temporary values." This PR makes the code match that comment, by removing all non-local uses of `LocalInternedString`. This allows the removal of a number of operations on `LocalInternedString` and a couple of uses of `unsafe`.
2019-09-05Rollup merge of #64110 - estebank:receiver-type, r=CentrilMazdak Farrokhzad-31/+50
Refer to "`self` type" instead of "receiver type" Fix https://github.com/rust-lang/rust/issues/42603.
2019-09-05Rollup merge of #64038 - matthewjasper:deny-mutual-impl-trait-recursion, ↵Mazdak Farrokhzad-2/+4
r=varkor Check impl trait substs when checking for recursive types closes #64004
2019-09-05Rollup merge of #64005 - ecstatic-morse:is-indirect, r=oli-obkMazdak Farrokhzad-0/+25
Add a `Place::is_indirect` method to determine whether a `Place` contains a `Deref` projection Working on #63860 requires tracking some property about each local. This requires differentiating `Place`s like `x` and `x.field[index]` from ones like `*x` and `*x.field`, since the first two will always access the same region of memory as `x` while the latter two may access any region of memory. This functionality is duplicated in various places across the compiler. This PR adds a helper method to `Place` which determines whether that `Place` has a `Deref` projection at any point and changes some existing code to use the new method. I've not converted `qualify_consts.rs` to use the new method, since it's not a trivial conversion and it will get replaced anyway by #63860. There may be other potential uses besides the two I change in this PR. r? @oli-obk
2019-09-04NLL: New Polonius versionAlbin Stjerna-1/+1
2019-09-04Remove hashing impls for `LocalInternedString`.Nicholas Nethercote-23/+2
2019-09-04Remove `LocalInternedString` uses from `librustc/traits/`.Nicholas Nethercote-9/+10
2019-09-04Remove `LocalInternedString` uses from `librustc/ty/`.Nicholas Nethercote-5/+1
This is not a compelling change in isolation, but it is a necessary step.
2019-09-03review commentsEsteban Küber-1/+3
2019-09-03Rollup merge of #64104 - Mark-Simulacrum:intrinsic-fn-ptr-ice, r=estebankMazdak Farrokhzad-0/+10
Emit error on intrinsic to fn ptr casts I'm not sure if a type error is the best way of doing this but it seemed like a relatively correct place to do it, and I expect this is a pretty rare case to hit anyway. Fixes #15694
2019-09-03Rollup merge of #64056 - estebank:arbitrary-self-types, r=CentrilMazdak Farrokhzad-0/+6
Account for arbitrary self types in E0599 Fix https://github.com/rust-lang/rust/issues/62373
2019-09-03Update other doc.Hal Gentz-2/+2
Value was renamed to Operand in https://github.com/rust-lang/rust/commit/ad2de8b4ee099916113b7b3577ac86857b1568be ScalarPair to Slice in https://github.com/rust-lang/rust/commit/fe50b4eb1d6f7a31c53798bca3d0fa2b0670fa3d Not familiar enough with rustc's source to know if the comment is even still applicable.
2019-09-03Remove `LocalInternedString` uses from `librustc/lint/`.Nicholas Nethercote-3/+3
2019-09-02account for DUMMY_SP and correct wordingEsteban Küber-5/+5
2019-09-02On object safety violation, point at source when possibleEsteban Küber-22/+37
2019-09-02Refer to "`self` type" instead of "receiver type"Esteban Küber-8/+10
2019-09-02Auto merge of #63561 - HeroicKatora:alloc-private-bytes, r=oli-obkbors-27/+212
Make Allocation::bytes private Fixes #62931. Direct immutable access to the bytes is still possible but redirected through the new method `raw_bytes_with_undef_and_ptr`, similar to `get_bytes_with_undef_and_ptr` but without requiring an interpretation context and not doing *any* relocation or bounds checks. The `size` of the allocation is stored separately which makes access as `Size` and `usize` more ergonomic. cc: @RalfJung
2019-09-02Emit error on intrinsic to fn ptr castsMark Rousskov-0/+10
2019-09-01review commentsEsteban Küber-14/+2