about summary refs log tree commit diff
path: root/src/librustc_resolve
AgeCommit message (Collapse)AuthorLines
2020-03-15Rollup merge of #69589 - petrochenkov:maccall, r=CentrilMazdak Farrokhzad-24/+24
ast: `Mac`/`Macro` -> `MacCall` It's now obvious that these refer to macro calls rather than to macro definitions. It's also a single name instead of two different names in different places. `rustc_expand` usually calls macro calls in a wide sense (including attributes and derives) "macro invocations", but structures and variants renamed in this PR are only relevant to fn-like macros, so it's simpler and clearer to just call them calls. cc https://github.com/rust-lang/rust/pull/63586#discussion_r314232513 r? @eddyb
2020-03-15resolve: Prevent fresh bindings from shadowing ambiguity itemsVadim Petrochenkov-22/+24
Correctly treat const generic parameters in fresh binding disambiguation
2020-03-15def_collector: Fully visit async functionsVadim Petrochenkov-61/+22
2020-03-14Index HIR after creating TyCtxtJohn Kåre Alsaker-7/+7
2020-03-14resolve: Fix regression in resolution of raw keywords in pathsVadim Petrochenkov-4/+1
2020-03-14Trim dependencies and features.Camille GILLOT-1/+0
2020-03-14Rollup merge of #69802 - matthiaskrgr:cl1ppy, r=Dylan-DPCYuki Okushi-10/+2
fix more clippy findings * reduce references on match patterns (clippy::match_ref_pats) * Use writeln!(fmt, "word") instead of write!(fmt, "word\n") (clippy::write_with_newline) * libtest: remove redundant argument to writeln!() (clippy::writeln_empty_string) * remove unneeded mutable references (cippy::unnecessary_mut_passed) * libtest: declare variables as floats instead of casting them (clippy::unnecessary_cast) * rustdoc: remove redundant static lifetimes (clippy::redundant_static_lifetimes) * call .as_deref() instead of .as_ref().map(Deref::deref) (clippy::option_as_ref_deref) * iterate over a maps values directly. (clippy::for_kv_map) * rustdoc: simplify boolean condition (clippy::nonminimal_bool) * Use ?-operator in more places (clippy::question_mark, had some false negatives fixed recently) * rustdoc: Use .any(p) instead of find(p).is_some(). (clippy::search_is_some) * rustdoc: don't call into_iter() on iterator. (clippy::identity_conversion)
2020-03-12ast: `Mac`/`Macro` -> `MacCall`Vadim Petrochenkov-24/+24
2020-03-12Rollup merge of #69674 - mark-i-m:assoc-fn, r=matthewjasperMazdak Farrokhzad-13/+10
Rename DefKind::Method and TraitItemKind::Method r? @eddyb, @Centril, or @matthewjasper cc #69498 #60163
2020-03-11Add the "consider importing it directly" label to public imports as wellVadim Petrochenkov-1/+1
2020-03-11resolve: Print import chains on privacy errorsVadim Petrochenkov-12/+49
2020-03-11resolve: Simplify `fn report_privacy_error`Vadim Petrochenkov-36/+31
by factoring out `fn ctor_fields_span` into a separate function
2020-03-10builtin_macros: Add attribute macro `#[cfg_accessible(path)]`Vadim Petrochenkov-0/+36
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-07call .as_deref() instead of .as_ref().map(Deref::deref) ↵Matthias Krüger-5/+1
(clippy::option_as_ref_deref)
2020-03-07Use ?-operator in more places (clippy::question_mark, had some false ↵Matthias Krüger-5/+1
negatives fixed recently)
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-03rename TraitItemKind::Method -> FnMark Mansi-6/+3
2020-03-03DefKind::Method -> DefKind::AssocFnMark Mansi-7/+7
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.