Skip to content

Rollup of PRs in the queue; Sunday #22909

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Mar 1, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -875,7 +875,7 @@ then
| cut -d ' ' -f 2)

case $CFG_CLANG_VERSION in
(3.0svn | 3.0 | 3.1* | 3.2* | 3.3* | 3.4* | 3.5* | 3.6*)
(3.2* | 3.3* | 3.4* | 3.5* | 3.6*)
step_msg "found ok version of CLANG: $CFG_CLANG_VERSION"
if [ -z "$CC" ]
then
Expand Down
6 changes: 3 additions & 3 deletions src/libcollections/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1455,9 +1455,9 @@ pub trait StrExt: Index<RangeFull, Output = str> {
///
/// `is_cjk` determines behavior for characters in the Ambiguous category: if `is_cjk` is
/// `true`, these are 2 columns wide; otherwise, they are 1. In CJK locales, `is_cjk` should be
/// `true`, else it should be `false`. [Unicode Standard Annex
/// #11](http://www.unicode.org/reports/tr11/) recommends that these characters be treated as 1
/// column (i.e., `is_cjk` = `false`) if the locale is unknown.
/// `true`, else it should be `false`.
/// [Unicode Standard Annex #11](http://www.unicode.org/reports/tr11/) recommends that these
/// characters be treated as 1 column (i.e., `is_cjk = false`) if the locale is unknown.
#[unstable(feature = "collections",
reason = "this functionality may only be provided by libunicode")]
fn width(&self, is_cjk: bool) -> usize {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/fmt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ impl Display for char {
impl<T> Pointer for *const T {
fn fmt(&self, f: &mut Formatter) -> Result {
f.flags |= 1 << (FlagV1::Alternate as u32);
let ret = LowerHex::fmt(&(*self as u32), f);
let ret = LowerHex::fmt(&(*self as usize), f);
f.flags &= !(1 << (FlagV1::Alternate as u32));
ret
}
Expand Down
6 changes: 1 addition & 5 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use num::{ToPrimitive, Int};
use ops::{Add, Deref, FnMut};
use option::Option;
use option::Option::{Some, None};
use marker::{Send, Sized, Sync};
use marker::Sized;
use usize;

/// An interface for dealing with "external iterators". These types of iterators
Expand Down Expand Up @@ -1783,10 +1783,6 @@ pub struct Peekable<I: Iterator> {
peeked: Option<I::Item>,
}

// FIXME: after #22828 being fixed, the following unsafe impl should be removed
unsafe impl<I: Iterator> Sync for Peekable<I> where I: Sync, I::Item: Sync {}
unsafe impl<I: Iterator> Send for Peekable<I> where I: Send, I::Item: Send {}

impl<I: Iterator + Clone> Clone for Peekable<I> where I::Item: Clone {
fn clone(&self) -> Peekable<I> {
Peekable {
Expand Down
4 changes: 3 additions & 1 deletion src/librustc_trans/back/write.rs
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,9 @@ pub fn run_passes(sess: &Session,

// FIXME: time_llvm_passes support - does this use a global context or
// something?
//if sess.time_llvm_passes() { llvm::LLVMRustPrintPassTimings(); }
if sess.opts.cg.codegen_units == 1 && sess.time_llvm_passes() {
unsafe { llvm::LLVMRustPrintPassTimings(); }
}
}

struct WorkItem {
Expand Down
15 changes: 10 additions & 5 deletions src/librustc_trans/trans/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,13 @@ pub fn set_inline_hint(f: ValueRef) {
}

pub fn set_llvm_fn_attrs(ccx: &CrateContext, attrs: &[ast::Attribute], llfn: ValueRef) {
use syntax::attr::*;
use syntax::attr::{find_inline_attr, InlineAttr};
// Set the inline hint if there is one
match find_inline_attr(Some(ccx.sess().diagnostic()), attrs) {
InlineHint => set_inline_hint(llfn),
InlineAlways => set_always_inline(llfn),
InlineNever => set_no_inline(llfn),
InlineNone => { /* fallthrough */ }
InlineAttr::Hint => set_inline_hint(llfn),
InlineAttr::Always => set_always_inline(llfn),
InlineAttr::Never => set_no_inline(llfn),
InlineAttr::None => { /* fallthrough */ }
}

for attr in attrs {
Expand Down Expand Up @@ -2332,6 +2332,11 @@ pub fn trans_item(ccx: &CrateContext, item: &ast::Item) {
// Do static_assert checking. It can't really be done much earlier
// because we need to get the value of the bool out of LLVM
if attr::contains_name(&item.attrs, "static_assert") {
if !ty::type_is_bool(ty::expr_ty(ccx.tcx(), expr)) {
ccx.sess().span_fatal(expr.span,
"can only have static_assert on a static \
with type `bool`");
}
if m == ast::MutMutable {
ccx.sess().span_fatal(expr.span,
"cannot have static_assert on a mutable \
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/sys/unix/thread.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ pub mod guard {

if pthread_main_np() == 1 {
// main thread
current_stack.ss_sp as uint - current_stack.ss_size as uint + 3 * PAGE_SIZE as uint
current_stack.ss_sp as uint - current_stack.ss_size as uint + PAGE_SIZE as uint

} else {
// new thread
Expand Down
25 changes: 12 additions & 13 deletions src/libsyntax/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

// Functions dealing with attributes and meta items

pub use self::InlineAttr::*;
pub use self::StabilityLevel::*;
pub use self::ReprAttr::*;
pub use self::IntType::*;
Expand Down Expand Up @@ -285,33 +284,33 @@ pub fn find_crate_name(attrs: &[Attribute]) -> Option<InternedString> {

#[derive(Copy, PartialEq)]
pub enum InlineAttr {
InlineNone,
InlineHint,
InlineAlways,
InlineNever,
None,
Hint,
Always,
Never,
}

/// Determine what `#[inline]` attribute is present in `attrs`, if any.
pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -> InlineAttr {
// FIXME (#2809)---validate the usage of #[inline] and #[inline]
attrs.iter().fold(InlineNone, |ia,attr| {
attrs.iter().fold(InlineAttr::None, |ia,attr| {
match attr.node.value.node {
MetaWord(ref n) if *n == "inline" => {
mark_used(attr);
InlineHint
InlineAttr::Hint
}
MetaList(ref n, ref items) if *n == "inline" => {
mark_used(attr);
if items.len() != 1 {
diagnostic.map(|d|{ d.span_err(attr.span, "expected one argument"); });
InlineNone
InlineAttr::None
} else if contains_name(&items[..], "always") {
InlineAlways
InlineAttr::Always
} else if contains_name(&items[..], "never") {
InlineNever
InlineAttr::Never
} else {
diagnostic.map(|d|{ d.span_err((*items[0]).span, "invalid argument"); });
InlineNone
InlineAttr::None
}
}
_ => ia
Expand All @@ -322,8 +321,8 @@ pub fn find_inline_attr(diagnostic: Option<&SpanHandler>, attrs: &[Attribute]) -
/// True if `#[inline]` or `#[inline(always)]` is present in `attrs`.
pub fn requests_inline(attrs: &[Attribute]) -> bool {
match find_inline_attr(None, attrs) {
InlineHint | InlineAlways => true,
InlineNone | InlineNever => false,
InlineAttr::Hint | InlineAttr::Always => true,
InlineAttr::None | InlineAttr::Never => false,
}
}

Expand Down
16 changes: 16 additions & 0 deletions src/test/compile-fail/nonbool_static_assert.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.

#![allow(dead_code)]

#[static_assert]
static E: i32 = 1; //~ ERROR can only have static_assert on a static with type `bool`

fn main() {}
8 changes: 8 additions & 0 deletions src/test/run-pass/ifmt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#![feature(box_syntax)]

use std::fmt;
use std::usize;

struct A;
struct B;
Expand Down Expand Up @@ -137,6 +138,13 @@ pub fn main() {
t!(format!("{:+10.3e}", 1.2345e6f64), " +1.234e6");
t!(format!("{:+10.3e}", -1.2345e6f64), " -1.234e6");

// Test that pointers don't get truncated.
{
let val = usize::MAX;
let exp = format!("{:#x}", val);
t!(format!("{:p}", val as *const isize), exp);
}

// Escaping
t!(format!("{{"), "{");
t!(format!("}}"), "}");
Expand Down