about summary refs log tree commit diff
path: root/src/librustc_mir/diagnostics.rs
AgeCommit message (Collapse)AuthorLines
2019-04-17Rename diagnostics to error_codesYuki OKUSHI-2425/+0
2019-04-11Update diagnostics.rsAndrew Banchich-2/+2
Add `a` and other minor text improvements
2019-02-25Auto merge of #57609 - matthewjasper:more-restrictive-match, r=pnkfelixbors-2/+2
Use normal mutable borrows in matches `ref mut` borrows are currently two-phase with NLL enabled. This changes them to be proper mutable borrows. To accommodate this, first the position of fake borrows is changed: ```text [ 1. Pre-match ] | [ (old create fake borrows) ] [ 2. Discriminant testing -- check discriminants ] <-+ | | | (once a specific arm is chosen) | | | [ (old read fake borrows) ] | [ 3. Create "guard bindings" for arm ] | [ (create fake borrows) ] | | | [ 4. Execute guard code ] | [ (read fake borrows) ] --(guard is false)-----------+ | | (guard results in true) | [ 5. Create real bindings and execute arm ] | [ Exit match ] ``` The following additional changes are made to accommodate `ref mut` bindings: * We no longer create fake `Shared` borrows. These borrows are no longer needed for soundness, just to avoid some arguably strange cases. * `Shallow` borrows no longer conflict with existing borrows, avoiding conflicting access between the guard borrow access and the `ref mut` borrow. There is some further clean up done in this PR: * Avoid the "later used here" note for Shallow borrows (since it's not relevant with the message provided) * Make any use of a two-phase borrow activate it. * Simplify the cleanup_post_borrowck passes into a single pass. cc #56254 r? @nikomatsakis
2019-02-21Fix error index exampleMatthew Jasper-2/+2
2019-02-20Remove braces from most E0505 examplesAlex Gurganus-15/+9
The solution which uses braces to release the borrow before it is moved is only required to satisfy the 2015 edition borrow checker. All other examples give the expected results for both 2015 and 2018 editions.
2019-02-20Fixes #58586: Make E0505 explain example fail for 2018 editionAlex Gurganus-3/+16
2019-02-14Fix documentation typovarkor-2/+2
2019-02-14Add specific error for unstable const fn featuresvarkor-0/+31
2019-02-14Rollup merge of #57856 - lzutao:fix-old-first-edition, r=steveklabnikMazdak Farrokhzad-7/+7
Convert old first edition links to current edition one r? @steveklabnik
2019-02-13Convert old doc links to current editionLzu Tao-7/+7
Use footnote style to bypass the tidy check
2019-01-27Change generator trait to use pinningWim Looman-10/+15
2019-01-26Replace deprecated ATOMIC_INIT constsMark Rousskov-4/+4
2019-01-13Update the const fn tracking issue to the new metabugvarkor-1/+1
2019-01-12Rollup merge of #57535 - varkor:stabilise-if-while-let-patterns, r=CentrilMazdak Farrokhzad-2/+6
Stabilise irrefutable if-let and while-let patterns This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). This replaces https://github.com/rust-lang/rust/pull/55639, as we want to stabilise this in time for the beta cut-off. Closes https://github.com/rust-lang/rust/pull/55639. r? @Centril
2019-01-12Stabilise irrefutable if-let and while-let patternsvarkor-2/+6
This stabilises RFC 2086 (https://github.com/rust-lang/rust/issues/44495). Co-Authored-By: Sebastian Malton <sebastian@malton.name>
2019-01-11Fixing a typographical error.David Sanders-1/+1
2018-12-25Remove licensesMark Rousskov-10/+0
2018-12-04cleanup: remove static lifetimes from constsljedrz-4/+4
2018-10-23fix typos in various placesMatthias Krüger-1/+1
2018-10-21Use new region infer errors for explaining borrowsMatthew Jasper-0/+40
This gives at least some explanation for why a borrow is expected to last for a certain free region. Also: * Reports E0373: "closure may outlive the current function" with NLL. * Special cases the case of returning a reference to (or value referencing) a local variable or temporary (E0515). * Special case assigning a reference to a local variable in a closure to a captured variable.
2018-10-20Give an error number for "borrowed data escapes outside of closure"Matthew Jasper-0/+1
2018-10-05Remove old unused error codeOliver Scherer-18/+0
2018-09-25Change the diagnostic number from 714 to 716.Felix S. Klock II-2/+2
2018-09-25add "temporary value dropped while borrowed" errorMikhail Modin-0/+85
Issue #54131
2018-09-24Better messages for errors from Shallow borrowsMatthew Jasper-0/+20
2018-09-19Address following error from rustdoc tests:Felix S. Klock II-2/+14
error[E0106]: missing lifetime specifier --> /checkout/obj/build/x86_64-unknown-linux-gnu/test/error-index.md:11424:23 | 9 | fn demo(s: &mut S) -> &mut String { let p = &mut *(*s).data; p } | ^ expected lifetime parameter | = help: this function's return type contains a borrowed value, but the signature does not say which one of `s`'s 2 lifetimes it is borrowed from
2018-09-18Fine tune dianostics for when a borrow conflicts with a destructor that ↵Felix S. Klock II-0/+45
needs exclusive access. In particular: 1. Extend `WriteKind::StorageDeadOrDrop` with state to track whether we are running a destructor or just freeing backing storage. (As part of this, when we drop a Box<..<Box<T>..> where `T` does not need drop, we now signal that the drop of `T` is a kind of storage dead rather than a drop.) 2. When reporting that a value does not live long enough, check if we're doing an "interesting" drop, i.e. we aren't just trivally freeing the borrowed state, but rather a user-defined dtor will run and potentially require exclusive aces to the borrowed state. 3. Added a new diagnosic to describe the scenario here.
2018-08-10Auto merge of #53131 - davidtwco:issue-52663-thread-local-static, r=nikomatsakisbors-0/+23
NLL says something "does not live long enough" when talking about a (thread-local) static Part of #52663. r? @nikomatsakis
2018-08-07Auto merge of #51990 - oli-obk:unstable_union, r=nikomatsakisbors-85/+0
Place unions, pointer casts and pointer derefs behind extra feature gates To ensure we don't stabilize these things together with const fn stabilization (or any other stabilization) This PR moves union field accesses inside `const fn` behind a feature gate. It was possible without a feature gate before, but since `const fn` was behind a feature gate we can do this change. While "dereferencing raw pointers" and "casting raw pointers to usize" were hard errors before this PR, one could work around them by abusing unions: ```rust // deref union Foo<T> { x: &'static T, y: *const T, } const FOO: u32 = unsafe { *Foo { y: 42 as *const T }.x }; // as usize cast union Bar<T> { x: usize, y: *const T, } const BAR: usize = unsafe { Bar { y: &1u8 }.x }; ``` r? @eddyb cc @nikomatsakis
2018-08-07Also put comparing raw pointers behind a feature gateOliver Schneider-30/+0
2018-08-07Place unions, pointer casts and pointer derefs behind extra feature gatesOliver Schneider-55/+0
2018-08-07Special case error message for thread-local statics.David Wood-0/+23
2018-08-06Remove references to `StaticMutex` which got removed a while agoRalf Jung-3/+1
2018-06-30Loosened rules involving statics mentioning other statics.Alexander Regueiro-55/+0
Updated tests accordingly.
2018-06-26migrate codebase to `..=` inclusive range patternsZack M. Davis-2/+2
These were stabilized in March 2018's #47813, and are the Preferred Way to Do It going forward (q.v. #51043).
2018-05-22Remove now unused error codeOliver Schneider-15/+0
2018-03-21Make resuming generators unsafe instead of the creation of immovable ↵John Kåre Alsaker-5/+5
generators. Fixes #47787
2018-03-08Add InterpretInterner to StableHashingContext for AllocId serializationOliver Schneider-30/+0
2018-03-08Nuke the entire ctfe from orbit, it's the only way to be sureOliver Schneider-0/+36
2018-03-08Move librustc_const_eval to librustc_mirOliver Schneider-0/+550
2018-02-17fix more typos found by codespell.Matthias Krüger-1/+1
2017-11-26Stabilize const-calling existing const-fns in stdSimon Sapin-4/+0
Fixes #46038
2017-10-14Improve E0382 extended help messageJacob Wahlgren-9/+57
Mention Clone and refererences, and use more realistic examples (within the constraints of a few lines :).
2017-10-10Moved remaining AST-borrowck diagnostic definitions to `rustc_mir` crate.Felix S. Klock II-0/+461
2017-10-04Move E0509 diagnostic into mod borrowck_errors shared between ast- and ↵Felix S. Klock II-0/+94
mir-borrowck.
2017-10-04Move E0508 diagnostic into mod borrowck_errors shared between ast- and ↵Felix S. Klock II-0/+45
mir-borrowck.
2017-10-04Move E0507 diagnostic into mod borrowck_errors shared between ast- and ↵Felix S. Klock II-0/+127
mir-borrowck. (Had to modify signature of `report_cannot_move_out_of` slightly to satisfy requirements of newly added `fn cannot_move_out_of` method.)
2017-09-29mir-borrowck: Factorize error message for `cannot_assign_static()` between ↵Basile Desloges-0/+1
AST and MIR borrowck
2017-09-24move unsafety checking to MIRAriel Ben-Yehuda-0/+34
No functional changes intended.
2017-09-16change #![feature(const_fn)] to specific gatesAlex Burka-2/+2