From 900c13e7f465e53a3bae7ff91a1090d6faf29416 Mon Sep 17 00:00:00 2001 From: Marco Conte Date: Fri, 18 Oct 2019 12:28:04 +0100 Subject: [PATCH 01/19] enhance the documentation of std::io::BufReader regarding potential data loss --- src/libstd/io/buffered.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 9593a1bae0a3c..7870c56b476b6 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -24,7 +24,8 @@ use crate::memchr; /// /// When the `BufReader` is dropped, the contents of its buffer will be /// discarded. Creating multiple instances of a `BufReader` on the same -/// stream can cause data loss. +/// stream can cause data loss, as well as reading from the underlying reader +/// after unwrapping the `BufReader` instance with `BufReader::into_inner()`. /// /// [`Read`]: ../../std/io/trait.Read.html /// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read @@ -179,7 +180,8 @@ impl BufReader { /// Unwraps this `BufReader`, returning the underlying reader. /// - /// Note that any leftover data in the internal buffer is lost. + /// Note that any leftover data in the internal buffer is lost. Therefore, + /// a following read from the underlying reader may lead to data loss. /// /// # Examples /// From 5b5196ad65db877c2f140dfc7a25f3fc6f2e40c6 Mon Sep 17 00:00:00 2001 From: Marco Conte Date: Wed, 23 Oct 2019 18:11:41 +0100 Subject: [PATCH 02/19] rephrase sentence regarding data loss when using BufReader::into_inner --- src/libstd/io/buffered.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs index 7870c56b476b6..ad567c97c2c40 100644 --- a/src/libstd/io/buffered.rs +++ b/src/libstd/io/buffered.rs @@ -24,8 +24,9 @@ use crate::memchr; /// /// When the `BufReader` is dropped, the contents of its buffer will be /// discarded. Creating multiple instances of a `BufReader` on the same -/// stream can cause data loss, as well as reading from the underlying reader -/// after unwrapping the `BufReader` instance with `BufReader::into_inner()`. +/// stream can cause data loss. Reading from the underlying reader after +/// unwrapping the `BufReader` with `BufReader::into_inner` can also cause +/// data loss. /// /// [`Read`]: ../../std/io/trait.Read.html /// [`TcpStream::read`]: ../../std/net/struct.TcpStream.html#method.read From 05c07916ed05c6904c1df841921c284b56a51190 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Nov 2019 23:15:45 +0100 Subject: [PATCH 03/19] consistent handling of missing sysroot spans --- src/test/ui/async-await/issues/issue-62009-1.rs | 3 +-- .../ui/async-await/issues/issue-62009-1.stderr | 12 ++++++------ src/test/ui/closures/closure-move-sync.rs | 3 +-- src/test/ui/closures/closure-move-sync.stderr | 8 ++++---- src/test/ui/consts/const-size_of-cycle.rs | 3 +-- src/test/ui/consts/const-size_of-cycle.stderr | 6 +++--- src/test/ui/impl-trait/impl-generic-mismatch.rs | 3 +-- .../ui/impl-trait/impl-generic-mismatch.stderr | 6 +++--- ...rn-prelude-extern-crate-restricted-shadowing.rs | 3 +-- ...relude-extern-crate-restricted-shadowing.stderr | 6 +++--- .../in-band-lifetimes/mismatched_trait_impl-2.rs | 3 +-- .../mismatched_trait_impl-2.stderr | 2 +- .../ui/interior-mutability/interior-mutability.rs | 3 +-- .../interior-mutability/interior-mutability.stderr | 4 ++-- src/test/ui/issues/issue-21160.rs | 3 +-- src/test/ui/issues/issue-21160.stderr | 2 +- src/test/ui/issues/issue-27033.rs | 3 +-- src/test/ui/issues/issue-27033.stderr | 4 ++-- src/test/ui/no-send-res-ports.rs | 3 +-- src/test/ui/no-send-res-ports.stderr | 6 +++--- .../termination-trait-test-wrong-type.rs | 3 +-- .../termination-trait-test-wrong-type.stderr | 2 +- src/test/ui/traits/trait-suggest-where-clause.rs | 3 +-- .../ui/traits/trait-suggest-where-clause.stderr | 14 +++++++------- src/test/ui/type_length_limit.rs | 3 +-- 25 files changed, 49 insertions(+), 62 deletions(-) diff --git a/src/test/ui/async-await/issues/issue-62009-1.rs b/src/test/ui/async-await/issues/issue-62009-1.rs index 788474365c9e5..e95f7df388c45 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.rs +++ b/src/test/ui/async-await/issues/issue-62009-1.rs @@ -1,6 +1,5 @@ // edition:2018 -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) async fn print_dur() {} 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 538430290d299..6c8e0d0a5c403 100644 --- a/src/test/ui/async-await/issues/issue-62009-1.stderr +++ b/src/test/ui/async-await/issues/issue-62009-1.stderr @@ -1,5 +1,5 @@ error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:8:5 + --> $DIR/issue-62009-1.rs:7:5 | LL | fn main() { | ---- this is not `async` @@ -7,7 +7,7 @@ LL | async { let (); }.await; | ^^^^^^^^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:10:5 + --> $DIR/issue-62009-1.rs:9:5 | LL | fn main() { | ---- this is not `async` @@ -19,7 +19,7 @@ LL | | }.await; | |___________^ only allowed inside `async` functions and blocks error[E0728]: `await` is only allowed inside `async` functions and blocks - --> $DIR/issue-62009-1.rs:14:5 + --> $DIR/issue-62009-1.rs:13:5 | LL | fn main() { | ---- this is not `async` @@ -27,11 +27,11 @@ LL | fn main() { LL | (|_| 2333).await; | ^^^^^^^^^^^^^^^^ only allowed inside `async` functions and blocks -error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:14:5: 14:15]: std::future::Future` is not satisfied - --> $DIR/issue-62009-1.rs:14:5 +error[E0277]: the trait bound `[closure@$DIR/issue-62009-1.rs:13:5: 13:15]: std::future::Future` is not satisfied + --> $DIR/issue-62009-1.rs:13:5 | LL | (|_| 2333).await; - | ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:14:5: 14:15]` + | ^^^^^^^^^^^^^^^^ the trait `std::future::Future` is not implemented for `[closure@$DIR/issue-62009-1.rs:13:5: 13:15]` | ::: $SRC_DIR/libstd/future.rs:LL:COL | diff --git a/src/test/ui/closures/closure-move-sync.rs b/src/test/ui/closures/closure-move-sync.rs index 951a3bcb5f423..2f1e6c81ae5a8 100644 --- a/src/test/ui/closures/closure-move-sync.rs +++ b/src/test/ui/closures/closure-move-sync.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::thread; use std::sync::mpsc::channel; diff --git a/src/test/ui/closures/closure-move-sync.stderr b/src/test/ui/closures/closure-move-sync.stderr index f676df9c559eb..ac5e3ccb42187 100644 --- a/src/test/ui/closures/closure-move-sync.stderr +++ b/src/test/ui/closures/closure-move-sync.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:8:13 + --> $DIR/closure-move-sync.rs:7:13 | LL | let t = thread::spawn(|| { | ^^^^^^^^^^^^^ `std::sync::mpsc::Receiver<()>` cannot be shared between threads safely @@ -11,10 +11,10 @@ LL | F: FnOnce() -> T, F: Send + 'static, T: Send + 'static | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Receiver<()>` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Receiver<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:8:27: 11:6 recv:&std::sync::mpsc::Receiver<()>]` + = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:7:27: 10:6 recv:&std::sync::mpsc::Receiver<()>]` error[E0277]: `std::sync::mpsc::Sender<()>` cannot be shared between threads safely - --> $DIR/closure-move-sync.rs:20:5 + --> $DIR/closure-move-sync.rs:19:5 | LL | thread::spawn(|| tx.send(()).unwrap()); | ^^^^^^^^^^^^^ `std::sync::mpsc::Sender<()>` cannot be shared between threads safely @@ -26,7 +26,7 @@ LL | F: FnOnce() -> T, F: Send + 'static, T: Send + 'static | = help: the trait `std::marker::Sync` is not implemented for `std::sync::mpsc::Sender<()>` = note: required because of the requirements on the impl of `std::marker::Send` for `&std::sync::mpsc::Sender<()>` - = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:20:19: 20:42 tx:&std::sync::mpsc::Sender<()>]` + = note: required because it appears within the type `[closure@$DIR/closure-move-sync.rs:19:19: 19:42 tx:&std::sync::mpsc::Sender<()>]` error: aborting due to 2 previous errors diff --git a/src/test/ui/consts/const-size_of-cycle.rs b/src/test/ui/consts/const-size_of-cycle.rs index 1bbe881872cb3..6c35b9212c6cb 100644 --- a/src/test/ui/consts/const-size_of-cycle.rs +++ b/src/test/ui/consts/const-size_of-cycle.rs @@ -1,5 +1,4 @@ -// ignore-musl -// ignore-x86 +// ignore-x86 FIXME: missing sysroot spans (#53081) // error-pattern: cycle detected struct Foo { diff --git a/src/test/ui/consts/const-size_of-cycle.stderr b/src/test/ui/consts/const-size_of-cycle.stderr index 1ae39e7563a82..5b06ade44c5cb 100644 --- a/src/test/ui/consts/const-size_of-cycle.stderr +++ b/src/test/ui/consts/const-size_of-cycle.stderr @@ -1,11 +1,11 @@ error[E0391]: cycle detected when const-evaluating + checking `Foo::bytes::{{constant}}#0` - --> $DIR/const-size_of-cycle.rs:6:17 + --> $DIR/const-size_of-cycle.rs:5:17 | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ | note: ...which requires const-evaluating + checking `Foo::bytes::{{constant}}#0`... - --> $DIR/const-size_of-cycle.rs:6:17 + --> $DIR/const-size_of-cycle.rs:5:17 | LL | bytes: [u8; std::mem::size_of::()] | ^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -23,7 +23,7 @@ LL | pub fn size_of() -> usize; = note: ...which requires normalizing `ParamEnvAnd { param_env: ParamEnv { caller_bounds: [], reveal: All, def_id: None }, value: [u8; _] }`... = note: ...which again requires const-evaluating + checking `Foo::bytes::{{constant}}#0`, completing the cycle note: cycle used when processing `Foo` - --> $DIR/const-size_of-cycle.rs:5:1 + --> $DIR/const-size_of-cycle.rs:4:1 | LL | struct Foo { | ^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.rs b/src/test/ui/impl-trait/impl-generic-mismatch.rs index f4fba4c34c142..5597df4ba499b 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.rs +++ b/src/test/ui/impl-trait/impl-generic-mismatch.rs @@ -1,5 +1,4 @@ -// ignore-musl -// ignore-x86 +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::fmt::Debug; diff --git a/src/test/ui/impl-trait/impl-generic-mismatch.stderr b/src/test/ui/impl-trait/impl-generic-mismatch.stderr index bfe94119a02f6..2278519e95ad1 100644 --- a/src/test/ui/impl-trait/impl-generic-mismatch.stderr +++ b/src/test/ui/impl-trait/impl-generic-mismatch.stderr @@ -1,5 +1,5 @@ error[E0643]: method `foo` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:11:12 + --> $DIR/impl-generic-mismatch.rs:10:12 | LL | fn foo(&self, _: &impl Debug); | ---------- declaration in trait here @@ -13,7 +13,7 @@ LL | fn foo(&self, _: &impl Debug) { } | -- ^^^^^^^^^^ error[E0643]: method `bar` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:20:23 + --> $DIR/impl-generic-mismatch.rs:19:23 | LL | fn bar(&self, _: &U); | - declaration in trait here @@ -27,7 +27,7 @@ LL | fn bar(&self, _: &U) { } | ^^^^^^^^^^ ^ error[E0643]: method `hash` has incompatible signature for trait - --> $DIR/impl-generic-mismatch.rs:31:33 + --> $DIR/impl-generic-mismatch.rs:30:33 | LL | fn hash(&self, hasher: &mut impl Hasher) {} | ^^^^^^^^^^^ expected generic parameter, found `impl Trait` diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs index ce8c2d5168fbb..abcc92ce34d17 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // aux-build:two_macros.rs macro_rules! define_vec { diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index 8e01fc8df3def..7a55abe42556c 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -1,5 +1,5 @@ error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:21:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:20:9 | LL | extern crate std as core; | ^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -8,13 +8,13 @@ LL | define_other_core!(); | --------------------- in this macro invocation error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:15:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:14:9 | LL | Vec::panic!(); | ^^^ ambiguous name | note: `Vec` could refer to the crate imported here - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:7:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:6:9 | LL | extern crate std as Vec; | ^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs index eca9a67fcb387..369de04007022 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::ops::Deref; trait Trait {} diff --git a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr index d3862e3d4df60..8086d3f1fbc64 100644 --- a/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr +++ b/src/test/ui/in-band-lifetimes/mismatched_trait_impl-2.stderr @@ -1,5 +1,5 @@ error: `impl` item signature doesn't match `trait` item signature - --> $DIR/mismatched_trait_impl-2.rs:10:5 + --> $DIR/mismatched_trait_impl-2.rs:9:5 | LL | fn deref(&self) -> &dyn Trait { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ found fn(&Struct) -> &dyn Trait diff --git a/src/test/ui/interior-mutability/interior-mutability.rs b/src/test/ui/interior-mutability/interior-mutability.rs index 6968e3669caec..60633fdd393ee 100644 --- a/src/test/ui/interior-mutability/interior-mutability.rs +++ b/src/test/ui/interior-mutability/interior-mutability.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::cell::Cell; use std::panic::catch_unwind; fn main() { diff --git a/src/test/ui/interior-mutability/interior-mutability.stderr b/src/test/ui/interior-mutability/interior-mutability.stderr index b76fce2880552..5c129524f51b4 100644 --- a/src/test/ui/interior-mutability/interior-mutability.stderr +++ b/src/test/ui/interior-mutability/interior-mutability.stderr @@ -1,5 +1,5 @@ error[E0277]: the type `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary - --> $DIR/interior-mutability.rs:7:5 + --> $DIR/interior-mutability.rs:6:5 | LL | catch_unwind(|| { x.set(23); }); | ^^^^^^^^^^^^ `std::cell::UnsafeCell` may contain interior mutability and a reference may not be safely transferrable across a catch_unwind boundary @@ -12,7 +12,7 @@ LL | pub fn catch_unwind R + UnwindSafe, R>(f: F) -> Result { = help: within `std::cell::Cell`, the trait `std::panic::RefUnwindSafe` is not implemented for `std::cell::UnsafeCell` = note: required because it appears within the type `std::cell::Cell` = note: required because of the requirements on the impl of `std::panic::UnwindSafe` for `&std::cell::Cell` - = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:7:18: 7:35 x:&std::cell::Cell]` + = note: required because it appears within the type `[closure@$DIR/interior-mutability.rs:6:18: 6:35 x:&std::cell::Cell]` error: aborting due to previous error diff --git a/src/test/ui/issues/issue-21160.rs b/src/test/ui/issues/issue-21160.rs index dfb39743352fc..0199abbd8f04a 100644 --- a/src/test/ui/issues/issue-21160.rs +++ b/src/test/ui/issues/issue-21160.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) struct Bar; impl Bar { diff --git a/src/test/ui/issues/issue-21160.stderr b/src/test/ui/issues/issue-21160.stderr index 9f88fa2fadd4c..65ba64b49d06d 100644 --- a/src/test/ui/issues/issue-21160.stderr +++ b/src/test/ui/issues/issue-21160.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Bar: std::hash::Hash` is not satisfied - --> $DIR/issue-21160.rs:10:12 + --> $DIR/issue-21160.rs:9:12 | LL | struct Foo(Bar); | ^^^ the trait `std::hash::Hash` is not implemented for `Bar` diff --git a/src/test/ui/issues/issue-27033.rs b/src/test/ui/issues/issue-27033.rs index bcb06d743a05d..7120dee6339f1 100644 --- a/src/test/ui/issues/issue-27033.rs +++ b/src/test/ui/issues/issue-27033.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) fn main() { match Some(1) { None @ _ => {} //~ ERROR match bindings cannot shadow unit variants diff --git a/src/test/ui/issues/issue-27033.stderr b/src/test/ui/issues/issue-27033.stderr index a4baa7bdf7f85..2d6d2ef41bd74 100644 --- a/src/test/ui/issues/issue-27033.stderr +++ b/src/test/ui/issues/issue-27033.stderr @@ -1,5 +1,5 @@ error[E0530]: match bindings cannot shadow unit variants - --> $DIR/issue-27033.rs:5:9 + --> $DIR/issue-27033.rs:4:9 | LL | None @ _ => {} | ^^^^ cannot be named the same as a unit variant @@ -10,7 +10,7 @@ LL | pub use crate::option::Option::{self, Some, None}; | ---- the unit variant `None` is defined here error[E0530]: match bindings cannot shadow constants - --> $DIR/issue-27033.rs:9:9 + --> $DIR/issue-27033.rs:8:9 | LL | const C: u8 = 1; | ---------------- the constant `C` is defined here diff --git a/src/test/ui/no-send-res-ports.rs b/src/test/ui/no-send-res-ports.rs index 01fc29713a45d..85d812dd61904 100644 --- a/src/test/ui/no-send-res-ports.rs +++ b/src/test/ui/no-send-res-ports.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::thread; use std::rc::Rc; diff --git a/src/test/ui/no-send-res-ports.stderr b/src/test/ui/no-send-res-ports.stderr index dc186f7c85e94..f23a3bf832ab6 100644 --- a/src/test/ui/no-send-res-ports.stderr +++ b/src/test/ui/no-send-res-ports.stderr @@ -1,5 +1,5 @@ error[E0277]: `std::rc::Rc<()>` cannot be sent between threads safely - --> $DIR/no-send-res-ports.rs:27:5 + --> $DIR/no-send-res-ports.rs:26:5 | LL | thread::spawn(move|| { | ^^^^^^^^^^^^^ `std::rc::Rc<()>` cannot be sent between threads safely @@ -9,10 +9,10 @@ LL | thread::spawn(move|| { LL | F: FnOnce() -> T, F: Send + 'static, T: Send + 'static | ---- required by this bound in `std::thread::spawn` | - = help: within `[closure@$DIR/no-send-res-ports.rs:27:19: 31:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` + = help: within `[closure@$DIR/no-send-res-ports.rs:26:19: 30:6 x:main::Foo]`, the trait `std::marker::Send` is not implemented for `std::rc::Rc<()>` = note: required because it appears within the type `Port<()>` = note: required because it appears within the type `main::Foo` - = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:27:19: 31:6 x:main::Foo]` + = note: required because it appears within the type `[closure@$DIR/no-send-res-ports.rs:26:19: 30:6 x:main::Foo]` error: aborting due to previous error diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs index c27cea302fc40..a028247ec5c11 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.rs @@ -1,6 +1,5 @@ // compile-flags: --test -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::num::ParseFloatError; diff --git a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr index 6aa95c308f248..9cefef58bf53a 100644 --- a/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr +++ b/src/test/ui/rfc-1937-termination-trait/termination-trait-test-wrong-type.stderr @@ -1,5 +1,5 @@ error[E0277]: `main` has invalid return type `std::result::Result` - --> $DIR/termination-trait-test-wrong-type.rs:8:1 + --> $DIR/termination-trait-test-wrong-type.rs:7:1 | LL | / fn can_parse_zero_as_f32() -> Result { LL | | "0".parse() diff --git a/src/test/ui/traits/trait-suggest-where-clause.rs b/src/test/ui/traits/trait-suggest-where-clause.rs index 5ed14a6a86685..5d3464d20f30d 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.rs +++ b/src/test/ui/traits/trait-suggest-where-clause.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) use std::mem; struct Misc(T); diff --git a/src/test/ui/traits/trait-suggest-where-clause.stderr b/src/test/ui/traits/trait-suggest-where-clause.stderr index f1004ea9dc6ee..2bb7defdac710 100644 --- a/src/test/ui/traits/trait-suggest-where-clause.stderr +++ b/src/test/ui/traits/trait-suggest-where-clause.stderr @@ -1,5 +1,5 @@ error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:9:20 + --> $DIR/trait-suggest-where-clause.rs:8:20 | LL | fn check() { | -- help: consider further restricting this bound: `U: std::marker::Sized +` @@ -16,7 +16,7 @@ LL | pub const fn size_of() -> usize { = note: to learn more, visit error[E0277]: the size for values of type `U` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:12:5 + --> $DIR/trait-suggest-where-clause.rs:11:5 | LL | fn check() { | -- help: consider further restricting this bound: `U: std::marker::Sized +` @@ -34,7 +34,7 @@ LL | pub const fn size_of() -> usize { = note: required because it appears within the type `Misc` error[E0277]: the trait bound `u64: std::convert::From` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:17:5 + --> $DIR/trait-suggest-where-clause.rs:16:5 | LL | >::from; | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `u64` @@ -42,7 +42,7 @@ LL | >::from; = note: required by `std::convert::From::from` error[E0277]: the trait bound `u64: std::convert::From<::Item>` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:20:5 + --> $DIR/trait-suggest-where-clause.rs:19:5 | LL | ::Item>>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From<::Item>` is not implemented for `u64` @@ -50,7 +50,7 @@ LL | ::Item>>::from; = note: required by `std::convert::From::from` error[E0277]: the trait bound `Misc<_>: std::convert::From` is not satisfied - --> $DIR/trait-suggest-where-clause.rs:25:5 + --> $DIR/trait-suggest-where-clause.rs:24:5 | LL | as From>::from; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::convert::From` is not implemented for `Misc<_>` @@ -58,7 +58,7 @@ LL | as From>::from; = note: required by `std::convert::From::from` error[E0277]: the size for values of type `[T]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:30:20 + --> $DIR/trait-suggest-where-clause.rs:29:20 | LL | mem::size_of::<[T]>(); | ^^^ doesn't have a size known at compile-time @@ -72,7 +72,7 @@ LL | pub const fn size_of() -> usize { = note: to learn more, visit error[E0277]: the size for values of type `[&U]` cannot be known at compilation time - --> $DIR/trait-suggest-where-clause.rs:33:5 + --> $DIR/trait-suggest-where-clause.rs:32:5 | LL | mem::size_of::<[&U]>(); | ^^^^^^^^^^^^^^^^^^^^ doesn't have a size known at compile-time diff --git a/src/test/ui/type_length_limit.rs b/src/test/ui/type_length_limit.rs index cd15f81a61535..926f12911c52a 100644 --- a/src/test/ui/type_length_limit.rs +++ b/src/test/ui/type_length_limit.rs @@ -1,5 +1,4 @@ -// ignore-musl -// ignore-x86 +// ignore-x86 FIXME: missing sysroot spans (#53081) // error-pattern: reached the type-length limit while instantiating // Test that the type length limit can be changed. From 18089689c0d06264f82b1d373e98a3d3a31c409a Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Sat, 2 Nov 2019 23:20:28 +0100 Subject: [PATCH 04/19] also adjust ignore in generated tests --- src/etc/generate-deriving-span-tests.py | 3 +-- src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs | 1 + .../ui/derives/derives-span-Clone-enum-struct-variant.stderr | 2 +- src/test/ui/derives/derives-span-Clone-enum.rs | 1 + src/test/ui/derives/derives-span-Clone-enum.stderr | 2 +- src/test/ui/derives/derives-span-Clone-struct.rs | 1 + src/test/ui/derives/derives-span-Clone-struct.stderr | 2 +- src/test/ui/derives/derives-span-Clone-tuple-struct.rs | 1 + src/test/ui/derives/derives-span-Clone-tuple-struct.stderr | 2 +- src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs | 1 + .../ui/derives/derives-span-Debug-enum-struct-variant.stderr | 2 +- src/test/ui/derives/derives-span-Debug-enum.rs | 1 + src/test/ui/derives/derives-span-Debug-enum.stderr | 2 +- src/test/ui/derives/derives-span-Debug-struct.rs | 1 + src/test/ui/derives/derives-span-Debug-struct.stderr | 2 +- src/test/ui/derives/derives-span-Debug-tuple-struct.rs | 1 + src/test/ui/derives/derives-span-Debug-tuple-struct.stderr | 2 +- src/test/ui/derives/derives-span-Default-struct.rs | 1 + src/test/ui/derives/derives-span-Default-struct.stderr | 2 +- src/test/ui/derives/derives-span-Default-tuple-struct.rs | 1 + src/test/ui/derives/derives-span-Default-tuple-struct.stderr | 2 +- src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs | 1 + .../ui/derives/derives-span-Eq-enum-struct-variant.stderr | 2 +- src/test/ui/derives/derives-span-Eq-enum.rs | 1 + src/test/ui/derives/derives-span-Eq-enum.stderr | 2 +- src/test/ui/derives/derives-span-Eq-struct.rs | 1 + src/test/ui/derives/derives-span-Eq-struct.stderr | 2 +- src/test/ui/derives/derives-span-Eq-tuple-struct.rs | 1 + src/test/ui/derives/derives-span-Eq-tuple-struct.stderr | 2 +- src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs | 3 +-- .../ui/derives/derives-span-Hash-enum-struct-variant.stderr | 2 +- src/test/ui/derives/derives-span-Hash-enum.rs | 3 +-- src/test/ui/derives/derives-span-Hash-enum.stderr | 2 +- src/test/ui/derives/derives-span-Hash-struct.rs | 3 +-- src/test/ui/derives/derives-span-Hash-struct.stderr | 2 +- src/test/ui/derives/derives-span-Hash-tuple-struct.rs | 3 +-- src/test/ui/derives/derives-span-Hash-tuple-struct.stderr | 2 +- src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs | 1 + .../ui/derives/derives-span-Ord-enum-struct-variant.stderr | 2 +- src/test/ui/derives/derives-span-Ord-enum.rs | 1 + src/test/ui/derives/derives-span-Ord-enum.stderr | 2 +- src/test/ui/derives/derives-span-Ord-struct.rs | 1 + src/test/ui/derives/derives-span-Ord-struct.stderr | 2 +- src/test/ui/derives/derives-span-Ord-tuple-struct.rs | 1 + src/test/ui/derives/derives-span-Ord-tuple-struct.stderr | 2 +- .../ui/derives/derives-span-PartialEq-enum-struct-variant.rs | 1 + .../derives/derives-span-PartialEq-enum-struct-variant.stderr | 4 ++-- src/test/ui/derives/derives-span-PartialEq-enum.rs | 1 + src/test/ui/derives/derives-span-PartialEq-enum.stderr | 4 ++-- src/test/ui/derives/derives-span-PartialEq-struct.rs | 1 + src/test/ui/derives/derives-span-PartialEq-struct.stderr | 4 ++-- src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs | 1 + .../ui/derives/derives-span-PartialEq-tuple-struct.stderr | 4 ++-- .../ui/derives/derives-span-PartialOrd-enum-struct-variant.rs | 1 + .../derives-span-PartialOrd-enum-struct-variant.stderr | 2 +- src/test/ui/derives/derives-span-PartialOrd-enum.rs | 1 + src/test/ui/derives/derives-span-PartialOrd-enum.stderr | 2 +- src/test/ui/derives/derives-span-PartialOrd-struct.rs | 1 + src/test/ui/derives/derives-span-PartialOrd-struct.stderr | 2 +- src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs | 1 + .../ui/derives/derives-span-PartialOrd-tuple-struct.stderr | 2 +- 61 files changed, 65 insertions(+), 44 deletions(-) diff --git a/src/etc/generate-deriving-span-tests.py b/src/etc/generate-deriving-span-tests.py index 66a3c8e555405..39c24fb10e590 100755 --- a/src/etc/generate-deriving-span-tests.py +++ b/src/etc/generate-deriving-span-tests.py @@ -14,8 +14,7 @@ os.path.join(os.path.dirname(__file__), '../test/ui/derives/')) TEMPLATE = """\ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' {error_deriving} diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs index b556d442420e0..da00f81b96ead 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr index 7db5fbe3de402..796e6a2b744f7 100644 --- a/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Clone-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-enum.rs b/src/test/ui/derives/derives-span-Clone-enum.rs index 9bb4f486c3ef0..98ae1b2c5b8a2 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.rs +++ b/src/test/ui/derives/derives-span-Clone-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-enum.stderr b/src/test/ui/derives/derives-span-Clone-enum.stderr index 4371dc900ac10..3e94bb551ea97 100644 --- a/src/test/ui/derives/derives-span-Clone-enum.stderr +++ b/src/test/ui/derives/derives-span-Clone-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-enum.rs:9:6 + --> $DIR/derives-span-Clone-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-struct.rs b/src/test/ui/derives/derives-span-Clone-struct.rs index f151636f848a0..db677e26f5049 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.rs +++ b/src/test/ui/derives/derives-span-Clone-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-struct.stderr b/src/test/ui/derives/derives-span-Clone-struct.stderr index cc3b602c9c0b9..0674d64fe9dfe 100644 --- a/src/test/ui/derives/derives-span-Clone-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-struct.rs:8:5 + --> $DIR/derives-span-Clone-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.rs b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs index 7a62885324ebd..d716b6fe900ca 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr index b2bf3527b0cc4..f6b4006014a3a 100644 --- a/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Clone-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::clone::Clone` is not satisfied - --> $DIR/derives-span-Clone-tuple-struct.rs:8:5 + --> $DIR/derives-span-Clone-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::clone::Clone` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs index 949597bc8f6ee..10deccb8ad7c1 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr index ca5bcfe930d61..6a0e382b9e545 100644 --- a/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Debug-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-enum.rs b/src/test/ui/derives/derives-span-Debug-enum.rs index b2a39708ceb9a..b8bed0eab552e 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.rs +++ b/src/test/ui/derives/derives-span-Debug-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-enum.stderr b/src/test/ui/derives/derives-span-Debug-enum.stderr index cd367a334fc60..f27499ba441a0 100644 --- a/src/test/ui/derives/derives-span-Debug-enum.stderr +++ b/src/test/ui/derives/derives-span-Debug-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-enum.rs:9:6 + --> $DIR/derives-span-Debug-enum.rs:10:6 | LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-struct.rs b/src/test/ui/derives/derives-span-Debug-struct.rs index cf91c9436a623..22f037ee36f24 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.rs +++ b/src/test/ui/derives/derives-span-Debug-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-struct.stderr b/src/test/ui/derives/derives-span-Debug-struct.stderr index e00695ec0ba62..09d62f12b0449 100644 --- a/src/test/ui/derives/derives-span-Debug-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-struct.rs:8:5 + --> $DIR/derives-span-Debug-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.rs b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs index cea973c91a783..c693facfeaa92 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr index 37440b59ae704..f100cf32fdf85 100644 --- a/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Debug-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: `Error` doesn't implement `std::fmt::Debug` - --> $DIR/derives-span-Debug-tuple-struct.rs:8:5 + --> $DIR/derives-span-Debug-tuple-struct.rs:9:5 | LL | Error | ^^^^^ `Error` cannot be formatted using `{:?}` diff --git a/src/test/ui/derives/derives-span-Default-struct.rs b/src/test/ui/derives/derives-span-Default-struct.rs index 71fd5829e7585..1654883998def 100644 --- a/src/test/ui/derives/derives-span-Default-struct.rs +++ b/src/test/ui/derives/derives-span-Default-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Default-struct.stderr b/src/test/ui/derives/derives-span-Default-struct.stderr index 413d4ec8c291a..11664d400ee71 100644 --- a/src/test/ui/derives/derives-span-Default-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied - --> $DIR/derives-span-Default-struct.rs:8:5 + --> $DIR/derives-span-Default-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::default::Default` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.rs b/src/test/ui/derives/derives-span-Default-tuple-struct.rs index 463f7d230ca41..f1390c8b6f6b5 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr index 8f4d43daa5191..c79f093942fdd 100644 --- a/src/test/ui/derives/derives-span-Default-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Default-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::default::Default` is not satisfied - --> $DIR/derives-span-Default-tuple-struct.rs:8:5 + --> $DIR/derives-span-Default-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::default::Default` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs index d2dab8687f774..77c386d7f9094 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr index 52ecce4632d12..87c0313ca1fc6 100644 --- a/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Eq-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-enum.rs b/src/test/ui/derives/derives-span-Eq-enum.rs index c6c0d4321083b..c7fe37813325d 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.rs +++ b/src/test/ui/derives/derives-span-Eq-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-enum.stderr b/src/test/ui/derives/derives-span-Eq-enum.stderr index bf91a0edc375b..c8db6d3ff2f7b 100644 --- a/src/test/ui/derives/derives-span-Eq-enum.stderr +++ b/src/test/ui/derives/derives-span-Eq-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-enum.rs:9:6 + --> $DIR/derives-span-Eq-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-struct.rs b/src/test/ui/derives/derives-span-Eq-struct.rs index df310039847d4..8674cadb3092d 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.rs +++ b/src/test/ui/derives/derives-span-Eq-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-struct.stderr b/src/test/ui/derives/derives-span-Eq-struct.stderr index 531e8887cd2bc..df4ea5b1d4144 100644 --- a/src/test/ui/derives/derives-span-Eq-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-struct.rs:8:5 + --> $DIR/derives-span-Eq-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.rs b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs index abf6526b90078..99cc9582b5b60 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr index 9e21c6c67bfc7..def06d710867f 100644 --- a/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Eq-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Eq` is not satisfied - --> $DIR/derives-span-Eq-tuple-struct.rs:8:5 + --> $DIR/derives-span-Eq-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::cmp::Eq` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs index ed87360a0be9f..604b0842fa93c 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr index 708ebca9fb153..cc1caf7804186 100644 --- a/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-enum-struct-variant.rs:11:6 + --> $DIR/derives-span-Hash-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-enum.rs b/src/test/ui/derives/derives-span-Hash-enum.rs index 5b3649c9826e6..bf3033a232c0c 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.rs +++ b/src/test/ui/derives/derives-span-Hash-enum.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-enum.stderr b/src/test/ui/derives/derives-span-Hash-enum.stderr index dc171cbe5dd13..246d821ed2bf6 100644 --- a/src/test/ui/derives/derives-span-Hash-enum.stderr +++ b/src/test/ui/derives/derives-span-Hash-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-enum.rs:11:6 + --> $DIR/derives-span-Hash-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-struct.rs b/src/test/ui/derives/derives-span-Hash-struct.rs index ead70861a0ad6..b6abb9d229e13 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.rs +++ b/src/test/ui/derives/derives-span-Hash-struct.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-struct.stderr b/src/test/ui/derives/derives-span-Hash-struct.stderr index 429449b82bf64..720c127635e62 100644 --- a/src/test/ui/derives/derives-span-Hash-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-struct.rs:10:5 + --> $DIR/derives-span-Hash-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.rs b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs index 820f13ed18ef2..e01351fe8a6ba 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.rs @@ -1,5 +1,4 @@ -// ignore-x86 -// ^ due to stderr output differences +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr index a6c4c479b24d7..1fd1e601eca01 100644 --- a/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Hash-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::hash::Hash` is not satisfied - --> $DIR/derives-span-Hash-tuple-struct.rs:10:5 + --> $DIR/derives-span-Hash-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::hash::Hash` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs index 62355cc2d9619..6d516d4b0adc3 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr index 5c0d4e4ebe917..f0d7e4465a79b 100644 --- a/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-Ord-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-enum.rs b/src/test/ui/derives/derives-span-Ord-enum.rs index 72738931d10f2..51b5d7f0ed1d2 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.rs +++ b/src/test/ui/derives/derives-span-Ord-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-enum.stderr b/src/test/ui/derives/derives-span-Ord-enum.stderr index 56268a237450a..37eca92e77e63 100644 --- a/src/test/ui/derives/derives-span-Ord-enum.stderr +++ b/src/test/ui/derives/derives-span-Ord-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-enum.rs:9:6 + --> $DIR/derives-span-Ord-enum.rs:10:6 | LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-struct.rs b/src/test/ui/derives/derives-span-Ord-struct.rs index 53d4c2c22b55f..c924ecaa315fc 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.rs +++ b/src/test/ui/derives/derives-span-Ord-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-struct.stderr b/src/test/ui/derives/derives-span-Ord-struct.stderr index 40dc3d09dad7e..72c1fe4803c4d 100644 --- a/src/test/ui/derives/derives-span-Ord-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-struct.rs:8:5 + --> $DIR/derives-span-Ord-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.rs b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs index 4e09c27098641..80546634690c3 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(Eq,PartialOrd,PartialEq)] diff --git a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr index 4a9dea8c12e9a..642c8579b514c 100644 --- a/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-Ord-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: the trait bound `Error: std::cmp::Ord` is not satisfied - --> $DIR/derives-span-Ord-tuple-struct.rs:8:5 + --> $DIR/derives-span-Ord-tuple-struct.rs:9:5 | LL | Error | ^^^^^ the trait `std::cmp::Ord` is not implemented for `Error` diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs index d66faa086dec7..b13798686c001 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr index ed5468cc4dac2..d6a5652560187 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-PartialEq-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.rs b/src/test/ui/derives/derives-span-PartialEq-enum.rs index 66edf460b312a..5f8f05ad94b47 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.rs +++ b/src/test/ui/derives/derives-span-PartialEq-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-enum.stderr b/src/test/ui/derives/derives-span-PartialEq-enum.stderr index 06a88c03f58af..1f5ad42a3aa33 100644 --- a/src/test/ui/derives/derives-span-PartialEq-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-enum.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:9:6 + --> $DIR/derives-span-PartialEq-enum.rs:10:6 | LL | Error | ^^^^^ @@ -7,7 +7,7 @@ LL | Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-enum.rs:9:6 + --> $DIR/derives-span-PartialEq-enum.rs:10:6 | LL | Error | ^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.rs b/src/test/ui/derives/derives-span-PartialEq-struct.rs index ce5c67af77f05..560bf582e8da2 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-struct.stderr index b8481048361e5..4e0b2fa4e6f26 100644 --- a/src/test/ui/derives/derives-span-PartialEq-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-struct.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ @@ -7,7 +7,7 @@ LL | x: Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs index eaa628311361c..09a3249f0593f 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' diff --git a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr index 4398d25212550..78e215534e0da 100644 --- a/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialEq-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0369]: binary operation `==` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-tuple-struct.rs:9:5 | LL | Error | ^^^^^ @@ -7,7 +7,7 @@ LL | Error = note: an implementation of `std::cmp::PartialEq` might be missing for `Error` error[E0369]: binary operation `!=` cannot be applied to type `Error` - --> $DIR/derives-span-PartialEq-tuple-struct.rs:8:5 + --> $DIR/derives-span-PartialEq-tuple-struct.rs:9:5 | LL | Error | ^^^^^ diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs index 0bc6f98d9825b..0d18bdc113aee 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr index ac9f45046353a..a6f0c873e2fd0 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum-struct-variant.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:9:6 + --> $DIR/derives-span-PartialOrd-enum-struct-variant.rs:10:6 | LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.rs b/src/test/ui/derives/derives-span-PartialOrd-enum.rs index ee4423f3bee7a..78e4babb976cd 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr index 3e684aef39f24..838126111c35e 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-enum.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-enum.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-enum.rs:9:6 + --> $DIR/derives-span-PartialOrd-enum.rs:10:6 | LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-struct.rs index 48435e0cd45a5..728ec75b6c40a 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr index 10659aac64217..2df64d915a94d 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-struct.rs:8:5 + --> $DIR/derives-span-PartialOrd-struct.rs:9:5 | LL | x: Error | ^^^^^^^^ no implementation for `Error < Error` and `Error > Error` diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs index 2aa412e6d1d8f..c92b47e9297be 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.rs @@ -1,3 +1,4 @@ +// ignore-x86 FIXME: missing sysroot spans (#53081) // This file was auto-generated using 'src/etc/generate-deriving-span-tests.py' #[derive(PartialEq)] diff --git a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr index cbe05e3784057..63aebe32ed298 100644 --- a/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr +++ b/src/test/ui/derives/derives-span-PartialOrd-tuple-struct.stderr @@ -1,5 +1,5 @@ error[E0277]: can't compare `Error` with `Error` - --> $DIR/derives-span-PartialOrd-tuple-struct.rs:8:5 + --> $DIR/derives-span-PartialOrd-tuple-struct.rs:9:5 | LL | Error | ^^^^^ no implementation for `Error < Error` and `Error > Error` From f66a331335f3ac931afabca6f927a9d7dc17db3e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Tue, 5 Nov 2019 17:41:40 +0100 Subject: [PATCH 05/19] When a URL hash refers to a hidden element, it makes the element visible --- src/librustdoc/html/static/main.js | 61 +++++++++++++++++++++++++----- 1 file changed, 51 insertions(+), 10 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 53e16978ff12b..9faddb8bc3f3f 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -161,17 +161,18 @@ function getSearchElement() { return window.history && typeof window.history.pushState === "function"; } + function isHidden(elem) { + return elem.offsetHeight === 0; + } + var main = document.getElementById("main"); + var savedHash = ""; - function onHashChange(ev) { - // If we're in mobile mode, we should hide the sidebar in any case. - hideSidebar(); - var match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/); - if (match) { - return highlightSourceLines(match, ev); - } + function handleHashes(ev) { var search = getSearchElement(); if (ev !== null && search && !hasClass(search, "hidden") && ev.newURL) { + // This block occurs when clicking on an element in the navbar while + // in a search. addClass(search, "hidden"); removeClass(main, "hidden"); var hash = ev.newURL.slice(ev.newURL.indexOf("#") + 1); @@ -183,6 +184,35 @@ function getSearchElement() { elem.scrollIntoView(); } } + // This part is used in case an element is not visible. + if (savedHash !== window.location.hash) { + savedHash = window.location.hash; + if (savedHash.length === 0) { + return; + } + var elem = document.getElementById(savedHash.slice(1)); // we remove the '#' + if (!elem || !isHidden(elem)) { + return; + } + var parent = elem.parentNode; + if (parent && hasClass(parent, "impl-items")) { + // In case this is a trait implementation item, we first need to toggle + // the "Show hidden undocumented items". + onEachLazy(parent.getElementsByClassName("collapsed"), function(e) { + if (e.parentNode === parent) { + // Only click on the toggle we're looking for. + e.click(); + return true; + } + }); + if (isHidden(elem)) { + // The whole parent is collapsed. We need to click on its toggle as well! + if (hasClass(parent.lastElementChild, "collapse-toggle")) { + parent.lastElementChild.click(); + } + } + } + } } function highlightSourceLines(match, ev) { @@ -228,6 +258,16 @@ function getSearchElement() { } } + function onHashChange(ev) { + // If we're in mobile mode, we should hide the sidebar in any case. + hideSidebar(); + var match = window.location.hash.match(/^#?(\d+)(?:-(\d+))?$/); + if (match) { + return highlightSourceLines(match, ev); + } + handleHashes(); + } + function expandSection(id) { var elem = document.getElementById(id); if (elem && isHidden(elem)) { @@ -246,9 +286,6 @@ function getSearchElement() { } } - highlightSourceLines(); - window.onhashchange = onHashChange; - // Gets the human-readable string for the virtual-key code of the // given KeyboardEvent, ev. // @@ -2615,6 +2652,10 @@ function getSearchElement() { insertAfter(popup, getSearchElement()); } + handleHashes(); + highlightSourceLines(); + window.onhashchange = onHashChange; + buildHelperPopup(); }()); From 62167c09e5941ca5c07d55f7496ab024287206a0 Mon Sep 17 00:00:00 2001 From: Srinivas Reddy Thatiparthy Date: Wed, 6 Nov 2019 19:20:01 +0530 Subject: [PATCH 06/19] using 2.0.log(2.0) in examples does not make it clear which is the base and number. This example makes it clear for programmers who take a glance at the example by following the calculation. It is more intuitive, and eliminates the need for executing the example in the playground. --- src/libstd/f64.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/libstd/f64.rs b/src/libstd/f64.rs index 44d25f1b47657..0588373dcdc3d 100644 --- a/src/libstd/f64.rs +++ b/src/libstd/f64.rs @@ -409,10 +409,10 @@ impl f64 { /// # Examples /// /// ``` - /// let five = 5.0_f64; + /// let twenty_five = 25.0_f64; /// - /// // log5(5) - 1 == 0 - /// let abs_difference = (five.log(5.0) - 1.0).abs(); + /// // log5(25) - 2 == 0 + /// let abs_difference = (twenty_five.log(5.0) - 2.0).abs(); /// /// assert!(abs_difference < 1e-10); /// ``` @@ -425,10 +425,10 @@ impl f64 { /// # Examples /// /// ``` - /// let two = 2.0_f64; + /// let four = 4.0_f64; /// - /// // log2(2) - 1 == 0 - /// let abs_difference = (two.log2() - 1.0).abs(); + /// // log2(4) - 2 == 0 + /// let abs_difference = (four.log2() - 2.0).abs(); /// /// assert!(abs_difference < 1e-10); /// ``` @@ -448,10 +448,10 @@ impl f64 { /// # Examples /// /// ``` - /// let ten = 10.0_f64; + /// let hundred = 100.0_f64; /// - /// // log10(10) - 1 == 0 - /// let abs_difference = (ten.log10() - 1.0).abs(); + /// // log10(100) - 2 == 0 + /// let abs_difference = (hundred.log10() - 2.0).abs(); /// /// assert!(abs_difference < 1e-10); /// ``` From c965432e1813efea0ae85ba5b5ea523a4df484a9 Mon Sep 17 00:00:00 2001 From: Umesh Kalappa Date: Wed, 30 Oct 2019 02:29:16 -0700 Subject: [PATCH 07/19] Ignore these tests ,since the called commands doesn't exist in VxWorks --- src/libstd/process.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/libstd/process.rs b/src/libstd/process.rs index 4b0cf8312f189..b1274a08cbe77 100644 --- a/src/libstd/process.rs +++ b/src/libstd/process.rs @@ -1661,7 +1661,7 @@ mod tests { // FIXME(#10380) these tests should not all be ignored on android. #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn smoke() { let p = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "exit 0"]).spawn() @@ -1683,7 +1683,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn exit_reported_right() { let p = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "exit 1"]).spawn() @@ -1698,7 +1698,7 @@ mod tests { #[test] #[cfg(unix)] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn signal_reported_right() { use crate::os::unix::process::ExitStatusExt; @@ -1726,7 +1726,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn stdout_works() { if cfg!(target_os = "windows") { let mut cmd = Command::new("cmd"); @@ -1740,7 +1740,7 @@ mod tests { } #[test] - #[cfg_attr(any(windows, target_os = "android"), ignore)] + #[cfg_attr(any(windows, target_os = "android", target_os = "vxworks"), ignore)] fn set_current_dir_works() { let mut cmd = Command::new("/bin/sh"); cmd.arg("-c").arg("pwd") @@ -1750,7 +1750,7 @@ mod tests { } #[test] - #[cfg_attr(any(windows, target_os = "android"), ignore)] + #[cfg_attr(any(windows, target_os = "android", target_os = "vxworks"), ignore)] fn stdin_works() { let mut p = Command::new("/bin/sh") .arg("-c").arg("read line; echo $line") @@ -1766,7 +1766,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn test_process_status() { let mut status = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "exit 1"]).status().unwrap() @@ -1792,7 +1792,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn test_process_output_output() { let Output {status, stdout, stderr} = if cfg!(target_os = "windows") { @@ -1808,7 +1808,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn test_process_output_error() { let Output {status, stdout, stderr} = if cfg!(target_os = "windows") { @@ -1823,7 +1823,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn test_finish_once() { let mut prog = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "exit 1"]).spawn().unwrap() @@ -1834,7 +1834,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn test_finish_twice() { let mut prog = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "exit 1"]).spawn().unwrap() @@ -1846,7 +1846,7 @@ mod tests { } #[test] - #[cfg_attr(target_os = "android", ignore)] + #[cfg_attr(any(target_os = "vxworks", target_os = "android"), ignore)] fn test_wait_with_output_once() { let prog = if cfg!(target_os = "windows") { Command::new("cmd").args(&["/C", "echo hello"]).stdout(Stdio::piped()).spawn().unwrap() @@ -1881,6 +1881,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "vxworks", ignore)] fn test_override_env() { use crate::env; @@ -1901,6 +1902,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "vxworks", ignore)] fn test_add_to_env() { let result = env_cmd().env("RUN_TEST_NEW_ENV", "123").output().unwrap(); let output = String::from_utf8_lossy(&result.stdout).to_string(); @@ -1910,6 +1912,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "vxworks", ignore)] fn test_capture_env_at_spawn() { use crate::env; @@ -1965,6 +1968,7 @@ mod tests { // Regression tests for #30862. #[test] + #[cfg_attr(target_os = "vxworks", ignore)] fn test_interior_nul_in_env_key_is_error() { match env_cmd().env("has-some-\0\0s-inside", "value").spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), @@ -1973,6 +1977,7 @@ mod tests { } #[test] + #[cfg_attr(target_os = "vxworks", ignore)] fn test_interior_nul_in_env_value_is_error() { match env_cmd().env("key", "has-some-\0\0s-inside").spawn() { Err(e) => assert_eq!(e.kind(), ErrorKind::InvalidInput), From 24e093c5c387f229d72329326f4474264475c0f4 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 7 Nov 2019 10:13:44 +0100 Subject: [PATCH 08/19] Remove old isHidden function --- src/librustdoc/html/static/main.js | 2 +- src/librustdoc/html/static/storage.js | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 9faddb8bc3f3f..c3667dcfe3df1 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -3,7 +3,7 @@ // Local js definitions: /* global addClass, getCurrentValue, hasClass */ -/* global isHidden, onEach, removeClass, updateLocalStorage */ +/* global onEach, removeClass, updateLocalStorage */ if (!String.prototype.startsWith) { String.prototype.startsWith = function(searchString, position) { diff --git a/src/librustdoc/html/static/storage.js b/src/librustdoc/html/static/storage.js index eae998ca3ecbf..d142d99ac704d 100644 --- a/src/librustdoc/html/static/storage.js +++ b/src/librustdoc/html/static/storage.js @@ -24,10 +24,6 @@ function removeClass(elem, className) { elem.classList.remove(className); } -function isHidden(elem) { - return elem.offsetParent === null; -} - function onEach(arr, func, reversed) { if (arr && arr.length > 0 && func) { var length = arr.length; From d4527b7e00de1e6ed5b22a3fdb99a4515f2ba482 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Thu, 7 Nov 2019 10:16:14 +0100 Subject: [PATCH 09/19] Only call onHashChange instead of both functions --- src/librustdoc/html/static/main.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index c3667dcfe3df1..2200d19d86c91 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -265,7 +265,7 @@ function getSearchElement() { if (match) { return highlightSourceLines(match, ev); } - handleHashes(); + handleHashes(ev); } function expandSection(id) { @@ -2652,8 +2652,7 @@ function getSearchElement() { insertAfter(popup, getSearchElement()); } - handleHashes(); - highlightSourceLines(); + onHashChange(); window.onhashchange = onHashChange; buildHelperPopup(); From 1906c6f714502b1a0de46b9c217dc02570c3fd3e Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 19 Oct 2019 00:48:21 +0200 Subject: [PATCH 10/19] Add `MaybeUninit` methods `uninit_array`, `slice_get_ref`, `slice_get_mut` --- src/libcore/mem/maybe_uninit.rs | 57 +++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 03093139bc2f9..46b0fd3c3cbaa 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -258,6 +258,37 @@ impl MaybeUninit { MaybeUninit { uninit: () } } + /// Create a new array of `MaybeUninit` items, in an uninitialized state. + /// + /// # Examples + /// + /// ``` + /// #![feature(maybe_uninit_uninit_array, maybe_uninit_extra, maybe_uninit_slice_assume_init)] + /// use std::mem::MaybeUninit; + /// + /// let input = b"Foo"; + /// let f = u8::to_ascii_uppercase; + /// + /// let mut buffer: [MaybeUninit; 32] = MaybeUninit::uninit_array(); + /// let vec; + /// let output = if let Some(buffer) = buffer.get_mut(..input.len()) { + /// buffer.iter_mut().zip(input).for_each(|(a, b)| { a.write(f(b)); }); + /// unsafe { MaybeUninit::slice_get_ref(buffer) } + /// } else { + /// vec = input.iter().map(f).collect::>(); + /// &vec + /// }; + /// + /// assert_eq!(output, b"FOO"); + /// ``` + #[unstable(feature = "maybe_uninit_uninit_array", issue = "0")] + #[inline(always)] + pub fn uninit_array() -> [Self; LEN] { + unsafe { + MaybeUninit::<[MaybeUninit; LEN]>::uninit().assume_init() + } + } + /// A promotable constant, equivalent to `uninit()`. #[unstable(feature = "internal_uninit_const", issue = "0", reason = "hack to work around promotability")] @@ -690,6 +721,32 @@ impl MaybeUninit { &mut *self.value } + /// Get a slice of assume-initialized items. + /// + /// # Safety + /// + /// It is up to the caller to guarantee that the `MaybeUninit` items + /// really are in an initialized state. + /// Calling this when the content is not yet fully initialized causes undefined behavior. + #[unstable(feature = "maybe_uninit_slice_assume_init", issue = "0")] + #[inline(always)] + pub unsafe fn slice_get_ref(slice: &[Self]) -> &[T] { + &*(slice as *const [Self] as *const [T]) + } + + /// Get a mutable slice of assume-initialized items. + /// + /// # Safety + /// + /// It is up to the caller to guarantee that the `MaybeUninit` items + /// really are in an initialized state. + /// Calling this when the content is not yet fully initialized causes undefined behavior. + #[unstable(feature = "maybe_uninit_slice_assume_init", issue = "0")] + #[inline(always)] + pub unsafe fn slice_get_mut(slice: &mut [Self]) -> &mut [T] { + &mut *(slice as *mut [Self] as *mut [T]) + } + /// Gets a pointer to the first element of the array. #[unstable(feature = "maybe_uninit_slice", issue = "63569")] #[inline(always)] From 05c14bcc3180092ec4c03d59977abf96db7b4b7a Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 26 Oct 2019 08:51:49 +0200 Subject: [PATCH 11/19] Apply docs suggestions from review Co-Authored-By: Mazdak Farrokhzad --- src/libcore/mem/maybe_uninit.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 46b0fd3c3cbaa..31f908e91f55e 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -721,11 +721,11 @@ impl MaybeUninit { &mut *self.value } - /// Get a slice of assume-initialized items. + /// Assuming all the elements are initialized, get a slice to them. /// /// # Safety /// - /// It is up to the caller to guarantee that the `MaybeUninit` items + /// It is up to the caller to guarantee that the `MaybeUninit` elements /// really are in an initialized state. /// Calling this when the content is not yet fully initialized causes undefined behavior. #[unstable(feature = "maybe_uninit_slice_assume_init", issue = "0")] @@ -734,11 +734,11 @@ impl MaybeUninit { &*(slice as *const [Self] as *const [T]) } - /// Get a mutable slice of assume-initialized items. + /// Assuming all the elements are initialized, get a mutable slice to them. /// /// # Safety /// - /// It is up to the caller to guarantee that the `MaybeUninit` items + /// It is up to the caller to guarantee that the `MaybeUninit` elements /// really are in an initialized state. /// Calling this when the content is not yet fully initialized causes undefined behavior. #[unstable(feature = "maybe_uninit_slice_assume_init", issue = "0")] From 639c4f779c60119383dd8a49b44522f6a6958a53 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Sat, 26 Oct 2019 09:19:48 +0200 Subject: [PATCH 12/19] MaybeUninit::uninit_array docs: better example --- src/libcore/mem/maybe_uninit.rs | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/libcore/mem/maybe_uninit.rs b/src/libcore/mem/maybe_uninit.rs index 31f908e91f55e..0c0a6d8a121b8 100644 --- a/src/libcore/mem/maybe_uninit.rs +++ b/src/libcore/mem/maybe_uninit.rs @@ -260,26 +260,32 @@ impl MaybeUninit { /// Create a new array of `MaybeUninit` items, in an uninitialized state. /// + /// Note: in a future Rust version this method may become unnecessary + /// when array literal syntax allows + /// [repeating const expressions](https://github.com/rust-lang/rust/issues/49147). + /// The example below could then use `let mut buf = [MaybeUninit::::uninit(); 32];`. + /// /// # Examples /// - /// ``` + /// ```no_run /// #![feature(maybe_uninit_uninit_array, maybe_uninit_extra, maybe_uninit_slice_assume_init)] + /// /// use std::mem::MaybeUninit; /// - /// let input = b"Foo"; - /// let f = u8::to_ascii_uppercase; - /// - /// let mut buffer: [MaybeUninit; 32] = MaybeUninit::uninit_array(); - /// let vec; - /// let output = if let Some(buffer) = buffer.get_mut(..input.len()) { - /// buffer.iter_mut().zip(input).for_each(|(a, b)| { a.write(f(b)); }); - /// unsafe { MaybeUninit::slice_get_ref(buffer) } - /// } else { - /// vec = input.iter().map(f).collect::>(); - /// &vec - /// }; + /// extern "C" { + /// fn read_into_buffer(ptr: *mut u8, max_len: usize) -> usize; + /// } + /// + /// /// Returns a (possibly smaller) slice of data that was actually read + /// fn read(buf: &mut [MaybeUninit]) -> &[u8] { + /// unsafe { + /// let len = read_into_buffer(buf.as_mut_ptr() as *mut u8, buf.len()); + /// MaybeUninit::slice_get_ref(&buf[..len]) + /// } + /// } /// - /// assert_eq!(output, b"FOO"); + /// let mut buf: [MaybeUninit; 32] = MaybeUninit::uninit_array(); + /// let data = read(&mut buf); /// ``` #[unstable(feature = "maybe_uninit_uninit_array", issue = "0")] #[inline(always)] From ccde510c95887a2a94e2ad194a7c166dd0c9bc63 Mon Sep 17 00:00:00 2001 From: Eduard-Mihai Burtescu Date: Thu, 7 Nov 2019 16:54:25 +0200 Subject: [PATCH 13/19] rustc_target: inline abi::FloatTy into abi::Primitive. --- src/librustc/ich/impls_syntax.rs | 1 - src/librustc/ty/layout.rs | 17 ++++++++-------- .../debuginfo/metadata.rs | 4 ++-- src/librustc_codegen_llvm/intrinsic.rs | 6 +++--- src/librustc_codegen_llvm/type_of.rs | 6 +++--- src/librustc_target/abi/call/mips64.rs | 6 +++--- src/librustc_target/abi/call/mod.rs | 2 +- src/librustc_target/abi/call/x86_64.rs | 2 +- src/librustc_target/abi/mod.rs | 20 +++++++------------ 9 files changed, 29 insertions(+), 35 deletions(-) diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 2201c4b0980b3..ff0ddb9ec0e6f 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -162,7 +162,6 @@ impl_stable_hash_for_spanned!(::syntax::ast::LitKind); impl_stable_hash_for!(enum ::syntax::ast::IntTy { Isize, I8, I16, I32, I64, I128 }); impl_stable_hash_for!(enum ::syntax::ast::UintTy { Usize, U8, U16, U32, U64, U128 }); impl_stable_hash_for!(enum ::syntax::ast::FloatTy { F32, F64 }); -impl_stable_hash_for!(enum ::rustc_target::abi::FloatTy { F32, F64 }); impl_stable_hash_for!(enum ::syntax::ast::Unsafety { Unsafe, Normal }); impl_stable_hash_for!(enum ::syntax::ast::Constness { Const, NotConst }); impl_stable_hash_for!(enum ::syntax::ast::Defaultness { Default, Final }); diff --git a/src/librustc/ty/layout.rs b/src/librustc/ty/layout.rs index 60aab6b6aa924..4bf500555f14b 100644 --- a/src/librustc/ty/layout.rs +++ b/src/librustc/ty/layout.rs @@ -132,8 +132,8 @@ impl PrimitiveExt for Primitive { fn to_ty<'tcx>(&self, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { match *self { Int(i, signed) => i.to_ty(tcx, signed), - Float(FloatTy::F32) => tcx.types.f32, - Float(FloatTy::F64) => tcx.types.f64, + F32 => tcx.types.f32, + F64 => tcx.types.f64, Pointer => tcx.mk_mut_ptr(tcx.mk_unit()), } } @@ -144,7 +144,7 @@ impl PrimitiveExt for Primitive { match *self { Int(i, signed) => i.to_ty(tcx, signed), Pointer => tcx.types.usize, - Float(..) => bug!("floats do not have an int type"), + F32 | F64 => bug!("floats do not have an int type"), } } } @@ -538,10 +538,10 @@ impl<'tcx> LayoutCx<'tcx, TyCtxt<'tcx>> { ty::Uint(ity) => { scalar(Int(Integer::from_attr(dl, attr::UnsignedInt(ity)), false)) } - ty::Float(fty) => scalar(Float(match fty { - ast::FloatTy::F32 => FloatTy::F32, - ast::FloatTy::F64 => FloatTy::F64, - })), + ty::Float(fty) => scalar(match fty { + ast::FloatTy::F32 => F32, + ast::FloatTy::F64 => F64, + }), ty::FnPtr(_) => { let mut ptr = scalar_unit(Pointer); ptr.valid_range = 1..=*ptr.valid_range.end(); @@ -2457,7 +2457,8 @@ impl_stable_hash_for!(enum crate::ty::layout::Integer { impl_stable_hash_for!(enum crate::ty::layout::Primitive { Int(integer, signed), - Float(fty), + F32, + F64, Pointer }); diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs index 5f18bb1700c14..f1bf451113152 100644 --- a/src/librustc_codegen_llvm/debuginfo/metadata.rs +++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs @@ -1904,8 +1904,8 @@ fn prepare_enum_metadata( let discr_type = match discr.value { layout::Int(t, _) => t, - layout::Float(layout::FloatTy::F32) => Integer::I32, - layout::Float(layout::FloatTy::F64) => Integer::I64, + layout::F32 => Integer::I32, + layout::F64 => Integer::I64, layout::Pointer => cx.data_layout().ptr_sized_integer(), }.to_ty(cx.tcx, false); diff --git a/src/librustc_codegen_llvm/intrinsic.rs b/src/librustc_codegen_llvm/intrinsic.rs index a4c3b42f51e9e..6935e09054d0b 100644 --- a/src/librustc_codegen_llvm/intrinsic.rs +++ b/src/librustc_codegen_llvm/intrinsic.rs @@ -18,7 +18,7 @@ use rustc::ty::layout::{self, LayoutOf, HasTyCtxt, Primitive}; use rustc::mir::interpret::GlobalId; use rustc_codegen_ssa::common::{IntPredicate, TypeKind}; use rustc::hir; -use rustc_target::abi::{FloatTy, HasDataLayout}; +use rustc_target::abi::HasDataLayout; use syntax::ast; use rustc_codegen_ssa::common::span_invalid_monomorphization_error; @@ -163,12 +163,12 @@ impl IntrinsicCallMethods<'tcx> for Builder<'a, 'll, 'tcx> { emit_va_arg(self, args[0], ret_ty) } } - Primitive::Float(FloatTy::F64) | + Primitive::F64 | Primitive::Pointer => { emit_va_arg(self, args[0], ret_ty) } // `va_arg` should never be used with the return type f32. - Primitive::Float(FloatTy::F32) => { + Primitive::F32 => { bug!("the va_arg intrinsic does not work with `f32`") } } diff --git a/src/librustc_codegen_llvm/type_of.rs b/src/librustc_codegen_llvm/type_of.rs index dc68872ede11c..c21e62e7562e3 100644 --- a/src/librustc_codegen_llvm/type_of.rs +++ b/src/librustc_codegen_llvm/type_of.rs @@ -3,7 +3,7 @@ use crate::common::*; use crate::type_::Type; use rustc::ty::{self, Ty, TypeFoldable}; use rustc::ty::layout::{self, Align, LayoutOf, FnAbiExt, PointeeInfo, Size, TyLayout}; -use rustc_target::abi::{FloatTy, TyLayoutMethods}; +use rustc_target::abi::TyLayoutMethods; use rustc::ty::print::obsolete::DefPathBasedNames; use rustc_codegen_ssa::traits::*; @@ -300,8 +300,8 @@ impl<'tcx> LayoutLlvmExt<'tcx> for TyLayout<'tcx> { scalar: &layout::Scalar, offset: Size) -> &'a Type { match scalar.value { layout::Int(i, _) => cx.type_from_integer( i), - layout::Float(FloatTy::F32) => cx.type_f32(), - layout::Float(FloatTy::F64) => cx.type_f64(), + layout::F32 => cx.type_f32(), + layout::F64 => cx.type_f64(), layout::Pointer => { // If we know the alignment, pick something better than i8. let pointee = if let Some(pointee) = self.pointee_info_at(cx, offset) { diff --git a/src/librustc_target/abi/call/mips64.rs b/src/librustc_target/abi/call/mips64.rs index db34d36621290..18b121f9c5bef 100644 --- a/src/librustc_target/abi/call/mips64.rs +++ b/src/librustc_target/abi/call/mips64.rs @@ -23,8 +23,8 @@ fn float_reg<'a, Ty, C>(cx: &C, ret: &ArgAbi<'a, Ty>, i: usize) -> Option { match ret.layout.field(cx, i).abi { abi::Abi::Scalar(ref scalar) => match scalar.value { - abi::Float(abi::FloatTy::F32) => Some(Reg::f32()), - abi::Float(abi::FloatTy::F64) => Some(Reg::f64()), + abi::F32 => Some(Reg::f32()), + abi::F64 => Some(Reg::f64()), _ => None }, _ => None @@ -107,7 +107,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &mut ArgAbi<'a, Ty>) // We only care about aligned doubles if let abi::Abi::Scalar(ref scalar) = field.abi { - if let abi::Float(abi::FloatTy::F64) = scalar.value { + if let abi::F64 = scalar.value { if offset.is_aligned(dl.f64_align.abi) { // Insert enough integers to cover [last_offset, offset) assert!(last_offset.is_aligned(dl.f64_align.abi)); diff --git a/src/librustc_target/abi/call/mod.rs b/src/librustc_target/abi/call/mod.rs index 396b962003803..6029b00aa31bd 100644 --- a/src/librustc_target/abi/call/mod.rs +++ b/src/librustc_target/abi/call/mod.rs @@ -287,7 +287,7 @@ impl<'a, Ty> TyLayout<'a, Ty> { let kind = match scalar.value { abi::Int(..) | abi::Pointer => RegKind::Integer, - abi::Float(_) => RegKind::Float, + abi::F32 | abi::F64 => RegKind::Float, }; HomogeneousAggregate::Homogeneous(Reg { kind, diff --git a/src/librustc_target/abi/call/x86_64.rs b/src/librustc_target/abi/call/x86_64.rs index 96fd077ec00b4..452ca024e61b4 100644 --- a/src/librustc_target/abi/call/x86_64.rs +++ b/src/librustc_target/abi/call/x86_64.rs @@ -45,7 +45,7 @@ fn classify_arg<'a, Ty, C>(cx: &C, arg: &ArgAbi<'a, Ty>) match scalar.value { abi::Int(..) | abi::Pointer => Class::Int, - abi::Float(_) => Class::Sse + abi::F32 | abi::F64 => Class::Sse } } diff --git a/src/librustc_target/abi/mod.rs b/src/librustc_target/abi/mod.rs index e58caed0c99dd..a19bb6807f1a1 100644 --- a/src/librustc_target/abi/mod.rs +++ b/src/librustc_target/abi/mod.rs @@ -532,13 +532,6 @@ impl Integer { } } -#[derive(Clone, PartialEq, Eq, RustcEncodable, RustcDecodable, Hash, Copy, - PartialOrd, Ord, Debug)] -pub enum FloatTy { - F32, - F64, -} - /// Fundamental unit of memory access and layout. #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub enum Primitive { @@ -550,7 +543,8 @@ pub enum Primitive { /// a negative integer passed by zero-extension will appear positive in /// the callee, and most operations on it will produce the wrong values. Int(Integer, bool), - Float(FloatTy), + F32, + F64, Pointer } @@ -560,8 +554,8 @@ impl Primitive { match self { Int(i, _) => i.size(), - Float(FloatTy::F32) => Size::from_bits(32), - Float(FloatTy::F64) => Size::from_bits(64), + F32 => Size::from_bits(32), + F64 => Size::from_bits(64), Pointer => dl.pointer_size } } @@ -571,15 +565,15 @@ impl Primitive { match self { Int(i, _) => i.align(dl), - Float(FloatTy::F32) => dl.f32_align, - Float(FloatTy::F64) => dl.f64_align, + F32 => dl.f32_align, + F64 => dl.f64_align, Pointer => dl.pointer_align } } pub fn is_float(self) -> bool { match self { - Float(_) => true, + F32 | F64 => true, _ => false } } From 8590b16d9b031014ddcda17b174645bb7ea8ebc4 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 3 Nov 2019 15:56:11 +0300 Subject: [PATCH 14/19] rustc_metadata: Move decoder/encoder/table into mod schema --- src/librustc_metadata/cstore_impl.rs | 3 +-- src/librustc_metadata/lib.rs | 3 --- src/librustc_metadata/schema.rs | 10 ++++++++-- src/librustc_metadata/{ => schema}/decoder.rs | 4 ++-- src/librustc_metadata/{ => schema}/encoder.rs | 2 +- src/librustc_metadata/{ => schema}/table.rs | 1 - 6 files changed, 12 insertions(+), 11 deletions(-) rename src/librustc_metadata/{ => schema}/decoder.rs (99%) rename src/librustc_metadata/{ => schema}/encoder.rs (99%) rename src/librustc_metadata/{ => schema}/table.rs (99%) diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index b01b99ffcfb09..2d3a6f4fa9f22 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -1,5 +1,4 @@ use crate::cstore::{self, LoadedMacro}; -use crate::encoder; use crate::link_args; use crate::native_libs; use crate::foreign_modules; @@ -524,7 +523,7 @@ impl CrateStore for cstore::CStore { } fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata { - encoder::encode_metadata(tcx) + schema::encode_metadata(tcx) } fn metadata_encoding_version(&self) -> &[u8] diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 291ee23ff7262..be7925f9f529e 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -26,15 +26,12 @@ extern crate rustc_data_structures; pub mod error_codes; -mod encoder; -mod decoder; mod dependency_format; mod cstore_impl; mod foreign_modules; mod link_args; mod native_libs; mod schema; -mod table; pub mod creader; pub mod cstore; diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index f644b7264320b..89570fda68bcb 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -1,4 +1,4 @@ -use crate::table::PerDefTable; +use table::PerDefTable; use rustc::hir; use rustc::hir::def::{self, CtorKind}; @@ -13,7 +13,6 @@ use rustc::ty::{self, Ty, ReprOptions}; use rustc_target::spec::{PanicStrategy, TargetTriple}; use rustc_index::vec::IndexVec; use rustc_data_structures::svh::Svh; - use rustc_serialize::Encodable; use syntax::{ast, attr}; use syntax::edition::Edition; @@ -23,6 +22,13 @@ use syntax_pos::{self, Span}; use std::marker::PhantomData; use std::num::NonZeroUsize; +crate use decoder::Metadata; +crate use encoder::encode_metadata; + +mod decoder; +mod encoder; +mod table; + crate fn rustc_version() -> String { format!("rustc {}", option_env!("CFG_VERSION").unwrap_or("unknown version")) diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/schema/decoder.rs similarity index 99% rename from src/librustc_metadata/decoder.rs rename to src/librustc_metadata/schema/decoder.rs index 771d01a4b6a1d..33a75e909c705 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/schema/decoder.rs @@ -2,7 +2,7 @@ use crate::cstore::{self, CrateMetadata, MetadataBlob}; use crate::schema::*; -use crate::table::{FixedSizeEncoding, PerDefTable}; +use crate::schema::table::{FixedSizeEncoding, PerDefTable}; use rustc_index::vec::IndexVec; use rustc_data_structures::sync::Lrc; @@ -1358,7 +1358,7 @@ impl<'a, 'tcx> CrateMetadata { /// Get the `DepNodeIndex` corresponding this crate. The result of this /// method is cached in the `dep_node_index` field. - pub(super) fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex { + crate fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex { let mut dep_node_index = self.dep_node_index.load(); if unlikely!(dep_node_index == DepNodeIndex::INVALID) { diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/schema/encoder.rs similarity index 99% rename from src/librustc_metadata/encoder.rs rename to src/librustc_metadata/schema/encoder.rs index 618d342f6fe75..2119ab9c2823e 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/schema/encoder.rs @@ -1,5 +1,5 @@ use crate::schema::*; -use crate::table::{FixedSizeEncoding, PerDefTable}; +use crate::schema::table::{FixedSizeEncoding, PerDefTable}; use rustc::middle::cstore::{LinkagePreference, NativeLibrary, EncodedMetadata, ForeignModule}; diff --git a/src/librustc_metadata/table.rs b/src/librustc_metadata/schema/table.rs similarity index 99% rename from src/librustc_metadata/table.rs rename to src/librustc_metadata/schema/table.rs index e164c28c953bc..3c2680c968c85 100644 --- a/src/librustc_metadata/table.rs +++ b/src/librustc_metadata/schema/table.rs @@ -1,4 +1,3 @@ -use crate::decoder::Metadata; use crate::schema::*; use rustc::hir::def_id::{DefId, DefIndex}; From 8e1ae56bc612a888bbd0336255bdb431249b8c74 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 3 Nov 2019 17:33:27 +0300 Subject: [PATCH 15/19] rustc_metadata: Privatize everything in schema and schema/table --- src/librustc_metadata/schema.rs | 144 +++++++++++++------------- src/librustc_metadata/schema/table.rs | 18 ++-- 2 files changed, 80 insertions(+), 82 deletions(-) diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index 89570fda68bcb..dcee19be432b9 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -1,3 +1,4 @@ +use decoder::Metadata; use table::PerDefTable; use rustc::hir; @@ -22,7 +23,6 @@ use syntax_pos::{self, Span}; use std::marker::PhantomData; use std::num::NonZeroUsize; -crate use decoder::Metadata; crate use encoder::encode_metadata; mod decoder; @@ -110,13 +110,13 @@ crate struct Lazy::Meta> where T: ?Sized + LazyMeta, Meta: 'static + Copy, { - pub position: NonZeroUsize, - pub meta: Meta, + position: NonZeroUsize, + meta: Meta, _marker: PhantomData, } impl Lazy { - crate fn from_position_and_meta(position: NonZeroUsize, meta: T::Meta) -> Lazy { + fn from_position_and_meta(position: NonZeroUsize, meta: T::Meta) -> Lazy { Lazy { position, meta, @@ -126,13 +126,13 @@ impl Lazy { } impl Lazy { - crate fn from_position(position: NonZeroUsize) -> Lazy { + fn from_position(position: NonZeroUsize) -> Lazy { Lazy::from_position_and_meta(position, ()) } } impl Lazy<[T]> { - crate fn empty() -> Lazy<[T]> { + fn empty() -> Lazy<[T]> { Lazy::from_position_and_meta(NonZeroUsize::new(1).unwrap(), 0) } } @@ -149,7 +149,7 @@ impl rustc_serialize::UseSpecializedDecodable for Lazy /// Encoding / decoding state for `Lazy`. #[derive(Copy, Clone, PartialEq, Eq, Debug)] -crate enum LazyState { +enum LazyState { /// Outside of a metadata node. NoNode, @@ -187,23 +187,23 @@ crate struct CrateRoot<'tcx> { pub has_default_lib_allocator: bool, pub plugin_registrar_fn: Option, pub proc_macro_decls_static: Option, - pub proc_macro_stability: Option, + proc_macro_stability: Option, pub crate_deps: Lazy<[CrateDep]>, - pub dylib_dependency_formats: Lazy<[Option]>, - pub lib_features: Lazy<[(Symbol, Option)]>, - pub lang_items: Lazy<[(DefIndex, usize)]>, - pub lang_items_missing: Lazy<[lang_items::LangItem]>, - pub diagnostic_items: Lazy<[(Symbol, DefIndex)]>, - pub native_libraries: Lazy<[NativeLibrary]>, - pub foreign_modules: Lazy<[ForeignModule]>, - pub source_map: Lazy<[syntax_pos::SourceFile]>, + dylib_dependency_formats: Lazy<[Option]>, + lib_features: Lazy<[(Symbol, Option)]>, + lang_items: Lazy<[(DefIndex, usize)]>, + lang_items_missing: Lazy<[lang_items::LangItem]>, + diagnostic_items: Lazy<[(Symbol, DefIndex)]>, + native_libraries: Lazy<[NativeLibrary]>, + foreign_modules: Lazy<[ForeignModule]>, + source_map: Lazy<[syntax_pos::SourceFile]>, pub def_path_table: Lazy, pub impls: Lazy<[TraitImpls]>, - pub exported_symbols: Lazy!([(ExportedSymbol<'tcx>, SymbolExportLevel)]), + exported_symbols: Lazy!([(ExportedSymbol<'tcx>, SymbolExportLevel)]), pub interpret_alloc_index: Lazy<[u32]>, - pub per_def: LazyPerDefTables<'tcx>, + per_def: LazyPerDefTables<'tcx>, /// The DefIndex's of any proc macros delcared by /// this crate @@ -236,35 +236,33 @@ crate struct TraitImpls { #[derive(RustcEncodable, RustcDecodable)] crate struct LazyPerDefTables<'tcx> { - pub kind: Lazy!(PerDefTable)>), - pub visibility: Lazy!(PerDefTable>), - pub span: Lazy!(PerDefTable>), - pub attributes: Lazy!(PerDefTable>), - pub children: Lazy!(PerDefTable>), - pub stability: Lazy!(PerDefTable>), - pub deprecation: Lazy!(PerDefTable>), - - pub ty: Lazy!(PerDefTable)>), - pub fn_sig: Lazy!(PerDefTable)>), - pub impl_trait_ref: Lazy!(PerDefTable)>), - pub inherent_impls: Lazy!(PerDefTable>), - pub variances: Lazy!(PerDefTable>), - pub generics: Lazy!(PerDefTable>), - pub explicit_predicates: Lazy!(PerDefTable)>), + kind: Lazy!(PerDefTable)>), + visibility: Lazy!(PerDefTable>), + span: Lazy!(PerDefTable>), + attributes: Lazy!(PerDefTable>), + children: Lazy!(PerDefTable>), + stability: Lazy!(PerDefTable>), + deprecation: Lazy!(PerDefTable>), + ty: Lazy!(PerDefTable)>), + fn_sig: Lazy!(PerDefTable)>), + impl_trait_ref: Lazy!(PerDefTable)>), + inherent_impls: Lazy!(PerDefTable>), + variances: Lazy!(PerDefTable>), + generics: Lazy!(PerDefTable>), + explicit_predicates: Lazy!(PerDefTable)>), // FIXME(eddyb) this would ideally be `Lazy<[...]>` but `ty::Predicate` // doesn't handle shorthands in its own (de)serialization impls, // as it's an `enum` for which we want to derive (de)serialization, // so the `ty::codec` APIs handle the whole `&'tcx [...]` at once. // Also, as an optimization, a missing entry indicates an empty `&[]`. - pub inferred_outlives: Lazy!(PerDefTable, Span)])>), - pub super_predicates: Lazy!(PerDefTable)>), - - pub mir: Lazy!(PerDefTable)>), - pub promoted_mir: Lazy!(PerDefTable>)>), + inferred_outlives: Lazy!(PerDefTable, Span)])>), + super_predicates: Lazy!(PerDefTable)>), + mir: Lazy!(PerDefTable)>), + promoted_mir: Lazy!(PerDefTable>)>), } #[derive(Copy, Clone, RustcEncodable, RustcDecodable)] -crate enum EntryKind<'tcx> { +enum EntryKind<'tcx> { Const(ConstQualif, Lazy), ImmStatic, MutStatic, @@ -299,18 +297,18 @@ crate enum EntryKind<'tcx> { /// Additional data for EntryKind::Const and EntryKind::AssocConst #[derive(Clone, Copy, RustcEncodable, RustcDecodable)] -crate struct ConstQualif { - pub mir: u8, +struct ConstQualif { + mir: u8, } /// Contains a constant which has been rendered to a String. /// Used by rustdoc. #[derive(RustcEncodable, RustcDecodable)] -crate struct RenderedConst(pub String); +struct RenderedConst(String); #[derive(RustcEncodable, RustcDecodable)] -crate struct ModData { - pub reexports: Lazy<[def::Export]>, +struct ModData { + reexports: Lazy<[def::Export]>, } #[derive(RustcEncodable, RustcDecodable)] @@ -320,37 +318,37 @@ crate struct MacroDef { } #[derive(RustcEncodable, RustcDecodable)] -crate struct FnData { - pub asyncness: hir::IsAsync, - pub constness: hir::Constness, - pub param_names: Lazy<[ast::Name]>, +struct FnData { + asyncness: hir::IsAsync, + constness: hir::Constness, + param_names: Lazy<[ast::Name]>, } #[derive(RustcEncodable, RustcDecodable)] -crate struct VariantData { - pub ctor_kind: CtorKind, - pub discr: ty::VariantDiscr, +struct VariantData { + ctor_kind: CtorKind, + discr: ty::VariantDiscr, /// If this is unit or tuple-variant/struct, then this is the index of the ctor id. - pub ctor: Option, + ctor: Option, } #[derive(RustcEncodable, RustcDecodable)] -crate struct TraitData { - pub unsafety: hir::Unsafety, - pub paren_sugar: bool, - pub has_auto_impl: bool, - pub is_marker: bool, +struct TraitData { + unsafety: hir::Unsafety, + paren_sugar: bool, + has_auto_impl: bool, + is_marker: bool, } #[derive(RustcEncodable, RustcDecodable)] -crate struct ImplData { - pub polarity: ty::ImplPolarity, - pub defaultness: hir::Defaultness, - pub parent_impl: Option, +struct ImplData { + polarity: ty::ImplPolarity, + defaultness: hir::Defaultness, + parent_impl: Option, /// This is `Some` only for impls of `CoerceUnsized`. // FIXME(eddyb) perhaps compute this on the fly if cheap enough? - pub coerce_unsized_info: Option, + coerce_unsized_info: Option, } @@ -358,7 +356,7 @@ crate struct ImplData { /// is a trait or an impl and whether, in a trait, it has /// a default, or an in impl, whether it's marked "default". #[derive(Copy, Clone, RustcEncodable, RustcDecodable)] -crate enum AssocContainer { +enum AssocContainer { TraitRequired, TraitWithDefault, ImplDefault, @@ -366,7 +364,7 @@ crate enum AssocContainer { } impl AssocContainer { - crate fn with_def_id(&self, def_id: DefId) -> ty::AssocItemContainer { + fn with_def_id(&self, def_id: DefId) -> ty::AssocItemContainer { match *self { AssocContainer::TraitRequired | AssocContainer::TraitWithDefault => ty::TraitContainer(def_id), @@ -376,7 +374,7 @@ impl AssocContainer { } } - crate fn defaultness(&self) -> hir::Defaultness { + fn defaultness(&self) -> hir::Defaultness { match *self { AssocContainer::TraitRequired => hir::Defaultness::Default { has_value: false, @@ -393,17 +391,17 @@ impl AssocContainer { } #[derive(RustcEncodable, RustcDecodable)] -crate struct MethodData { - pub fn_data: FnData, - pub container: AssocContainer, - pub has_self: bool, +struct MethodData { + fn_data: FnData, + container: AssocContainer, + has_self: bool, } #[derive(RustcEncodable, RustcDecodable)] -crate struct GeneratorData<'tcx> { - pub layout: mir::GeneratorLayout<'tcx>, +struct GeneratorData<'tcx> { + layout: mir::GeneratorLayout<'tcx>, } // Tags used for encoding Spans: -crate const TAG_VALID_SPAN: u8 = 0; -crate const TAG_INVALID_SPAN: u8 = 1; +const TAG_VALID_SPAN: u8 = 0; +const TAG_INVALID_SPAN: u8 = 1; diff --git a/src/librustc_metadata/schema/table.rs b/src/librustc_metadata/schema/table.rs index 3c2680c968c85..cc65ab8a8ff55 100644 --- a/src/librustc_metadata/schema/table.rs +++ b/src/librustc_metadata/schema/table.rs @@ -11,7 +11,7 @@ use log::debug; /// Used mainly for Lazy positions and lengths. /// Unchecked invariant: `Self::default()` should encode as `[0; BYTE_LEN]`, /// but this has no impact on safety. -crate trait FixedSizeEncoding: Default { +pub(super) trait FixedSizeEncoding: Default { const BYTE_LEN: usize; // FIXME(eddyb) convert to and from `[u8; Self::BYTE_LEN]` instead, @@ -125,7 +125,7 @@ impl FixedSizeEncoding for Option> { // FIXME(eddyb) replace `Vec` with `[_]` here, such that `Box>` would be used // when building it, and `Lazy>` or `&Table` when reading it. // (not sure if that is possible given that the `Vec` is being resized now) -crate struct Table where Option: FixedSizeEncoding { +pub(super) struct Table where Option: FixedSizeEncoding { // FIXME(eddyb) store `[u8; >::BYTE_LEN]` instead of `u8` in `Vec`, // once that starts being allowed by the compiler (i.e. lazy normalization). bytes: Vec, @@ -142,7 +142,7 @@ impl Default for Table where Option: FixedSizeEncoding { } impl Table where Option: FixedSizeEncoding { - crate fn set(&mut self, i: usize, value: T) { + fn set(&mut self, i: usize, value: T) { // FIXME(eddyb) investigate more compact encodings for sparse tables. // On the PR @michaelwoerister mentioned: // > Space requirements could perhaps be optimized by using the HAMT `popcnt` @@ -156,7 +156,7 @@ impl Table where Option: FixedSizeEncoding { Some(value).write_to_bytes_at(&mut self.bytes, i); } - crate fn encode(&self, buf: &mut Encoder) -> Lazy { + fn encode(&self, buf: &mut Encoder) -> Lazy { let pos = buf.position(); buf.emit_raw_bytes(&self.bytes); Lazy::from_position_and_meta( @@ -177,7 +177,7 @@ impl LazyMeta for Table where Option: FixedSizeEncoding { impl Lazy> where Option: FixedSizeEncoding { /// Given the metadata, extract out the value at a particular index (if any). #[inline(never)] - crate fn get<'a, 'tcx, M: Metadata<'a, 'tcx>>( + fn get<'a, 'tcx, M: Metadata<'a, 'tcx>>( &self, metadata: M, i: usize, @@ -193,7 +193,7 @@ impl Lazy> where Option: FixedSizeEncoding { /// Like a `Table` but using `DefIndex` instead of `usize` as keys. // FIXME(eddyb) replace by making `Table` behave like `IndexVec`, // and by using `newtype_index!` to define `DefIndex`. -crate struct PerDefTable(Table) where Option: FixedSizeEncoding; +pub(super) struct PerDefTable(Table) where Option: FixedSizeEncoding; impl Default for PerDefTable where Option: FixedSizeEncoding { fn default() -> Self { @@ -202,12 +202,12 @@ impl Default for PerDefTable where Option: FixedSizeEncoding { } impl PerDefTable where Option: FixedSizeEncoding { - crate fn set(&mut self, def_id: DefId, value: T) { + pub(super) fn set(&mut self, def_id: DefId, value: T) { assert!(def_id.is_local()); self.0.set(def_id.index.index(), value); } - crate fn encode(&self, buf: &mut Encoder) -> Lazy { + pub(super) fn encode(&self, buf: &mut Encoder) -> Lazy { let lazy = self.0.encode(buf); Lazy::from_position_and_meta(lazy.position, lazy.meta) } @@ -228,7 +228,7 @@ impl Lazy> where Option: FixedSizeEncoding { /// Given the metadata, extract out the value at a particular DefIndex (if any). #[inline(never)] - crate fn get<'a, 'tcx, M: Metadata<'a, 'tcx>>( + pub(super) fn get<'a, 'tcx, M: Metadata<'a, 'tcx>>( &self, metadata: M, def_index: DefIndex, From 0c9d4246b0826430d287936f9041a13ab5581710 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 3 Nov 2019 17:36:16 +0300 Subject: [PATCH 16/19] rustc_metadata: Move cstore_impl into mod decoder --- src/librustc_metadata/cstore.rs | 2 +- src/librustc_metadata/lib.rs | 1 - src/librustc_metadata/schema.rs | 1 + src/librustc_metadata/schema/decoder.rs | 4 ++++ src/librustc_metadata/{ => schema/decoder}/cstore_impl.rs | 0 5 files changed, 6 insertions(+), 2 deletions(-) rename src/librustc_metadata/{ => schema/decoder}/cstore_impl.rs (100%) diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index b7596d2018f7e..656ece79add92 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -17,7 +17,7 @@ use syntax_expand::base::SyntaxExtension; use syntax_pos; use proc_macro::bridge::client::ProcMacro; -pub use crate::cstore_impl::{provide, provide_extern}; +pub use crate::schema::{provide, provide_extern}; // A map from external crate numbers (as decoded from some crate file) to // local crate numbers (as generated during this session). Each external diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index be7925f9f529e..516f9feb94573 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -27,7 +27,6 @@ extern crate rustc_data_structures; pub mod error_codes; mod dependency_format; -mod cstore_impl; mod foreign_modules; mod link_args; mod native_libs; diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index dcee19be432b9..e7b56fed50a5f 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -23,6 +23,7 @@ use syntax_pos::{self, Span}; use std::marker::PhantomData; use std::num::NonZeroUsize; +pub use decoder::{provide, provide_extern}; crate use encoder::encode_metadata; mod decoder; diff --git a/src/librustc_metadata/schema/decoder.rs b/src/librustc_metadata/schema/decoder.rs index 33a75e909c705..2264cd3804e0d 100644 --- a/src/librustc_metadata/schema/decoder.rs +++ b/src/librustc_metadata/schema/decoder.rs @@ -40,6 +40,10 @@ use syntax_pos::symbol::{Symbol, sym}; use log::debug; use proc_macro::bridge::client::ProcMacro; +pub use cstore_impl::{provide, provide_extern}; + +mod cstore_impl; + crate struct DecodeContext<'a, 'tcx> { opaque: opaque::Decoder<'a>, cdata: Option<&'a CrateMetadata>, diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/schema/decoder/cstore_impl.rs similarity index 100% rename from src/librustc_metadata/cstore_impl.rs rename to src/librustc_metadata/schema/decoder/cstore_impl.rs From 166d5f8b2fa853e3fa14a719c13d59b7b7160237 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 3 Nov 2019 17:13:07 +0300 Subject: [PATCH 17/19] rustc_metadata: Privatize everything in decoder --- src/librustc_metadata/schema/decoder.rs | 108 ++++++++++++------------ 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/src/librustc_metadata/schema/decoder.rs b/src/librustc_metadata/schema/decoder.rs index 2264cd3804e0d..0d113cecff561 100644 --- a/src/librustc_metadata/schema/decoder.rs +++ b/src/librustc_metadata/schema/decoder.rs @@ -468,7 +468,7 @@ impl<'tcx> EntryKind<'tcx> { } impl<'a, 'tcx> CrateMetadata { - crate fn is_proc_macro_crate(&self) -> bool { + fn is_proc_macro_crate(&self) -> bool { self.root.proc_macro_decls_static.is_some() } @@ -511,7 +511,7 @@ impl<'a, 'tcx> CrateMetadata { &self.raw_proc_macros.unwrap()[pos] } - crate fn item_name(&self, item_index: DefIndex) -> Symbol { + fn item_name(&self, item_index: DefIndex) -> Symbol { if !self.is_proc_macro(item_index) { self.def_key(item_index) .disambiguated_data @@ -523,7 +523,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn def_kind(&self, index: DefIndex) -> Option { + fn def_kind(&self, index: DefIndex) -> Option { if !self.is_proc_macro(index) { self.kind(index).def_kind() } else { @@ -533,11 +533,11 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_span(&self, index: DefIndex, sess: &Session) -> Span { + fn get_span(&self, index: DefIndex, sess: &Session) -> Span { self.root.per_def.span.get(self, index).unwrap().decode((self, sess)) } - crate fn load_proc_macro(&self, id: DefIndex, sess: &Session) -> SyntaxExtension { + fn load_proc_macro(&self, id: DefIndex, sess: &Session) -> SyntaxExtension { let (name, kind, helper_attrs) = match *self.raw_proc_macro(id) { ProcMacro::CustomDerive { trait_name, attributes, client } => { let helper_attrs = @@ -567,7 +567,7 @@ impl<'a, 'tcx> CrateMetadata { ) } - crate fn get_trait_def(&self, item_id: DefIndex, sess: &Session) -> ty::TraitDef { + fn get_trait_def(&self, item_id: DefIndex, sess: &Session) -> ty::TraitDef { match self.kind(item_id) { EntryKind::Trait(data) => { let data = data.decode((self, sess)); @@ -637,7 +637,7 @@ impl<'a, 'tcx> CrateMetadata { ) } - crate fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> &'tcx ty::AdtDef { + fn get_adt_def(&self, item_id: DefIndex, tcx: TyCtxt<'tcx>) -> &'tcx ty::AdtDef { let kind = self.kind(item_id); let did = self.local_def_id(item_id); @@ -662,7 +662,7 @@ impl<'a, 'tcx> CrateMetadata { tcx.alloc_adt_def(did, adt_kind, variants, repr) } - crate fn get_explicit_predicates( + fn get_explicit_predicates( &self, item_id: DefIndex, tcx: TyCtxt<'tcx>, @@ -670,7 +670,7 @@ impl<'a, 'tcx> CrateMetadata { self.root.per_def.explicit_predicates.get(self, item_id).unwrap().decode((self, tcx)) } - crate fn get_inferred_outlives( + fn get_inferred_outlives( &self, item_id: DefIndex, tcx: TyCtxt<'tcx>, @@ -680,7 +680,7 @@ impl<'a, 'tcx> CrateMetadata { }).unwrap_or_default() } - crate fn get_super_predicates( + fn get_super_predicates( &self, item_id: DefIndex, tcx: TyCtxt<'tcx>, @@ -688,28 +688,28 @@ impl<'a, 'tcx> CrateMetadata { self.root.per_def.super_predicates.get(self, item_id).unwrap().decode((self, tcx)) } - crate fn get_generics(&self, item_id: DefIndex, sess: &Session) -> ty::Generics { + fn get_generics(&self, item_id: DefIndex, sess: &Session) -> ty::Generics { self.root.per_def.generics.get(self, item_id).unwrap().decode((self, sess)) } - crate fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { + fn get_type(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Ty<'tcx> { self.root.per_def.ty.get(self, id).unwrap().decode((self, tcx)) } - crate fn get_stability(&self, id: DefIndex) -> Option { + fn get_stability(&self, id: DefIndex) -> Option { match self.is_proc_macro(id) { true => self.root.proc_macro_stability.clone(), false => self.root.per_def.stability.get(self, id).map(|stab| stab.decode(self)), } } - crate fn get_deprecation(&self, id: DefIndex) -> Option { + fn get_deprecation(&self, id: DefIndex) -> Option { self.root.per_def.deprecation.get(self, id) .filter(|_| !self.is_proc_macro(id)) .map(|depr| depr.decode(self)) } - crate fn get_visibility(&self, id: DefIndex) -> ty::Visibility { + fn get_visibility(&self, id: DefIndex) -> ty::Visibility { match self.is_proc_macro(id) { true => ty::Visibility::Public, false => self.root.per_def.visibility.get(self, id).unwrap().decode(self), @@ -723,31 +723,31 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_parent_impl(&self, id: DefIndex) -> Option { + fn get_parent_impl(&self, id: DefIndex) -> Option { self.get_impl_data(id).parent_impl } - crate fn get_impl_polarity(&self, id: DefIndex) -> ty::ImplPolarity { + fn get_impl_polarity(&self, id: DefIndex) -> ty::ImplPolarity { self.get_impl_data(id).polarity } - crate fn get_impl_defaultness(&self, id: DefIndex) -> hir::Defaultness { + fn get_impl_defaultness(&self, id: DefIndex) -> hir::Defaultness { self.get_impl_data(id).defaultness } - crate fn get_coerce_unsized_info( + fn get_coerce_unsized_info( &self, id: DefIndex, ) -> Option { self.get_impl_data(id).coerce_unsized_info } - crate fn get_impl_trait(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Option> { + fn get_impl_trait(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> Option> { self.root.per_def.impl_trait_ref.get(self, id).map(|tr| tr.decode((self, tcx))) } /// Iterates over all the stability attributes in the given crate. - crate fn get_lib_features(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(ast::Name, Option)] { + fn get_lib_features(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(ast::Name, Option)] { // FIXME: For a proc macro crate, not sure whether we should return the "host" // features or an empty Vec. Both don't cause ICEs. tcx.arena.alloc_from_iter(self.root @@ -756,7 +756,7 @@ impl<'a, 'tcx> CrateMetadata { } /// Iterates over the language items in the given crate. - crate fn get_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)] { + fn get_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)] { if self.is_proc_macro_crate() { // Proc macro crates do not export any lang-items to the target. &[] @@ -769,7 +769,7 @@ impl<'a, 'tcx> CrateMetadata { } /// Iterates over the diagnostic items in the given crate. - crate fn get_diagnostic_items( + fn get_diagnostic_items( &self, tcx: TyCtxt<'tcx>, ) -> &'tcx FxHashMap { @@ -786,7 +786,7 @@ impl<'a, 'tcx> CrateMetadata { } /// Iterates over each child of the given item. - crate fn each_child_of_item(&self, id: DefIndex, mut callback: F, sess: &Session) + fn each_child_of_item(&self, id: DefIndex, mut callback: F, sess: &Session) where F: FnMut(def::Export) { if let Some(proc_macros_ids) = self.root.proc_macro_data.map(|d| d.decode(self)) { @@ -925,12 +925,12 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn is_item_mir_available(&self, id: DefIndex) -> bool { + fn is_item_mir_available(&self, id: DefIndex) -> bool { !self.is_proc_macro(id) && self.root.per_def.mir.get(self, id).is_some() } - crate fn get_optimized_mir(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> Body<'tcx> { + fn get_optimized_mir(&self, tcx: TyCtxt<'tcx>, id: DefIndex) -> Body<'tcx> { self.root.per_def.mir.get(self, id) .filter(|_| !self.is_proc_macro(id)) .unwrap_or_else(|| { @@ -939,7 +939,7 @@ impl<'a, 'tcx> CrateMetadata { .decode((self, tcx)) } - crate fn get_promoted_mir( + fn get_promoted_mir( &self, tcx: TyCtxt<'tcx>, id: DefIndex, @@ -952,7 +952,7 @@ impl<'a, 'tcx> CrateMetadata { .decode((self, tcx)) } - crate fn mir_const_qualif(&self, id: DefIndex) -> u8 { + fn mir_const_qualif(&self, id: DefIndex) -> u8 { match self.kind(id) { EntryKind::Const(qualif, _) | EntryKind::AssocConst(AssocContainer::ImplDefault, qualif, _) | @@ -963,7 +963,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_associated_item(&self, id: DefIndex) -> ty::AssocItem { + fn get_associated_item(&self, id: DefIndex) -> ty::AssocItem { let def_key = self.def_key(id); let parent = self.local_def_id(def_key.parent.unwrap()); let name = def_key.disambiguated_data.data.get_opt_name().unwrap(); @@ -996,12 +996,12 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_item_variances(&self, id: DefIndex) -> Vec { + fn get_item_variances(&self, id: DefIndex) -> Vec { self.root.per_def.variances.get(self, id).unwrap_or(Lazy::empty()) .decode(self).collect() } - crate fn get_ctor_kind(&self, node_id: DefIndex) -> CtorKind { + fn get_ctor_kind(&self, node_id: DefIndex) -> CtorKind { match self.kind(node_id) { EntryKind::Struct(data, _) | EntryKind::Union(data, _) | @@ -1010,7 +1010,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_ctor_def_id(&self, node_id: DefIndex) -> Option { + fn get_ctor_def_id(&self, node_id: DefIndex) -> Option { match self.kind(node_id) { EntryKind::Struct(data, _) => { data.decode(self).ctor.map(|index| self.local_def_id(index)) @@ -1022,7 +1022,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_item_attrs(&self, node_id: DefIndex, sess: &Session) -> Lrc<[ast::Attribute]> { + fn get_item_attrs(&self, node_id: DefIndex, sess: &Session) -> Lrc<[ast::Attribute]> { // The attributes for a tuple struct/variant are attached to the definition, not the ctor; // we assume that someone passing in a tuple struct ctor is actually wanting to // look at the definition @@ -1038,7 +1038,7 @@ impl<'a, 'tcx> CrateMetadata { .collect::>()) } - crate fn get_struct_field_names( + fn get_struct_field_names( &self, id: DefIndex, sess: &Session, @@ -1064,7 +1064,7 @@ impl<'a, 'tcx> CrateMetadata { None } - crate fn get_inherent_implementations_for_type( + fn get_inherent_implementations_for_type( &self, tcx: TyCtxt<'tcx>, id: DefIndex, @@ -1076,7 +1076,7 @@ impl<'a, 'tcx> CrateMetadata { ) } - crate fn get_implementations_for_trait( + fn get_implementations_for_trait( &self, tcx: TyCtxt<'tcx>, filter: Option, @@ -1107,7 +1107,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_trait_of_item(&self, id: DefIndex) -> Option { + fn get_trait_of_item(&self, id: DefIndex) -> Option { let def_key = self.def_key(id); match def_key.disambiguated_data.data { DefPathData::TypeNs(..) | DefPathData::ValueNs(..) => (), @@ -1124,7 +1124,7 @@ impl<'a, 'tcx> CrateMetadata { } - crate fn get_native_libraries(&self, sess: &Session) -> Vec { + fn get_native_libraries(&self, sess: &Session) -> Vec { if self.is_proc_macro_crate() { // Proc macro crates do not have any *target* native libraries. vec![] @@ -1133,7 +1133,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_foreign_modules(&self, tcx: TyCtxt<'tcx>) -> &'tcx [ForeignModule] { + fn get_foreign_modules(&self, tcx: TyCtxt<'tcx>) -> &'tcx [ForeignModule] { if self.is_proc_macro_crate() { // Proc macro crates do not have any *target* foreign modules. &[] @@ -1142,7 +1142,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_dylib_dependency_formats( + fn get_dylib_dependency_formats( &self, tcx: TyCtxt<'tcx>, ) -> &'tcx [(CrateNum, LinkagePreference)] { @@ -1156,7 +1156,7 @@ impl<'a, 'tcx> CrateMetadata { })) } - crate fn get_missing_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [lang_items::LangItem] { + fn get_missing_lang_items(&self, tcx: TyCtxt<'tcx>) -> &'tcx [lang_items::LangItem] { if self.is_proc_macro_crate() { // Proc macro crates do not depend on any target weak lang-items. &[] @@ -1167,7 +1167,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_fn_param_names(&self, id: DefIndex) -> Vec { + fn get_fn_param_names(&self, id: DefIndex) -> Vec { let param_names = match self.kind(id) { EntryKind::Fn(data) | EntryKind::ForeignFn(data) => data.decode(self).param_names, @@ -1177,7 +1177,7 @@ impl<'a, 'tcx> CrateMetadata { param_names.decode(self).collect() } - crate fn exported_symbols( + fn exported_symbols( &self, tcx: TyCtxt<'tcx>, ) -> Vec<(ExportedSymbol<'tcx>, SymbolExportLevel)> { @@ -1190,7 +1190,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_rendered_const(&self, id: DefIndex) -> String { + fn get_rendered_const(&self, id: DefIndex) -> String { match self.kind(id) { EntryKind::Const(_, data) | EntryKind::AssocConst(_, _, data) => data.decode(self).0, @@ -1198,14 +1198,14 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn get_macro(&self, id: DefIndex) -> MacroDef { + fn get_macro(&self, id: DefIndex) -> MacroDef { match self.kind(id) { EntryKind::MacroDef(macro_def) => macro_def.decode(self), _ => bug!(), } } - crate fn is_const_fn_raw(&self, id: DefIndex) -> bool { + fn is_const_fn_raw(&self, id: DefIndex) -> bool { let constness = match self.kind(id) { EntryKind::Method(data) => data.decode(self).fn_data.constness, EntryKind::Fn(data) => data.decode(self).constness, @@ -1215,7 +1215,7 @@ impl<'a, 'tcx> CrateMetadata { constness == hir::Constness::Const } - crate fn asyncness(&self, id: DefIndex) -> hir::IsAsync { + fn asyncness(&self, id: DefIndex) -> hir::IsAsync { match self.kind(id) { EntryKind::Fn(data) => data.decode(self).asyncness, EntryKind::Method(data) => data.decode(self).fn_data.asyncness, @@ -1224,7 +1224,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn is_foreign_item(&self, id: DefIndex) -> bool { + fn is_foreign_item(&self, id: DefIndex) -> bool { match self.kind(id) { EntryKind::ForeignImmStatic | EntryKind::ForeignMutStatic | @@ -1233,7 +1233,7 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn static_mutability(&self, id: DefIndex) -> Option { + fn static_mutability(&self, id: DefIndex) -> Option { match self.kind(id) { EntryKind::ImmStatic | EntryKind::ForeignImmStatic => Some(hir::MutImmutable), @@ -1243,12 +1243,12 @@ impl<'a, 'tcx> CrateMetadata { } } - crate fn fn_sig(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> { + fn fn_sig(&self, id: DefIndex, tcx: TyCtxt<'tcx>) -> ty::PolyFnSig<'tcx> { self.root.per_def.fn_sig.get(self, id).unwrap().decode((self, tcx)) } #[inline] - crate fn def_key(&self, index: DefIndex) -> DefKey { + fn def_key(&self, index: DefIndex) -> DefKey { let mut key = self.def_path_table.def_key(index); if self.is_proc_macro(index) { let name = self.raw_proc_macro(index).name(); @@ -1258,13 +1258,13 @@ impl<'a, 'tcx> CrateMetadata { } // Returns the path leading to the thing with this `id`. - crate fn def_path(&self, id: DefIndex) -> DefPath { + fn def_path(&self, id: DefIndex) -> DefPath { debug!("def_path(cnum={:?}, id={:?})", self.cnum, id); DefPath::make(self.cnum, id, |parent| self.def_key(parent)) } #[inline] - crate fn def_path_hash(&self, index: DefIndex) -> DefPathHash { + fn def_path_hash(&self, index: DefIndex) -> DefPathHash { self.def_path_table.def_path_hash(index) } @@ -1362,7 +1362,7 @@ impl<'a, 'tcx> CrateMetadata { /// Get the `DepNodeIndex` corresponding this crate. The result of this /// method is cached in the `dep_node_index` field. - crate fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex { + fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex { let mut dep_node_index = self.dep_node_index.load(); if unlikely!(dep_node_index == DepNodeIndex::INVALID) { From 2b75147451ffe8654963b3399df40d40c6ed0ff2 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Sun, 3 Nov 2019 18:27:24 +0300 Subject: [PATCH 18/19] rustc_metadata: Privatize more entities --- src/librustc_metadata/schema.rs | 23 +++++++++---------- .../schema/decoder/cstore_impl.rs | 4 ++-- src/librustc_metadata/schema/encoder.rs | 2 +- 3 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index e7b56fed50a5f..4eabeac6d9869 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -24,7 +24,6 @@ use std::marker::PhantomData; use std::num::NonZeroUsize; pub use decoder::{provide, provide_extern}; -crate use encoder::encode_metadata; mod decoder; mod encoder; @@ -178,16 +177,16 @@ macro_rules! Lazy { crate struct CrateRoot<'tcx> { pub name: Symbol, pub triple: TargetTriple, - pub extra_filename: String, + extra_filename: String, pub hash: Svh, pub disambiguator: CrateDisambiguator, pub panic_strategy: PanicStrategy, - pub edition: Edition, + edition: Edition, pub has_global_allocator: bool, - pub has_panic_handler: bool, + has_panic_handler: bool, pub has_default_lib_allocator: bool, - pub plugin_registrar_fn: Option, - pub proc_macro_decls_static: Option, + plugin_registrar_fn: Option, + proc_macro_decls_static: Option, proc_macro_stability: Option, pub crate_deps: Lazy<[CrateDep]>, @@ -210,14 +209,14 @@ crate struct CrateRoot<'tcx> { /// this crate pub proc_macro_data: Option>, - pub compiler_builtins: bool, + compiler_builtins: bool, pub needs_allocator: bool, pub needs_panic_runtime: bool, - pub no_builtins: bool, + no_builtins: bool, pub panic_runtime: bool, pub profiler_runtime: bool, pub sanitizer_runtime: bool, - pub symbol_mangling_version: SymbolManglingVersion, + symbol_mangling_version: SymbolManglingVersion, } #[derive(RustcEncodable, RustcDecodable)] @@ -313,9 +312,9 @@ struct ModData { } #[derive(RustcEncodable, RustcDecodable)] -crate struct MacroDef { - pub body: String, - pub legacy: bool, +struct MacroDef { + body: String, + legacy: bool, } #[derive(RustcEncodable, RustcDecodable)] diff --git a/src/librustc_metadata/schema/decoder/cstore_impl.rs b/src/librustc_metadata/schema/decoder/cstore_impl.rs index 2d3a6f4fa9f22..59aa5c7402ffb 100644 --- a/src/librustc_metadata/schema/decoder/cstore_impl.rs +++ b/src/librustc_metadata/schema/decoder/cstore_impl.rs @@ -2,7 +2,7 @@ use crate::cstore::{self, LoadedMacro}; use crate::link_args; use crate::native_libs; use crate::foreign_modules; -use crate::schema; +use crate::schema::{self, encoder}; use rustc::ty::query::QueryConfig; use rustc::middle::cstore::{CrateSource, CrateStore, DepKind, EncodedMetadata, NativeLibraryKind}; @@ -523,7 +523,7 @@ impl CrateStore for cstore::CStore { } fn encode_metadata(&self, tcx: TyCtxt<'_>) -> EncodedMetadata { - schema::encode_metadata(tcx) + encoder::encode_metadata(tcx) } fn metadata_encoding_version(&self) -> &[u8] diff --git a/src/librustc_metadata/schema/encoder.rs b/src/librustc_metadata/schema/encoder.rs index 2119ab9c2823e..9970d753dbca8 100644 --- a/src/librustc_metadata/schema/encoder.rs +++ b/src/librustc_metadata/schema/encoder.rs @@ -1781,7 +1781,7 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> { // will allow us to slice the metadata to the precise length that we just // generated regardless of trailing bytes that end up in it. -crate fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata { +pub(super) fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata { let mut encoder = opaque::Encoder::new(vec![]); encoder.emit_raw_bytes(METADATA_HEADER); From 5eb1cf16197a8cc38d18e81338f4c148e14ee36f Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 4 Nov 2019 11:57:17 +0300 Subject: [PATCH 19/19] rustc_metadata: Rename `schema` to `rmeta` And change `rmeta.rs` to `rmeta/mod.rs` --- src/librustc_metadata/creader.rs | 2 +- src/librustc_metadata/cstore.rs | 8 ++++---- src/librustc_metadata/lib.rs | 2 +- src/librustc_metadata/locator.rs | 2 +- src/librustc_metadata/{schema => rmeta}/decoder.rs | 4 ++-- .../{schema => rmeta}/decoder/cstore_impl.rs | 4 ++-- src/librustc_metadata/{schema => rmeta}/encoder.rs | 4 ++-- src/librustc_metadata/{schema.rs => rmeta/mod.rs} | 0 src/librustc_metadata/{schema => rmeta}/table.rs | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) rename src/librustc_metadata/{schema => rmeta}/decoder.rs (99%) rename src/librustc_metadata/{schema => rmeta}/decoder/cstore_impl.rs (99%) rename src/librustc_metadata/{schema => rmeta}/encoder.rs (99%) rename src/librustc_metadata/{schema.rs => rmeta/mod.rs} (100%) rename src/librustc_metadata/{schema => rmeta}/table.rs (99%) diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index 483b1a40e44d6..05e3ee3322e59 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -2,7 +2,7 @@ use crate::cstore::{self, CStore, MetadataBlob}; use crate::locator::{self, CratePaths}; -use crate::schema::{CrateRoot, CrateDep}; +use crate::rmeta::{CrateRoot, CrateDep}; use rustc_data_structures::sync::{Lock, Once, AtomicCell}; use rustc::hir::def_id::CrateNum; diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index 656ece79add92..c6c8ee575a98a 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -1,7 +1,7 @@ // The crate store - a central repo for information collected about external // crates and libraries -use crate::schema; +use crate::rmeta; use rustc::dep_graph::DepNodeIndex; use rustc::hir::def_id::{CrateNum, DefIndex}; use rustc::hir::map::definitions::DefPathTable; @@ -17,7 +17,7 @@ use syntax_expand::base::SyntaxExtension; use syntax_pos; use proc_macro::bridge::client::ProcMacro; -pub use crate::schema::{provide, provide_extern}; +pub use crate::rmeta::{provide, provide_extern}; // A map from external crate numbers (as decoded from some crate file) to // local crate numbers (as generated during this session). Each external @@ -49,7 +49,7 @@ crate struct CrateMetadata { /// lifetime is only used behind `Lazy`, and therefore acts like an /// universal (`for<'tcx>`), that is paired up with whichever `TyCtxt` /// is being used to decode those values. - crate root: schema::CrateRoot<'static>, + crate root: rmeta::CrateRoot<'static>, /// For each definition in this crate, we encode a key. When the /// crate is loaded, we read all the keys and put them in this /// hashmap, which gives the reverse mapping. This allows us to @@ -59,7 +59,7 @@ crate struct CrateMetadata { /// Trait impl data. /// FIXME: Used only from queries and can use query cache, /// so pre-decoding can probably be avoided. - crate trait_impls: FxHashMap<(u32, DefIndex), schema::Lazy<[DefIndex]>>, + crate trait_impls: FxHashMap<(u32, DefIndex), rmeta::Lazy<[DefIndex]>>, /// Proc macro descriptions for this crate, if it's a proc macro crate. crate raw_proc_macros: Option<&'static [ProcMacro]>, /// Source maps for code from the crate. diff --git a/src/librustc_metadata/lib.rs b/src/librustc_metadata/lib.rs index 516f9feb94573..ac9d78e9a515c 100644 --- a/src/librustc_metadata/lib.rs +++ b/src/librustc_metadata/lib.rs @@ -30,7 +30,7 @@ mod dependency_format; mod foreign_modules; mod link_args; mod native_libs; -mod schema; +mod rmeta; pub mod creader; pub mod cstore; diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 4a263250f9b0d..88d7595b063da 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -214,7 +214,7 @@ use crate::cstore::MetadataBlob; use crate::creader::Library; -use crate::schema::{METADATA_HEADER, rustc_version}; +use crate::rmeta::{METADATA_HEADER, rustc_version}; use rustc_data_structures::fx::FxHashSet; use rustc_data_structures::svh::Svh; diff --git a/src/librustc_metadata/schema/decoder.rs b/src/librustc_metadata/rmeta/decoder.rs similarity index 99% rename from src/librustc_metadata/schema/decoder.rs rename to src/librustc_metadata/rmeta/decoder.rs index 0d113cecff561..40ec04537b0e6 100644 --- a/src/librustc_metadata/schema/decoder.rs +++ b/src/librustc_metadata/rmeta/decoder.rs @@ -1,8 +1,8 @@ // Decoding metadata from a single crate's metadata use crate::cstore::{self, CrateMetadata, MetadataBlob}; -use crate::schema::*; -use crate::schema::table::{FixedSizeEncoding, PerDefTable}; +use crate::rmeta::*; +use crate::rmeta::table::{FixedSizeEncoding, PerDefTable}; use rustc_index::vec::IndexVec; use rustc_data_structures::sync::Lrc; diff --git a/src/librustc_metadata/schema/decoder/cstore_impl.rs b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs similarity index 99% rename from src/librustc_metadata/schema/decoder/cstore_impl.rs rename to src/librustc_metadata/rmeta/decoder/cstore_impl.rs index 59aa5c7402ffb..6eacfc28de2db 100644 --- a/src/librustc_metadata/schema/decoder/cstore_impl.rs +++ b/src/librustc_metadata/rmeta/decoder/cstore_impl.rs @@ -2,7 +2,7 @@ use crate::cstore::{self, LoadedMacro}; use crate::link_args; use crate::native_libs; use crate::foreign_modules; -use crate::schema::{self, encoder}; +use crate::rmeta::{self, encoder}; use rustc::ty::query::QueryConfig; use rustc::middle::cstore::{CrateSource, CrateStore, DepKind, EncodedMetadata, NativeLibraryKind}; @@ -528,6 +528,6 @@ impl CrateStore for cstore::CStore { fn metadata_encoding_version(&self) -> &[u8] { - schema::METADATA_HEADER + rmeta::METADATA_HEADER } } diff --git a/src/librustc_metadata/schema/encoder.rs b/src/librustc_metadata/rmeta/encoder.rs similarity index 99% rename from src/librustc_metadata/schema/encoder.rs rename to src/librustc_metadata/rmeta/encoder.rs index 9970d753dbca8..afc81649e3719 100644 --- a/src/librustc_metadata/schema/encoder.rs +++ b/src/librustc_metadata/rmeta/encoder.rs @@ -1,5 +1,5 @@ -use crate::schema::*; -use crate::schema::table::{FixedSizeEncoding, PerDefTable}; +use crate::rmeta::*; +use crate::rmeta::table::{FixedSizeEncoding, PerDefTable}; use rustc::middle::cstore::{LinkagePreference, NativeLibrary, EncodedMetadata, ForeignModule}; diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/rmeta/mod.rs similarity index 100% rename from src/librustc_metadata/schema.rs rename to src/librustc_metadata/rmeta/mod.rs diff --git a/src/librustc_metadata/schema/table.rs b/src/librustc_metadata/rmeta/table.rs similarity index 99% rename from src/librustc_metadata/schema/table.rs rename to src/librustc_metadata/rmeta/table.rs index cc65ab8a8ff55..613d92c6d7b0b 100644 --- a/src/librustc_metadata/schema/table.rs +++ b/src/librustc_metadata/rmeta/table.rs @@ -1,4 +1,4 @@ -use crate::schema::*; +use crate::rmeta::*; use rustc::hir::def_id::{DefId, DefIndex}; use rustc_serialize::{Encodable, opaque::Encoder};