forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#132207 - compiler-errors:tweak-res-mod-segm…
…ent, r=petrochenkov Store resolution for self and crate root module segments Let's make sure to record the segment resolution for `self::`, `crate::` and `$crate::`. I'm actually somewhat surprised that the only diagnostic that uses this is the one that errors on invalid generics on a module segment... but seems strictly more correct regardless, and there may be other diagnostics using these segments resolutions that just haven't been tested for `self`. Also includes a drive-by on `report_prohibit_generics_error`.
- Loading branch information
Showing
4 changed files
with
62 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
struct Ty; | ||
|
||
fn self_(_: self::<i32>::Ty) {} | ||
//~^ ERROR type arguments are not allowed on module `generics_on_self_mod_segment` | ||
|
||
fn crate_(_: crate::<i32>::Ty) {} | ||
//~^ ERROR type arguments are not allowed on module `generics_on_self_mod_segment` | ||
|
||
macro_rules! dollar_crate { | ||
() => { | ||
fn dollar_crate_(_: $crate::<i32>::Ty) {} | ||
//~^ ERROR type arguments are not allowed on module `generics_on_self_mod_segment` | ||
} | ||
} | ||
|
||
dollar_crate!(); | ||
|
||
fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
error[E0109]: type arguments are not allowed on module `generics_on_self_mod_segment` | ||
--> $DIR/generics-on-self-mod-segment.rs:3:20 | ||
| | ||
LL | fn self_(_: self::<i32>::Ty) {} | ||
| ---- ^^^ type argument not allowed | ||
| | | ||
| not allowed on module `generics_on_self_mod_segment` | ||
|
||
error[E0109]: type arguments are not allowed on module `generics_on_self_mod_segment` | ||
--> $DIR/generics-on-self-mod-segment.rs:6:22 | ||
| | ||
LL | fn crate_(_: crate::<i32>::Ty) {} | ||
| ----- ^^^ type argument not allowed | ||
| | | ||
| not allowed on module `generics_on_self_mod_segment` | ||
|
||
error[E0109]: type arguments are not allowed on module `generics_on_self_mod_segment` | ||
--> $DIR/generics-on-self-mod-segment.rs:11:38 | ||
| | ||
LL | fn dollar_crate_(_: $crate::<i32>::Ty) {} | ||
| ------ ^^^ type argument not allowed | ||
| | | ||
| not allowed on module `generics_on_self_mod_segment` | ||
... | ||
LL | dollar_crate!(); | ||
| --------------- in this macro invocation | ||
| | ||
= note: this error originates in the macro `dollar_crate` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 3 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0109`. |