summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2020-03-08Rollup merge of #69805 - petrochenkov:importname, r=CentrilMazdak Farrokhzad-323/+281
resolve: Modernize some naming `ImportDirective` -> `Import` `ImportDirectiveSubclass` -> `ImportKind` `ImportKind::SingleImport` -> `ImportKind::Single` `ImportKind::GlobImport` -> `ImportKind::Glob`
2020-03-07resolve: `directive` -> `import`Vadim Petrochenkov-235/+213
2020-03-07Rollup merge of #69773 - matthiaskrgr:typos, r=petrochenkovMazdak Farrokhzad-4/+4
fix various typos
2020-03-07Rollup merge of #69687 - Centril:bm-inconsistent-wording, r=estebankMazdak Farrokhzad-2/+1
resolve, inconsistent binding mode: tweak wording Now that we can have e.g. `let Ok(x) | Err(x) = res;`, it's no longer appropriate to refer to "the same *match arm*", so let's tweak the wording. r? @estebank
2020-03-07resolve: `ImportDirective` -> `Import`Vadim Petrochenkov-125/+105
`ImportDirectiveSubclass` -> `ImportKind` `ImportKind::SingleImport` -> `ImportKind::Single` `ImportKind::GlobImport` -> `ImportKind::Glob`
2020-03-06Don't redundantly repeat field names (clippy::redundant_field_names)Matthias Krüger-5/+5
2020-03-06fix various typosMatthias Krüger-4/+4
2020-03-06Auto merge of #69586 - petrochenkov:unmerge, r=Centrilbors-10/+6
ast: Unmerge structures for associated items and foreign items Follow-up to https://github.com/rust-lang/rust/pull/69194. r? @Centril
2020-03-05Rollup merge of #69736 - matthiaskrgr:even_more_clippy, r=Dylan-DPCDylan DPC-1/+1
even more clippy cleanups * Don't pass &mut where immutable reference (&) is sufficient (clippy::unnecessary_mut_passed) * Use more efficient &&str to String conversion (clippy::inefficient_to_string) * Don't always eval arguments inside .expect(), use unwrap_or_else and closure. (clippy::expect_fun_call) * Use righthand '&' instead of lefthand "ref". (clippy::toplevel_ref_arg) * Use simple 'for i in x' loops instead of 'while let Some(i) = x.next()' loops on iterators. (clippy::while_let_on_iterator) * Const items have by default a static lifetime, there's no need to annotate it. (clippy::redundant_static_lifetimes) * Remove redundant patterns when matching ( x @ _ to x) (clippy::redundant_pattern)
2020-03-05Remove redundant patterns when matching ( x @ _ to x) ↵Matthias Krüger-1/+1
(clippy::redundant_pattern)
2020-03-04Use single-char patter on {ends,starts}_with and remove clone on copy type.Matthias Krüger-3/+3
These were introduced since I last fixed most of these occurences. (clippy::clone_on_copy, clippy::single_char_pattern)
2020-03-04resolve, inconsistent binding mode: tweak wording.Mazdak Farrokhzad-2/+1
2020-03-03Rollup merge of #69637 - matthiaskrgr:if_let_some_result, r=ecstatic-morseYuki Okushi-2/+2
Don't convert Results to Options just for matching.
2020-03-03Rollup merge of #69619 - matthiaskrgr:misc, r=eddybYuki Okushi-1/+1
more cleanups * use starts_with() instead of chars().next() == Some(x) * use subsec_micros() instead of subsec_nanos() / 1000 * use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables * use values() or keys() respectively when iterating only over keys or values of maps.
2020-03-02Don't convert Results to Options just for matching.Matthias Krüger-2/+2
2020-03-02use values() or keys() respectively when iterating only over keys or values ↵Matthias Krüger-1/+1
of maps.
2020-03-02Auto merge of #69432 - petrochenkov:alldeps, r=eddybbors-5/+0
rustc_metadata: Load metadata for indirect macro-only dependencies Imagine this dependency chain between crates ``` Executable crate -> Library crate -> Macro crate ``` where "Library crate" uses the macros from "Macro crate" for some code generation, but doesn't reexport them any further. Currently, when compiling "Executable crate" we don't even load metadata for it, because why would we want to load any metadata from "Macro crate" if it already did all its code generation job when compiling "Library crate". Right? Wrong! Hygiene data and spans (https://github.com/rust-lang/rust/issues/68686, https://github.com/rust-lang/rust/pull/68941) from "Macro crate" still may need to be decoded from "Executable crate". So we'll have to load them properly. Questions: - How this will affect compile times for larger crate trees in practice? How to measure it? Hygiene/span encoding/decoding will necessarily slow down compilation because right now we just don't do some work that we should do, but this introduces a whole new way to slow down things. E.g. loading metadata for `syn` (and its dependencies) when compiling your executable if one of its library dependencies uses it. - We are currently detecting whether a crate reexports macros from "Macro crate" or not, could we similarly detect whether a crate "reexports spans" and keep it unloaded if it doesn't? Or at least "reexports important spans" affecting hygiene, we can probably lose spans that only affect diagnostics.
2020-03-01Rollup merge of #69569 - matthiaskrgr:nonminimal_bool, r=mark-SimulacrumDylan DPC-2/+2
simplify boolean expressions
2020-03-01ast: Unmerge structures for associated items and foreign itemsVadim Petrochenkov-10/+6
2020-03-01Auto merge of #69592 - petrochenkov:nosyntax, r=Centrilbors-36/+36
Rename `libsyntax` to `librustc_ast` This was the last rustc crate that wasn't following the `rustc_*` naming convention. Follow-up to https://github.com/rust-lang/rust/pull/67763.
2020-02-29Rename `syntax` to `rustc_ast` in source codeVadim Petrochenkov-36/+36
2020-02-29Rollup merge of #69572 - matthiaskrgr:try_err_and_iter_on_ref, r=CentrilDylan DPC-1/+1
use .iter() instead of .into_iter() on references
2020-02-29Make it build againVadim Petrochenkov-1/+1
2020-02-29simplify boolean expressionsMatthias Krüger-2/+2
2020-02-29use .iter() instead of .into_iter() on references.Matthias Krüger-1/+1
2020-02-29Rollup merge of #69567 - matthiaskrgr:useless_fmt, r=nagisaDylan DPC-10/+9
use .to_string() instead of format!() macro to create strings handles what is left after https://github.com/rust-lang/rust/pull/69541
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-4/+4
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-29use .to_string() instead of format!() macro to create stringsMatthias Krüger-10/+9
2020-02-28Rollup merge of #69547 - matthiaskrgr:more_misc, r=Mark-SimulacrumMazdak Farrokhzad-38/+32
remove redundant clones, references to operands, explicit boolean comparisons and filter(x).next() calls.
2020-02-28Rollup merge of #69541 - dotdash:format, r=Mark-SimulacrumMazdak Farrokhzad-2/+2
Remove unneeded calls to format!()
2020-02-28Rollup merge of #69539 - Centril:fix-69401, r=petrochenkovMazdak Farrokhzad-2/+3
late resolve, visit_fn: bail early if there's no body. Fixes https://github.com/rust-lang/rust/issues/69401 which was injected by https://github.com/rust-lang/rust/commit/b2c6eeb713d4cf9b35b7dda6ff2b0274e7f24684 in https://github.com/rust-lang/rust/pull/68788. r? @petrochenkov
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-11/+7
2020-02-28remove redundant clones, references to operands, explicit boolean ↵Matthias Krüger-38/+32
comparisons and filter(x).next() calls.
2020-02-28late resolve, visit_fn: bail early if there's no body.Mazdak Farrokhzad-2/+3
2020-02-27Remove unneeded calls to format!()Björn Steinbrink-2/+2
2020-02-27use char instead of &str for single char patternsMatthias Krüger-2/+2
2020-02-27Rollup merge of #69439 - petrochenkov:latelife, r=matthewjasperYuki Okushi-246/+246
resolve: `lifetimes.rs` -> `late/lifetimes.rs` Lifetime resolution should ideally be merged into the late resolution pass, at least for named lifetimes. Let's move it closer to it for a start.
2020-02-24resolve: `lifetimes.rs` -> `late/lifetime.rs`Vadim Petrochenkov-246/+246
2020-02-24don't explicitly compare against true or falseMatthias Krüger-1/+1
2020-02-24rustc_metadata: Load metadata for indirect macro-only dependenciesVadim Petrochenkov-5/+0
2020-02-24parse/ast: move `Defaultness` into variants.Mazdak Farrokhzad-14/+16
2020-02-23Rollup merge of #69375 - Menschenkindlein:master, r=Dylan-DPCDylan DPC-18/+18
Rename CodeMap to SourceMap follow up See https://github.com/rust-lang/rust/issues/51574
2020-02-22Rename CodeMap to SourceMap follow upMaxim Zholobak-18/+18
2020-02-22parse: allow `type Foo: Ord` syntactically.Mazdak Farrokhzad-3/+3
2020-02-18Rollup merge of #69194 - Centril:assoc-extern-fuse, r=petrochenkovMazdak Farrokhzad-103/+110
parse: fuse associated and extern items up to defaultness Language changes: - The grammar of extern `type` aliases is unified with associated ones, and becomes: ```rust TypeItem = "type" ident generics {":" bounds}? where_clause {"=" type}? ";" ; ``` Semantic restrictions (`ast_validation`) are added to forbid any parameters in `generics`, any bounds in `bounds`, and any predicates in `where_clause`, as well as the presence of a type expression (`= u8`). (Work still remains to fuse this with free `type` aliases, but this can be done later.) - The grammar of constants and static items (free, associated, and extern) now permits the absence of an expression, and becomes: ```rust GlobalItem = {"const" {ident | "_"} | "static" "mut"? ident} {"=" expr}? ";" ; ``` - A semantic restriction is added to enforce the presence of the expression (the body). - A semantic restriction is added to reject `const _` in associated contexts. Together, these changes allow us to fuse the grammar of associated items and extern items up to `default`ness which is the main goal of the PR. ----------------------- We are now very close to fully fusing the entirely of item parsing and their ASTs. To progress further, we must make a decision: should we parse e.g. `default use foo::bar;` and whatnot? Accepting that is likely easiest from a parsing perspective, as it does not require using look-ahead, but it is perhaps not too onerous to only accept it for `fn`s (and all their various qualifiers), `const`s, `static`s, and `type`s. r? @petrochenkov
2020-02-17Rename `FunctionRetTy` to `FnRetTy`Yuki Okushi-3/+3
2020-02-16Make librustc_infer compile.Camille GILLOT-0/+1
2020-02-15parse extern constsMazdak Farrokhzad-2/+2
2020-02-15parse associated statics.Mazdak Farrokhzad-4/+8
2020-02-15ast: make `= <expr>;` optional in free statics/consts.Mazdak Farrokhzad-3/+3