Skip to content

Commit

Permalink
Rollup merge of #106793 - Mark-Simulacrum:normalize-test, r=compiler-…
Browse files Browse the repository at this point in the history
…errors

Normalize test output more thoroughly

This prevents differences in local environments, which may (for example) end up with a longer backtrace with more digits in the backtrace prefix, as happened to me. While we're at it, clean more of the output up, including the exact location of the error in the compiler.

cc #106521 which introduced this test
  • Loading branch information
matthiaskrgr authored Jan 13, 2023
2 parents 720137b + 95ef76b commit e0f6840
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 28 deletions.
17 changes: 13 additions & 4 deletions tests/ui/chalkify/bugs/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@
// known-bug
// unset-rustc-env:RUST_BACKTRACE
// compile-flags:-Z trait-solver=chalk --edition=2021
// error-pattern:stack backtrace:
// error-pattern:internal compiler error
// failure-status:101
// normalize-stderr-test "note: .*" -> ""
// normalize-stderr-test "thread 'rustc' .*" -> ""
// normalize-stderr-test " .*\n" -> ""
// normalize-stderr-test "DefId([^)]*)" -> "..."
// normalize-stderr-test "\nerror: internal compiler error.*\n\n" -> ""
// normalize-stderr-test "note:.*unexpectedly panicked.*\n\n" -> ""
// normalize-stderr-test "note: we would appreciate a bug report.*\n\n" -> ""
// normalize-stderr-test "note: compiler flags.*\n\n" -> ""
// normalize-stderr-test "note: rustc.*running on.*\n\n" -> ""
// normalize-stderr-test "thread.*panicked.*\n" -> ""
// normalize-stderr-test "stack backtrace:\n" -> ""
// normalize-stderr-test "\s\d{1,}: .*\n" -> ""
// normalize-stderr-test "\s at .*\n" -> ""
// normalize-stderr-test ".*note: Some details.*\n" -> ""
// normalize-stderr-test "\n\n[ ]*\n" -> ""
// normalize-stderr-test "compiler/.*: projection" -> "projection"

fn main() -> () {}

Expand Down
66 changes: 42 additions & 24 deletions tests/ui/chalkify/bugs/async.stderr
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
error[E0277]: `[async fn body@$DIR/async.rs:14:29: 16:2]` is not a future
LL |LL | |LL | | }


error[E0277]: the size for values of type `<[async fn body@$DIR/async.rs:14:29: 16:2] as Future>::Output` cannot be known at compilation time
LL |LL | |LL | | }


error[E0277]: `[async fn body@$DIR/async.rs:14:29: 16:2]` is not a future
error[E0277]: `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future
--> $DIR/async.rs:23:29
|
LL | async fn foo(x: u32) -> u32 {
| _____________________________-
LL | | x
LL | | }
| | ^
| | |
| |_`[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future
| required by a bound introduced by this call
|
= help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]`
= note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited
note: required by a bound in `identity_future`
--> $SRC_DIR/core/src/future/mod.rs:LL:COL

error[E0277]: the size for values of type `<[async fn body@$DIR/async.rs:23:29: 25:2] as Future>::Output` cannot be known at compilation time
--> $DIR/async.rs:23:29
|
LL | async fn foo(x: u32) -> u32 {
| _____________________________^
LL | | x
LL | | }
| |_^ doesn't have a size known at compile-time
|
= help: the trait `Sized` is not implemented for `<[async fn body@$DIR/async.rs:23:29: 25:2] as Future>::Output`
note: required by a bound in `identity_future`
--> $SRC_DIR/core/src/future/mod.rs:LL:COL

error[E0277]: `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future
--> $DIR/async.rs:23:25
|
LL | async fn foo(x: u32) -> u32 {

error: internal compiler error: compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs:1114:25: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:14:29: 16:2]], def_id: ...), _use_mk_alias_ty_instead: () }, Term::Ty(u32)), []), depth=0)`
| ^^^ `[async fn body@$DIR/async.rs:23:29: 25:2]` is not a future
|
= help: the trait `Future` is not implemented for `[async fn body@$DIR/async.rs:23:29: 25:2]`
= note: [async fn body@$DIR/async.rs:23:29: 25:2] must be a future or must implement `IntoFuture` to be awaited

error: internal compiler error: projection clauses should be implied from elsewhere. obligation: `Obligation(predicate=Binder(ProjectionPredicate(AliasTy { substs: [[async fn body@$DIR/async.rs:23:29: 25:2]], def_id: ...), _use_mk_alias_ty_instead: () }, Term::Ty(u32)), []), depth=0)`
--> $DIR/async.rs:23:25
|
LL | async fn foo(x: u32) -> u32 {


stack backtrace:









query stack during panic:
| ^^^query stack during panic:
#0 [typeck] type-checking `foo`
#1 [thir_body] building THIR for `foo`
#2 [mir_built] building MIR for `foo`
Expand Down

0 comments on commit e0f6840

Please sign in to comment.