about summary refs log tree commit diff
path: root/src/librustc_borrowck
AgeCommit message (Collapse)AuthorLines
2015-05-27Remove #[cfg(stage0)] items.Eduard Burtescu-3/+0
2015-05-26Convert 15 diagnostics to have error codes (E0380-E0394).Nick Hamann-39/+59
Also adds explanations for E0380 and E0381.
2015-05-15libs: Move favicon URLs to HTTPSAlex Crichton-1/+1
Helps prevent mixed content warnings if accessing docs over HTTPS. Closes #25459
2015-05-03Update old uses of ~ in comments and debugging statementsCarol Nichols-1/+1
2015-04-30Auto merge of #24884 - michaelsproul:extended-errors, r=nrcbors-2/+5
I've been working on improving the diagnostic registration system so that it can: * Check uniqueness of error codes *across the whole compiler*. The current method using `errorck.py` is prone to failure as it relies on simple text search - I found that it breaks when referencing an error's ident within a string (e.g. `"See also E0303"`). * Provide JSON output of error metadata, to eventually facilitate HTML output, as well as tracking of which errors need descriptions. The current schema is: ``` <error code>: { "description": <long description>, "use_site": { "filename": <filename where error is used>, "line": <line in file where error is used> } } ``` [Here's][metadata-dump] a pretty-printed sample dump for `librustc`. One thing to note is that I had to move the diagnostics arrays out of the diagnostics modules. I really wanted to be able to capture error usage information, which only becomes available as a crate is compiled. Hence all invocations of `__build_diagnostics_array!` have been moved to the ends of their respective `lib.rs` files. I tried to avoid moving the array by making a plugin that expands to nothing but couldn't invoke it in item position and gave up on hackily generating a fake item. I also briefly considered using a lint, but it seemed like it would impossible to get access to the data stored in the thread-local storage. The next step will be to generate a web page that lists each error with its rendered description and use site. Simple mapping and filtering of the metadata files also allows us to work out which error numbers are absent, which errors are unused and which need descriptions. [metadata-dump]: https://gist.github.com/michaelsproul/3246846ff1bea71bd049
2015-04-30Add metadata output to the diagnostics system.Michael Sproul-2/+5
Diagnostic errors are now checked for uniqueness across the compiler and error metadata is written to JSON files.
2015-04-28Register new snapshotsTamir Duberstein-1/+0
2015-04-27Auto merge of #23606 - quantheory:associated_const, r=nikomatsakisbors-0/+14
Closes #17841. The majority of the work should be done, e.g. trait and inherent impls, different forms of UFCS syntax, defaults, and cross-crate usage. It's probably enough to replace the constants in `f32`, `i8`, and so on, or close to good enough. There is still some significant functionality missing from this commit: - ~~Associated consts can't be used in match patterns at all. This is simply because I haven't updated the relevant bits in the parser or `resolve`, but it's *probably* not hard to get working.~~ - Since you can't select an impl for trait-associated consts until partway through type-checking, there are some problems with code that assumes that you can check constants earlier. Associated consts that are not in inherent impls cause ICEs if you try to use them in array sizes or match ranges. For similar reasons, `check_static_recursion` doesn't check them properly, so the stack goes ka-blooey if you use an associated constant that's recursively defined. That's a bit trickier to solve; I'm not entirely sure what the best approach is yet. - Dealing with consts associated with type parameters will raise some new issues (e.g. if you have a `T: Int` type parameter and want to use `<T>::ZERO`). See rust-lang/rfcs#865. - ~~Unused associated consts don't seem to trigger the `dead_code` lint when they should. Probably easy to fix.~~ Also, this is the first time I've been spelunking in rustc to such a large extent, so I've probably done some silly things in a couple of places.
2015-04-23Functional changes for associated constants. Cross-crate usage of associated ↵Sean Patrick Santos-0/+14
constants is not yet working.
2015-04-18Rather than storing the relations between free-regions in a globalNiko Matsakis-7/+43
table, introduce a `FreeRegionMap` data structure. regionck computes the `FreeRegionMap` for each fn and stores the result into the tcx so that borrowck can use it (this could perhaps be refactored to have borrowck recompute the map, but it's a bid tedious to recompute due to the interaction of closures and free fns). The main reason to do this is because of #22779 -- using a global table was incorrect because when validating impl method signatures, we want to use the free region relationships from the *trait*, not the impl. Fixes #22779.
2015-04-15Dataflow changes and associated borrowck fix.Felix S. Klock II-6/+16
Revise rustc::middle::dataflow: one must select kill-kind when calling add_kill. The current kill-kinds are (1.) kills associated with ends-of-scopes and (2.) kills associated with the actual action of the expression/pattern. Then, use this to fix borrowck analysis so that it will not treat a break that pops through an assignment `x = { ... break; ... }` as a kill of the "moved-out" bit for `x`. Fix #24267. (incorporated review feedback.)
2015-04-10Improve error message where a closure escapes fn while trying to borrowNiko Matsakis-9/+74
from the current fn. Employ the new `span_suggestion` to show how you can use `move`.
2015-04-08Modify the ExprUseVisitor to walk each part of an AutoRef, and inNiko Matsakis-0/+3
particular to treat an AutoUnsize as as kind of "instantaneous" borrow of the value being unsized. This prevents us from feeding uninitialized data. This caused a problem for the eager reborrow of comparison traits, because that wound up introducing a "double AutoRef", which was not being thoroughly checked before but turned out not to type check. Fortunately, we can just remove that "eager reborrow" as it is no longer needed now that `PartialEq` doesn't force both LHS and RHS to have the same type (and even if we did have this problem, the better way would be to lean on introducing a common supertype).
2015-04-03In librustc*, convert many uses of ast::Ident to ast::Name, fixing much of ↵Jonathan S-3/+3
#6993.
2015-04-01Fallout out rustcNiko Matsakis-9/+9
2015-03-31Rollup merge of #23859 - pnkfelix:fsk-lesser-box, r=nikomatsakisManish Goregaokar-13/+39
Disallow writing through mutable pointers stored in non-mut Box. Fix #14270 The fix works by making `cmt::freely_aliasable` result more fine-grained. Instead of encoding the aliasability (i.e. whether the cmt is uniquely writable or not) as an option, now pass back an enum indicating either: 1. freely-aliasable (thus not uniquely-writable), 2. non-aliasable (thus uniquely writable), or 3. unique but immutable (and thus not uniquely writable, according to proposal from issue #14270.) This is all of course a giant hack that will hopefully go away with an eventually removal of special treatment of `Box<T>` (aka `ty_unique`) from the compiler.
2015-03-30Address Issue 14270 by making `cmt::freely_aliasable` result more fine-grained.Felix S. Klock II-9/+33
Instead of encoding the aliasability (i.e. whether the cmt is uniquely writable or not) as an option, now pass back an enum indicating either: 1. freely-aliasable (thus not uniquely-writable), 2. non-aliasble (thus uniquely writable), or 3. unique but immutable (and thus not uniquely writable, according to proposal from issue 14270.) This is all of course a giant hack that will hopefully go away with an eventually removal of special treatment of `Box<T>` (aka `ty_unique`) from the compiler.
2015-03-30Mucho debug instrumentation.Felix S. Klock II-4/+6
2015-03-28Rollup merge of #23803 - richo:unused-braces, r=ManishearthManish Goregaokar-4/+4
Pretty much what it says on the tin.
2015-03-28cleanup: Remove unused braces in use statementsRicho Healey-4/+4
2015-03-27Test fixes and rebase conflicts, round 1Alex Crichton-1/+0
2015-03-27rollup merge of #23741: alexcrichton/remove-int-uintAlex Crichton-18/+17
Conflicts: src/librustc/middle/ty.rs src/librustc_trans/trans/adt.rs src/librustc_typeck/check/mod.rs src/libserialize/json.rs src/test/run-pass/spawn-fn.rs
2015-03-26Mass rename uint/int to usize/isizeAlex Crichton-18/+17
Now that support has been removed, all lingering use cases are renamed.
2015-03-26Register new snapshotsAlex Crichton-1/+1
2015-03-23rollup merge of #23601: nikomatsakis/by-value-indexAlex Crichton-1/+1
This is a [breaking-change]. When indexing a generic map (hashmap, etc) using the `[]` operator, it is now necessary to borrow explicitly, so change `map[key]` to `map[&key]` (consistent with the `get` routine). However, indexing of string-valued maps with constant strings can now be written `map["abc"]`. r? @japaric cc @aturon @Gankro
2015-03-23Add generic conversion traitsAaron Turon-0/+1
This commit: * Introduces `std::convert`, providing an implementation of RFC 529. * Deprecates the `AsPath`, `AsOsStr`, and `IntoBytes` traits, all in favor of the corresponding generic conversion traits. Consequently, various IO APIs now take `AsRef<Path>` rather than `AsPath`, and so on. Since the types provided by `std` implement both traits, this should cause relatively little breakage. * Deprecates many `from_foo` constructors in favor of `from`. * Changes `PathBuf::new` to take no argument (creating an empty buffer, as per convention). The previous behavior is now available as `PathBuf::from`. * De-stabilizes `IntoCow`. It's not clear whether we need this separate trait. Closes #22751 Closes #14433 [breaking-change]
2015-03-23Fallout in stdlib, rustdoc, rustc, etc. For most maps, converted uses ofNiko Matsakis-1/+1
`[]` on maps to `get` in rustc, since stage0 and stage1+ disagree about how to use `[]`.
2015-03-20don't use Result::ok just to be able to use unwrap/unwrap_orOliver Schneider-1/+1
2015-03-11syntax: gather common fields of impl & trait items into their respective types.Eduard Burtescu-19/+3
2015-03-09remove uses of as_slice where deref coercions can be usedRicho Healey-2/+2
2015-03-06Rollup merge of #23056 - awlnx:master, r=nrcManish Goregaokar-0/+2
2015-03-05fix for new attributes failing. issue #22964awlnx-0/+2
2015-03-05Rollup merge of #22764 - ivanradanov:fileline_help, r=huonwManish Goregaokar-4/+8
When warnings and errors occur, the associated help message should not print the same code snippet. https://github.com/rust-lang/rust/issues/21938
2015-03-03Change span_help calls to fileline_help where appropriateIvan Radanov Ivanov-4/+8
2015-03-02Use `const`s instead of `static`s where appropriateFlorian Zeitz-5/+3
This changes the type of some public constants/statics in libunicode. Notably some `&'static &'static [(char, char)]` have changed to `&'static [(char, char)]`. The regexp crate seems to be the sole user of these, yet this is technically a [breaking-change]
2015-02-25Rollup merge of #22736 - nikomatsakis:issue-22382, r=eddybManish Goregaokar-3/+3
Apply borrowck to fns that appear in const declarations. Fixes #22382. r? @eddyb
2015-02-24Rollup merge of #22580 - pnkfelix:guard-pat-cfg2, r=pnkfelixManish Goregaokar-8/+21
aatch's cfg revisions, namely to match expressions Revise handling of match expressions so that arms branch to next arm. Update the graphviz tests accordingly. Fixes #22073. (Includes regression test for the issue.)
2015-02-23Apply borrowck to fns that appear in const declarations.Niko Matsakis-3/+3
Fixes #22382.
2015-02-23Rollup merge of #22559 - kmcallister:borrowck-readme, r=nikomatsakisManish Goregaokar-137/+84
And minor fixes to other docs. r? @nikomatsakis
2015-02-22Improve borrowck error when a second move is due to a loop.James Miller-7/+20
(Factoring of aatch CFG code, Part 5.)
2015-02-22Distinguish between AST and various Dummy nodes in CFG.James Miller-1/+1
(Factoring of aatch CFG code, Part 1.)
2015-02-20Remove remaining uses of `[]`. This time I tried to use deref coercions ↵Niko Matsakis-50/+50
where possible.
2015-02-18borrowck/README.md: Normalize types in examplesKeegan McAllister-37/+37
2015-02-18Fix references to doc.rs throughout the codeKeegan McAllister-9/+9
2015-02-18borrowck/README.md: Fix display of code on GitHubKeegan McAllister-18/+18
2015-02-18borrowck/README.md: Remove SCOPE (mostly unused)Keegan McAllister-37/+1
Only one case is used in the text. All of them are pretty straightforward, so I don't think the code needs an explicit link to the README.
2015-02-18borrowck/README.md: Clarify MUTABILITY and ALIASABLEKeegan McAllister-12/+10
2015-02-18borrowck/README.md: Remove most references to &constKeegan McAllister-24/+9
2015-02-18rollup merge of #22502: nikomatsakis/deprecate-bracket-bracketAlex Crichton-17/+17
Conflicts: src/libcollections/slice.rs src/libcollections/str.rs src/librustc/middle/lang_items.rs src/librustc_back/rpath.rs src/librustc_typeck/check/regionck.rs src/libstd/ffi/os_str.rs src/libsyntax/diagnostic.rs src/libsyntax/parse/parser.rs src/libsyntax/util/interner.rs src/test/run-pass/regions-refcell.rs
2015-02-18Replace all uses of `&foo[]` with `&foo[..]` en masse.Niko Matsakis-17/+17