| Age | Commit message (Collapse) | Author | Lines |
|
Don't resolve blocks in foreign functions
Although it is an error for a foreign function to have a block, it is still possible at the level of the AST. #74204 made AST lowering skip over blocks belonging to foreign functions, since they're invalid. However, resolve still treated these blocks normally, resulting in a mismatch between the HIR and resolve, which could cause an ICE under certain circumstances. This PR changes resolve to skip over blocks belonging to foreign functions, as AST lowering does.
Fixes #91370.
r? ``@cjgillot``
|
|
Also rename `module_exports`/`export_map` to `module_reexports`/`reexport_map` for clarity.
|
|
`module_children(_untracked)`
And `each_child_of_item` to `for_each_module_child`
|
|
|
|
|
|
Rename `CStore::item_attrs` -> `CStore::item_attrs_untracked` top follow conventions
|
|
|
|
This makes it more uniform with other expanded nodes
|
|
Suggest while let x = y when encountering while x = y
Extends #75931 to also detect where the `let` might be missing from `while let` expressions.
|
|
Extends #75931 to also detect where the `let` might be missing from `while let` expressions.
|
|
Visit expressions in-order when resolving pattern bindings
[edited:] Visit the pattern's sub-expressions before defining any bindings.
Otherwise, we might get into a case where a Lit/Range expression in a pattern has a qpath pointing to a Ident pattern that is defined after it, causing an ICE when lowering to HIR. I have a more detailed explanation in the issue linked.
Fixes #92100
|
|
Tighten span when suggesting lifetime on path
This is kind of a hack.
Really the issue here is that we want to suggest the segment's span if the path resolves to something defined outside of the macro, and the macro's span if it resolves to something defined within.. I'll look into seeing if we can do something like that.
Fixes #92324
r? `@cjgillot`
|
|
|
|
resolve: Minor miscellaneous cleanups from #89059
`@bors` rollup=always
|
|
|
|
Also avoid decoding the whole `ty::AssocItem` to get a `has_self` flag
|
|
|
|
Suggest adding a `#[cfg(test)]` to to a test module
closes #88138
|
|
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`
|
|
Use a separate nameless `DefPathData` variant instead
|
|
remove a empty line
import `module_to_string`
use `contains("test")`
show a suggestion in case module starts_with/ends_with "test"
replace `parent` with `containing`
|
|
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.
|
|
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```
|
|
|
|
|
|
Rollup of 7 pull requests
Successful merges:
- #90939 (Tweak errors coming from `for`-loop, `?` and `.await` desugaring)
- #91859 (Iterator::cycle() — document empty iterator special case)
- #91868 (Use `OutputFilenames` to generate output file for `-Zllvm-time-trace`)
- #91870 (Revert setting a default for the MACOSX_DEPLOYMENT_TARGET env var for linking)
- #91881 (Stabilize `iter::zip`)
- #91882 (Remove `in_band_lifetimes` from `rustc_typeck`)
- #91940 (Update cargo)
Failed merges:
r? `@ghost`
`@rustbot` modify labels: rollup
|
|
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`!
|
|
|
|
Avoid suggest adding `self` in visibility spec
Fixes #91783
|
|
|
|
Normalize symbol hashes in compiletest.
Remove DefId sorting
|
|
Co-authored-by: Esteban Kuber <estebank@users.noreply.github.com>
|
|
Do not ICE when suggesting elided lifetimes on non-existent spans.
Fixes https://github.com/rust-lang/rust/issues/91763
r? `@jackh726`
|
|
|
|
|
|
* 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
|
|
Keep the spans for generics coming from a `derive`d Item, so that errors
and suggestions have better detail.
Fix #84003.
|
|
Bump stage0 compiler
r? `@pietroalbini` (or anyone else)
|
|
Issue 90702 fix: Stop treating some crate loading failures as fatal errors
Surface mulitple `extern crate` resolution errors at a time.
This is achieved by creating a dummy crate, instead of aborting directly after the resolution error. The `ExternCrateError` has been added to allow propagating the resolution error from `rustc_metadata` crate to the `rustc_resolve` with a minimal public surface. The `import_extern_crate` function is a block that was factored out from `build_reduced_graph_for_item` for better organization. The only added functionality made to it where the added error handling in the `process_extern_crate` call. The remaining bits in this function are the same as before.
Resolves #90702
r? `@petrochenkov`
|
|
Lint elided lifetimes in path during lifetime resolution.
The lifetime elision lint is known to be brittle and can be redundant with later lifetime resolution errors. This PR aims to remove the redundancy by performing the lint after lifetime resolution.
This PR proposes to carry the information that an elision should be linted against by using a special `LifetimeName`. I am not certain this is the best solution, but it is certainly the easiest.
Fixes https://github.com/rust-lang/rust/issues/60199
Fixes https://github.com/rust-lang/rust/issues/55768
Fixes https://github.com/rust-lang/rust/issues/63110
Fixes https://github.com/rust-lang/rust/issues/71957
|
|
|
|
|
|
|
|
expand: Turn `ast::Crate` into a first class expansion target
And stop creating a fake `mod` item for the crate root when expanding a crate, thus addressing FIXMEs left in https://github.com/rust-lang/rust/pull/82238, and making a step towards a proper support for crate-level macro attributes (cc #54726).
I haven't added token collection support for the whole crate in this PR, maybe later.
r? `@Aaron1011`
|
|
Fix bad `NodeId` limit checking.
`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!
This commit removes the conversion to/from `usize`.
|
|
Improve error message for `E0659` if the source is not available
Fixes #91028. The fix is similar to those in #89233 and #87088. With this change, instead of the dangling
```
note: `Option` could also refer to the enum defined here
```
I get
```
note: `Option` could also refer to an enum from prelude
```
If the standard library source code _is_ available, the output does not change.
|
|
`Resolver::next_node_id` converts a `u32` to a `usize` (which is
possibly bigger), does a checked add, and then converts the result back
to a `u32`. The `usize` conversion completely subverts the checked add!
This commit removes the conversion to/from `usize`.
|
|
|
|
|
|
|