summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2022-02-18Rollup merge of #93634 - matthiaskrgr:clippy_complexity_jan_2022, r=oli-obkMatthias Krüger-1/+1
compiler: clippy::complexity fixes useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-18Auto merge of #94088 - oli-obk:revert, r=jackh726bors-26/+8
Revert #91403 fixes #94004 r? `@pnkfelix` `@cjgillot`
2022-02-17Rollup merge of #94011 - est31:let_else, r=lcnrMatthias Krüger-8/+4
Even more let_else adoptions Continuation of #89933, #91018, #91481, #93046, #93590.
2022-02-17Revert "Auto merge of #91403 - cjgillot:inherit-async, r=oli-obk"Oli Scherer-26/+8
This reverts commit 3cfa4def7c87d571bd46d92fed608edf8fad236e, reversing changes made to 5d8767cb229b097fedb1dd4bd9420d463c37774f.
2022-02-16Adopt let_else in even more placesest31-8/+4
2022-02-14Auto merge of #93938 - BoxyUwU:fix_res_self_ty, r=lcnrbors-2/+2
Make `Res::SelfTy` a struct variant and update docs I found pattern matching on a `(Option<DefId>, Option<(DefId, bool)>)` to not be super readable, additionally the doc comments on the types in a tuple variant aren't visible anywhere at use sites as far as I can tell (using rust analyzer + vscode) The docs incorrectly assumed that the `DefId` in `Option<(DefId, bool)>` would only ever be for an impl item and I also found the code examples to be somewhat unclear about which `DefId` was being talked about. r? `@lcnr` since you reviewed the last PR changing these docs
2022-02-12change to a struct variantEllen-2/+2
2022-02-12Inherit lifetimes for async fn instead of duplicating them.Camille GILLOT-8/+26
2022-02-11Rollup merge of #93853 - steffahn:map_by_value, r=wesleywiserMatthias Krüger-18/+15
Make all `hir::Map` methods consistently by-value `hir::Map` only consists of a single reference (as part of the contained `TyCtxt`) anyways, so copying is literally zero overhead compared to passing a reference
2022-02-10Remove further usage of `&hir::Map`Frank Steffahn-18/+15
2022-02-09Use a slice for object_lifetime_defaults.Camille GILLOT-78/+71
2022-02-09Ensure that queries only return Copy types.Camille GILLOT-1/+7
2022-02-05resolve lifetimes for const generic defaultsMichael Goulet-1/+4
2022-02-03compiler: clippy::complexity fixesMatthias Krüger-1/+1
useless_format map_flatten useless_conversion needless_bool filter_next clone_on_copy needless_option_as_deref
2022-02-02Detect `::` -> `:` typo in type argumentEsteban Kuber-0/+37
When writing `Vec<A:B>`, suggest `Vec<A::B>`.
2022-01-27Store def_id_to_hir_id as variant in hir_owner.Camille GILLOT-9/+1
If hir_owner is Owner(_), the LocalDefId is pointing to an owner, so the ItemLocalId is 0. If the HIR node does not exist, we store Phantom. Otherwise, we store the HirId associated to the LocalDefId.
2022-01-21Rollup merge of #93046 - est31:let_else, r=davidtwcoMatthias Krüger-41/+38
Use let_else in even more places Followup of #89933, #91018, #91481.
2022-01-19Only suggest adding `!` to expressions that can be macro invocationEsteban Kuber-1/+10
2022-01-18Use let_else in even more placesest31-41/+38
2022-01-16Replace NestedVisitorMap with NestedFilterCameron Steffen-40/+5
2022-01-15Reduce use of local_def_id_to_hir_id.Camille GILLOT-44/+36
2022-01-15Return a LocalDefId in get_parent_item.Camille GILLOT-5/+5
2021-12-27Tighten span when suggesting lifetime on pathMichael Goulet-3/+6
2021-12-19Auto merge of #91957 - nnethercote:rm-SymbolStr, r=oli-obkbors-8/+8
Remove `SymbolStr` This was originally proposed in https://github.com/rust-lang/rust/pull/74554#discussion_r466203544. As well as removing the icky `SymbolStr` type, it allows the removal of a lot of `&` and `*` occurrences. Best reviewed one commit at a time. r? `@oli-obk`
2021-12-16Auto merge of #89836 - pierwill:fix-85142-crate-hash, r=wesleywiserbors-4/+1
Include rustc version in `rustc_span::StableCrateId` `rustc_span::def_id::StableCrateId` is a hash of various data about a crate during compilation. This PR includes the version of `rustc` in the input when computing this hash. From a cursory reading of [RFC 2603](https://rust-lang.github.io/rfcs/2603-rust-symbol-name-mangling-v0.html), this appears to be acceptable within that design. In order to pass the `mir-opt` and `ui` test suites, this adds new [normalization for hashes and symbol names in `compiletest`](https://github.com/rust-lang/rust/pull/89836/files#diff-03a0567fa80ca04ed5a55f9ac5c711b4f84659be2d0ac4a984196d581c04f76b). These are enabled by default, but we might prefer it to be configurable. In the UI tests, I had to truncate a significant amount of error annotations in v0 symbols (and maybe some legacy) in order to get the normalization to work correctly. (See https://github.com/rust-lang/rust/issues/90116.) Closes #85142.
2021-12-15Rollup merge of #91888 - BoxyUwU:generic_arg_infer_aaaa, r=lcnrMatthias Krüger-5/+4
Handle unordered const/ty generics for object lifetime defaults *feel like I should have a PR description but cant think of what to put here* r? ```@lcnr```
2021-12-15Remove unnecessary sigils around `Ident::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Remove unnecessary sigils around `Symbol::as_str()` calls.Nicholas Nethercote-2/+2
2021-12-15Remove `SymbolStr`.Nicholas Nethercote-5/+5
By changing `as_str()` to take `&self` instead of `self`, we can just return `&str`. We're still lying about lifetimes, but it's a smaller lie than before, where `SymbolStr` contained a (fake) `&'static str`!
2021-12-14Rollup merge of #91798 - bugadani:issue-91783, r=michaelwoeristerMatthias Krüger-1/+6
Avoid suggest adding `self` in visibility spec Fixes #91783
2021-12-14awdawdawdEllen-5/+4
2021-12-13Include rustc version in `rustc_span::StableCrateId`pierwill-4/+1
Normalize symbol hashes in compiletest. Remove DefId sorting
2021-12-12Avoid suggesting self in visibility specDániel Buga-1/+6
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
2021-12-11Rollup merge of #91764 - cjgillot:elide-anyway, r=jackh726Matthias Krüger-0/+5
Do not ICE when suggesting elided lifetimes on non-existent spans. Fixes https://github.com/rust-lang/rust/issues/91763 r? `@jackh726`
2021-12-11Do not ICE when suggesting elided lifetimes on non-existent spans.Camille GILLOT-0/+5
2021-12-07Store impl_trait_fn inside OpaqueTyOrigin.Camille GILLOT-4/+11
2021-12-03Annotate `derive`d spans and move span suggestion codeEsteban Kuber-2/+2
* Annotate `derive`d spans from the user's code with the appropciate context * Add `Span::can_be_used_for_suggestion` to query if the underlying span at the users' code
2021-12-03Keep spans for generics in `#[derive(_)]` desugaringEsteban Kuber-11/+5
Keep the spans for generics coming from a `derive`d Item, so that errors and suggestions have better detail. Fix #84003.
2021-11-30Merge Implicit and ImplicitMissing.Camille GILLOT-7/+4
2021-11-30Handle `allow(elided_lifetimes_in_paths)`.Camille GILLOT-31/+28
2021-11-30Lint elided lifetimes in path during lifetime resolution.Camille GILLOT-9/+57
2021-11-30Flatten match.Camille GILLOT-37/+41
2021-11-30Move report_elision_failure in diagnostics.rs.Camille GILLOT-82/+83
2021-11-28Take a LocalDefId in expect_*item.Camille GILLOT-6/+6
2021-11-18rustc: Remove `#[rustc_synthetic]`Vadim Petrochenkov-12/+8
This function parameter attribute was introduced in https://github.com/rust-lang/rust/pull/44866 as an intermediate step in implementing `impl Trait`, it's not necessary or used anywhere by itself.
2021-11-09Rollup merge of #89561 - nbdd0121:const_typeck, r=nikomatsakisMatthias Krüger-1/+1
Type inference for inline consts Fixes #78132 Fixes #78174 Fixes #81857 Fixes #89964 Perform type checking/inference of inline consts in the same context as the outer def, similar to what is currently done to closure. Doing so would require `closure_base_def_id` of the inline const to return the outer def, and since `closure_base_def_id` can be called on non-local crate (and thus have no HIR available), a new `DefKind` is created for inline consts. The type of the generated anon const can capture lifetime of outer def, so we couldn't just use the typeck result as the type of the inline const's def. Closure has a similar issue, and it uses extra type params `CK, CS, U` to capture closure kind, input/output signature and upvars. I use a similar approach for inline consts, letting it have an extra type param `R`, and then `typeof(InlineConst<[paremt generics], R>)` would just be `R`. In borrowck region requirements are also propagated to the outer MIR body just like it's currently done for closure. With this PR, inline consts in expression position are quitely usable now; however the usage in pattern position is still incomplete -- since those does not remain in the MIR borrowck couldn't verify the lifetime there. I have left an ignored test as a FIXME. Some disucssions can be found on [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/260443-project-const-generics/topic/inline.20consts.20typeck). cc `````@spastorino````` `````@lcnr````` r? `````@nikomatsakis````` `````@rustbot````` label A-inference F-inline_const T-compiler
2021-11-08Rollup merge of #90652 - matthiaskrgr:unnnec_filter_map, r=jyn514Guillaume Gomez-20/+8
use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))
2021-11-07Auto merge of #90668 - matthiaskrgr:clippy_nov7, r=jyn514bors-15/+11
more clippy fixes
2021-11-07more clippy fixesMatthias Krüger-15/+11
2021-11-07ast: Fix naming conventions in AST structuresVadim Petrochenkov-3/+1
TraitKind -> Trait TyAliasKind -> TyAlias ImplKind -> Impl FnKind -> Fn All `*Kind`s in AST are supposed to be enums. Tuple structs are converted to braced structs for the types above, and fields are reordered in syntactic order. Also, mutable AST visitor now correctly visit spans in defaultness, unsafety, impl polarity and constness.