summary refs log tree commit diff
path: root/compiler/rustc_resolve/src/late
AgeCommit message (Collapse)AuthorLines
2022-02-11resolve lifetimes for const generic defaultsMichael Goulet-1/+4
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.
2021-11-07Give inline const separate DefKindGary Guo-1/+1
2021-11-06Replace some uses of vec.drain(..) with vec.into_iter()The8472-5/+5
IntoIter should optimize better than Drain
2021-11-06use filter(|x| matches!(..)) instead of filter_map(|x| match x ... => Some(xy))Matthias Krüger-20/+8
2021-10-26Adds hint if a trait fails to resolve and a newly added one in Edition 2021 ↵Jakob Degen-0/+1
is suggested
2021-10-21Revert "Auto merge of #89100 - petrochenkov:localbind, r=cjgillot"Mark Rousskov-2/+1
This reverts commit 6162529a01473bbb2427fa27354cbafc3c514eee.
2021-10-20Auto merge of #89100 - petrochenkov:localbind, r=cjgillotbors-1/+2
resolve: Use `NameBinding` for local variables and generic parameters `NameBinding` is a structure used for representing any name introduction (an item, or import, or even a built-in). Except that local variables and generic parameters weren't represented as `NameBinding`s, for this reason they requires separate paths in name resolution code in several places. This PR introduces `NameBinding`s for local variables as well and simplifies all the code working with them leaving only the `NameBinding` paths.
2021-10-19Auto merge of #89933 - est31:let_else, r=michaelwoeristerbors-3/+1
Adopt let_else across the compiler This performs a substitution of code following the pattern: ``` let <id> = if let <pat> = ... { identity } else { ... : ! }; ``` To simplify it to: ``` let <pat> = ... { identity } else { ... : ! }; ``` By adopting the `let_else` feature (cc #87335). The PR also updates the syn crate because the currently used version of the crate doesn't support `let_else` syntax yet. Note: Generally I'm the person who *removes* usages of unstable features from the compiler, not adds more usages of them, but in this instance I think it hopefully helps the feature get stabilized sooner and in a better state. I have written a [comment](https://github.com/rust-lang/rust/issues/87335#issuecomment-944846205) on the tracking issue about my experience and what I feel could be improved before stabilization of `let_else`.
2021-10-18resolve: Use `NameBinding` for local variables and generic parametersVadim Petrochenkov-1/+2
2021-10-17Some "parenthesis" and "parentheses" fixesr00ster91-1/+1
2021-10-16Update the syn crate and adopt let_else in three more placesest31-3/+1
The syn crate has gained support for let_else syntax in version 1.0.76, see https://github.com/dtolnay/syn/pull/1057 . In the three instances that use let_else, we've sent code through an attr macro, which would create compile errors when there was no let_else support in syn. To avoid this, we ran `cargo +nightly update -p syn` for updating the syn crate.
2021-10-02resolve: Avoid comparing modules by optional def-idVadim Petrochenkov-1/+1
It makes all block modules identical during comparison
2021-09-30Rollup merge of #89248 - hkmatsumoto:suggest-similarly-named-assoc-items, ↵Manish Goregaokar-2/+36
r=estebank Suggest similarly named associated items in trait impls Fix #85942 Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types, and constants.
2021-09-29Suggest similarly named assoc items in trait implsHirochika Matsumoto-2/+36
Previously, the compiler didn't suggest similarly named associated items unlike we do in many situations. This patch adds such diagnostics for associated functions, types and constants.
2021-09-28More tracing instrumentationOli Scherer-0/+3
2021-09-27suggest path for tuple structTakayuki Maeda-1/+7
2021-09-21Rollup merge of #89078 - camsteffen:map-ref, r=cjgillotthe8472-2/+1
Cleanup: Remove needless reference in ParentHirIterator It forces an intermediate binding of `Map` which is a Copy type.
2021-09-19Rollup merge of #88966 - tmiasko:block-label-shadowing, r=petrochenkovYuki Okushi-1/+5
Check for shadowing issues involving block labels
2021-09-18Remove needless hir Map refCameron Steffen-2/+1
2021-09-18Auto merge of #88650 - sapessi:issue-77175-fix, r=estebankbors-1/+22
Skip single use lifetime lint for generated opaque types Fix: #77175 The opaque type generated by the desugaring process of an async function uses the lifetimes defined by the originating function. The DefId for the lifetimes in the opaque type are different from the ones in the originating async function - as they should be, as far as I understand, and could therefore be considered a single use lifetimes, this causes the single_use_lifetimes lint to fail compilation if explicitly denied. This fix skips the lint for lifetimes used only once in generated opaque types for an async function that are declared in the parent async function definition. More info in the comments on the original issue: 1 and 2
2021-09-15Check for shadowing issues involving block labelsTomasz Miąsko-1/+5
2021-09-13Auto merge of #87915 - estebank:fancy-spans, r=oli-obkbors-11/+6
Use smaller spans for some structured suggestions Use more accurate suggestion spans for * argument parse error * fully qualified path * missing code block type * numeric casts