#[macro_export]
#[cfg(dox)]
macro_rules! concat_idents {
- ($($e:ident),*) => ({ /* compiler built-in */ });
- ($($e:ident,)*) => ({ /* compiler built-in */ });
+ ($($e:ident),+) => ({ /* compiler built-in */ });
+ ($($e:ident,)+) => ({ /* compiler built-in */ });
}
/// Concatenates literals into a static string slice.
}
// Desugar `<start>..=<end>` to `std::ops::RangeInclusive::new(<start>, <end>)`
ExprKind::Range(Some(ref e1), Some(ref e2), RangeLimits::Closed) => {
- // FIXME: Use head_sp directly after RangeInclusive::new() is stabilized in stage0.
+ // FIXME: Use e.span directly after RangeInclusive::new() is stabilized in stage0.
let span = self.allow_internal_unstable(CompilerDesugaringKind::DotFill, e.span);
- let id = self.lower_node_id(e.id);
+ let id = self.next_id();
let e1 = self.lower_expr(e1);
let e2 = self.lower_expr(e2);
let ty_path = P(self.std_path(span, &["ops", "RangeInclusive"], false));
let explanation = if lint_id == LintId::of(::lint::builtin::UNSTABLE_NAME_COLLISION) {
"once this method is added to the standard library, \
- there will be ambiguity here, which will cause a hard error!"
+ the ambiguity may cause an error or change in behavior!"
.to_owned()
} else if let Some(edition) = future_incompatible.edition {
format!("{} in the {} edition!", STANDARD_MESSAGE, edition)
// the start. So this algorithm is faster.
let mut ma = Some(scope_a);
let mut mb = Some(scope_b);
- let mut seen: SmallVec<[Scope; 32]> = SmallVec::new();
+ let mut seen_a: SmallVec<[Scope; 32]> = SmallVec::new();
+ let mut seen_b: SmallVec<[Scope; 32]> = SmallVec::new();
loop {
if let Some(a) = ma {
- if seen.iter().position(|s| *s == a).is_some() {
+ if seen_b.iter().position(|s| *s == a).is_some() {
return a;
}
- seen.push(a);
+ seen_a.push(a);
ma = self.parent_map.get(&a).map(|s| *s);
}
if let Some(b) = mb {
- if seen.iter().position(|s| *s == b).is_some() {
+ if seen_a.iter().position(|s| *s == b).is_some() {
return b;
}
- seen.push(b);
+ seen_b.push(b);
mb = self.parent_map.get(&b).map(|s| *s);
}
ConstVal::Value(miri) => const_val_field(
self.tcx, self.param_env, instance,
variant_opt, field, miri, cv.ty,
- ).unwrap(),
+ ).expect("field access failed"),
_ => bug!("{:#?} is not a valid adt", cv),
};
self.const_to_pat(instance, val, id, span)
use syntax::ast::FloatTy;
let layout = self.layout_of(ty)?;
- // do the strongest layout check of the two
- let align = layout.align.max(ptr_align);
- self.memory.check_align(ptr, align)?;
+ self.memory.check_align(ptr, ptr_align)?;
if layout.size.bytes() == 0 {
return Ok(Some(Value::ByVal(PrimVal::Undef)));
if (e.parentNode.id === "main") {
var otherMessage;
if (hasClass(e, "type-decl")) {
- otherMessage = ' Show type declaration';
+ otherMessage = ' Show declaration';
}
e.parentNode.insertBefore(createToggle(otherMessage), e);
if (otherMessage && getCurrentValue('rustdoc-item-declarations') !== "false") {
#[unstable(feature = "concat_idents_macro", issue = "29599")]
#[macro_export]
macro_rules! concat_idents {
- ($($e:ident),*) => ({ /* compiler built-in */ });
- ($($e:ident,)*) => ({ /* compiler built-in */ });
+ ($($e:ident),+) => ({ /* compiler built-in */ });
+ ($($e:ident,)+) => ({ /* compiler built-in */ });
}
/// Concatenates literals into a static string slice.
use iter::{self, FusedIterator};
use ops::{self, Deref};
use rc::Rc;
-use str::FromStr;
use sync::Arc;
use ffi::{OsStr, OsString};
}
}
-/// Error returned from [`PathBuf::from_str`][`from_str`].
-///
-/// Note that parsing a path will never fail. This error is just a placeholder
-/// for implementing `FromStr` for `PathBuf`.
-///
-/// [`from_str`]: struct.PathBuf.html#method.from_str
-#[derive(Debug, Clone, PartialEq, Eq)]
-#[stable(feature = "path_from_str", since = "1.26.0")]
-pub enum ParsePathError {}
-
-#[stable(feature = "path_from_str", since = "1.26.0")]
-impl fmt::Display for ParsePathError {
- fn fmt(&self, _: &mut fmt::Formatter) -> fmt::Result {
- match *self {}
- }
-}
-
-#[stable(feature = "path_from_str", since = "1.26.0")]
-impl FromStr for PathBuf {
- type Err = ParsePathError;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- Ok(PathBuf::from(s))
- }
-}
-
#[stable(feature = "rust1", since = "1.0.0")]
impl<P: AsRef<Path>> iter::FromIterator<P> for PathBuf {
fn from_iter<I: IntoIterator<Item = P>>(iter: I) -> PathBuf {
return base::DummyResult::expr(sp);
}
+ if tts.is_empty() {
+ cx.span_err(sp, "concat_idents! takes 1 or more arguments.");
+ return DummyResult::expr(sp);
+ }
+
let mut res_str = String::new();
for (i, e) in tts.iter().enumerate() {
if i & 1 == 1 {
// have been unsuccessful
impl Pos for BytePos {
+ #[inline(always)]
fn from_usize(n: usize) -> BytePos { BytePos(n as u32) }
+
+ #[inline(always)]
fn to_usize(&self) -> usize { let BytePos(n) = *self; n as usize }
}
impl Add for BytePos {
type Output = BytePos;
+ #[inline(always)]
fn add(self, rhs: BytePos) -> BytePos {
BytePos((self.to_usize() + rhs.to_usize()) as u32)
}
impl Sub for BytePos {
type Output = BytePos;
+ #[inline(always)]
fn sub(self, rhs: BytePos) -> BytePos {
BytePos((self.to_usize() - rhs.to_usize()) as u32)
}
}
impl Pos for CharPos {
+ #[inline(always)]
fn from_usize(n: usize) -> CharPos { CharPos(n) }
+
+ #[inline(always)]
fn to_usize(&self) -> usize { let CharPos(n) = *self; n }
}
impl Add for CharPos {
type Output = CharPos;
+ #[inline(always)]
fn add(self, rhs: CharPos) -> CharPos {
CharPos(self.to_usize() + rhs.to_usize())
}
impl Sub for CharPos {
type Output = CharPos;
+ #[inline(always)]
fn sub(self, rhs: CharPos) -> CharPos {
CharPos(self.to_usize() - rhs.to_usize())
}
--- /dev/null
+// Copyright 2018 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.
+
+fn main() {
+ // -------- Simplified test case --------
+
+ let _ = || 0..=1;
+
+ // -------- Original test case --------
+
+ let full_length = 1024;
+ let range = {
+ // do some stuff, omit here
+ None
+ };
+
+ let range = range.map(|(s, t)| s..=t).unwrap_or(0..=(full_length-1));
+
+ assert_eq!(range, 0..=1023);
+}
// option. This file may not be copied, modified, or distributed
// except according to those terms.
+// ignore-order
+
const QUERY = '[';
const EXPECTED = {
const EXPECTED = {
'others': [
{ 'path': 'std::string', 'name': 'String' },
- { 'path': 'std::ffi', 'name': 'OsString' },
{ 'path': 'std::ffi', 'name': 'CString' },
+ { 'path': 'std::ffi', 'name': 'OsString' },
],
'in_args': [
{ 'path': 'std::str', 'name': 'eq' },
--- /dev/null
+// Copyright 2018 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.
+
+// compile-pass
+#[derive(Copy, Clone, PartialEq, Eq)]
+#[repr(packed)]
+pub struct Num(u64);
+
+impl Num {
+ pub const ZERO: Self = Num(0);
+}
+
+pub fn decrement(a: Num) -> Num {
+ match a {
+ Num::ZERO => Num::ZERO,
+ a => Num(a.0 - 1)
+ }
+}
+
+fn main() {
+}
fn main() {
assert_eq!('x'.ipu_flatten(), 1);
//~^ WARN a method with this name may be added to the standard library in the future
- //~^^ WARN once this method is added to the standard library, there will be ambiguity here
+ //~^^ WARN once this method is added to the standard library, the ambiguity may cause an error
}
| ^^^^^^^^^^^
|
= note: #[warn(unstable_name_collision)] on by default
- = warning: once this method is added to the standard library, there will be ambiguity here, which will cause a hard error!
+ = warning: once this method is added to the standard library, the ambiguity may cause an error or change in behavior!
= note: for more information, see issue #48919 <https://github.com/rust-lang/rust/issues/48919>
= help: call with fully qualified syntax `inference_unstable_itertools::IpuItertools::ipu_flatten(...)` to keep using the current method
= note: add #![feature(ipu_flatten)] to the crate attributes to enable `inference_unstable_iterator::IpuIterator::ipu_flatten`
--- /dev/null
+// Copyright 2016 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.
+
+#![feature(concat_idents)]
+
+fn main() {
+ let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments
+}
--- /dev/null
+error: concat_idents! takes 1 or more arguments.
+ --> $DIR/issue-50403.rs:14:13
+ |
+LL | let x = concat_idents!(); //~ ERROR concat_idents! takes 1 or more arguments
+ | ^^^^^^^^^^^^^^^^
+
+error: aborting due to previous error
+
-Subproject commit 122fd5be5201913d42e219e132d6569493583bca
+Subproject commit 66b0ffa81c560be1b79511b51f49cbb23bc78651
var Module = module.constructor;
var m = new Module();
m._compile(content, "tmp.js");
+ m.exports.ignore_order = content.indexOf("\n// ignore-order\n") !== -1;
return m.exports;
}
}
}
if (allGood === true) {
- return true;
+ return i;
}
}
- return false;
+ return null;
}
function main(argv) {
'exports.QUERY = QUERY;exports.EXPECTED = EXPECTED;');
const expected = loadedFile.EXPECTED;
const query = loadedFile.QUERY;
+ const ignore_order = loadedFile.ignore_order;
var results = loaded.execSearch(loaded.getQuery(query), index);
process.stdout.write('Checking "' + file + '" ... ');
var error_text = [];
break;
}
var entry = expected[key];
- var found = false;
+ var prev_pos = 0;
for (var i = 0; i < entry.length; ++i) {
- if (lookForEntry(entry[i], results[key]) === true) {
- found = true;
- } else {
+ var entry_pos = lookForEntry(entry[i], results[key]);
+ if (entry_pos === null) {
error_text.push("==> Result not found in '" + key + "': '" +
JSON.stringify(entry[i]) + "'");
+ } else if (entry_pos < prev_pos && ignore_order === false) {
+ error_text.push("==> '" + JSON.stringify(entry[i]) + "' was supposed to be " +
+ " before '" + JSON.stringify(results[key][entry_pos]) + "'");
+ } else {
+ prev_pos = entry_pos;
}
}
}