summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2016-01-16rustc: Fix bugs in renamed and removed lints and re-add raw_pointer_deriveBrian Anderson-36/+154
cc #30346 Conflicts: src/librustc_lint/lib.rs
2016-01-12Merge pull request #30847 from nikomatsakis/issue-29857-betaBrian Anderson-5/+20
[beta] Backport fix for issue 29857
2016-01-12Added proper lint for the unit variant/struct warning.Felix S. Klock II-0/+8
2016-01-12improve visibility of future-incompatibilities (mildly, at least)Niko Matsakis-3/+22
2016-01-11Change error scheme so that if projection fails we generate `A::B` instead ↵Niko Matsakis-5/+20
of `TyError` Conflicts: src/test/compile-fail/issue-29857.rs
2015-12-09Auto merge of #30266 - oli-obk:expr_type_checked, r=luqmanabors-40/+23
r? @eefriedman It was getting out of hand with my additions to the const evaluator
2015-12-09Rollup merge of #30201 - GuillaumeGomez:patch-3, r=ManishearthSteve Klabnik-2/+18
r? @Manishearth
2015-12-09Auto merge of #30208 - pnkfelix:fix-issue-30063, r=alexcrichtonbors-1/+46
When given `rustc -C codegen-units=4 --emit=obj`, reset units back to 1. Fix #30063 Note: while this code is careful to handle the case of mutliple emit types (e.g. `--emit=asm,obj`) by reporting all the emit types that conflict with codegen units in its warnings, an invocation with multiple emit types *and* `-o PATH` will continue to ignore the requested target path (with a warning), as it already does today, since the code that checks for that is further downstream. (Multiple emit types without `-o PATH` will "work", though it will downgrade codegen-units to 1 just like all the other cases.) r? @alexcrichton
2015-12-09Auto merge of #30145 - petrochenkov:hyg, r=nrcbors-10/+8
Instead of `ast::Ident`, bindings, paths and labels in HIR now keep a new structure called `hir::Ident` containing mtwt-renamed `name` and the original not-renamed `unhygienic_name`. `name` is supposed to be used by default, `unhygienic_name` is rarely used. This is not ideal, but better than the status quo for two reasons: - MTWT tables can be cleared immediately after lowering to HIR - This is less bug-prone, because it is impossible now to forget applying `mtwt::resolve` to a name. It is still possible to use `name` instead of `unhygienic_name` by mistake, but `unhygienic_name`s are used only in few very special circumstances, so it shouldn't be a problem. Besides name resolution `unhygienic_name` is used in some lints and debuginfo. `unhygienic_name` can be very well approximated by "reverse renaming" `token::intern(name.as_str())` or even plain string `name.as_str()`, except that it would break gensyms like `iter` in desugared `for` loops. This approximation is likely good enough for lints and debuginfo, but not for name resolution, unfortunately (see https://github.com/rust-lang/rust/issues/27639), so `unhygienic_name` has to be kept. cc https://github.com/rust-lang/rust/issues/29782 r? @nrc
2015-12-08shorten common if let patterns to function callsOliver Schneider-40/+23
2015-12-08When given `rustc -C codegen-units=4 -o output --emit=obj`, reset units back ↵Felix S. Klock II-1/+46
to 1. Fix #30063 Note: while this code is careful to handle the case of mutliple emit types (e.g. `--emit=asm,obj`) by reporting all the emit types that conflict with codegen units in its warnings, an invocation with multiple emit types *and* `-o PATH` will continue to ignore the requested target path (with a warning), as it already does today, since the code that checks for that is further downstream.
2015-12-07Auto merge of #30087 - petrochenkov:indi, r=nrcbors-12/+12
I've measured the time/memory consumption before and after - the difference is lost in statistical noise, so it's mostly a code simplification. Sizes of `enum`s are not affected. r? @nrc I wonder if AST/HIR visitors could run faster if `P`s are systematically removed (except for cases where they control `enum` sizes). Theoretically they should. Remaining unnecessary `P`s can't be easily removed because many folders accept `P<X>`s as arguments, but these folders can be converted to accept `X`s instead without loss of efficiency. When I have a mood for some mindless refactoring again, I'll probably try to convert the folders, remove remaining `P`s and measure again.
2015-12-07Add E0264 error explanationGuillaume Gomez-3/+27
2015-12-07Remove some unnecessary indirection from HIR structuresVadim Petrochenkov-12/+12
2015-12-07Auto merge of #30202 - oli-obk:fix/const_index_feature_gate, r=Aatchbors-10/+7
see https://github.com/rust-lang/rust/issues/29947#issuecomment-161781257 I also added some missing tests
2015-12-06Auto merge of #30187 - alexcrichton:stabilize-1.6, r=aturonbors-28/+19
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-12-05std: Stabilize APIs for the 1.6 releaseAlex Crichton-28/+19
This commit is the standard API stabilization commit for the 1.6 release cycle. The list of issues and APIs below have all been through their cycle-long FCP and the libs team decisions are listed below Stabilized APIs * `Read::read_exact` * `ErrorKind::UnexpectedEof` (renamed from `UnexpectedEOF`) * libcore -- this was a bit of a nuanced stabilization, the crate itself is now marked as `#[stable]` and the methods appearing via traits for primitives like `char` and `str` are now also marked as stable. Note that the extension traits themeselves are marked as unstable as they're imported via the prelude. The `try!` macro was also moved from the standard library into libcore to have the same interface. Otherwise the functions all have copied stability from the standard library now. * The `#![no_std]` attribute * `fs::DirBuilder` * `fs::DirBuilder::new` * `fs::DirBuilder::recursive` * `fs::DirBuilder::create` * `os::unix::fs::DirBuilderExt` * `os::unix::fs::DirBuilderExt::mode` * `vec::Drain` * `vec::Vec::drain` * `string::Drain` * `string::String::drain` * `vec_deque::Drain` * `vec_deque::VecDeque::drain` * `collections::hash_map::Drain` * `collections::hash_map::HashMap::drain` * `collections::hash_set::Drain` * `collections::hash_set::HashSet::drain` * `collections::binary_heap::Drain` * `collections::binary_heap::BinaryHeap::drain` * `Vec::extend_from_slice` (renamed from `push_all`) * `Mutex::get_mut` * `Mutex::into_inner` * `RwLock::get_mut` * `RwLock::into_inner` * `Iterator::min_by_key` (renamed from `min_by`) * `Iterator::max_by_key` (renamed from `max_by`) Deprecated APIs * `ErrorKind::UnexpectedEOF` (renamed to `UnexpectedEof`) * `OsString::from_bytes` * `OsStr::to_cstring` * `OsStr::to_bytes` * `fs::walk_dir` and `fs::WalkDir` * `path::Components::peek` * `slice::bytes::MutableByteVector` * `slice::bytes::copy_memory` * `Vec::push_all` (renamed to `extend_from_slice`) * `Duration::span` * `IpAddr` * `SocketAddr::ip` * `Read::tee` * `io::Tee` * `Write::broadcast` * `io::Broadcast` * `Iterator::min_by` (renamed to `min_by_key`) * `Iterator::max_by` (renamed to `max_by_key`) * `net::lookup_addr` New APIs (still unstable) * `<[T]>::sort_by_key` (added to mirror `min_by_key`) Closes #27585 Closes #27704 Closes #27707 Closes #27710 Closes #27711 Closes #27727 Closes #27740 Closes #27744 Closes #27799 Closes #27801 cc #27801 (doesn't close as `Chars` is still unstable) Closes #28968
2015-12-05fix const index feature-gate regressionOliver Schneider-10/+7
2015-12-05Do MTWT resolution during lowering to HIRVadim Petrochenkov-10/+8
2015-12-04Auto merge of #30084 - oli-obk:const_fn, r=pnkfelixbors-27/+51
2015-12-04Add E0452 error explanationGuillaume Gomez-2/+18
2015-12-04Auto merge of #29850 - Kimundi:attributes_that_make_a_statement, r=pnkfelixbors-5/+16
See https://github.com/rust-lang/rfcs/pull/16 and https://github.com/rust-lang/rust/issues/15701 - Added syntax support for attributes on expressions and all syntax nodes in statement position. - Extended `#[cfg]` folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. - Extended lint checker to recognize lint levels on expressions and locals. - As per RFC, attributes are not yet accepted on `if` expressions. Examples: ```rust let x = y; { ... } assert_eq!((1, #[cfg(unset)] 2, 3), (1, 3)); let FOO = 0; ``` Implementation wise, there are a few rough corners and open questions: - The parser work ended up a bit ugly. - The pretty printer change was based mostly on guessing. - Similar to the `if` case, there are some places in the grammar where a new `Expr` node starts, but where it seemed weird to accept attributes and hence the parser doesn't. This includes: - const expressions in patterns - in the middle of an postfix operator chain (that is, after `.`, before indexing, before calls) - on range expressions, since `#[attr] x .. y` parses as `(#[attr] x) .. y`, which is inconsistent with `#[attr] .. y` which would parse as `#[attr] (.. y)` - Attributes are added as additional `Option<Box<Vec<Attribute>>>` fields in expressions and locals. - Memory impact has not been measured yet. - A cfg-away trailing expression in a block does not currently promote the previous `StmtExpr` in a block to a new trailing expr. That is to say, this won't work: ```rust let x = { #[cfg(foo)] Foo { data: x } #[cfg(not(foo))] Foo { data: y } }; ``` - One-element tuples can have their inner expression removed to become Unit, but just Parenthesis can't. Eg, `(#[cfg(unset)] x,) == ()` but `(#[cfg(unset)] x) == error`. This seemed reasonable to me since tuples and unit are type constructors, but could probably be argued either way. - Attributes on macro nodes are currently unconditionally dropped during macro expansion, which seemed fine since macro disappear at that point? - Attributes on `ast::ExprParens` will be prepend-ed to the inner expression in the hir folder. - The work on pretty printer tests for this did trigger, but not fix errors regarding macros: - expression `foo![]` prints as `foo!()` - expression `foo!{}` prints as `foo!()` - statement `foo![];` prints as `foo!();` - statement `foo!{};` prints as `foo!();` - statement `foo!{}` triggers a `None` unwrap ICE.
2015-12-03Auto merge of #30149 - mitaa:fqn, r=alexcrichtonbors-0/+2
Fixes #30109
2015-12-03Use the extern item-path for documentation linksmitaa-0/+2
The local item-path includes the local crates path to the extern crate declaration which breaks cross-crate rustdoc links if the extern crate is not linked into the crate root or renamed via `extern foo as bar`.
2015-12-03Auto merge of #30167 - GuillaumeGomez:patch-3, r=Manishearthbors-1/+44
r? @Manishearth
2015-12-03Add E0400 error explanationGuillaume Gomez-1/+44
2015-12-02s/isize/i32Tobias Bucher-3/+3
2015-12-01Rollup merge of #30136 - fhahn:remove-int-from-doc-examples, r=steveklabnikSteve Klabnik-3/+3
This PR replaces uses of int/uint in some doc examples in various crates.
2015-12-01Replace uses of int/uint with isize/uzsize in doc examplesFlorian Hahn-3/+3
2015-12-01Auto merge of #25570 - oli-obk:const_indexing, r=nikomatsakisbors-1/+93
This PR allows the constant evaluation of index operations on constant arrays and repeat expressions. This allows index expressions to appear in the expression path of the length expression of a repeat expression or an array type. An example is ```rust const ARR: [usize; 5] = [1, 2, 3, 4, 5]; const ARR2: [usize; ARR[1]] = [42, 99]; ``` In most other locations llvm's const evaluator figures it out already. This is not specific to index expressions and could be remedied in the future.
2015-12-01Auto merge of #30135 - michaelwoerister:interning-checks, r=sanxiynbors-5/+18
This PR adds some safety checks to interning things in `ty::ctxt`. Accidentally re-interning an `AdtDef` has bitten me in the behind just last week (it messes up things in very subtle way only showing up later as an LLVM assertion). Initially I had also added a check to `ty::ctxt::node_type_insert()` -- but there it seems to be expected that the same table slot is written to multiple times. Roll-up candidate.
2015-12-01Add some consistency checks for value interning in ty::ctxt.Michael Woerister-5/+18
2015-11-30Auto merge of #29929 - michaelwoerister:mir-repr-to-librustc, r=nikomatsakisbors-0/+1145
This is done mostly so that we can refer to MIR types in csearch and other metadata related area. Heads up, @rust-lang/compiler! r? @nikomatsakis
2015-11-30Reword E0492Guillaume Gomez-3/+3
2015-11-30Also move the MIR visitor to librustc.Michael Woerister-0/+247
2015-11-30Move the core MIR datastructures to librustc.Michael Woerister-0/+898
This is done mostly so that we can refer to MIR types in csearch and other metadata related area.
2015-11-29Add E0492 error explanationGuillaume Gomez-19/+79
2015-11-28Add E0498 error explanationGuillaume Gomez-0/+18
2015-11-28Auto merge of #29383 - petrochenkov:empstr, r=pnkfelixbors-15/+14
Fixes https://github.com/rust-lang/rust/issues/28692 Fixes https://github.com/rust-lang/rust/issues/28992 Fixes some other similar issues (see the tests) [breaking-change], needs crater run (cc @brson or @alexcrichton ) The pattern with parens `UnitVariant(..)` for unit variants seems to be popular in rustc (see the second commit), but mostly used by one person (@nikomatsakis), according to git blame. If it causes breakage on crates.io I'll add an exceptional case for it.
2015-11-27Auto merge of #30064 - fhartwig:macro-suggestions, r=sanxiynbors-64/+0
Fixes #13677 This does the same sort of suggestion for misspelt macros that we already do for misspelt identifiers. Example. Compiling this program: ```rust macro_rules! foo { ($e:expr) => ( $e ) } fn main() { fob!("hello!"); } ``` gives the following error message: ``` /Users/mcp/temp/test.rs:7:5: 7:8 error: macro undefined: 'fob!' /Users/mcp/temp/test.rs:7 fob!("hello!"); ^~~ /Users/mcp/temp/test.rs:7:5: 7:8 help: did you mean `foo`? /Users/mcp/temp/test.rs:7 fob!("hello!"); ``` I had to move the levenshtein distance function into libsyntax for this. Maybe this should live somewhere else (some utility crate?), but I couldn't find a crate to put it in that is imported by libsyntax and the other rustc crates.
2015-11-27implement calling of `const fn`-methods in true constantsOliver Schneider-27/+51
2015-11-26Moved and refactored ThinAttributesMarvin Löbel-3/+4
2015-11-26Add syntax support for attributes on expressions and all syntaxMarvin Löbel-6/+16
nodes in statement position. Extended #[cfg] folder to allow removal of statements, and of expressions in optional positions like expression lists and trailing block expressions. Extended lint checker to recognize lint levels on expressions and locals.
2015-11-26fix rustc-testAriel Ben-Yehuda-6/+138
2015-11-26fix tidyAriel Ben-Yehuda-6/+9
2015-11-26split the metadata code into rustc_metadataAriel Ben-Yehuda-10288/+301
tests & rustdoc still broken
2015-11-26move librustc/plugin to librustc_pluginAriel Ben-Yehuda-420/+1
this is a [breaking-change] to all plugin authors - sorry
2015-11-26make check worksAriel Ben-Yehuda-6/+39
2015-11-26make CrateStore a trait objectAriel Ben-Yehuda-112/+135
rustdoc still broken
2015-11-26remove csearch from the rest of rustcAriel Ben-Yehuda-31/+169