提交 04689e22 编写于 作者: B bors

Auto merge of #71907 - Dylan-DPC:rollup-z8iaqlv, r=Dylan-DPC

Rollup of 10 pull requests

Successful merges:

 - #71587 (Report cannot move errors in promoted MIR)
 - #71711 (Updates to some ignored tests)
 - #71845 (Add const examples)
 - #71878 (Add remove_current_as_list to LinkedList's CursorMut)
 - #71881 (Correctly handle UEFI targets as Windows-like when emitting sections for LLVM bitcode)
 - #71883 (add a missing "at" in a comment)
 - #71891 (¬∃x. ¬y => ∀x. y)
 - #71892 (Update btree_map::VacantEntry::insert docs to actually call insert)
 - #71902 (Suggest to add missing feature when using gated const features)
 - #71904 (fix typo in function name)

Failed merges:

r? @ghost
......@@ -2499,15 +2499,14 @@ pub fn into_key(self) -> K {
///
/// ```
/// use std::collections::BTreeMap;
/// use std::collections::btree_map::Entry;
///
/// let mut count: BTreeMap<&str, usize> = BTreeMap::new();
/// let mut map: BTreeMap<&str, u32> = BTreeMap::new();
///
/// // count the number of occurrences of letters in the vec
/// for x in vec!["a","b","a","c","a","b"] {
/// *count.entry(x).or_insert(0) += 1;
/// if let Entry::Vacant(o) = map.entry("poneyland") {
/// o.insert(37);
/// }
///
/// assert_eq!(count["a"], 3);
/// assert_eq!(map["poneyland"], 37);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub fn insert(self, value: V) -> &'a mut V {
......
......@@ -1496,6 +1496,31 @@ pub fn remove_current(&mut self) -> Option<T> {
}
}
/// Removes the current element from the `LinkedList` without deallocating the list node.
///
/// The node that was removed is returned as a new `LinkedList` containing only this node.
/// The cursor is moved to point to the next element in the current `LinkedList`.
///
/// If the cursor is currently pointing to the "ghost" non-element then no element
/// is removed and `None` is returned.
#[unstable(feature = "linked_list_cursors", issue = "58533")]
pub fn remove_current_as_list(&mut self) -> Option<LinkedList<T>> {
let mut unlinked_node = self.current?;
unsafe {
self.current = unlinked_node.as_ref().next;
self.list.unlink_node(unlinked_node);
unlinked_node.as_mut().prev = None;
unlinked_node.as_mut().next = None;
Some(LinkedList {
head: Some(unlinked_node),
tail: Some(unlinked_node),
len: 1,
marker: PhantomData,
})
}
}
/// Inserts the elements from the given `LinkedList` after the current one.
///
/// If the cursor is pointing at the "ghost" non-element then the new elements are
......
......@@ -18,15 +18,46 @@
/// The radix or base of the internal representation of `f32`.
/// Use [`f32::RADIX`](../../std/primitive.f32.html#associatedconstant.RADIX) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let r = std::f32::RADIX;
///
/// // intended way
/// let r = f32::RADIX;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const RADIX: u32 = f32::RADIX;
/// Number of significant digits in base 2.
/// Use [`f32::MANTISSA_DIGITS`](../../std/primitive.f32.html#associatedconstant.MANTISSA_DIGITS) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let d = std::f32::MANTISSA_DIGITS;
///
/// // intended way
/// let d = f32::MANTISSA_DIGITS;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MANTISSA_DIGITS: u32 = f32::MANTISSA_DIGITS;
/// Approximate number of significant digits in base 10.
/// Use [`f32::DIGITS`](../../std/primitive.f32.html#associatedconstant.DIGITS) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let d = std::f32::DIGITS;
///
/// // intended way
/// let d = f32::DIGITS;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const DIGITS: u32 = f32::DIGITS;
......@@ -36,50 +67,166 @@
/// This is the difference between `1.0` and the next larger representable number.
///
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let e = std::f32::EPSILON;
///
/// // intended way
/// let e = f32::EPSILON;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const EPSILON: f32 = f32::EPSILON;
/// Smallest finite `f32` value.
/// Use [`f32::MIN`](../../std/primitive.f32.html#associatedconstant.MIN) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN;
///
/// // intended way
/// let min = f32::MIN;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN: f32 = f32::MIN;
/// Smallest positive normal `f32` value.
/// Use [`f32::MIN_POSITIVE`](../../std/primitive.f32.html#associatedconstant.MIN_POSITIVE) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN_POSITIVE;
///
/// // intended way
/// let min = f32::MIN_POSITIVE;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_POSITIVE: f32 = f32::MIN_POSITIVE;
/// Largest finite `f32` value.
/// Use [`f32::MAX`](../../std/primitive.f32.html#associatedconstant.MAX) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f32::MAX;
///
/// // intended way
/// let max = f32::MAX;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: f32 = f32::MAX;
/// One greater than the minimum possible normal power of 2 exponent.
/// Use [`f32::MIN_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN_EXP;
///
/// // intended way
/// let min = f32::MIN_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_EXP: i32 = f32::MIN_EXP;
/// Maximum possible power of 2 exponent.
/// Use [`f32::MAX_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f32::MAX_EXP;
///
/// // intended way
/// let max = f32::MAX_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_EXP: i32 = f32::MAX_EXP;
/// Minimum possible normal power of 10 exponent.
/// Use [`f32::MIN_10_EXP`](../../std/primitive.f32.html#associatedconstant.MIN_10_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f32::MIN_10_EXP;
///
/// // intended way
/// let min = f32::MIN_10_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_10_EXP: i32 = f32::MIN_10_EXP;
/// Maximum possible power of 10 exponent.
/// Use [`f32::MAX_10_EXP`](../../std/primitive.f32.html#associatedconstant.MAX_10_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f32::MAX_10_EXP;
///
/// // intended way
/// let max = f32::MAX_10_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_10_EXP: i32 = f32::MAX_10_EXP;
/// Not a Number (NaN).
/// Use [`f32::NAN`](../../std/primitive.f32.html#associatedconstant.NAN) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let nan = std::f32::NAN;
///
/// // intended way
/// let nan = f32::NAN;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const NAN: f32 = f32::NAN;
/// Infinity (∞).
/// Use [`f32::INFINITY`](../../std/primitive.f32.html#associatedconstant.INFINITY) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let inf = std::f32::INFINITY;
///
/// // intended way
/// let inf = f32::INFINITY;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const INFINITY: f32 = f32::INFINITY;
/// Negative infinity (−∞).
/// Use [`f32::NEG_INFINITY`](../../std/primitive.f32.html#associatedconstant.NEG_INFINITY) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let ninf = std::f32::NEG_INFINITY;
///
/// // intended way
/// let ninf = f32::NEG_INFINITY;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const NEG_INFINITY: f32 = f32::NEG_INFINITY;
......
......@@ -18,15 +18,46 @@
/// The radix or base of the internal representation of `f64`.
/// Use [`f64::RADIX`](../../std/primitive.f64.html#associatedconstant.RADIX) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let r = std::f64::RADIX;
///
/// // intended way
/// let r = f64::RADIX;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const RADIX: u32 = f64::RADIX;
/// Number of significant digits in base 2.
/// Use [`f64::MANTISSA_DIGITS`](../../std/primitive.f64.html#associatedconstant.MANTISSA_DIGITS) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let d = std::f64::MANTISSA_DIGITS;
///
/// // intended way
/// let d = f64::MANTISSA_DIGITS;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MANTISSA_DIGITS: u32 = f64::MANTISSA_DIGITS;
/// Approximate number of significant digits in base 10.
/// Use [`f64::DIGITS`](../../std/primitive.f64.html#associatedconstant.DIGITS) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let d = std::f64::DIGITS;
///
/// // intended way
/// let d = f64::DIGITS;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const DIGITS: u32 = f64::DIGITS;
......@@ -36,50 +67,166 @@
/// This is the difference between `1.0` and the next larger representable number.
///
/// [Machine epsilon]: https://en.wikipedia.org/wiki/Machine_epsilon
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let e = std::f64::EPSILON;
///
/// // intended way
/// let e = f64::EPSILON;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const EPSILON: f64 = f64::EPSILON;
/// Smallest finite `f64` value.
/// Use [`f64::MIN`](../../std/primitive.f64.html#associatedconstant.MIN) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f64::MIN;
///
/// // intended way
/// let min = f64::MIN;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN: f64 = f64::MIN;
/// Smallest positive normal `f64` value.
/// Use [`f64::MIN_POSITIVE`](../../std/primitive.f64.html#associatedconstant.MIN_POSITIVE) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f64::MIN_POSITIVE;
///
/// // intended way
/// let min = f64::MIN_POSITIVE;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_POSITIVE: f64 = f64::MIN_POSITIVE;
/// Largest finite `f64` value.
/// Use [`f64::MAX`](../../std/primitive.f64.html#associatedconstant.MAX) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f64::MAX;
///
/// // intended way
/// let max = f64::MAX;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX: f64 = f64::MAX;
/// One greater than the minimum possible normal power of 2 exponent.
/// Use [`f64::MIN_EXP`](../../std/primitive.f64.html#associatedconstant.MIN_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f64::MIN_EXP;
///
/// // intended way
/// let min = f64::MIN_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_EXP: i32 = f64::MIN_EXP;
/// Maximum possible power of 2 exponent.
/// Use [`f64::MAX_EXP`](../../std/primitive.f64.html#associatedconstant.MAX_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f64::MAX_EXP;
///
/// // intended way
/// let max = f64::MAX_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_EXP: i32 = f64::MAX_EXP;
/// Minimum possible normal power of 10 exponent.
/// Use [`f64::MIN_10_EXP`](../../std/primitive.f64.html#associatedconstant.MIN_10_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let min = std::f64::MIN_10_EXP;
///
/// // intended way
/// let min = f64::MIN_10_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MIN_10_EXP: i32 = f64::MIN_10_EXP;
/// Maximum possible power of 10 exponent.
/// Use [`f64::MAX_10_EXP`](../../std/primitive.f64.html#associatedconstant.MAX_10_EXP) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let max = std::f64::MAX_10_EXP;
///
/// // intended way
/// let max = f64::MAX_10_EXP;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const MAX_10_EXP: i32 = f64::MAX_10_EXP;
/// Not a Number (NaN).
/// Use [`f64::NAN`](../../std/primitive.f64.html#associatedconstant.NAN) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let nan = std::f64::NAN;
///
/// // intended way
/// let nan = f64::NAN;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const NAN: f64 = f64::NAN;
/// Infinity (∞).
/// Use [`f64::INFINITY`](../../std/primitive.f64.html#associatedconstant.INFINITY) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let inf = std::f64::INFINITY;
///
/// // intended way
/// let inf = f64::INFINITY;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const INFINITY: f64 = f64::INFINITY;
/// Negative infinity (−∞).
/// Use [`f64::NEG_INFINITY`](../../std/primitive.f64.html#associatedconstant.NEG_INFINITY) instead.
///
/// # Examples
///
/// ```rust
/// // deprecated way
/// let ninf = std::f64::NEG_INFINITY;
///
/// // intended way
/// let ninf = f64::NEG_INFINITY;
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
pub const NEG_INFINITY: f64 = f64::NEG_INFINITY;
......
......@@ -12,14 +12,36 @@
($T:ident, #[$attr:meta]) => (
doc_comment! {
concat!("The smallest value that can be represented by this integer type.
Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead."),
Use [`", stringify!($T), "::MIN", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MIN) instead.
# Examples
```rust
// deprecated way
let min = std::", stringify!($T), "::MIN;
// intended way
let min = ", stringify!($T), "::MIN;
```
"),
#[$attr]
pub const MIN: $T = $T::MIN;
}
doc_comment! {
concat!("The largest value that can be represented by this integer type.
Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead."),
Use [`", stringify!($T), "::MAX", "`](../../std/primitive.", stringify!($T), ".html#associatedconstant.MAX) instead.
# Examples
```rust
// deprecated way
let max = std::", stringify!($T), "::MAX;
// intended way
let max = ", stringify!($T), "::MAX;
```
"),
#[$attr]
pub const MAX: $T = $T::MAX;
}
......
......@@ -88,7 +88,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
// Use `let _ = expr;` to avoid triggering the
// unused_results lint.
stmts.push(stmt_let_undescore(cx, span, expr));
stmts.push(stmt_let_underscore(cx, span, expr));
}
}
ast::VariantData::Struct(..) => {
......@@ -112,7 +112,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
Ident::new(sym::field, span),
vec![name, field],
);
stmts.push(stmt_let_undescore(cx, span, expr));
stmts.push(stmt_let_underscore(cx, span, expr));
}
}
}
......@@ -124,7 +124,7 @@ fn show_substructure(cx: &mut ExtCtxt<'_>, span: Span, substr: &Substructure<'_>
cx.expr_block(block)
}
fn stmt_let_undescore(cx: &mut ExtCtxt<'_>, sp: Span, expr: P<ast::Expr>) -> ast::Stmt {
fn stmt_let_underscore(cx: &mut ExtCtxt<'_>, sp: Span, expr: P<ast::Expr>) -> ast::Stmt {
let local = P(ast::Local {
pat: cx.pat_wild(sp),
ty: None,
......
......@@ -853,7 +853,9 @@ unsafe fn embed_bitcode(
|| cgcx.opts.target_triple.triple().starts_with("asmjs")
{
// nothing to do here
} else if cgcx.opts.target_triple.triple().contains("windows") {
} else if cgcx.opts.target_triple.triple().contains("windows")
|| cgcx.opts.target_triple.triple().contains("uefi")
{
let asm = "
.section .llvmbc,\"n\"
.section .llvmcmd,\"n\"
......
......@@ -2607,7 +2607,7 @@ fn new_internal(
// `Box` (`UniqueBorrowed`) are not necessarily dereferenceable
// for the entire duration of the function as they can be deallocated
// any time. Set their valid size to 0.
// at any time. Set their valid size to 0.
attrs.pointee_size = match kind {
PointerKind::UniqueOwned => Size::ZERO,
_ => pointee.size,
......
......@@ -180,11 +180,14 @@ fn do_mir_borrowck<'a, 'tcx>(
let location_table = &LocationTable::new(&body);
let mut errors_buffer = Vec::new();
let (move_data, move_errors): (MoveData<'tcx>, Option<Vec<(Place<'tcx>, MoveError<'tcx>)>>) =
let (move_data, move_errors): (MoveData<'tcx>, Vec<(Place<'tcx>, MoveError<'tcx>)>) =
match MoveData::gather_moves(&body, tcx, param_env) {
Ok(move_data) => (move_data, None),
Err((move_data, move_errors)) => (move_data, Some(move_errors)),
Ok(move_data) => (move_data, Vec::new()),
Err((move_data, move_errors)) => (move_data, move_errors),
};
let promoted_errors = promoted
.iter_enumerated()
.map(|(idx, body)| (idx, MoveData::gather_moves(&body, tcx, param_env)));
let mdpe = MoveDataParamEnv { move_data, param_env };
......@@ -264,6 +267,41 @@ fn do_mir_borrowck<'a, 'tcx>(
_ => true,
};
for (idx, move_data_results) in promoted_errors {
let promoted_body = &promoted[idx];
let dominators = promoted_body.dominators();
if let Err((move_data, move_errors)) = move_data_results {
let mut promoted_mbcx = MirBorrowckCtxt {
infcx,
body: promoted_body,
mir_def_id: def_id.to_def_id(),
move_data: &move_data,
location_table: &LocationTable::new(promoted_body),
movable_generator,
locals_are_invalidated_at_exit,
access_place_error_reported: Default::default(),
reservation_error_reported: Default::default(),
reservation_warnings: Default::default(),
move_error_reported: BTreeMap::new(),
uninitialized_error_reported: Default::default(),
errors_buffer,
regioncx: regioncx.clone(),
used_mut: Default::default(),
used_mut_upvars: SmallVec::new(),
borrow_set: borrow_set.clone(),
dominators,
upvars: Vec::new(),
local_names: IndexVec::from_elem(None, &promoted_body.local_decls),
region_names: RefCell::default(),
next_region_name: RefCell::new(1),
polonius_output: None,
};
promoted_mbcx.report_move_errors(move_errors);
errors_buffer = promoted_mbcx.errors_buffer;
};
}
let dominators = body.dominators();
let mut mbcx = MirBorrowckCtxt {
......@@ -301,9 +339,7 @@ fn do_mir_borrowck<'a, 'tcx>(
borrows: flow_borrows,
};
if let Some(errors) = move_errors {
mbcx.report_move_errors(errors);
}
mbcx.report_move_errors(move_errors);
dataflow::visit_results(
&body,
......
......@@ -39,6 +39,9 @@ fn emit_error(&self, ccx: &ConstCx<'_, '_>, span: Span) {
"{} contains unimplemented expression type",
ccx.const_kind()
);
if let Some(feat) = Self::feature_gate() {
err.help(&format!("add `#![feature({})]` to the crate attributes to enable", feat));
}
if ccx.tcx.sess.teach(&err.get_code().unwrap()) {
err.note(
"A function call isn't allowed in the const's initialization expression \
......
......@@ -1753,7 +1753,7 @@ fn complain_about_missing_associated_types(
potential_assoc_types: Vec<Span>,
trait_bounds: &[hir::PolyTraitRef<'_>],
) {
if !associated_types.values().any(|v| !v.is_empty()) {
if associated_types.values().all(|v| v.is_empty()) {
return;
}
let tcx = self.tcx();
......
// aux-build:issue-27362.rs
// aux-build:issue-27362-aux.rs
// ignore-cross-compile
// ignore-test This test fails on beta/stable #32019
extern crate issue_27362;
pub use issue_27362 as quux;
extern crate issue_27362_aux;
// @matches issue_27362/quux/fn.foo.html '//pre' "pub const fn foo()"
// @matches issue_27362/quux/fn.bar.html '//pre' "pub const unsafe fn bar()"
// @matches issue_27362/quux/struct.Foo.html '//code' "const unsafe fn baz()"
pub use issue_27362_aux::*;
// @matches issue_27362/fn.foo.html '//pre' "pub const fn foo()"
// @matches issue_27362/fn.bar.html '//pre' "pub const unsafe fn bar()"
// @matches issue_27362/struct.Foo.html '//code' "const unsafe fn baz()"
// Regression test for #70934
struct S;
fn foo() {
&([S][0],);
//~^ ERROR cannot move out of type `[S; 1]`
}
fn main() {}
error[E0508]: cannot move out of type `[S; 1]`, a non-copy array
--> $DIR/move-error-in-promoted-2.rs:6:7
|
LL | &([S][0],);
| ^^^^^^
| |
| cannot move out of here
| move occurs because value has type `S`, which does not implement the `Copy` trait
error: aborting due to previous error
For more information about this error, try `rustc --explain E0508`.
// Regression test for #70934
fn f() {
const C: [S2; 1] = [S2];
let _ = S1(C[0]).clone();
//~^ ERROR cannot move out of type `[S2; 1]`
}
#[derive(Clone)]
struct S1(S2);
#[derive(Clone)]
struct S2;
fn main() {
f();
}
error[E0508]: cannot move out of type `[S2; 1]`, a non-copy array
--> $DIR/move-error-in-promoted.rs:5:16
|
LL | let _ = S1(C[0]).clone();
| ^^^^
| |
| cannot move out of here
| move occurs because value has type `S2`, which does not implement the `Copy` trait
error: aborting due to previous error
For more information about this error, try `rustc --explain E0508`.
......@@ -18,6 +18,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | static STATIC11: Box<MyOwned> = box MyOwned;
| ^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
--> $DIR/check-static-values-constraints.rs:90:32
......@@ -36,6 +38,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | box MyOwned,
| ^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:97:5
......@@ -48,6 +52,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | box MyOwned,
| ^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:102:6
......@@ -60,6 +66,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | &box MyOwned,
| ^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:104:6
......@@ -72,6 +80,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | &box MyOwned,
| ^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0010]: allocations are not allowed in statics
--> $DIR/check-static-values-constraints.rs:111:5
......@@ -84,6 +94,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | box 3;
| ^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0507]: cannot move out of static item `x`
--> $DIR/check-static-values-constraints.rs:116:45
......@@ -105,6 +117,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | let y = { static x: Box<isize> = box 3; x };
| ^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 17 previous errors
......
const WRITE: () = unsafe {
*std::ptr::null_mut() = 0;
//~^ ERROR dereferencing raw pointers in constants is unstable
//~| HELP add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
//~| ERROR constant contains unimplemented expression type
//~| HELP add `#![feature(const_mut_refs)]` to the crate attributes to enable
};
fn main() {}
error[E0658]: dereferencing raw pointers in constants is unstable
--> $DIR/const-suggest-feature.rs:2:5
|
LL | *std::ptr::null_mut() = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: see issue #51911 <https://github.com/rust-lang/rust/issues/51911> for more information
= help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
error[E0019]: constant contains unimplemented expression type
--> $DIR/const-suggest-feature.rs:2:5
|
LL | *std::ptr::null_mut() = 0;
| ^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0019, E0658.
For more information about an error, try `rustc --explain E0019`.
......@@ -3,6 +3,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | *FOO.0.get() = 5;
| ^^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to previous error
......
......@@ -3,6 +3,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | *FOO.0.get() = 5;
| ^^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants
--> $DIR/mod-static-with-const-fn.rs:21:5
......
......@@ -3,6 +3,8 @@ error[E0019]: constant function contains unimplemented expression type
|
LL | self.state = x;
| ^^^^^^^^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: references in constants may only refer to immutable values
--> $DIR/const_let_assign3.rs:16:5
......@@ -27,6 +29,8 @@ error[E0019]: constant contains unimplemented expression type
|
LL | *y = 42;
| ^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 4 previous errors
......
......@@ -21,6 +21,8 @@ error[E0019]: constant contains unimplemented expression type
|
LL | unsafe { *b = 5; }
| ^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 3 previous errors
......
......@@ -12,6 +12,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 2 previous errors
......
......@@ -12,6 +12,7 @@ error[E0019]: constant contains unimplemented expression type
LL | const CON : Box<i32> = box 0;
| ^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
= note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time.
= note: Remember: you can't use a function call inside a const's initialization expression! However, you can use it anywhere else.
......
......@@ -9,6 +9,8 @@ error[E0019]: constant contains unimplemented expression type
|
LL | const CON : Box<i32> = box 0;
| ^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 2 previous errors
......
......@@ -12,6 +12,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: references in statics may only refer to immutable values
--> $DIR/E0017.rs:6:39
......
......@@ -12,6 +12,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | static STATIC_REF: &'static mut i32 = &mut X;
| ^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0658]: references in statics may only refer to immutable values
--> $DIR/E0388.rs:5:39
......
// Test that we use fully-qualified type names in error messages.
// ignore-test
type T1 = usize;
type T2 = isize;
fn bar(x: T1) -> T2 {
return x;
//~^ ERROR mismatched types: expected `T2`, found `T1`
}
fn main() {
}
// ignore-test the unsized enum no longer compiles
enum A {
B(char),
C([Box<A>]),
}
fn c(c:char) {
A::B(c);
//~^ ERROR cannot move a value of type A: the size of A cannot be statically determined
}
pub fn main() {}
......@@ -9,6 +9,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
| ^^^^^^^^^^^^^^^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error[E0277]: `std::cell::RefCell<isize>` cannot be shared between threads safely
--> $DIR/issue-7364.rs:6:1
......
......@@ -9,6 +9,8 @@ error[E0019]: static contains unimplemented expression type
|
LL | static mut a: Box<isize> = box 3;
| ^
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
error: aborting due to 2 previous errors
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册