Skip to content

Commit

Permalink
Add two new test cases
Browse files Browse the repository at this point in the history
gcc/testsuite/ChangeLog:

	* rust/compile/negative_impls.rs: New test.
	* rust/compile/negative_impls_2.rs: New test.
  • Loading branch information
badumbatish committed May 17, 2024
1 parent 5f1c733 commit a7940b2
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions gcc/testsuite/rust/compile/negative_impls.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// { dg-output "" }

#![feature(negative_impls)]

trait ExampleTrait {}

impl !ExampleTrait for i32 {}


fn main() {}
19 changes: 19 additions & 0 deletions gcc/testsuite/rust/compile/negative_impls_2.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// This test case should error out since we haven't included the negative_impls feature
// Output from online rust compiler 2021 ver
// Compiling playground v0.0.1 (/playground)
// error[E0658]: negative trait bounds are not yet fully implemented; use marker types for now
// --> src/main.rs:8:6
// |
// 8 | impl !ExampleTrait for i32 {}//
// | ^^^^^^^^^^^^^
// |
// = note: see issue #68318 <https://github.com/rust-lang/rust/issues/68318> for more information

// For more information about this error, try `rustc --explain E0658`.
// error: could not compile `playground` (bin "playground") due to 1 previous error
trait ExampleTrait {}

impl !ExampleTrait for i32 {} // { dg-error "negative_impls are not yet implemented" }


fn main() {}

0 comments on commit a7940b2

Please sign in to comment.