diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2022-07-06 09:15:56 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-06 09:15:56 +0000 |
commit | e0844def89deb7953b6eee563833b0e8e8e2668d (patch) | |
tree | 7b5e1dc63abdd67e9e9a1ccf8e76ddeb5e10ab64 /gcc/rust/rust-buffered-queue.h | |
parent | 408b7f87b99c1b9d074787ac279c86319ab00667 (diff) | |
parent | f4a5629fb7f6274433005c255bc9baf113856a5d (diff) | |
download | gcc-e0844def89deb7953b6eee563833b0e8e8e2668d.zip gcc-e0844def89deb7953b6eee563833b0e8e8e2668d.tar.gz gcc-e0844def89deb7953b6eee563833b0e8e8e2668d.tar.bz2 |
Merge #1346
1346: Support self paths r=philberty a=philberty
This adds support for the self path which is used in two different
contexts. One where it refers to the self parameter within methods
the other is where it can refer to the crate module scope.
Handling self has some limitations where it must be the first
the segment in the path or be a single segment path for example see:
```
struct foo;
fn test() {
crate::self::foo;
}
```
Errors with (rustc 1.61):
```
Error[E0433]: failed to resolve: `self` in paths can only be used in start position
```
crate and super keywords can be chained as expected but self seems to be a special case.
The patch here reorders the algorithm to look at the name/type scope first if its the first segment
and handle the lower case self as a special case. If this fails to result in a resolved node we
then try to look at the module_scope_id hierarchy to handle the case that the previous segments
were crate or super and finally error out at the end if we failed to resolve the segment. We can
only error for the first segment as associated paths such as Foo::Bar with Bar being an associated
impl block item requiring type-resolution.
Fixes #1231 #1227
Co-authored-by: Philip Herron <philip.herron@embecosm.com>
Diffstat (limited to 'gcc/rust/rust-buffered-queue.h')
0 files changed, 0 insertions, 0 deletions