{
- if let Some(ref mut rhs) = rhs {
- lhs.append(rhs);
- }
- lhs
-}
-
#[derive(Debug, Clone, Copy, PartialEq)]
enum PrevTokenKind {
DocComment,
diff --git a/src/libsyntax/parse/parser/item.rs b/src/libsyntax/parse/parser/item.rs
index 0acfd1450d819..73bd80e2a21f7 100644
--- a/src/libsyntax/parse/parser/item.rs
+++ b/src/libsyntax/parse/parser/item.rs
@@ -10,7 +10,6 @@ use crate::ast::{Visibility, VisibilityKind, Mutability, FnHeader, ForeignItem,
use crate::ast::{Ty, TyKind, Generics, GenericBounds, TraitRef, EnumDef, VariantData, StructField};
use crate::ast::{Mac, MacDelimiter, Block, BindingMode, FnDecl, MethodSig, SelfKind, Param};
use crate::parse::token;
-use crate::parse::parser::maybe_append;
use crate::tokenstream::{TokenTree, TokenStream};
use crate::symbol::{kw, sym};
use crate::source_map::{self, respan, Span};
@@ -416,10 +415,17 @@ impl<'a> Parser<'a> {
) -> PResult<'a, Option>> {
let (ident, item, extra_attrs) = info;
let span = lo.to(self.prev_span);
- let attrs = maybe_append(attrs, extra_attrs);
+ let attrs = Self::maybe_append(attrs, extra_attrs);
Ok(Some(self.mk_item(span, ident, item, vis, attrs)))
}
+ fn maybe_append(mut lhs: Vec, mut rhs: Option>) -> Vec {
+ if let Some(ref mut rhs) = rhs {
+ lhs.append(rhs);
+ }
+ lhs
+ }
+
/// This is the fall-through for parsing items.
fn parse_macro_use_or_failure(
&mut self,
diff --git a/src/test/ui/asm/issue-51431.rs b/src/test/ui/asm/issue-51431.rs
new file mode 100644
index 0000000000000..d29c31fafc286
--- /dev/null
+++ b/src/test/ui/asm/issue-51431.rs
@@ -0,0 +1,10 @@
+// ignore-emscripten no asm! support
+
+#![feature(asm)]
+
+fn main() {
+ unsafe {
+ asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
+ //~^ ERROR: invalid value for constraint in inline assembly
+ }
+}
diff --git a/src/test/ui/asm/issue-51431.stderr b/src/test/ui/asm/issue-51431.stderr
new file mode 100644
index 0000000000000..132eea126d642
--- /dev/null
+++ b/src/test/ui/asm/issue-51431.stderr
@@ -0,0 +1,8 @@
+error[E0669]: invalid value for constraint in inline assembly
+ --> $DIR/issue-51431.rs:7:32
+ |
+LL | asm! {"mov $0,$1"::"0"("bx"),"1"(0x00)}
+ | ^^^^
+
+error: aborting due to previous error
+
diff --git a/src/test/ui/associated-const/issue-63496.rs b/src/test/ui/associated-const/issue-63496.rs
new file mode 100644
index 0000000000000..311c48b5e48c5
--- /dev/null
+++ b/src/test/ui/associated-const/issue-63496.rs
@@ -0,0 +1,9 @@
+trait A {
+ const C: usize;
+
+ fn f() -> ([u8; A::C], [u8; A::C]);
+ //~^ ERROR: type annotations needed: cannot resolve
+ //~| ERROR: type annotations needed: cannot resolve
+}
+
+fn main() {}
diff --git a/src/test/ui/associated-const/issue-63496.stderr b/src/test/ui/associated-const/issue-63496.stderr
new file mode 100644
index 0000000000000..70bb12de1fb72
--- /dev/null
+++ b/src/test/ui/associated-const/issue-63496.stderr
@@ -0,0 +1,21 @@
+error[E0283]: type annotations needed: cannot resolve `_: A`
+ --> $DIR/issue-63496.rs:4:21
+ |
+LL | const C: usize;
+ | --------------- required by `A::C`
+LL |
+LL | fn f() -> ([u8; A::C], [u8; A::C]);
+ | ^^^^
+
+error[E0283]: type annotations needed: cannot resolve `_: A`
+ --> $DIR/issue-63496.rs:4:33
+ |
+LL | const C: usize;
+ | --------------- required by `A::C`
+LL |
+LL | fn f() -> ([u8; A::C], [u8; A::C]);
+ | ^^^^
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0283`.
diff --git a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
index 7caa9f26bc2f8..4b5e2d59e38c9 100644
--- a/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
+++ b/src/test/ui/async-await/await-keyword/incorrect-syntax-suggestions.stderr
@@ -244,4 +244,5 @@ LL | let _ = await bar()?;
error: aborting due to 35 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0728.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/async-await/issues/issue-51719.stderr b/src/test/ui/async-await/issues/issue-51719.stderr
index 6c3c8889da7ce..5b9adb253d968 100644
--- a/src/test/ui/async-await/issues/issue-51719.stderr
+++ b/src/test/ui/async-await/issues/issue-51719.stderr
@@ -8,3 +8,4 @@ LL | let _gen = || foo().await;
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0728`.
diff --git a/src/test/ui/async-await/issues/issue-51751.stderr b/src/test/ui/async-await/issues/issue-51751.stderr
index e50c78534f852..f120bd119c540 100644
--- a/src/test/ui/async-await/issues/issue-51751.stderr
+++ b/src/test/ui/async-await/issues/issue-51751.stderr
@@ -9,3 +9,4 @@ LL | let finished = result.await;
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0728`.
diff --git a/src/test/ui/async-await/issues/issue-62009-1.stderr b/src/test/ui/async-await/issues/issue-62009-1.stderr
index f63eaa4c48a97..538430290d299 100644
--- a/src/test/ui/async-await/issues/issue-62009-1.stderr
+++ b/src/test/ui/async-await/issues/issue-62009-1.stderr
@@ -40,4 +40,5 @@ LL | F: Future
error: aborting due to 4 previous errors
-For more information about this error, try `rustc --explain E0277`.
+Some errors have detailed explanations: E0277, E0728.
+For more information about an error, try `rustc --explain E0277`.
diff --git a/src/test/ui/async-await/issues/issue-62009-2.stderr b/src/test/ui/async-await/issues/issue-62009-2.stderr
index 79b6803263eec..47b74b5574fea 100644
--- a/src/test/ui/async-await/issues/issue-62009-2.stderr
+++ b/src/test/ui/async-await/issues/issue-62009-2.stderr
@@ -8,3 +8,4 @@ LL | (async || 2333)().await;
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0728`.
diff --git a/src/test/ui/async-await/issues/non-async-enclosing-span.stderr b/src/test/ui/async-await/issues/non-async-enclosing-span.stderr
index 49ebf414c550b..f826a86f08985 100644
--- a/src/test/ui/async-await/issues/non-async-enclosing-span.stderr
+++ b/src/test/ui/async-await/issues/non-async-enclosing-span.stderr
@@ -9,3 +9,4 @@ LL | let y = do_the_thing().await;
error: aborting due to previous error
+For more information about this error, try `rustc --explain E0728`.
diff --git a/src/test/ui/closures/issue-41366.rs b/src/test/ui/closures/issue-41366.rs
new file mode 100644
index 0000000000000..5cae0e76d1acb
--- /dev/null
+++ b/src/test/ui/closures/issue-41366.rs
@@ -0,0 +1,13 @@
+trait T<'x> {
+ type V;
+}
+
+impl<'g> T<'g> for u32 {
+ type V = u16;
+}
+
+fn main() {
+ (&|_|()) as &dyn for<'x> Fn(>::V);
+ //~^ ERROR: type mismatch in closure arguments
+ //~| ERROR: type mismatch resolving
+}
diff --git a/src/test/ui/closures/issue-41366.stderr b/src/test/ui/closures/issue-41366.stderr
new file mode 100644
index 0000000000000..91d26efbc4f35
--- /dev/null
+++ b/src/test/ui/closures/issue-41366.stderr
@@ -0,0 +1,22 @@
+error[E0631]: type mismatch in closure arguments
+ --> $DIR/issue-41366.rs:10:5
+ |
+LL | (&|_|()) as &dyn for<'x> Fn(>::V);
+ | ^^-----^
+ | | |
+ | | found signature of `fn(_) -> _`
+ | expected signature of `for<'x> fn(>::V) -> _`
+ |
+ = note: required for the cast to the object type `dyn for<'x> std::ops::Fn(>::V)`
+
+error[E0271]: type mismatch resolving `for<'x> <[closure@$DIR/issue-41366.rs:10:7: 10:12] as std::ops::FnOnce<(>::V,)>>::Output == ()`
+ --> $DIR/issue-41366.rs:10:5
+ |
+LL | (&|_|()) as &dyn for<'x> Fn(>::V);
+ | ^^^^^^^^ expected bound lifetime parameter 'x, found concrete lifetime
+ |
+ = note: required for the cast to the object type `dyn for<'x> std::ops::Fn(>::V)`
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0271`.
diff --git a/src/test/ui/closures/issue-52437.rs b/src/test/ui/closures/issue-52437.rs
new file mode 100644
index 0000000000000..6ac5380a5aa23
--- /dev/null
+++ b/src/test/ui/closures/issue-52437.rs
@@ -0,0 +1,5 @@
+fn main() {
+ [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
+ //~^ ERROR: invalid label name `'static`
+ //~| ERROR: type annotations needed
+}
diff --git a/src/test/ui/closures/issue-52437.stderr b/src/test/ui/closures/issue-52437.stderr
new file mode 100644
index 0000000000000..e76f942e9ba57
--- /dev/null
+++ b/src/test/ui/closures/issue-52437.stderr
@@ -0,0 +1,15 @@
+error: invalid label name `'static`
+ --> $DIR/issue-52437.rs:2:13
+ |
+LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
+ | ^^^^^^^
+
+error[E0282]: type annotations needed
+ --> $DIR/issue-52437.rs:2:30
+ |
+LL | [(); &(&'static: loop { |x| {}; }) as *const _ as usize]
+ | ^ consider giving this closure parameter a type
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0282`.
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign.rs b/src/test/ui/coherence/impl-foreign-for-foreign.rs
new file mode 100644
index 0000000000000..de0b66a35eb01
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-foreign.rs
@@ -0,0 +1,17 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote for i32 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign.stderr b/src/test/ui/coherence/impl-foreign-for-foreign.stderr
new file mode 100644
index 0000000000000..b03a75a77c346
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-foreign.stderr
@@ -0,0 +1,12 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign-for-foreign.rs:12:1
+ |
+LL | impl Remote for i32 {
+ | ^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign[foreign].rs b/src/test/ui/coherence/impl-foreign-for-foreign[foreign].rs
new file mode 100644
index 0000000000000..5146263d99114
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-foreign[foreign].rs
@@ -0,0 +1,25 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote1> for i32 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+impl Remote1> for f64 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+impl Remote1> for f32 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr b/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr
new file mode 100644
index 0000000000000..bfaec790b20a6
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-foreign[foreign].stderr
@@ -0,0 +1,30 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign-for-foreign[foreign].rs:12:1
+ |
+LL | impl Remote1> for i32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign-for-foreign[foreign].rs:16:1
+ |
+LL | impl Remote1> for f64 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign-for-foreign[foreign].rs:20:1
+ |
+LL | impl Remote1> for f32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/ui/coherence/impl-foreign-for-foreign[local].rs b/src/test/ui/coherence/impl-foreign-for-foreign[local].rs
new file mode 100644
index 0000000000000..050769dcf4ce8
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-foreign[local].rs
@@ -0,0 +1,16 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local(Rc);
+
+impl Remote1> for i32 {}
+impl Remote1> for f32 {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].rs b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].rs
new file mode 100644
index 0000000000000..03b11edf98b41
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].rs
@@ -0,0 +1,21 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote for Box {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+impl Remote for Box> {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr
new file mode 100644
index 0000000000000..2ce4921cf938f
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-fundamental[foreign].stderr
@@ -0,0 +1,21 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign-for-fundamental[foreign].rs:12:1
+ |
+LL | impl Remote for Box {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign-for-fundamental[foreign].rs:16:1
+ |
+LL | impl Remote for Box> {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/ui/coherence/impl-foreign-for-fundamental[local].rs b/src/test/ui/coherence/impl-foreign-for-fundamental[local].rs
new file mode 100644
index 0000000000000..ae03ce6a440dc
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-fundamental[local].rs
@@ -0,0 +1,17 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local1(Rc);
+
+impl Remote for Box {}
+impl Remote for Box> {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign-for-local.rs b/src/test/ui/coherence/impl-foreign-for-local.rs
new file mode 100644
index 0000000000000..c9dddeba18dc5
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign-for-local.rs
@@ -0,0 +1,15 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote for Local {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs
new file mode 100644
index 0000000000000..06efb6c2ad75e
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.rs
@@ -0,0 +1,26 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local1(Rc);
+
+impl Remote1> for i32 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+impl Remote1>> for f64 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+impl Remote1>> for f32 {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr
new file mode 100644
index 0000000000000..bf2361a1718af
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign[fundemental[foreign]]-for-foreign.stderr
@@ -0,0 +1,30 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:13:1
+ |
+LL | impl Remote1> for i32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:17:1
+ |
+LL | impl Remote1>> for f64 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl-foreign[fundemental[foreign]]-for-foreign.rs:21:1
+ |
+LL | impl Remote1>> for f32 {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 3 previous errors
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs b/src/test/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs
new file mode 100644
index 0000000000000..d47e0a36a5659
--- /dev/null
+++ b/src/test/ui/coherence/impl-foreign[fundemental[local]]-for-foreign.rs
@@ -0,0 +1,18 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local1(Rc);
+
+impl Remote1> for i32 {}
+impl Remote1>> for f64 {}
+impl Remote1>> for f32 {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].rs b/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].rs
new file mode 100644
index 0000000000000..db7a2ae8076a3
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].rs
@@ -0,0 +1,23 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+use std::sync::Arc;
+
+struct Local;
+
+impl Remote for Rc {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+
+impl Remote for Arc {
+ //~^ ERROR only traits defined in the current crate
+ // | can be implemented for arbitrary types [E0117]
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr b/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr
new file mode 100644
index 0000000000000..d7ffcaf76f9a2
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign-for-foreign[t].stderr
@@ -0,0 +1,21 @@
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl[t]-foreign-for-foreign[t].rs:13:1
+ |
+LL | impl Remote for Rc {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error[E0117]: only traits defined in the current crate can be implemented for arbitrary types
+ --> $DIR/impl[t]-foreign-for-foreign[t].rs:18:1
+ |
+LL | impl Remote for Arc {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ impl doesn't use types inside crate
+ |
+ = note: the impl does not reference only types defined in this crate
+ = note: define and implement a trait or new type instead
+
+error: aborting due to 2 previous errors
+
+For more information about this error, try `rustc --explain E0117`.
diff --git a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs
new file mode 100644
index 0000000000000..4cc19e1a526ca
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].rs
@@ -0,0 +1,17 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+
+impl Remote for Box {
+ //~^ ERROR type parameter `T` must be used as the type parameter for
+ // | some local type (e.g., `MyStruct`)
+}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr
new file mode 100644
index 0000000000000..20ce11ef9759e
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign-for-fundamental[t].stderr
@@ -0,0 +1,11 @@
+error[E0210]: type parameter `T` must be used as the type parameter for some local type (e.g., `MyStruct`)
+ --> $DIR/impl[t]-foreign-for-fundamental[t].rs:12:1
+ |
+LL | impl Remote for Box {
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^ type parameter `T` must be used as the type parameter for some local type
+ |
+ = note: only traits defined in the current crate can be implemented for a type parameter
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0210`.
diff --git a/src/test/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs b/src/test/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs
new file mode 100644
index 0000000000000..914680f191ac9
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[fundemental[local]]-for-foreign[t].rs
@@ -0,0 +1,17 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local1(Rc);
+
+impl Remote1> for Rc {}
+impl Remote1>> for Rc {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs b/src/test/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs
new file mode 100644
index 0000000000000..1e84ff40c6227
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-foreign[t].rs
@@ -0,0 +1,17 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local1(Rc);
+
+impl Remote1 for Rc {}
+impl Remote1> for Rc {}
+
+fn main() {}
diff --git a/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs
new file mode 100644
index 0000000000000..ea6aa101d209c
--- /dev/null
+++ b/src/test/ui/coherence/impl[t]-foreign[local]-for-fundamental[foreign[t]].rs
@@ -0,0 +1,19 @@
+#![feature(re_rebalance_coherence)]
+
+// compile-flags:--crate-name=test
+// aux-build:coherence_lib.rs
+// check-pass
+
+extern crate coherence_lib as lib;
+use lib::*;
+use std::rc::Rc;
+
+struct Local;
+struct Local1(Rc);
+
+impl Remote1 for Box> {}
+impl Remote1> for Box> {}
+impl Remote1> for Box> {}
+impl Remote1>> for Box> {}
+
+fn main() {}
diff --git a/src/test/ui/lint/unused_parens_json_suggestion.fixed b/src/test/ui/lint/unused_parens_json_suggestion.fixed
index 427407119102c..15ee19755bffc 100644
--- a/src/test/ui/lint/unused_parens_json_suggestion.fixed
+++ b/src/test/ui/lint/unused_parens_json_suggestion.fixed
@@ -1,5 +1,4 @@
-// compile-flags: --error-format pretty-json -Zunstable-options
-// build-pass (FIXME(62277): could be check-pass?)
+// compile-flags: --error-format json -Zunstable-options
// run-rustfix
// The output for humans should just highlight the whole span without showing
@@ -8,13 +7,13 @@
// stripping away any starting or ending parenthesis characters—hence this
// test of the JSON error format.
-#![warn(unused_parens)]
+#![deny(unused_parens)]
#![allow(unreachable_code)]
fn main() {
// We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
// the malformed `1 / (2 + 3`
- let _a = 1 / (2 + 3);
+ let _a = 1 / (2 + 3); //~ERROR unnecessary parentheses
f();
}
diff --git a/src/test/ui/lint/unused_parens_json_suggestion.rs b/src/test/ui/lint/unused_parens_json_suggestion.rs
index 87192503986c4..d72df21e09ae2 100644
--- a/src/test/ui/lint/unused_parens_json_suggestion.rs
+++ b/src/test/ui/lint/unused_parens_json_suggestion.rs
@@ -1,5 +1,4 @@
-// compile-flags: --error-format pretty-json -Zunstable-options
-// build-pass (FIXME(62277): could be check-pass?)
+// compile-flags: --error-format json -Zunstable-options
// run-rustfix
// The output for humans should just highlight the whole span without showing
@@ -8,13 +7,13 @@
// stripping away any starting or ending parenthesis characters—hence this
// test of the JSON error format.
-#![warn(unused_parens)]
+#![deny(unused_parens)]
#![allow(unreachable_code)]
fn main() {
// We want to suggest the properly-balanced expression `1 / (2 + 3)`, not
// the malformed `1 / (2 + 3`
- let _a = (1 / (2 + 3));
+ let _a = (1 / (2 + 3)); //~ERROR unnecessary parentheses
f();
}
diff --git a/src/test/ui/lint/unused_parens_json_suggestion.stderr b/src/test/ui/lint/unused_parens_json_suggestion.stderr
index 256c7555c908b..c503c100808db 100644
--- a/src/test/ui/lint/unused_parens_json_suggestion.stderr
+++ b/src/test/ui/lint/unused_parens_json_suggestion.stderr
@@ -1,106 +1,16 @@
-{
- "message": "unnecessary parentheses around assigned value",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_json_suggestion.rs",
- "byte_start": 654,
- "byte_end": 667,
- "line_start": 17,
- "line_end": 17,
- "column_start": 14,
- "column_end": 27,
- "is_primary": true,
- "text": [
- {
- "text": " let _a = (1 / (2 + 3));",
- "highlight_start": 14,
- "highlight_end": 27
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "lint level defined here",
- "code": null,
- "level": "note",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_json_suggestion.rs",
- "byte_start": 472,
- "byte_end": 485,
- "line_start": 11,
- "line_end": 11,
- "column_start": 9,
- "column_end": 22,
- "is_primary": true,
- "text": [
- {
- "text": "#![warn(unused_parens)]",
- "highlight_start": 9,
- "highlight_end": 22
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- },
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_json_suggestion.rs",
- "byte_start": 654,
- "byte_end": 667,
- "line_start": 17,
- "line_end": 17,
- "column_start": 14,
- "column_end": 27,
- "is_primary": true,
- "text": [
- {
- "text": " let _a = (1 / (2 + 3));",
- "highlight_start": 14,
- "highlight_end": 27
- }
- ],
- "label": null,
- "suggested_replacement": "1 / (2 + 3)",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around assigned value
- --> $DIR/unused_parens_json_suggestion.rs:17:14
+{"message":"unnecessary parentheses around assigned value","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_json_suggestion.rs","byte_start":596,"byte_end":609,"line_start":16,"line_end":16,"column_start":14,"column_end":27,"is_primary":true,"text":[{"text":" let _a = (1 / (2 + 3));
+ --> $DIR/unused_parens_json_suggestion.rs:16:14
|
LL | let _a = (1 / (2 + 3));
| ^^^^^^^^^^^^^ help: remove these parentheses
|
note: lint level defined here
- --> $DIR/unused_parens_json_suggestion.rs:11:9
+ --> $DIR/unused_parens_json_suggestion.rs:10:9
|
-LL | #![warn(unused_parens)]
+LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
-"
-}
+"}
+{"message":"aborting due to previous error","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to previous error
+
+"}
diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed
index 2459eb1ac5cb8..1d891d328dd5a 100644
--- a/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed
+++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.fixed
@@ -1,5 +1,4 @@
-// compile-flags: --error-format pretty-json -Zunstable-options
-// build-pass
+// compile-flags: --error-format json -Zunstable-options
// run-rustfix
// The output for humans should just highlight the whole span without showing
@@ -8,14 +7,14 @@
// stripping away any starting or ending parenthesis characters—hence this
// test of the JSON error format.
-#![warn(unused_parens)]
+#![deny(unused_parens)]
#![allow(unreachable_code)]
fn main() {
let _b = false;
- if _b {
+ if _b { //~ ERROR unnecessary parentheses
println!("hello");
}
@@ -26,29 +25,29 @@ fn main() {
fn f() -> bool {
let c = false;
- if c {
+ if c { //~ ERROR unnecessary parentheses
println!("next");
}
- if c {
+ if c { //~ ERROR unnecessary parentheses
println!("prev");
}
while false && true {
- if c {
+ if c { //~ ERROR unnecessary parentheses
println!("norm");
}
}
- while true && false {
- for _ in 0 .. 3 {
+ while true && false { //~ ERROR unnecessary parentheses
+ for _ in 0 .. 3 { //~ ERROR unnecessary parentheses
println!("e~")
}
}
- for _ in 0 .. 3 {
- while true && false {
+ for _ in 0 .. 3 { //~ ERROR unnecessary parentheses
+ while true && false { //~ ERROR unnecessary parentheses
println!("e~")
}
}
diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs
index 0e9869b67d590..494cd18450630 100644
--- a/src/test/ui/lint/unused_parens_remove_json_suggestion.rs
+++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.rs
@@ -1,5 +1,4 @@
-// compile-flags: --error-format pretty-json -Zunstable-options
-// build-pass
+// compile-flags: --error-format json -Zunstable-options
// run-rustfix
// The output for humans should just highlight the whole span without showing
@@ -8,14 +7,14 @@
// stripping away any starting or ending parenthesis characters—hence this
// test of the JSON error format.
-#![warn(unused_parens)]
+#![deny(unused_parens)]
#![allow(unreachable_code)]
fn main() {
let _b = false;
- if (_b) {
+ if (_b) { //~ ERROR unnecessary parentheses
println!("hello");
}
@@ -26,29 +25,29 @@ fn main() {
fn f() -> bool {
let c = false;
- if(c) {
+ if(c) { //~ ERROR unnecessary parentheses
println!("next");
}
- if (c){
+ if (c){ //~ ERROR unnecessary parentheses
println!("prev");
}
while (false && true){
- if (c) {
+ if (c) { //~ ERROR unnecessary parentheses
println!("norm");
}
}
- while(true && false) {
- for _ in (0 .. 3){
+ while(true && false) { //~ ERROR unnecessary parentheses
+ for _ in (0 .. 3){ //~ ERROR unnecessary parentheses
println!("e~")
}
}
- for _ in (0 .. 3) {
- while (true && false) {
+ for _ in (0 .. 3) { //~ ERROR unnecessary parentheses
+ while (true && false) { //~ ERROR unnecessary parentheses
println!("e~")
}
}
diff --git a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr
index b4eab200dd016..873f105435e08 100644
--- a/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr
+++ b/src/test/ui/lint/unused_parens_remove_json_suggestion.stderr
@@ -1,666 +1,72 @@
-{
- "message": "unnecessary parentheses around `if` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 521,
- "byte_end": 525,
- "line_start": 18,
- "line_end": 18,
- "column_start": 8,
- "column_end": 12,
- "is_primary": true,
- "text": [
- {
- "text": " if (_b) {",
- "highlight_start": 8,
- "highlight_end": 12
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "lint level defined here",
- "code": null,
- "level": "note",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 435,
- "byte_end": 448,
- "line_start": 11,
- "line_end": 11,
- "column_start": 9,
- "column_end": 22,
- "is_primary": true,
- "text": [
- {
- "text": "#![warn(unused_parens)]",
- "highlight_start": 9,
- "highlight_end": 22
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- },
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 521,
- "byte_end": 525,
- "line_start": 18,
- "line_end": 18,
- "column_start": 8,
- "column_end": 12,
- "is_primary": true,
- "text": [
- {
- "text": " if (_b) {",
- "highlight_start": 8,
- "highlight_end": 12
- }
- ],
- "label": null,
- "suggested_replacement": "_b",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `if` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:18:8
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":500,"byte_end":504,"line_start":17,"line_end":17,"column_start":8,"column_end":12,"is_primary":true,"text":[{"text":" if (_b) {
+ --> $DIR/unused_parens_remove_json_suggestion.rs:17:8
|
LL | if (_b) {
| ^^^^ help: remove these parentheses
|
note: lint level defined here
- --> $DIR/unused_parens_remove_json_suggestion.rs:11:9
+ --> $DIR/unused_parens_remove_json_suggestion.rs:10:9
|
-LL | #![warn(unused_parens)]
+LL | #![deny(unused_parens)]
| ^^^^^^^^^^^^^
-"
-}
-{
- "message": "unnecessary parentheses around `if` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 618,
- "byte_end": 621,
- "line_start": 29,
- "line_end": 29,
- "column_start": 7,
- "column_end": 10,
- "is_primary": true,
- "text": [
- {
- "text": " if(c) {",
- "highlight_start": 7,
- "highlight_end": 10
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 618,
- "byte_end": 621,
- "line_start": 29,
- "line_end": 29,
- "column_start": 7,
- "column_end": 10,
- "is_primary": true,
- "text": [
- {
- "text": " if(c) {",
- "highlight_start": 7,
- "highlight_end": 10
- }
- ],
- "label": null,
- "suggested_replacement": " c",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `if` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:29:7
+"}
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":631,"byte_end":634,"line_start":28,"line_end":28,"column_start":7,"column_end":10,"is_primary":true,"text":[{"text":" if(c) {
+ --> $DIR/unused_parens_remove_json_suggestion.rs:28:7
|
LL | if(c) {
| ^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `if` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 664,
- "byte_end": 667,
- "line_start": 33,
- "line_end": 33,
- "column_start": 8,
- "column_end": 11,
- "is_primary": true,
- "text": [
- {
- "text": " if (c){",
- "highlight_start": 8,
- "highlight_end": 11
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 664,
- "byte_end": 667,
- "line_start": 33,
- "line_end": 33,
- "column_start": 8,
- "column_end": 11,
- "is_primary": true,
- "text": [
- {
- "text": " if (c){",
- "highlight_start": 8,
- "highlight_end": 11
- }
- ],
- "label": null,
- "suggested_replacement": "c ",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `if` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:33:8
+"}
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":711,"byte_end":714,"line_start":32,"line_end":32,"column_start":8,"column_end":11,"is_primary":true,"text":[{"text":" if (c){
+ --> $DIR/unused_parens_remove_json_suggestion.rs:32:8
|
LL | if (c){
| ^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `while` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 712,
- "byte_end": 727,
- "line_start": 37,
- "line_end": 37,
- "column_start": 11,
- "column_end": 26,
- "is_primary": true,
- "text": [
- {
- "text": " while (false && true){",
- "highlight_start": 11,
- "highlight_end": 26
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 712,
- "byte_end": 727,
- "line_start": 37,
- "line_end": 37,
- "column_start": 11,
- "column_end": 26,
- "is_primary": true,
- "text": [
- {
- "text": " while (false && true){",
- "highlight_start": 11,
- "highlight_end": 26
- }
- ],
- "label": null,
- "suggested_replacement": "false && true ",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `while` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:37:11
+"}
+{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":808,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":null,"suggestion_applicability":null,"expansion":null}],"children":[{"message":"remove these parentheses","code":null,"level":"help","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":793,"byte_end":808,"line_start":36,"line_end":36,"column_start":11,"column_end":26,"is_primary":true,"text":[{"text":" while (false && true){","highlight_start":11,"highlight_end":26}],"label":null,"suggested_replacement":"false && true ","suggestion_applicability":"MachineApplicable","expansion":null}],"children":[],"rendered":null}],"rendered":"error: unnecessary parentheses around `while` condition
+ --> $DIR/unused_parens_remove_json_suggestion.rs:36:11
|
LL | while (false && true){
| ^^^^^^^^^^^^^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `if` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 740,
- "byte_end": 743,
- "line_start": 38,
- "line_end": 38,
- "column_start": 12,
- "column_end": 15,
- "is_primary": true,
- "text": [
- {
- "text": " if (c) {",
- "highlight_start": 12,
- "highlight_end": 15
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 740,
- "byte_end": 743,
- "line_start": 38,
- "line_end": 38,
- "column_start": 12,
- "column_end": 15,
- "is_primary": true,
- "text": [
- {
- "text": " if (c) {",
- "highlight_start": 12,
- "highlight_end": 15
- }
- ],
- "label": null,
- "suggested_replacement": "c",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `if` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:38:12
+"}
+{"message":"unnecessary parentheses around `if` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":821,"byte_end":824,"line_start":37,"line_end":37,"column_start":12,"column_end":15,"is_primary":true,"text":[{"text":" if (c) {
+ --> $DIR/unused_parens_remove_json_suggestion.rs:37:12
|
LL | if (c) {
| ^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `while` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 803,
- "byte_end": 818,
- "line_start": 44,
- "line_end": 44,
- "column_start": 10,
- "column_end": 25,
- "is_primary": true,
- "text": [
- {
- "text": " while(true && false) {",
- "highlight_start": 10,
- "highlight_end": 25
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 803,
- "byte_end": 818,
- "line_start": 44,
- "line_end": 44,
- "column_start": 10,
- "column_end": 25,
- "is_primary": true,
- "text": [
- {
- "text": " while(true && false) {",
- "highlight_start": 10,
- "highlight_end": 25
- }
- ],
- "label": null,
- "suggested_replacement": " true && false",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `while` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:44:10
+"}
+{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":918,"byte_end":933,"line_start":43,"line_end":43,"column_start":10,"column_end":25,"is_primary":true,"text":[{"text":" while(true && false) {
+ --> $DIR/unused_parens_remove_json_suggestion.rs:43:10
|
LL | while(true && false) {
| ^^^^^^^^^^^^^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `for` head expression",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 838,
- "byte_end": 846,
- "line_start": 45,
- "line_end": 45,
- "column_start": 18,
- "column_end": 26,
- "is_primary": true,
- "text": [
- {
- "text": " for _ in (0 .. 3){",
- "highlight_start": 18,
- "highlight_end": 26
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 838,
- "byte_end": 846,
- "line_start": 45,
- "line_end": 45,
- "column_start": 18,
- "column_end": 26,
- "is_primary": true,
- "text": [
- {
- "text": " for _ in (0 .. 3){",
- "highlight_start": 18,
- "highlight_end": 26
- }
- ],
- "label": null,
- "suggested_replacement": "0 .. 3 ",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `for` head expression
- --> $DIR/unused_parens_remove_json_suggestion.rs:45:18
+"}
+{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":987,"byte_end":995,"line_start":44,"line_end":44,"column_start":18,"column_end":26,"is_primary":true,"text":[{"text":" for _ in (0 .. 3){
+ --> $DIR/unused_parens_remove_json_suggestion.rs:44:18
|
LL | for _ in (0 .. 3){
| ^^^^^^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `for` head expression",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 905,
- "byte_end": 913,
- "line_start": 50,
- "line_end": 50,
- "column_start": 14,
- "column_end": 22,
- "is_primary": true,
- "text": [
- {
- "text": " for _ in (0 .. 3) {",
- "highlight_start": 14,
- "highlight_end": 22
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 905,
- "byte_end": 913,
- "line_start": 50,
- "line_end": 50,
- "column_start": 14,
- "column_end": 22,
- "is_primary": true,
- "text": [
- {
- "text": " for _ in (0 .. 3) {",
- "highlight_start": 14,
- "highlight_end": 22
- }
- ],
- "label": null,
- "suggested_replacement": "0 .. 3",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `for` head expression
- --> $DIR/unused_parens_remove_json_suggestion.rs:50:14
+"}
+{"message":"unnecessary parentheses around `for` head expression","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1088,"byte_end":1096,"line_start":49,"line_end":49,"column_start":14,"column_end":22,"is_primary":true,"text":[{"text":" for _ in (0 .. 3) {
+ --> $DIR/unused_parens_remove_json_suggestion.rs:49:14
|
LL | for _ in (0 .. 3) {
| ^^^^^^^^ help: remove these parentheses
-"
-}
-{
- "message": "unnecessary parentheses around `while` condition",
- "code": {
- "code": "unused_parens",
- "explanation": null
- },
- "level": "warning",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 930,
- "byte_end": 945,
- "line_start": 51,
- "line_end": 51,
- "column_start": 15,
- "column_end": 30,
- "is_primary": true,
- "text": [
- {
- "text": " while (true && false) {",
- "highlight_start": 15,
- "highlight_end": 30
- }
- ],
- "label": null,
- "suggested_replacement": null,
- "suggestion_applicability": null,
- "expansion": null
- }
- ],
- "children": [
- {
- "message": "remove these parentheses",
- "code": null,
- "level": "help",
- "spans": [
- {
- "file_name": "$DIR/unused_parens_remove_json_suggestion.rs",
- "byte_start": 930,
- "byte_end": 945,
- "line_start": 51,
- "line_end": 51,
- "column_start": 15,
- "column_end": 30,
- "is_primary": true,
- "text": [
- {
- "text": " while (true && false) {",
- "highlight_start": 15,
- "highlight_end": 30
- }
- ],
- "label": null,
- "suggested_replacement": "true && false",
- "suggestion_applicability": "MachineApplicable",
- "expansion": null
- }
- ],
- "children": [],
- "rendered": null
- }
- ],
- "rendered": "warning: unnecessary parentheses around `while` condition
- --> $DIR/unused_parens_remove_json_suggestion.rs:51:15
+"}
+{"message":"unnecessary parentheses around `while` condition","code":{"code":"unused_parens","explanation":null},"level":"error","spans":[{"file_name":"$DIR/unused_parens_remove_json_suggestion.rs","byte_start":1147,"byte_end":1162,"line_start":50,"line_end":50,"column_start":15,"column_end":30,"is_primary":true,"text":[{"text":" while (true && false) {
+ --> $DIR/unused_parens_remove_json_suggestion.rs:50:15
|
LL | while (true && false) {
| ^^^^^^^^^^^^^^^ help: remove these parentheses
-"
-}
+"}
+{"message":"aborting due to 9 previous errors","code":null,"level":"error","spans":[],"children":[],"rendered":"error: aborting due to 9 previous errors
+
+"}
diff --git a/src/test/ui/repr/repr-packed-contains-align.stderr b/src/test/ui/repr/repr-packed-contains-align.stderr
index 219516d8abc48..df001d6b5f2a4 100644
--- a/src/test/ui/repr/repr-packed-contains-align.stderr
+++ b/src/test/ui/repr/repr-packed-contains-align.stderr
@@ -56,3 +56,4 @@ LL | | }
error: aborting due to 8 previous errors
+For more information about this error, try `rustc --explain E0588`.