about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-11-28Auto merge of #66246 - matthewjasper:simplify-mem-cat, r=pnkfelixbors-2176/+0
Simplify memory categorization With AST borrowck gone, mem_categorization can be simplified, a lot. * `cmt_` is now called `Place`. Most local variable names have been updated to reflect this, but the `cat_*` methods retain their names. * `MemCategorizationContext` no longer needs a `ScopeTree` and always needs an `InferCtxt`. * `Place` now uses a similar representation to `mir::Place` with a `Vec` of projections. * `Upvar` places don't include the implicit environment and capture derefs. These are now handled by `regionck` when needed. * Various types, methods and variants only used by AST borrowck have been removed. * `ExprUseVisitor` now lives in `rustc_typeck::expr_use_visitor`. * `MemCategorizationContext` and `Place` live in `rustc_typeck::mem_categorization`. * `Place` is re-exported in `rustc_typeck::expr_use_visitor` so that Clippy can access it. The loss of an error in `issue-4335.rs` is due to a change in capture inference in ill-formed programs. If any projection from a variable is moved from then we capture that variable by move, whether or not the place being moved from allows this. Closes #66270
2019-11-28const_prop: detect and avoid catching Miri errors that require allocationRalf Jung-7/+13
2019-11-28Removed FIXME commentDavid Haig-2/+0
2019-11-28Remove duplication using single variant for errorDavid Haig-17/+14
2019-11-28Fixed merge issueDavid Haig-0/+10
2019-11-28Fixed merge issueDavid Haig-1/+1
2019-11-28SquashDavid Haig-4/+19
2019-11-28Auto merge of #66294 - davidhewitt:const_fn_memoization, r=oli-obkbors-1/+4
Add memoization for const function evaluations When a const function is being evaluated, as long as all its arguments are zero-sized-types (or it has no arguments) then we can trivially memoize the evaluation result using the existing query mechanism. With thanks to @oli-obk for mentoring me through this at RustFest Barcelona. r? @oli-obk
2019-11-27Rollup merge of #66798 - bwignall:typo, r=varkorTyler Mandry-8/+8
Fix spelling typos Should be non-semantic. Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos.
2019-11-27Rollup merge of #66700 - VirrageS:master, r=matthewjasperTyler Mandry-1/+1
Fix pointing at arg for fulfillment errors in function calls Closes: https://github.com/rust-lang/rust/issues/66258
2019-11-27Move ExprUseVisitor and mem_categorization to rustc_typeckMatthew Jasper-1341/+0
`MemCategorizationContext` is now private, the remaining types and traits remain public for Clippy.
2019-11-27Remove remaining uses of "cmt"Matthew Jasper-48/+50
2019-11-27Simplify `mem_categorization`Matthew Jasper-937/+183
* `Place` is no longer recursive. * The `cmt` type alias is removed * `Upvar` places no longer include the dereferences of the environment closure or of by reference captures. * All non-dereference projections are combined to a single variant. * Various unnecessary types and methods have been removed.
2019-11-27Simplify fields of `MemCategorizationContext`Matthew Jasper-137/+54
2019-11-27Rename `cmt_` to `Place`Matthew Jasper-40/+40
2019-11-27rustc: move debug info from LocalDecl and UpvarDecl into a dedicated ↵Eduard-Mihai Burtescu-52/+52
VarDebugInfo.
2019-11-27Allocate HIR Forest on arena.Camille GILLOT-0/+1
2019-11-27Misc renames.Camille GILLOT-2/+2
2019-11-27Add memoization for const function evaluationsDavid Hewitt-1/+4
When a const function is being evaluated, as long as all its arguments are zero-sized-types (or it has no arguments) then we can trivially memoize the evaluation result using the existing query mechanism.
2019-11-27Auto merge of #66677 - wesleywiser:fix_const_prop_alloc_id_ice, r=oli-obkbors-1/+1
[const prop] Fix "alloc id without corresponding allocation" ICE r? @oli-obk
2019-11-26Fix spelling typosBrian Wignall-8/+8
2019-11-26Rollup merge of #66754 - estebank:rustdoc-capitalization, r=Dylan-DPCTyler Mandry-10/+5
Various tweaks to diagnostic output
2019-11-26Rollup merge of #66720 - Mark-Simulacrum:error-reported, r=CentrilTyler Mandry-5/+1
Move ErrorReported to rustc_errors The new location is more consistent with what this type is for, though we don't remove it from the old location (via a re-export) to avoid changing the dozens of use sites (~139 at this time).
2019-11-26Rollup merge of #66719 - Mark-Simulacrum:int-normalization, r=CentrilTyler Mandry-9/+7
Store pointer width as u32 on Config This removes the dependency on IntTy, UintTy from Session. It's not obviously a win, but it seems a bit odd to store the AST IntTy/UintTy in Session, rather we store the pointer width as an integer and add normalization methods to IntTy and UintTy.
2019-11-26Record temporary static references in generator witnessesMatthew Jasper-0/+17
2019-11-26Move local Arena to Queries.Camille GILLOT-2/+3
2019-11-26Make the HIR map own the Definitions.Camille GILLOT-5/+5
2019-11-26Move ErrorReported to rustc_errorsMark Rousskov-5/+1
2019-11-26Auto merge of #66561 - TimoFreiberg:trait-name-report, r=estebankbors-0/+39
Add version mismatch help message for unimplemented trait Improves issue #22750 The error reporting for E0277 (the trait `X` is not implemented for `Foo`) now checks whether `Foo` implements a trait with the same path as `X`, which probably means that the programmer wanted to actually use only one version of the trait `X` instead of the two. Still open: * the same diagnostic should be added for [the trait method case](https://github.com/rust-lang/rust/issues/22750#issuecomment-372077056) * Showing the real crate versions would be nice, but rustc currently doesn't have that information [according to Esteban](https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/diagnostics.20for.20crate.20version.20mismatch/near/180572989)
2019-11-26Auto merge of #66522 - tmiasko:sanitize-flags, r=alexcrichtonbors-9/+61
Add support for sanitizer recover and tracking origins of uninitialized memory * Add support for sanitizer recovery `-Zsanitizer-recover=...` (equivalent to `-fsanitize-recover` in clang). * Add support for tracking origins of uninitialized memory in MemorySanitizer `-Zsanitizer-memory-track-origins` (equivalent to `-fsanitize-memory-track-origins` in clang).
2019-11-25review feedback: comments and spacingRalf Jung-2/+3
2019-11-25Fix capitalization when mentioning different crate versions in E0308Esteban Küber-10/+5
2019-11-25add `enclosing_scope` param to `rustc_on_unimplmented`Mikhail Babenko-14/+49
add ui test compute enclosing_scope_span on demand add scope test make tidy happy stylistic and typo fixes
2019-11-25Auto merge of #66682 - estebank:fn-type-err, r=davidtwcobors-11/+197
Highlight parts of fn in type errors When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each. Examples: <img width="699" alt="" src="https://user-images.githubusercontent.com/1606434/69487597-ab561600-0e11-11ea-9b4e-d4fd9e91d5dc.png"> <img width="528" alt="" src="https://user-images.githubusercontent.com/1606434/69487207-9033d800-0e0a-11ea-93e3-8c4d002411a5.png"> <img width="468" alt="" src="https://user-images.githubusercontent.com/1606434/69487208-9033d800-0e0a-11ea-92e3-2b2cee120335.png"> <img width="775" alt="" src="https://user-images.githubusercontent.com/1606434/69487209-9033d800-0e0a-11ea-9e68-7f6ed5c8cb08.png">
2019-11-25Auto merge of #66279 - cjgillot:hashstable, r=Zoxcbors-500/+19
Use proc-macro to derive HashStable everywhere Hello, 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 strip much of librustc's boilerplate. Still, two implementations `Span` and `TokenKind` require to be placed in librustc. The latter only depends on the `bug` macro. Advise welcome on how to sever that link. A trait `StableHasingContextLike` has been introduced at each crate root, in order to handle those implementations which require librustc's very `StableHashingContext`. This overall effort allowed to remove the `impl_stable_hash_for` macro. Each commit passes the `x.py check`. I still have to double check there was no change in the implementation.
2019-11-25Auto merge of #66671 - matthewjasper:ast-address-of, r=Centrilbors-33/+58
Ast address-of This is the parts of #64588 that don't affect MIR. If an address-of expression makes it to MIR lowering we error and lower to the best currently expressible approximation to limit further errors. r? @Centril
2019-11-24Store ptr_width as u32 on ConfigMark Rousskov-9/+7
This removes the dependency on IntTy, UintTy from Session.
2019-11-24Add raw address of expressions to the AST and HIRMatthew Jasper-33/+58
2019-11-24Fix pointing at arg for fulfillment errors in function callsJanusz Marcinkiewicz-1/+1
2019-11-24fixup! Lowercase diagnostic message labelTimo Freiberg-1/+1
2019-11-24Add version mismatch help message for unimplemented traitTimo Freiberg-0/+39
Issue #22750 The error reporting for E0277 (the trait `X` is not implemented for `Foo`) now checks whether `Foo` implements a trait with the same path as `X`, which probably means that the programmer wanted to actually use only one version of the trait `X` instead of the two.
2019-11-23review comments: remove unnecessary `&str` to `String` conversionsEsteban Küber-20/+20
2019-11-24Rollup merge of #66659 - Centril:fix-bench, r=Mark-SimulacrumMazdak Farrokhzad-61/+59
make `./x.py bench` again Fixes #54016
2019-11-24Rollup merge of #66594 - Aaron1011:fix/debug-print-cycle, r=matthewjasperMazdak Farrokhzad-38/+65
Fix cycle when debug-printing opaque types 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-23Highlight parts of fn in type errorsEsteban Küber-11/+197
When a type error arises between two fn items, fn pointers or tuples, highlight only the differing parts of each.
2019-11-23Derive HashStable for TokenKind.Camille GILLOT-66/+1
2019-11-23Implement HashStable for Span in libsyntax_pos.Camille GILLOT-83/+10
2019-11-23Move CachingSourceMapView to libsyntax_pos.Camille GILLOT-105/+1
2019-11-23Rename StableHashingContextLike to HashStableContext.Camille GILLOT-3/+3
2019-11-23Move def collector from `rustc` to `rustc_resolve`Vadim Petrochenkov-353/+10