1. 19 7月, 2017 3 次提交
    • B
      Auto merge of #43168 - pnkfelix:check-attr-gating, r=aturon · 88e2c396
      bors 提交于
      Slew of builtin-attribute gating tests
      
      Slew of builtin-attribute "gating" tests for issue #43106.
      
      Some stray observations:
      
       * I don't know if its a good thing that so many attributes allow inputs which are silently discarded. (I  made heavy use of that in writing my tests, but that was more out of curiosity than necessity.)
       * The difference between crate-level and non-crate-level behavior is quite significant in some cases. Definitely worth making sure one has tests for both cases. (Not as clear whether it was worthwhile trying the various other AST forms like `fn f()` vs `struct S;`)
       * `#[no_builtins]` and `#[no_mangle]` occur twice on the `BUILTIN_ATTRIBUTES` list. Thats almost certainly a bug. (Filed as #43148)
       * We are maximally liberal in what we allow for `#[test]` and `#[bench]` when one compiles without `--test`.
       * We allow `#[no_mangle]` on arbitrary AST nodes, but only warn about potential misuse on `fn`
       * We allow `#[cold]`, `#[must_use]`, `#[windows_subsystem]`, and `#[no_builtins]` on arbitrary AST nodes. I don't know off-hand what the semantics are for e.g. a `#[cold] type T = ...;`
       * We allow crate-level `#![inline]`. That's probably a bug since its otherwise restricted to `fn` items
      88e2c396
    • B
      Auto merge of #40989 - matklad:comma-arms, r=petrochenkov · 83c36219
      bors 提交于
      Unify rules about commas in match arms and semicolons in expressions
      
      Original discussion: https://internals.rust-lang.org/t/syntax-of-block-like-expressions-in-match-arms/5025/7.
      
      Currently, rust uses different rules to determine if `,` is needed after an expression in a match arm and if `;` is needed in an expression statement:
      
      ```Rust
      fn stmt() {
          # no need for semicolons
          { () }
          if true { () } else { () }
          loop {}
          while true {}
      }
      
      fn match_arm(n: i32) {
          match n {
              1 => { () } # can omit comma here
              2 => if true { () } else { () }, # but all other cases do need commas.
              3 => loop { },
              4 => while true {},
              _ => ()
          }
      }
      ```
      
      This seems weird: why would you want to require `,` after and `if`?
      
      This PR unifies the rules. It is backwards compatible because it allows strictly more programs.
      83c36219
    • B
      Auto merge of #43316 - Mark-Simulacrum:rollup, r=Mark-Simulacrum · af049cd0
      bors 提交于
      Rollup of 11 pull requests
      
      - Successful merges: #42837, #43282, #43287, #43290, #43292, #43294, #43304, #43310, #43312, #43314, #43315
      - Failed merges:
      af049cd0
  2. 18 7月, 2017 32 次提交
  3. 17 7月, 2017 5 次提交