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.
Auto merge of rust-lang#123202 - estebank:issue-123009, r=compiler-er…
…rors Do not attempt to write `ty::Err` on binding that isn't from current HIR Owner Fix rust-lang#123009. Follow up to rust-lang#122119.
- Loading branch information
Showing
3 changed files
with
46 additions
and
10 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
7 changes: 7 additions & 0 deletions
7
tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs
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,7 @@ | ||
fn main() { | ||
let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ||
//~^ ERROR expected a pattern, found an expression | ||
//~| ERROR cannot find type `T` in this scope | ||
//~| ERROR type and const arguments are not allowed on builtin type `str` | ||
//~| ERROR expected unit struct, unit variant or constant, found associated function `str<, T>::as_bytes` | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/ui/sized/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.stderr
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,36 @@ | ||
error: expected a pattern, found an expression | ||
--> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:31 | ||
| | ||
LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ||
| ^^^^^^^^^^^^^^^^^^ arbitrary expressions are not allowed in patterns | ||
|
||
error[E0412]: cannot find type `T` in this scope | ||
--> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:55 | ||
| | ||
LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ||
| ^ not found in this scope | ||
|
||
error[E0109]: type and const arguments are not allowed on builtin type `str` | ||
--> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:15 | ||
| | ||
LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ||
| --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^ type and const arguments not allowed | ||
| | | ||
| not allowed on builtin type `str` | ||
| | ||
help: primitive type `str` doesn't have generic parameters | ||
| | ||
LL - let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ||
LL + let str::as_bytes; | ||
| | ||
|
||
error[E0533]: expected unit struct, unit variant or constant, found associated function `str<, T>::as_bytes` | ||
--> $DIR/ensure-overriding-bindings-in-pattern-with-ty-err-doesnt-ice.rs:2:9 | ||
| | ||
LL | let str::<{fn str() { let str::T>>::as_bytes; }}, T>::as_bytes; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ not a unit struct, unit variant or constant | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
Some errors have detailed explanations: E0109, E0412, E0533. | ||
For more information about an error, try `rustc --explain E0109`. |