Skip to content

Commit 388c3f2

Browse files
authored
Auto merge of #36661 - jneem:master, r=nrc
Change error message for intrinsic signature. Makes it so the signature of the intrinsic in the user's code is "found," while the signature that rustc knows about is "expected." Before this patch, the code ``` extern "platform-intrinsic" { fn x86_mm_movemask_ps() -> i32; } ``` would give the error ``` error[E0444]: platform-specific intrinsic has invalid number of arguments: found 1, expected 0 --> test.rs:4:5 | 4 | fn x86_mm_movemask_ps() -> i32; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: aborting due to previous error ``` After this patch, it says "found 0, expected 1".
2 parents 8ccfc69 + 159aa0b commit 388c3f2

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/librustc_typeck/check/intrinsic.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ pub fn check_platform_intrinsic_type(ccx: &CrateCtxt,
379379
span_err!(tcx.sess, it.span, E0444,
380380
"platform-specific intrinsic has invalid number of \
381381
arguments: found {}, expected {}",
382-
intr.inputs.len(), sig.inputs.len());
382+
sig.inputs.len(), intr.inputs.len());
383383
return
384384
}
385385
let input_pairs = intr.inputs.iter().zip(&sig.inputs);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(platform_intrinsics)]
12+
extern "platform-intrinsic" {
13+
fn x86_mm_movemask_ps() -> i32; //~ERROR found 0, expected 1
14+
}
15+
16+
fn main() { }

0 commit comments

Comments
 (0)