Auto merge of #45169 - kennytm:rollup, r=kennytm
Rollup of 9 pull requests - Successful merges: #44775, #45089, #45095, #45099, #45101, #45108, #45116, #45135, #45146 - Failed merges:
This commit is contained in:
commit
d6d711dd8f
@ -39,7 +39,7 @@ The script accepts commands, flags, and arguments to determine what to do:
|
||||
```
|
||||
|
||||
If files are dirty that would normally be rebuilt from stage 0, that can be
|
||||
overidden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
|
||||
overridden using `--keep-stage 0`. Using `--keep-stage n` will skip all steps
|
||||
that belong to stage n or earlier:
|
||||
|
||||
```
|
||||
|
@ -346,7 +346,7 @@ for target in configured_targets:
|
||||
targets[target][0] = targets[target][0].replace("x86_64-unknown-linux-gnu", target)
|
||||
|
||||
# Here we walk through the constructed configuration we have from the parsed
|
||||
# command line arguemnts. We then apply each piece of configuration by
|
||||
# command line arguments. We then apply each piece of configuration by
|
||||
# basically just doing a `sed` to change the various configuration line to what
|
||||
# we've got configure.
|
||||
def to_toml(value):
|
||||
|
@ -836,7 +836,7 @@ pub unsafe fn transmute_copy<T, U>(src: &T) -> U {
|
||||
///
|
||||
/// See the `discriminant` function in this module for more information.
|
||||
#[stable(feature = "discriminant_value", since = "1.21.0")]
|
||||
pub struct Discriminant<T>(u64, PhantomData<*const T>);
|
||||
pub struct Discriminant<T>(u64, PhantomData<fn() -> T>);
|
||||
|
||||
// N.B. These trait implementations cannot be derived because we don't want any bounds on T.
|
||||
|
||||
|
@ -121,3 +121,19 @@ fn test_transmute() {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[allow(dead_code)]
|
||||
fn test_discriminant_send_sync() {
|
||||
enum Regular {
|
||||
A,
|
||||
B(i32)
|
||||
}
|
||||
enum NotSendSync {
|
||||
A(*const i32)
|
||||
}
|
||||
|
||||
fn is_send_sync<T: Send + Sync>() { }
|
||||
|
||||
is_send_sync::<Discriminant<Regular>>();
|
||||
is_send_sync::<Discriminant<NotSendSync>>();
|
||||
}
|
||||
|
@ -488,7 +488,7 @@ impl Literal {
|
||||
pub fn string(string: &str) -> Literal {
|
||||
let mut escaped = String::new();
|
||||
for ch in string.chars() {
|
||||
escaped.extend(ch.escape_unicode());
|
||||
escaped.extend(ch.escape_debug());
|
||||
}
|
||||
Literal(token::Literal(token::Lit::Str_(Symbol::intern(&escaped)), None))
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
//! be indexed by the direction (see the type `Direction`).
|
||||
|
||||
use bitvec::BitVector;
|
||||
use std::fmt::{Formatter, Error, Debug};
|
||||
use std::fmt::Debug;
|
||||
use std::usize;
|
||||
use snapshot_vec::{SnapshotVec, SnapshotVecDelegate};
|
||||
|
||||
@ -48,6 +48,7 @@ pub struct Node<N> {
|
||||
pub data: N,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Edge<E> {
|
||||
next_edge: [EdgeIndex; 2], // see module comment
|
||||
source: NodeIndex,
|
||||
@ -69,18 +70,6 @@ impl<N> SnapshotVecDelegate for Edge<N> {
|
||||
fn reverse(_: &mut Vec<Edge<N>>, _: ()) {}
|
||||
}
|
||||
|
||||
impl<E: Debug> Debug for Edge<E> {
|
||||
fn fmt(&self, f: &mut Formatter) -> Result<(), Error> {
|
||||
write!(f,
|
||||
"Edge {{ next_edge: [{:?}, {:?}], source: {:?}, target: {:?}, data: {:?} }}",
|
||||
self.next_edge[0],
|
||||
self.next_edge[1],
|
||||
self.source,
|
||||
self.target,
|
||||
self.data)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, PartialEq, Eq, Debug, Hash)]
|
||||
pub struct NodeIndex(pub usize);
|
||||
|
||||
|
@ -1464,7 +1464,7 @@ impl<'tcx> ExplicitSelf<'tcx> {
|
||||
/// declaration like `self: SomeType` into either `self`,
|
||||
/// `&self`, `&mut self`, or `Box<self>`. We do this here
|
||||
/// by some simple pattern matching. A more precise check
|
||||
/// is done later in `check_method_self_type()`.
|
||||
/// is done later in `check_method_receiver()`.
|
||||
///
|
||||
/// Examples:
|
||||
///
|
||||
@ -1475,7 +1475,7 @@ impl<'tcx> ExplicitSelf<'tcx> {
|
||||
/// fn method2(self: &T); // ExplicitSelf::ByValue
|
||||
/// fn method3(self: Box<&T>); // ExplicitSelf::ByBox
|
||||
///
|
||||
/// // Invalid cases will be caught later by `check_method_self_type`:
|
||||
/// // Invalid cases will be caught later by `check_method_receiver`:
|
||||
/// fn method_err1(self: &mut T); // ExplicitSelf::ByReference
|
||||
/// }
|
||||
/// ```
|
||||
|
@ -919,7 +919,7 @@ impl<T> Drop for Sender<T> {
|
||||
#[stable(feature = "mpsc_debug", since = "1.8.0")]
|
||||
impl<T> fmt::Debug for Sender<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Sender {{ .. }}")
|
||||
f.debug_struct("Sender").finish()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1049,7 +1049,7 @@ impl<T> Drop for SyncSender<T> {
|
||||
#[stable(feature = "mpsc_debug", since = "1.8.0")]
|
||||
impl<T> fmt::Debug for SyncSender<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "SyncSender {{ .. }}")
|
||||
f.debug_struct("SyncSender").finish()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1551,7 +1551,7 @@ impl<T> Drop for Receiver<T> {
|
||||
#[stable(feature = "mpsc_debug", since = "1.8.0")]
|
||||
impl<T> fmt::Debug for Receiver<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Receiver {{ .. }}")
|
||||
f.debug_struct("Receiver").finish()
|
||||
}
|
||||
}
|
||||
|
||||
@ -3009,22 +3009,4 @@ mod sync_tests {
|
||||
repro()
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fmt_debug_sender() {
|
||||
let (tx, _) = channel::<i32>();
|
||||
assert_eq!(format!("{:?}", tx), "Sender { .. }");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fmt_debug_recv() {
|
||||
let (_, rx) = channel::<i32>();
|
||||
assert_eq!(format!("{:?}", rx), "Receiver { .. }");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fmt_debug_sync_sender() {
|
||||
let (tx, _) = sync_channel::<i32>(1);
|
||||
assert_eq!(format!("{:?}", tx), "SyncSender { .. }");
|
||||
}
|
||||
}
|
||||
|
@ -354,13 +354,13 @@ impl Iterator for Packets {
|
||||
|
||||
impl fmt::Debug for Select {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Select {{ .. }}")
|
||||
f.debug_struct("Select").finish()
|
||||
}
|
||||
}
|
||||
|
||||
impl<'rx, T:Send+'rx> fmt::Debug for Handle<'rx, T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Handle {{ .. }}")
|
||||
f.debug_struct("Handle").finish()
|
||||
}
|
||||
}
|
||||
|
||||
@ -774,18 +774,4 @@ mod tests {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fmt_debug_select() {
|
||||
let sel = Select::new();
|
||||
assert_eq!(format!("{:?}", sel), "Select { .. }");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fmt_debug_handle() {
|
||||
let (_, rx) = channel::<i32>();
|
||||
let sel = Select::new();
|
||||
let handle = sel.handle(&rx);
|
||||
assert_eq!(format!("{:?}", handle), "Handle { .. }");
|
||||
}
|
||||
}
|
||||
|
@ -394,11 +394,18 @@ impl<T: ?Sized + Default> Default for Mutex<T> {
|
||||
impl<T: ?Sized + fmt::Debug> fmt::Debug for Mutex<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.try_lock() {
|
||||
Ok(guard) => write!(f, "Mutex {{ data: {:?} }}", &*guard),
|
||||
Ok(guard) => f.debug_struct("Mutex").field("data", &&*guard).finish(),
|
||||
Err(TryLockError::Poisoned(err)) => {
|
||||
write!(f, "Mutex {{ data: Poisoned({:?}) }}", &**err.get_ref())
|
||||
f.debug_struct("Mutex").field("data", &&**err.get_ref()).finish()
|
||||
},
|
||||
Err(TryLockError::WouldBlock) => write!(f, "Mutex {{ <locked> }}")
|
||||
Err(TryLockError::WouldBlock) => {
|
||||
struct LockedPlaceholder;
|
||||
impl fmt::Debug for LockedPlaceholder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("<locked>") }
|
||||
}
|
||||
|
||||
f.debug_struct("Mutex").field("data", &LockedPlaceholder).finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -428,11 +428,18 @@ unsafe impl<#[may_dangle] T: ?Sized> Drop for RwLock<T> {
|
||||
impl<T: ?Sized + fmt::Debug> fmt::Debug for RwLock<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.try_read() {
|
||||
Ok(guard) => write!(f, "RwLock {{ data: {:?} }}", &*guard),
|
||||
Ok(guard) => f.debug_struct("RwLock").field("data", &&*guard).finish(),
|
||||
Err(TryLockError::Poisoned(err)) => {
|
||||
write!(f, "RwLock {{ data: Poisoned({:?}) }}", &**err.get_ref())
|
||||
f.debug_struct("RwLock").field("data", &&**err.get_ref()).finish()
|
||||
},
|
||||
Err(TryLockError::WouldBlock) => write!(f, "RwLock {{ <locked> }}")
|
||||
Err(TryLockError::WouldBlock) => {
|
||||
struct LockedPlaceholder;
|
||||
impl fmt::Debug for LockedPlaceholder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("<locked>") }
|
||||
}
|
||||
|
||||
f.debug_struct("RwLock").field("data", &LockedPlaceholder).finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -116,11 +116,18 @@ impl<T> Drop for ReentrantMutex<T> {
|
||||
impl<T: fmt::Debug + 'static> fmt::Debug for ReentrantMutex<T> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self.try_lock() {
|
||||
Ok(guard) => write!(f, "ReentrantMutex {{ data: {:?} }}", &*guard),
|
||||
Ok(guard) => f.debug_struct("ReentrantMutex").field("data", &*guard).finish(),
|
||||
Err(TryLockError::Poisoned(err)) => {
|
||||
write!(f, "ReentrantMutex {{ data: Poisoned({:?}) }}", &**err.get_ref())
|
||||
f.debug_struct("ReentrantMutex").field("data", &**err.get_ref()).finish()
|
||||
},
|
||||
Err(TryLockError::WouldBlock) => write!(f, "ReentrantMutex {{ <locked> }}")
|
||||
Err(TryLockError::WouldBlock) => {
|
||||
struct LockedPlaceholder;
|
||||
impl fmt::Debug for LockedPlaceholder {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("<locked>") }
|
||||
}
|
||||
|
||||
f.debug_struct("ReentrantMutex").field("data", &LockedPlaceholder).finish()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2890,17 +2890,30 @@ impl<'a> Parser<'a> {
|
||||
|
||||
match self.parse_path(PathStyle::Expr) {
|
||||
Ok(path) => {
|
||||
let (op_noun, op_verb) = match self.token {
|
||||
token::Lt => ("comparison", "comparing"),
|
||||
token::BinOp(token::Shl) => ("shift", "shifting"),
|
||||
_ => {
|
||||
// We can end up here even without `<` being the next token, for
|
||||
// example because `parse_ty_no_plus` returns `Err` on keywords,
|
||||
// but `parse_path` returns `Ok` on them due to error recovery.
|
||||
// Return original error and parser state.
|
||||
mem::replace(self, parser_snapshot_after_type);
|
||||
return Err(type_err);
|
||||
}
|
||||
};
|
||||
|
||||
// Successfully parsed the type path leaving a `<` yet to parse.
|
||||
type_err.cancel();
|
||||
|
||||
// Report non-fatal diagnostics, keep `x as usize` as an expression
|
||||
// in AST and continue parsing.
|
||||
let msg = format!("`<` is interpreted as a start of generic \
|
||||
arguments for `{}`, not a comparison", path);
|
||||
arguments for `{}`, not a {}", path, op_noun);
|
||||
let mut err = self.sess.span_diagnostic.struct_span_err(self.span, &msg);
|
||||
err.span_label(self.look_ahead_span(1).to(parser_snapshot_after_type.span),
|
||||
"interpreted as generic arguments");
|
||||
err.span_label(self.span, "not interpreted as comparison");
|
||||
err.span_label(self.span, format!("not interpreted as {}", op_noun));
|
||||
|
||||
let expr = mk_expr(self, P(Ty {
|
||||
span: path.span,
|
||||
@ -2911,7 +2924,7 @@ impl<'a> Parser<'a> {
|
||||
let expr_str = self.sess.codemap().span_to_snippet(expr.span)
|
||||
.unwrap_or(pprust::expr_to_string(&expr));
|
||||
err.span_suggestion(expr.span,
|
||||
"try comparing the casted value",
|
||||
&format!("try {} the casted value", op_verb),
|
||||
format!("({})", expr_str));
|
||||
err.emit();
|
||||
|
||||
|
@ -339,8 +339,11 @@ impl serialize::UseSpecializedDecodable for Span {
|
||||
}
|
||||
|
||||
fn default_span_debug(span: Span, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
write!(f, "Span {{ lo: {:?}, hi: {:?}, ctxt: {:?} }}",
|
||||
span.lo(), span.hi(), span.ctxt())
|
||||
f.debug_struct("Span")
|
||||
.field("lo", &span.lo())
|
||||
.field("hi", &span.hi())
|
||||
.field("ctxt", &span.ctxt())
|
||||
.finish()
|
||||
}
|
||||
|
||||
impl fmt::Debug for Span {
|
||||
|
@ -19,7 +19,7 @@ use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast};
|
||||
#[no_mangle]
|
||||
pub fn add(x: f32, y: f32) -> f32 {
|
||||
// CHECK: fadd float
|
||||
// CHECK-NOT fast
|
||||
// CHECK-NOT: fast
|
||||
x + y
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,9 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
// compile-flags: -Zincremental=tmp/cfail-tests/incr_comp_with_macro_export
|
||||
// revisions: cfail1 cfail2 cfail3
|
||||
// must-compile-successfully
|
||||
|
||||
|
||||
// This test case makes sure that we can compile with incremental compilation
|
||||
// enabled when there are macros exported from this crate. (See #37756)
|
||||
|
@ -5,5 +5,5 @@ all:
|
||||
$(RUSTC) foo.rs --target=my-invalid-platform.json 2>&1 | grep -q "Error loading target specification"
|
||||
$(RUSTC) foo.rs --target=my-incomplete-platform.json 2>&1 | grep 'Field llvm-target'
|
||||
RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-awesome-platform --crate-type=lib --emit=asm
|
||||
RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=x86_64-unknown-linux-gnu --crate-type=lib --emit=asm
|
||||
RUST_TARGET_PATH=. $(RUSTC) foo.rs --target=my-x86_64-unknown-linux-gnu-platform --crate-type=lib --emit=asm
|
||||
$(RUSTC) -Z unstable-options --target=my-awesome-platform.json --print target-spec-json > $(TMPDIR)/test-platform.json && $(RUSTC) -Z unstable-options --target=$(TMPDIR)/test-platform.json --print target-spec-json | diff -q $(TMPDIR)/test-platform.json -
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"pre-link-args": ["-m64"],
|
||||
"data-layout": "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128",
|
||||
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
|
||||
"linker-flavor": "gcc",
|
||||
"llvm-target": "x86_64-unknown-linux-gnu",
|
||||
"target-endian": "little",
|
@ -35,5 +35,7 @@ fn main() {
|
||||
<
|
||||
5);
|
||||
|
||||
println!("{}", a as usize << long_name);
|
||||
|
||||
println!("{}", a: &mut 4);
|
||||
}
|
||||
|
@ -76,9 +76,18 @@ help: try comparing the casted value
|
||||
33 |
|
||||
...
|
||||
|
||||
error: expected type, found `4`
|
||||
--> $DIR/issue-22644.rs:38:28
|
||||
error: `<` is interpreted as a start of generic arguments for `usize`, not a shift
|
||||
--> $DIR/issue-22644.rs:38:31
|
||||
|
|
||||
38 | println!("{}", a: &mut 4);
|
||||
38 | println!("{}", a as usize << long_name);
|
||||
| ---------- ^^ --------- interpreted as generic arguments
|
||||
| | |
|
||||
| | not interpreted as shift
|
||||
| help: try shifting the casted value: `(a as usize)`
|
||||
|
||||
error: expected type, found `4`
|
||||
--> $DIR/issue-22644.rs:40:28
|
||||
|
|
||||
40 | println!("{}", a: &mut 4);
|
||||
| ^ expecting a type here because of type ascription
|
||||
|
||||
|
19
src/test/ui/issue-44406.rs
Normal file
19
src/test/ui/issue-44406.rs
Normal file
@ -0,0 +1,19 @@
|
||||
// Copyright 2017 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.
|
||||
|
||||
macro_rules! foo {
|
||||
($rest: tt) => {
|
||||
bar(baz: $rest)
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
foo!(true);
|
||||
}
|
26
src/test/ui/issue-44406.stderr
Normal file
26
src/test/ui/issue-44406.stderr
Normal file
@ -0,0 +1,26 @@
|
||||
error: expected identifier, found keyword `true`
|
||||
--> $DIR/issue-44406.rs:18:10
|
||||
|
|
||||
18 | foo!(true);
|
||||
| ^^^^
|
||||
|
||||
error: expected type, found keyword `true`
|
||||
--> $DIR/issue-44406.rs:18:10
|
||||
|
|
||||
13 | bar(baz: $rest)
|
||||
| - help: did you mean to use `;` here?
|
||||
...
|
||||
18 | foo!(true);
|
||||
| ^^^^ expecting a type here because of type ascription
|
||||
|
||||
error: expected one of `!`, `&&`, `&`, `(`, `*`, `.`, `;`, `<`, `?`, `[`, `_`, `extern`, `fn`, `for`, `impl`, `unsafe`, `}`, an operator, or lifetime, found `true`
|
||||
--> $DIR/issue-44406.rs:18:10
|
||||
|
|
||||
13 | bar(baz: $rest)
|
||||
| - expected one of 19 possible tokens here
|
||||
...
|
||||
18 | foo!(true);
|
||||
| ^^^^ unexpected token
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
Loading…
x
Reference in New Issue
Block a user