-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 #111929 - compiler-errors:no-newline-apit, r=wesleywiser
Don't print newlines in APITs This is kind of a hack, but it gets the job done because the only "special" formatting that (afaict) `rustc_ast_pretty` does is break with newlines sometimes. Fixes rust-lang/measureme#207
- Loading branch information
Showing
3 changed files
with
54 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
struct Header; | ||
struct EntryMetadata; | ||
struct Entry<A, B>(A, B); | ||
|
||
trait Tr { | ||
type EncodedKey; | ||
type EncodedValue; | ||
} | ||
|
||
fn test<C: Tr, R>( | ||
// This APIT is long, however we shouldn't render the type name with a newline in it. | ||
y: impl FnOnce( | ||
&mut Header, | ||
&mut [EntryMetadata], | ||
&mut [Entry<C::EncodedKey, C::EncodedValue>] | ||
) -> R, | ||
) { | ||
let () = y; | ||
//~^ ERROR mismatched types | ||
} | ||
|
||
fn main() {} |
22 changes: 22 additions & 0 deletions
22
tests/ui/impl-trait/arg-position-impl-trait-too-long.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,22 @@ | ||
error[E0308]: mismatched types | ||
--> $DIR/arg-position-impl-trait-too-long.rs:18:9 | ||
| | ||
LL | y: impl FnOnce( | ||
| ________- | ||
LL | | &mut Header, | ||
LL | | &mut [EntryMetadata], | ||
LL | | &mut [Entry<C::EncodedKey, C::EncodedValue>] | ||
LL | | ) -> R, | ||
| |__________- this type parameter | ||
LL | ) { | ||
LL | let () = y; | ||
| ^^ - this expression has type `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R` | ||
| | | ||
| expected type parameter `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R`, found `()` | ||
| | ||
= note: expected type parameter `impl FnOnce(&mut Header, &mut [EntryMetadata], &mut [Entry<C::EncodedKey, C::EncodedValue>]) -> R` | ||
found unit type `()` | ||
|
||
error: aborting due to previous error | ||
|
||
For more information about this error, try `rustc --explain E0308`. |