-
Notifications
You must be signed in to change notification settings - Fork 12.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure we deny unimplemented RTN on qpath segments
- Loading branch information
1 parent
e356a87
commit fabc8f6
Showing
5 changed files
with
112 additions
and
3 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
26 changes: 26 additions & 0 deletions
26
tests/ui/associated-type-bounds/return-type-notation/bare-path.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,26 @@ | ||
#![feature(return_type_notation)] | ||
//~^ WARN the feature `return_type_notation` is incomplete | ||
|
||
trait Tr { | ||
const CONST: usize; | ||
|
||
fn method() -> impl Sized; | ||
} | ||
|
||
fn foo<T: Tr>() | ||
where | ||
T::method(..): Send, | ||
//~^ ERROR return type notation not allowed in this position yet | ||
//~| ERROR expected type, found function | ||
<T as Tr>::method(..): Send, | ||
//~^ ERROR return type notation not allowed in this position yet | ||
//~| ERROR expected associated type, found associated function `Tr::method` | ||
{ | ||
let _ = T::CONST::(..); | ||
//~^ ERROR return type notation not allowed in this position yet | ||
let _: T::method(..); | ||
//~^ ERROR return type notation not allowed in this position yet | ||
//~| ERROR expected type, found function | ||
} | ||
|
||
fn main() {} |
66 changes: 66 additions & 0 deletions
66
tests/ui/associated-type-bounds/return-type-notation/bare-path.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,66 @@ | ||
error[E0575]: expected associated type, found associated function `Tr::method` | ||
--> $DIR/bare-path.rs:15:5 | ||
| | ||
LL | <T as Tr>::method(..): Send, | ||
| ^^^^^^^^^^^^^^^^^^^^^ not a associated type | ||
|
||
warning: the feature `return_type_notation` is incomplete and may not be safe to use and/or cause compiler crashes | ||
--> $DIR/bare-path.rs:1:12 | ||
| | ||
LL | #![feature(return_type_notation)] | ||
| ^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: see issue #109417 <https://github.com/rust-lang/rust/issues/109417> for more information | ||
= note: `#[warn(incomplete_features)]` on by default | ||
|
||
error: return type notation not allowed in this position yet | ||
--> $DIR/bare-path.rs:19:23 | ||
| | ||
LL | let _ = T::CONST::(..); | ||
| ^^^^ | ||
|
||
error: return type notation not allowed in this position yet | ||
--> $DIR/bare-path.rs:21:21 | ||
| | ||
LL | let _: T::method(..); | ||
| ^^^^ | ||
|
||
error: return type notation not allowed in this position yet | ||
--> $DIR/bare-path.rs:12:14 | ||
| | ||
LL | T::method(..): Send, | ||
| ^^^^ | ||
|
||
error: return type notation not allowed in this position yet | ||
--> $DIR/bare-path.rs:15:22 | ||
| | ||
LL | <T as Tr>::method(..): Send, | ||
| ^^^^ | ||
|
||
error: expected type, found function | ||
--> $DIR/bare-path.rs:12:8 | ||
| | ||
LL | T::method(..): Send, | ||
| ^^^^^^ unexpected function | ||
| | ||
note: the associated function is defined here | ||
--> $DIR/bare-path.rs:7:5 | ||
| | ||
LL | fn method() -> impl Sized; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: expected type, found function | ||
--> $DIR/bare-path.rs:21:15 | ||
| | ||
LL | let _: T::method(..); | ||
| ^^^^^^ unexpected function | ||
| | ||
note: the associated function is defined here | ||
--> $DIR/bare-path.rs:7:5 | ||
| | ||
LL | fn method() -> impl Sized; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
||
error: aborting due to 7 previous errors; 1 warning emitted | ||
|
||
For more information about this error, try `rustc --explain E0575`. |