Auto merge of #86399 - JohnTitor:rollup-qlm2dvz, r=JohnTitor
Rollup of 7 pull requests Successful merges: - #85663 (Document Arc::from) - #85802 (Rename IoSlice(Mut)::advance to advance_slice and add IoSlice(Mut)::advance) - #85970 (Remove methods under Implementors on trait pages) - #86340 (Use better error message for hard errors in CTFE) - #86343 (Do not emit invalid suggestions on multiple mutable borrow errors) - #86355 (Remove invalid suggestions for assoc consts on placeholder type error) - #86389 (Make `sum()` and `product()` documentation hyperlinks refer to `Iterator` methods.) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
4d3ce2e7da
60 changed files with 406 additions and 318 deletions
|
|
@ -2,9 +2,6 @@
|
|||
goto: file://|DOC_PATH|/test_docs/struct.Foo.html#method.borrow
|
||||
// In the blanket implementations list, "Borrow" is the second one, hence the ":nth(2)".
|
||||
assert: ("#blanket-implementations-list > details:nth-child(2)", "open", "")
|
||||
// Please note the "\" below is needed because otherwise ".borrow" would be interpreted as
|
||||
// a class selector.
|
||||
assert: ("#method\.borrow", {"display": "flex"})
|
||||
// We first check that the impl block is open by default.
|
||||
assert: ("#implementations + details", "open", "")
|
||||
// We collapse it.
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
|
||||
// This test ensures that the [src] link is present on traits items.
|
||||
|
||||
// @has foo/trait.Iterator.html '//div[@id="method.zip"]/a[@class="srclink"]' "[src]"
|
||||
// @has foo/trait.Iterator.html '//div[@id="method.zip"]//a[@class="srclink"]' "[src]"
|
||||
pub use std::iter::Iterator;
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
// @has issue_19055/trait.Any.html
|
||||
pub trait Any {}
|
||||
|
||||
impl<'any> Any + 'any {
|
||||
// @has - '//*[@id="method.is"]' 'fn is'
|
||||
pub fn is<T: 'static>(&self) -> bool { loop {} }
|
||||
|
||||
// @has - '//*[@id="method.downcast_ref"]' 'fn downcast_ref'
|
||||
pub fn downcast_ref<T: 'static>(&self) -> Option<&T> { loop {} }
|
||||
|
||||
// @has - '//*[@id="method.downcast_mut"]' 'fn downcast_mut'
|
||||
pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> { loop {} }
|
||||
}
|
||||
|
||||
pub trait Foo {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
// @has - '//*[@id="method.foo"]' 'fn foo'
|
||||
impl Foo for Any {}
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
// @has foo/struct.Unsized.html
|
||||
// @has - '//div[@id="impl-Sized"]/code' 'impl !Sized for Unsized'
|
||||
// @!has - '//div[@id="impl-Sized"]/a[@class="srclink"]' '[src]'
|
||||
// @!has - '//div[@id="impl-Sized"]//a[@class="srclink"]' '[src]'
|
||||
// @has - '//div[@id="impl-Sync"]/code' 'impl Sync for Unsized'
|
||||
// @!has - '//div[@id="impl-Sync"]/a[@class="srclink"]' '[src]'
|
||||
// @!has - '//div[@id="impl-Sync"]//a[@class="srclink"]' '[src]'
|
||||
// @has - '//div[@id="impl-Any"]/code' 'impl<T> Any for T'
|
||||
// @has - '//div[@id="impl-Any"]/a[@class="srclink"]' '[src]'
|
||||
// @has - '//div[@id="impl-Any"]//a[@class="srclink"]' '[src]'
|
||||
pub struct Unsized {
|
||||
data: [u8],
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,23 +38,15 @@ impl MyTrait for Vec<u8> {
|
|||
}
|
||||
|
||||
impl MyTrait for MyStruct {
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="type"]/@href' #associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedtype.Assoc-3"]//a[@class="anchor"]/@href' #associatedtype.Assoc-3
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="type"]/@href' trait.MyTrait.html#associatedtype.Assoc
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedtype.Assoc"]//a[@class="anchor"]/@href' #associatedtype.Assoc
|
||||
type Assoc = bool;
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="constant"]/@href' #associatedconstant.VALUE
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="associatedconstant.VALUE-3"]//a[@class="anchor"]/@href' #associatedconstant.VALUE-3
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="constant"]/@href' trait.MyTrait.html#associatedconstant.VALUE
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="associatedconstant.VALUE"]//a[@class="anchor"]/@href' #associatedconstant.VALUE
|
||||
const VALUE: u32 = 20;
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="fnname"]/@href' #tymethod.trait_function
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.trait_function-2"]//a[@class="anchor"]/@href' #method.trait_function-2
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="fnname"]/@href' trait.MyTrait.html#tymethod.trait_function
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.trait_function"]//a[@class="anchor"]/@href' #method.trait_function
|
||||
fn trait_function(&self) {}
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="fnname"]/@href' #method.defaulted_override
|
||||
// @has trait_impl_items_links_and_anchors/trait.MyTrait.html '//div[@id="method.defaulted_override-3"]//a[@class="anchor"]/@href' #method.defaulted_override-3
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="fnname"]/@href' trait.MyTrait.html#method.defaulted_override
|
||||
// @has trait_impl_items_links_and_anchors/struct.MyStruct.html '//div[@id="method.defaulted_override"]//a[@class="anchor"]/@href' #method.defaulted_override
|
||||
fn defaulted_override(&self) {}
|
||||
|
|
|
|||
15
src/test/ui/borrowck/issue-85581.rs
Normal file
15
src/test/ui/borrowck/issue-85581.rs
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Regression test of #85581.
|
||||
// Checks not to suggest to add `;` when the second mutable borrow
|
||||
// is in the first's scope.
|
||||
|
||||
use std::collections::BinaryHeap;
|
||||
|
||||
fn foo(heap: &mut BinaryHeap<i32>) {
|
||||
match heap.peek_mut() {
|
||||
Some(_) => { heap.pop(); },
|
||||
//~^ ERROR: cannot borrow `*heap` as mutable more than once at a time
|
||||
None => (),
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
17
src/test/ui/borrowck/issue-85581.stderr
Normal file
17
src/test/ui/borrowck/issue-85581.stderr
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
error[E0499]: cannot borrow `*heap` as mutable more than once at a time
|
||||
--> $DIR/issue-85581.rs:9:22
|
||||
|
|
||||
LL | match heap.peek_mut() {
|
||||
| ---------------
|
||||
| |
|
||||
| first mutable borrow occurs here
|
||||
| a temporary with access to the first borrow is created here ...
|
||||
LL | Some(_) => { heap.pop(); },
|
||||
| ^^^^ second mutable borrow occurs here
|
||||
...
|
||||
LL | }
|
||||
| - ... and the first borrow might be used here, when that temporary is dropped and runs the destructor for type `Option<PeekMut<'_, i32>>`
|
||||
|
||||
error: aborting due to previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0499`.
|
||||
|
|
@ -5,31 +5,31 @@
|
|||
const MSG: &str = "hello";
|
||||
|
||||
const Z: () = std::panic!("cheese");
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Z2: () = std::panic!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y: () = std::unreachable!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X: () = std::unimplemented!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
//
|
||||
const W: () = std::panic!(MSG);
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Z_CORE: () = core::panic!("cheese");
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Z2_CORE: () = core::panic!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y_CORE: () = core::unreachable!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X_CORE: () = core::unimplemented!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const W_CORE: () = core::panic!(MSG);
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
|
|
|||
|
|
@ -1,100 +1,80 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:7:15
|
||||
|
|
||||
LL | const Z: () = std::panic!("cheese");
|
||||
| --------------^^^^^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:7:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:10:16
|
||||
|
|
||||
LL | const Z2: () = std::panic!();
|
||||
| ---------------^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16
|
||||
| ^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:10:16
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:13:15
|
||||
|
|
||||
LL | const Y: () = std::unreachable!();
|
||||
| --------------^^^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15
|
||||
| ^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:13:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:16:15
|
||||
|
|
||||
LL | const X: () = std::unimplemented!();
|
||||
| --------------^^^^^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15
|
||||
| ^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:16:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:19:15
|
||||
|
|
||||
LL | const W: () = std::panic!(MSG);
|
||||
| --------------^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15
|
||||
| ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:19:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:22:20
|
||||
|
|
||||
LL | const Z_CORE: () = core::panic!("cheese");
|
||||
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic.rs:22:20
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:25:21
|
||||
|
|
||||
LL | const Z2_CORE: () = core::panic!();
|
||||
| --------------------^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21
|
||||
| ^^^^^^^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/const_panic.rs:25:21
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:28:20
|
||||
|
|
||||
LL | const Y_CORE: () = core::unreachable!();
|
||||
| -------------------^^^^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20
|
||||
| ^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic.rs:28:20
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:31:20
|
||||
|
|
||||
LL | const X_CORE: () = core::unimplemented!();
|
||||
| -------------------^^^^^^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic.rs:31:20
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic.rs:34:20
|
||||
|
|
||||
LL | const W_CORE: () = core::panic!(MSG);
|
||||
| -------------------^^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20
|
||||
| ^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'hello', $DIR/const_panic.rs:34:20
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -7,13 +7,13 @@
|
|||
use core::panic::PanicInfo;
|
||||
|
||||
const Z: () = panic!("cheese");
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const Y: () = unreachable!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
const X: () = unimplemented!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
#[lang = "eh_personality"]
|
||||
fn eh() {}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,24 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic_libcore_bin.rs:9:15
|
||||
|
|
||||
LL | const Z: () = panic!("cheese");
|
||||
| --------------^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15
|
||||
| ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'cheese', $DIR/const_panic_libcore_bin.rs:9:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic_libcore_bin.rs:12:15
|
||||
|
|
||||
LL | const Y: () = unreachable!();
|
||||
| --------------^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15
|
||||
| ^^^^^^^^^^^^^^ the evaluated program panicked at 'internal error: entered unreachable code', $DIR/const_panic_libcore_bin.rs:12:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/const_panic_libcore_bin.rs:15:15
|
||||
|
|
||||
LL | const X: () = unimplemented!();
|
||||
| --------------^^^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15
|
||||
| ^^^^^^^^^^^^^^^^ the evaluated program panicked at 'not implemented', $DIR/const_panic_libcore_bin.rs:15:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ struct PrintName;
|
|||
|
||||
impl PrintName {
|
||||
const VOID: ! = panic!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/panic-assoc-never-type.rs:11:21
|
||||
|
|
||||
LL | const VOID: ! = panic!();
|
||||
| ----------------^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21
|
||||
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-assoc-never-type.rs:11:21
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
#![feature(never_type)]
|
||||
|
||||
const VOID: ! = panic!();
|
||||
//~^ ERROR any use of this value will cause an error
|
||||
//~^ ERROR evaluation of constant value failed
|
||||
|
||||
fn main() {
|
||||
let _ = VOID;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/panic-never-type.rs:6:17
|
||||
|
|
||||
LL | const VOID: ! = panic!();
|
||||
| ----------------^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17
|
||||
| ^^^^^^^^ the evaluated program panicked at 'explicit panic', $DIR/panic-never-type.rs:6:17
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#[unwind(aborts)]
|
||||
const fn foo() {
|
||||
panic!() //~ ERROR any use of this value will cause an error
|
||||
panic!() //~ ERROR evaluation of constant value failed
|
||||
}
|
||||
|
||||
const _: () = foo();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/unwind-abort.rs:5:5
|
||||
|
|
||||
LL | panic!()
|
||||
|
|
@ -6,10 +6,9 @@ LL | panic!()
|
|||
| |
|
||||
| the evaluated program panicked at 'explicit panic', $DIR/unwind-abort.rs:5:5
|
||||
| inside `foo` at $SRC_DIR/std/src/panic.rs:LL:COL
|
||||
| inside `_` at $DIR/unwind-abort.rs:8:15
|
||||
...
|
||||
LL | const _: () = foo();
|
||||
| --------------------
|
||||
| ----- inside `_` at $DIR/unwind-abort.rs:8:15
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $SRC_DIR/core/src/option.rs:LL:COL
|
||||
|
|
||||
LL | None => panic!("called `Option::unwrap()` on a `None` value"),
|
||||
|
|
@ -6,12 +6,11 @@ LL | None => panic!("called `Option::unwrap()` on a `None` value"),
|
|||
| |
|
||||
| the evaluated program panicked at 'called `Option::unwrap()` on a `None` value', $DIR/const-unwrap.rs:9:38
|
||||
| inside `Option::<i32>::unwrap` at $SRC_DIR/core/src/panic.rs:LL:COL
|
||||
| inside `BAR` at $DIR/const-unwrap.rs:9:18
|
||||
|
|
||||
::: $DIR/const-unwrap.rs:9:1
|
||||
::: $DIR/const-unwrap.rs:9:18
|
||||
|
|
||||
LL | const BAR: i32 = Option::<i32>::None.unwrap();
|
||||
| ----------------------------------------------
|
||||
| ---------------------------- inside `BAR` at $DIR/const-unwrap.rs:9:18
|
||||
|
|
||||
= note: this error originates in the macro `$crate::panic::panic_2015` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
error[E0080]: any use of this value will cause an error
|
||||
error[E0080]: evaluation of constant value failed
|
||||
--> $DIR/assert.rs:10:15
|
||||
|
|
||||
LL | const _: () = assert!(false);
|
||||
| --------------^^^^^^^^^^^^^^-
|
||||
| |
|
||||
| the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15
|
||||
| ^^^^^^^^^^^^^^ the evaluated program panicked at 'assertion failed: false', $DIR/assert.rs:10:15
|
||||
|
|
||||
= note: this error originates in the macro `assert` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ const _: () = assert!(true);
|
|||
|
||||
const _: () = assert!(false);
|
||||
//[stock]~^ ERROR panicking in constants is unstable
|
||||
//[const_panic]~^^ ERROR any use of this value will cause an error
|
||||
//[const_panic]~^^ ERROR evaluation of constant value failed
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
14
src/test/ui/typeck/type-placeholder-fn-in-const.rs
Normal file
14
src/test/ui/typeck/type-placeholder-fn-in-const.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
struct MyStruct;
|
||||
|
||||
trait Test {
|
||||
const TEST: fn() -> _;
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
//~| ERROR: the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
}
|
||||
|
||||
impl Test for MyStruct {
|
||||
const TEST: fn() -> _ = 42;
|
||||
//~^ ERROR: the type placeholder `_` is not allowed within types on item signatures [E0121]
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
21
src/test/ui/typeck/type-placeholder-fn-in-const.stderr
Normal file
21
src/test/ui/typeck/type-placeholder-fn-in-const.stderr
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:4:25
|
||||
|
|
||||
LL | const TEST: fn() -> _;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error[E0121]: the type placeholder `_` is not allowed within types on item signatures
|
||||
--> $DIR/type-placeholder-fn-in-const.rs:10:25
|
||||
|
|
||||
LL | const TEST: fn() -> _ = 42;
|
||||
| ^ not allowed in type signatures
|
||||
|
||||
error: aborting due to 3 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0121`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue