From ac66b04ccb04e264004189970c817eb3da208f4a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 3 Oct 2018 10:01:56 -0600 Subject: Run both lldb and gdb tests Currently lldb tests are run only on macOS, and gdb tests are only run elsewhere. This patch changes this to run tests depending on what is available. One test is changed, as it was previously marked as failing on macOS, whereas really it is a generic failure with lldb. Closes #54721 --- src/test/debuginfo/lexical-scope-with-macro.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/debuginfo/lexical-scope-with-macro.rs b/src/test/debuginfo/lexical-scope-with-macro.rs index 4e88f65ad1d..d11a42bb0ed 100644 --- a/src/test/debuginfo/lexical-scope-with-macro.rs +++ b/src/test/debuginfo/lexical-scope-with-macro.rs @@ -9,7 +9,7 @@ // except according to those terms. // min-lldb-version: 310 -// ignore-macos FIXME #48807 +// ignore-lldb FIXME #48807 // compile-flags:-g -Zdebug-macros -- cgit 1.4.1-3-g733a5 From 86d5a33c890404da65c48925525af06b9b68a0ac Mon Sep 17 00:00:00 2001 From: Oliver Middleton Date: Mon, 15 Oct 2018 00:48:57 +0100 Subject: rustdoc: Use dyn keyword when rendering dynamic traits The dyn keyword has been stable for a while now so rustdoc should start using it. --- src/librustdoc/html/format.rs | 3 +++ src/test/rustdoc/assoc-consts.rs | 2 +- src/test/rustdoc/inline_cross/issue-32881.rs | 4 ++-- src/test/rustdoc/test-parens.rs | 2 +- 4 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/test') diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 7643aade83b..445fc2e833a 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -553,6 +553,9 @@ fn fmt_type(t: &clean::Type, f: &mut fmt::Formatter, use_absolute: bool) -> fmt: f.write_str(name) } clean::ResolvedPath{ did, ref typarams, ref path, is_generic } => { + if typarams.is_some() { + f.write_str("dyn ")?; + } // Paths like T::Output and Self::Output should be rendered with all segments resolved_path(f, did, path, is_generic, use_absolute)?; tybounds(f, typarams) diff --git a/src/test/rustdoc/assoc-consts.rs b/src/test/rustdoc/assoc-consts.rs index 71e7db5f4a5..cbb2a00214a 100644 --- a/src/test/rustdoc/assoc-consts.rs +++ b/src/test/rustdoc/assoc-consts.rs @@ -52,7 +52,7 @@ pub fn f(_: &(ToString + 'static)) {} impl Bar { // @has assoc_consts/struct.Bar.html '//*[@id="associatedconstant.F"]' \ - // "const F: fn(_: &(ToString + 'static))" + // "const F: fn(_: &(dyn ToString + 'static))" pub const F: fn(_: &(ToString + 'static)) = f; } diff --git a/src/test/rustdoc/inline_cross/issue-32881.rs b/src/test/rustdoc/inline_cross/issue-32881.rs index 948061bdcbe..c55a69bcb7b 100644 --- a/src/test/rustdoc/inline_cross/issue-32881.rs +++ b/src/test/rustdoc/inline_cross/issue-32881.rs @@ -15,8 +15,8 @@ extern crate rustdoc_trait_object_impl; // @has issue_32881/trait.Bar.html -// @has - '//code' "impl<'a> Bar" -// @has - '//code' "impl<'a> Debug for Bar" +// @has - '//code' "impl<'a> dyn Bar" +// @has - '//code' "impl<'a> Debug for dyn Bar" pub use rustdoc_trait_object_impl::Bar; diff --git a/src/test/rustdoc/test-parens.rs b/src/test/rustdoc/test-parens.rs index 792dc9c218d..0c9452fa1e1 100644 --- a/src/test/rustdoc/test-parens.rs +++ b/src/test/rustdoc/test-parens.rs @@ -11,5 +11,5 @@ #![crate_name = "foo"] // @has foo/fn.foo.html -// @has - '//*[@class="rust fn"]' "_: &(ToString + 'static)" +// @has - '//*[@class="rust fn"]' "_: &(dyn ToString + 'static)" pub fn foo(_: &(ToString + 'static)) {} -- cgit 1.4.1-3-g733a5 From 481ad0ea35afb795b04e2aba99c194d50a0ebe3f Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 15 Oct 2018 14:07:19 +0200 Subject: regression test for issue #54597 --- ...ssue-54597-reject-move-out-of-borrow-via-pat.rs | 22 ++++++++++++++++++++++ ...-54597-reject-move-out-of-borrow-via-pat.stderr | 12 ++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs create mode 100644 src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr (limited to 'src/test') diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs new file mode 100644 index 00000000000..0749900986d --- /dev/null +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.rs @@ -0,0 +1,22 @@ +#![feature(nll)] + +#![allow(dead_code)] + +#[derive(Debug)] +struct Value; +impl Value { + fn as_array(&self) -> Option<&Vec> { + None + } +} + +fn foo(val: Value) { + let _reviewers_original: Vec = match val.as_array() { + Some(array) => { + *array + } + None => vec![] + }; +} + +fn main() { } diff --git a/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr new file mode 100644 index 00000000000..6a12016b2a5 --- /dev/null +++ b/src/test/ui/borrowck/issue-54597-reject-move-out-of-borrow-via-pat.stderr @@ -0,0 +1,12 @@ +error[E0507]: cannot move out of borrowed content + --> $DIR/issue-54597-reject-move-out-of-borrow-via-pat.rs:16:13 + | +LL | *array + | ^^^^^^ + | | + | cannot move out of borrowed content + | help: consider removing the `*`: `array` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0507`. -- cgit 1.4.1-3-g733a5 From 70dd9ca5da56b805c9495f4e0e91e67fdb1d4a02 Mon Sep 17 00:00:00 2001 From: Esteban Küber Date: Mon, 15 Oct 2018 14:17:54 -0700 Subject: Add test for #34229 --- src/test/ui/issues/issue-34229.rs | 4 ++++ src/test/ui/issues/issue-34229.stderr | 12 ++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 src/test/ui/issues/issue-34229.rs create mode 100644 src/test/ui/issues/issue-34229.stderr (limited to 'src/test') diff --git a/src/test/ui/issues/issue-34229.rs b/src/test/ui/issues/issue-34229.rs new file mode 100644 index 00000000000..bcdfcc767fb --- /dev/null +++ b/src/test/ui/issues/issue-34229.rs @@ -0,0 +1,4 @@ +#[derive(PartialEq)] struct Comparable; +#[derive(PartialEq, PartialOrd)] struct Nope(Comparable); + +fn main() {} diff --git a/src/test/ui/issues/issue-34229.stderr b/src/test/ui/issues/issue-34229.stderr new file mode 100644 index 00000000000..c57f80cd409 --- /dev/null +++ b/src/test/ui/issues/issue-34229.stderr @@ -0,0 +1,12 @@ +error[E0277]: can't compare `Comparable` with `Comparable` + --> $DIR/issue-34229.rs:2:46 + | +LL | #[derive(PartialEq, PartialOrd)] struct Nope(Comparable); + | ^^^^^^^^^^ no implementation for `Comparable < Comparable` and `Comparable > Comparable` + | + = help: the trait `std::cmp::PartialOrd` is not implemented for `Comparable` + = note: required by `std::cmp::PartialOrd::partial_cmp` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0277`. -- cgit 1.4.1-3-g733a5 From 350f9a2be56c2527647300287599464cdd508340 Mon Sep 17 00:00:00 2001 From: Vadim Petrochenkov Date: Mon, 15 Oct 2018 23:43:59 +0300 Subject: resolve: Do not skip extern prelude during speculative resolution --- src/librustc_resolve/lib.rs | 12 +++++++++--- src/test/run-pass/extern/extern-prelude-no-speculative.rs | 2 +- src/test/ui/impl-trait/auxiliary/extra-item.rs | 1 + src/test/ui/impl-trait/extra-item.rs | 10 ++++++++++ src/test/ui/impl-trait/extra-item.stderr | 9 +++++++++ 5 files changed, 30 insertions(+), 4 deletions(-) create mode 100644 src/test/ui/impl-trait/auxiliary/extra-item.rs create mode 100644 src/test/ui/impl-trait/extra-item.rs create mode 100644 src/test/ui/impl-trait/extra-item.stderr (limited to 'src/test') diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 86fe584dc3a..ac0616e50b0 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1980,9 +1980,15 @@ impl<'a, 'crateloader: 'a> Resolver<'a, 'crateloader> { } if !module.no_implicit_prelude { - // `record_used` means that we don't try to load crates during speculative resolution - if record_used && ns == TypeNS && self.extern_prelude.contains(&ident.name) { - let crate_id = self.crate_loader.process_path_extern(ident.name, ident.span); + if ns == TypeNS && self.extern_prelude.contains(&ident.name) { + let crate_id = if record_used { + self.crate_loader.process_path_extern(ident.name, ident.span) + } else if let Some(crate_id) = + self.crate_loader.maybe_process_path_extern(ident.name, ident.span) { + crate_id + } else { + return None; + }; let crate_root = self.get_module(DefId { krate: crate_id, index: CRATE_DEF_INDEX }); self.populate_module_if_necessary(&crate_root); diff --git a/src/test/run-pass/extern/extern-prelude-no-speculative.rs b/src/test/run-pass/extern/extern-prelude-no-speculative.rs index 6ca1815a191..372f34454de 100644 --- a/src/test/run-pass/extern/extern-prelude-no-speculative.rs +++ b/src/test/run-pass/extern/extern-prelude-no-speculative.rs @@ -10,7 +10,7 @@ // run-pass #![allow(unused_variables)] -// compile-flags: --extern LooksLikeExternCrate=/path/to/nowhere +// compile-flags: --extern LooksLikeExternCrate mod m { pub struct LooksLikeExternCrate; diff --git a/src/test/ui/impl-trait/auxiliary/extra-item.rs b/src/test/ui/impl-trait/auxiliary/extra-item.rs new file mode 100644 index 00000000000..8eaeafa5207 --- /dev/null +++ b/src/test/ui/impl-trait/auxiliary/extra-item.rs @@ -0,0 +1 @@ +pub trait MyTrait {} diff --git a/src/test/ui/impl-trait/extra-item.rs b/src/test/ui/impl-trait/extra-item.rs new file mode 100644 index 00000000000..d82237ccecc --- /dev/null +++ b/src/test/ui/impl-trait/extra-item.rs @@ -0,0 +1,10 @@ +// aux-build:extra-item.rs +// compile-flags:--extern extra_item + +struct S; + +impl extra_item::MyTrait for S { + fn extra() {} //~ ERROR method `extra` is not a member of trait `extra_item::MyTrait` +} + +fn main() {} diff --git a/src/test/ui/impl-trait/extra-item.stderr b/src/test/ui/impl-trait/extra-item.stderr new file mode 100644 index 00000000000..de3c7ba5d31 --- /dev/null +++ b/src/test/ui/impl-trait/extra-item.stderr @@ -0,0 +1,9 @@ +error[E0407]: method `extra` is not a member of trait `extra_item::MyTrait` + --> $DIR/extra-item.rs:7:5 + | +LL | fn extra() {} //~ ERROR method `extra` is not a member of trait `extra_item::MyTrait` + | ^^^^^^^^^^^^^ not a member of trait `extra_item::MyTrait` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0407`. -- cgit 1.4.1-3-g733a5