Skip to content

Commit

Permalink
Adjust as-precedence.rs
Browse files Browse the repository at this point in the history
- Document `as-precedence.rs`
- Move `as-precedence.rs` under `tests/ui/parser/`
  • Loading branch information
jieyouxu committed Dec 10, 2024
1 parent 4652b14 commit 56efa0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
10 changes: 0 additions & 10 deletions tests/ui/as-precedence.rs

This file was deleted.

18 changes: 18 additions & 0 deletions tests/ui/parser/as-precedence.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//! Parser precedence test to help with [RFC 87 "Trait Bounds with Plus"][rfc-87], to check the
//! precedence of the `as` operator in relation to some arithmetic bin-ops and parentheses.
//!
//! Editor's note: this test seems quite incomplete compared to what's possible nowadays. Maybe
//! there's another set of tests whose coverage overshadows this test?
//!
//! [rfc-87]: https://rust-lang.github.io/rfcs/0087-trait-bounds-with-plus.html
//@ run-pass

#[allow(unused_parens)]
fn main() {
assert_eq!(3 as usize * 3, 9);
assert_eq!(3 as (usize) * 3, 9);
assert_eq!(3 as (usize) / 3, 1);
assert_eq!(3 as usize + 3, 6);
assert_eq!(3 as (usize) + 3, 6);
}

0 comments on commit 56efa0a

Please sign in to comment.