Skip to content

Commit 6c7dbab

Browse files
committed
---
yaml --- r: 224126 b: refs/heads/beta c: d6a6178 h: refs/heads/master v: v3
1 parent d66eb15 commit 6c7dbab

File tree

6 files changed

+20
-23
lines changed

6 files changed

+20
-23
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ refs/tags/0.9: 36870b185fc5f5486636d4515f0e22677493f225
2323
refs/tags/0.10: ac33f2b15782272ae348dbd7b14b8257b2148b5a
2424
refs/tags/0.11.0: e1247cb1d0d681be034adb4b558b5a0c0d5720f9
2525
refs/tags/0.12.0: f0c419429ef30723ceaf6b42f9b5a2aeb5d2e2d1
26-
refs/heads/beta: b2213498c4654d60af7e40ff8f59b14a9a3a18a9
26+
refs/heads/beta: d6a617863761a4023b437bd70288abc77ac20554
2727
refs/tags/1.0.0-alpha: e42bd6d93a1d3433c486200587f8f9e12590a4d7
2828
refs/heads/tmp: 938f5d7af401e2d8238522fed4a612943b6e77fd
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f

branches/beta/src/libcore/str/mod.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -871,12 +871,12 @@ impl<'a> DoubleEndedIterator for LinesAny<'a> {
871871
Section: Comparing strings
872872
*/
873873

874-
// share the implementation of the lang-item vs. non-lang-item
875-
// eq_slice.
874+
/// Bytewise slice equality
876875
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
877876
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
877+
#[lang = "str_eq"]
878878
#[inline]
879-
fn eq_slice_(a: &str, b: &str) -> bool {
879+
fn eq_slice(a: &str, b: &str) -> bool {
880880
// NOTE: In theory n should be libc::size_t and not usize, but libc is not available here
881881
#[allow(improper_ctypes)]
882882
extern { fn memcmp(s1: *const i8, s2: *const i8, n: usize) -> i32; }
@@ -887,15 +887,6 @@ fn eq_slice_(a: &str, b: &str) -> bool {
887887
}
888888
}
889889

890-
/// Bytewise slice equality
891-
/// NOTE: This function is (ab)used in rustc::middle::trans::_match
892-
/// to compare &[u8] byte slices that are not necessarily valid UTF-8.
893-
#[lang = "str_eq"]
894-
#[inline]
895-
fn eq_slice(a: &str, b: &str) -> bool {
896-
eq_slice_(a, b)
897-
}
898-
899890
/*
900891
Section: Misc
901892
*/

branches/beta/src/librustc_trans/save/dump_csv.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
478478

479479
let ctor_id = match def.ctor_id {
480480
Some(node_id) => node_id,
481-
None => -1,
481+
None => ast::DUMMY_NODE_ID,
482482
};
483483
let val = self.span.snippet(item.span);
484484
let sub_span = self.span.sub_span_after_keyword(item.span, keywords::Struct);
@@ -536,7 +536,7 @@ impl <'l, 'tcx> DumpCsvVisitor<'l, 'tcx> {
536536
ast::StructVariantKind(ref struct_def) => {
537537
let ctor_id = match struct_def.ctor_id {
538538
Some(node_id) => node_id,
539-
None => -1,
539+
None => ast::DUMMY_NODE_ID,
540540
};
541541
self.fmt.struct_variant_str(variant.span,
542542
self.span.span_for_first_ident(variant.span),

branches/beta/src/librustc_typeck/astconv.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ use middle::subst::{FnSpace, TypeSpace, SelfSpace, Subst, Substs};
5959
use middle::traits;
6060
use middle::ty::{self, RegionEscape, Ty, ToPredicate, HasTypeFlags};
6161
use middle::ty_fold;
62+
use require_c_abi_if_variadic;
6263
use rscope::{self, UnelidableRscope, RegionScope, ElidableRscope, ExplicitRscope,
6364
ObjectLifetimeDefaultRscope, ShiftedRscope, BindingRscope,
6465
ElisionFailureInfo, ElidedLifetime};
@@ -1575,10 +1576,7 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>,
15751576
}
15761577
ast::TyParen(ref typ) => ast_ty_to_ty(this, rscope, &**typ),
15771578
ast::TyBareFn(ref bf) => {
1578-
if bf.decl.variadic && bf.abi != abi::C {
1579-
span_err!(tcx.sess, ast_ty.span, E0045,
1580-
"variadic function must have C calling convention");
1581-
}
1579+
require_c_abi_if_variadic(tcx, &bf.decl, bf.abi, ast_ty.span);
15821580
let bare_fn = ty_of_bare_fn(this, bf.unsafety, bf.abi, &*bf.decl);
15831581
tcx.mk_fn(None, tcx.mk_bare_fn(bare_fn))
15841582
}

branches/beta/src/librustc_typeck/check/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ use middle::ty::{Disr, ParamTy, ParameterEnvironment};
9797
use middle::ty::{self, HasTypeFlags, RegionEscape, ToPolyTraitRef, Ty};
9898
use middle::ty::{MethodCall, MethodCallee};
9999
use middle::ty_fold::{TypeFolder, TypeFoldable};
100+
use require_c_abi_if_variadic;
100101
use rscope::{ElisionFailureInfo, RegionScope};
101102
use session::Session;
102103
use {CrateCtxt, lookup_full_def, require_same_types};
@@ -685,10 +686,7 @@ pub fn check_item_type<'a,'tcx>(ccx: &CrateCtxt<'a,'tcx>, it: &'tcx ast::Item) {
685686
}
686687

687688
if let ast::ForeignItemFn(ref fn_decl, _) = item.node {
688-
if fn_decl.variadic && m.abi != abi::C {
689-
span_err!(ccx.tcx.sess, item.span, E0045,
690-
"variadic function must have C calling convention");
691-
}
689+
require_c_abi_if_variadic(ccx.tcx, fn_decl, m.abi, item.span);
692690
}
693691
}
694692
}

branches/beta/src/librustc_typeck/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ fn lookup_full_def(tcx: &ty::ctxt, sp: Span, id: ast::NodeId) -> def::Def {
176176
}
177177
}
178178

179+
fn require_c_abi_if_variadic(tcx: &ty::ctxt,
180+
decl: &ast::FnDecl,
181+
abi: abi::Abi,
182+
span: Span) {
183+
if decl.variadic && abi != abi::C {
184+
span_err!(tcx.sess, span, E0045,
185+
"variadic function must have C calling convention");
186+
}
187+
}
188+
179189
fn require_same_types<'a, 'tcx, M>(tcx: &ty::ctxt<'tcx>,
180190
maybe_infcx: Option<&infer::InferCtxt<'a, 'tcx>>,
181191
t1_is_expected: bool,

0 commit comments

Comments
 (0)