Auto merge of #77557 - Dylan-DPC:rollup-aib9ptp, r=Dylan-DPC

Rollup of 11 pull requests

Successful merges:

 - #75853 (Use more intra-doc-links in `core::fmt`)
 - #75928 (Remove trait_selection error message in specific case)
 - #76329 (Add check for doc alias attribute at crate level)
 - #77219 (core::global_allocator docs link to std::alloc::GlobalAlloc)
 - #77395 (BTreeMap: admit the existence of leaf edges in comments)
 - #77407 (Improve build-manifest to work with the improved promote-release)
 - #77426 (Include scope id in SocketAddrV6::Display)
 - #77439 (Fix missing diagnostic span for `impl Trait` with const generics, and add various tests for `min_const_generics` and `const_generics`)
 - #77471 (BTreeMap: refactoring around edges, missed spots)
 - #77512 (Allow `Abort` terminators in all const-contexts)
 - #77514 (Replace some once(x).chain(once(y)) with [x, y] IntoIter)

Failed merges:

r? `@ghost`
This commit is contained in:
bors 2020-10-05 02:49:51 +00:00
commit efbaa41306
116 changed files with 1643 additions and 659 deletions

View File

@ -183,7 +183,16 @@ dependencies = [
"block-padding",
"byte-tools",
"byteorder",
"generic-array",
"generic-array 0.12.3",
]
[[package]]
name = "block-buffer"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4"
dependencies = [
"generic-array 0.14.4",
]
[[package]]
@ -233,8 +242,11 @@ version = "0.1.0"
dependencies = [
"anyhow",
"flate2",
"hex 0.4.2",
"rayon",
"serde",
"serde_json",
"sha2",
"tar",
"toml",
]
@ -687,6 +699,12 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a21fa21941700a3cd8fcb4091f361a6a712fac632f85d9f487cc892045d55c6"
[[package]]
name = "cpuid-bool"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634"
[[package]]
name = "crates-io"
version = "0.31.1"
@ -884,7 +902,16 @@ version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
dependencies = [
"generic-array",
"generic-array 0.12.3",
]
[[package]]
name = "digest"
version = "0.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066"
dependencies = [
"generic-array 0.14.4",
]
[[package]]
@ -1166,6 +1193,16 @@ dependencies = [
"typenum",
]
[[package]]
name = "generic-array"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817"
dependencies = [
"typenum",
"version_check",
]
[[package]]
name = "getopts"
version = "0.2.21"
@ -1835,9 +1872,9 @@ version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a18af3dcaf2b0219366cdb4e2af65a6101457b415c3d1a5c71dd9c2b7c77b9c8"
dependencies = [
"block-buffer",
"digest",
"opaque-debug",
"block-buffer 0.7.3",
"digest 0.8.1",
"opaque-debug 0.2.3",
]
[[package]]
@ -2097,6 +2134,12 @@ version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c"
[[package]]
name = "opaque-debug"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5"
[[package]]
name = "open"
version = "1.4.0"
@ -4362,10 +4405,23 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df"
dependencies = [
"block-buffer",
"digest",
"block-buffer 0.7.3",
"digest 0.8.1",
"fake-simd",
"opaque-debug",
"opaque-debug 0.2.3",
]
[[package]]
name = "sha2"
version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2933378ddfeda7ea26f48c555bdad8bb446bf8a3d17832dc83e380d444cfb8c1"
dependencies = [
"block-buffer 0.9.0",
"cfg-if",
"cpuid-bool",
"digest 0.9.0",
"opaque-debug 0.3.0",
]
[[package]]

View File

@ -581,7 +581,7 @@ declare_features! (
/// Allows `if let` guard in match arms.
(active, if_let_guard, "1.47.0", Some(51114), None),
/// Allows non trivial generic constants which have to be manually propageted upwards.
/// Allows non-trivial generic constants which have to be manually propageted upwards.
(active, const_evaluatable_checked, "1.48.0", Some(76560), None),
/// Allows basic arithmetic on floating point types in a `const fn`.

View File

@ -341,9 +341,7 @@ impl<T> PerNS<Option<T>> {
/// Returns an iterator over the items which are `Some`.
pub fn present_items(self) -> impl Iterator<Item = T> {
use std::iter::once;
once(self.type_ns).chain(once(self.value_ns)).chain(once(self.macro_ns)).filter_map(|it| it)
IntoIter::new([self.type_ns, self.value_ns, self.macro_ns]).filter_map(|it| it)
}
}

View File

@ -9,13 +9,13 @@ use crate::{Item, ItemKind, TraitItem, TraitItemKind};
use std::fmt::{self, Display};
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum MethodKind {
Trait { body: bool },
Inherent,
}
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, Debug)]
pub enum Target {
ExternCrate,
Use,

View File

@ -41,18 +41,6 @@ pub trait NonConstOp: std::fmt::Debug {
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx>;
}
#[derive(Debug)]
pub struct Abort;
impl NonConstOp for Abort {
fn status_in_item(&self, ccx: &ConstCx<'_, '_>) -> Status {
mcf_status_in_item(ccx)
}
fn build_error(&self, ccx: &ConstCx<'_, 'tcx>, span: Span) -> DiagnosticBuilder<'tcx> {
mcf_build_error(ccx, span, "abort is not stable in const fn")
}
}
#[derive(Debug)]
pub struct FloatingPointOp;
impl NonConstOp for FloatingPointOp {

View File

@ -434,11 +434,13 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
fn visit_basic_block_data(&mut self, bb: BasicBlock, block: &BasicBlockData<'tcx>) {
trace!("visit_basic_block_data: bb={:?} is_cleanup={:?}", bb, block.is_cleanup);
// Just as the old checker did, we skip const-checking basic blocks on the unwind path.
// These blocks often drop locals that would otherwise be returned from the function.
// We don't const-check basic blocks on the cleanup path since we never unwind during
// const-eval: a panic causes an immediate compile error. In other words, cleanup blocks
// are unreachable during const-eval.
//
// FIXME: This shouldn't be unsound since a panic at compile time will cause a compiler
// error anyway, but maybe we should do more here?
// We can't be more conservative (e.g., by const-checking cleanup blocks anyways) because
// locals that would never be dropped during normal execution are sometimes dropped during
// unwinding, which means backwards-incompatible live-drop errors.
if block.is_cleanup {
return;
}
@ -874,12 +876,16 @@ impl Visitor<'tcx> for Validator<'mir, 'tcx> {
}
TerminatorKind::InlineAsm { .. } => self.check_op(ops::InlineAsm),
TerminatorKind::Abort => self.check_op(ops::Abort),
TerminatorKind::GeneratorDrop | TerminatorKind::Yield { .. } => {
self.check_op(ops::Generator(hir::GeneratorKind::Gen))
}
TerminatorKind::Abort => {
// Cleanup blocks are skipped for const checking (see `visit_basic_block_data`).
span_bug!(self.span, "`Abort` terminator outside of cleanup block")
}
TerminatorKind::Assert { .. }
| TerminatorKind::FalseEdge { .. }
| TerminatorKind::FalseUnwind { .. }

View File

@ -13,12 +13,14 @@ use rustc_errors::{pluralize, struct_span_err};
use rustc_hir as hir;
use rustc_hir::def_id::LocalDefId;
use rustc_hir::intravisit::{self, NestedVisitorMap, Visitor};
use rustc_hir::{self, FnSig, ForeignItem, ForeignItemKind, HirId, Item, ItemKind, TraitItem};
use rustc_hir::{
self, FnSig, ForeignItem, ForeignItemKind, HirId, Item, ItemKind, TraitItem, CRATE_HIR_ID,
};
use rustc_hir::{MethodKind, Target};
use rustc_session::lint::builtin::{CONFLICTING_REPR_HINTS, UNUSED_ATTRIBUTES};
use rustc_session::parse::feature_err;
use rustc_span::symbol::sym;
use rustc_span::Span;
use rustc_span::symbol::{sym, Symbol};
use rustc_span::{Span, DUMMY_SP};
pub(crate) fn target_from_impl_item<'tcx>(
tcx: TyCtxt<'tcx>,
@ -333,6 +335,17 @@ impl CheckAttrVisitor<'tcx> {
.emit();
return false;
}
if CRATE_HIR_ID == hir_id {
self.tcx
.sess
.struct_span_err(
meta.span(),
"`#![doc(alias = \"...\")]` isn't allowed as a crate \
level attribute",
)
.emit();
return false;
}
}
}
}
@ -808,9 +821,46 @@ fn is_c_like_enum(item: &Item<'_>) -> bool {
}
}
fn check_invalid_crate_level_attr(tcx: TyCtxt<'_>, attrs: &[Attribute]) {
const ATTRS_TO_CHECK: &[Symbol] = &[
sym::macro_export,
sym::repr,
sym::path,
sym::automatically_derived,
sym::start,
sym::main,
];
for attr in attrs {
for attr_to_check in ATTRS_TO_CHECK {
if tcx.sess.check_name(attr, *attr_to_check) {
tcx.sess
.struct_span_err(
attr.span,
&format!(
"`{}` attribute cannot be used at crate level",
attr_to_check.to_ident_string()
),
)
.emit();
}
}
}
}
fn check_mod_attrs(tcx: TyCtxt<'_>, module_def_id: LocalDefId) {
tcx.hir()
.visit_item_likes_in_module(module_def_id, &mut CheckAttrVisitor { tcx }.as_deep_visitor());
if module_def_id.is_top_level_module() {
CheckAttrVisitor { tcx }.check_attributes(
CRATE_HIR_ID,
tcx.hir().krate_attrs(),
&DUMMY_SP,
Target::Mod,
None,
);
check_invalid_crate_level_attr(tcx, tcx.hir().krate_attrs());
}
}
pub(crate) fn provide(providers: &mut Providers) {

View File

@ -78,29 +78,38 @@ fn entry_fn(tcx: TyCtxt<'_>, cnum: CrateNum) -> Option<(LocalDefId, EntryFnType)
// Beware, this is duplicated in `librustc_builtin_macros/test_harness.rs`
// (with `ast::Item`), so make sure to keep them in sync.
fn entry_point_type(sess: &Session, item: &Item<'_>, at_root: bool) -> EntryPointType {
match item.kind {
ItemKind::Fn(..) => {
if sess.contains_name(&item.attrs, sym::start) {
EntryPointType::Start
} else if sess.contains_name(&item.attrs, sym::main) {
EntryPointType::MainAttr
} else if item.ident.name == sym::main {
if at_root {
// This is a top-level function so can be `main`.
EntryPointType::MainNamed
} else {
EntryPointType::OtherMain
}
} else {
EntryPointType::None
}
if sess.contains_name(&item.attrs, sym::start) {
EntryPointType::Start
} else if sess.contains_name(&item.attrs, sym::main) {
EntryPointType::MainAttr
} else if item.ident.name == sym::main {
if at_root {
// This is a top-level function so can be `main`.
EntryPointType::MainNamed
} else {
EntryPointType::OtherMain
}
_ => EntryPointType::None,
} else {
EntryPointType::None
}
}
fn throw_attr_err(sess: &Session, span: Span, attr: &str) {
sess.struct_span_err(span, &format!("`{}` attribute can only be used on functions", attr))
.emit();
}
fn find_item(item: &Item<'_>, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
match entry_point_type(&ctxt.session, item, at_root) {
EntryPointType::None => (),
_ if !matches!(item.kind, ItemKind::Fn(..)) => {
if let Some(attr) = ctxt.session.find_by_name(item.attrs, sym::start) {
throw_attr_err(&ctxt.session, attr.span, "start");
}
if let Some(attr) = ctxt.session.find_by_name(item.attrs, sym::main) {
throw_attr_err(&ctxt.session, attr.span, "main");
}
}
EntryPointType::MainNamed => {
if ctxt.main_fn.is_none() {
ctxt.main_fn = Some((item.hir_id, item.span));
@ -137,7 +146,6 @@ fn find_item(item: &Item<'_>, ctxt: &mut EntryContext<'_, '_>, at_root: bool) {
.emit();
}
}
EntryPointType::None => (),
}
}

View File

@ -469,7 +469,7 @@ impl<'a> Resolver<'a> {
ResolutionError::ParamInNonTrivialAnonConst { name, is_type } => {
let mut err = self.session.struct_span_err(
span,
"generic parameters must not be used inside of non trivial constant values",
"generic parameters must not be used inside of non-trivial constant values",
);
err.span_label(
span,

View File

@ -218,7 +218,7 @@ enum ResolutionError<'a> {
ParamInTyOfConstParam(Symbol),
/// constant values inside of type parameter defaults must not depend on generic parameters.
ParamInAnonConstInTyDefault(Symbol),
/// generic parameters must not be used inside of non trivial constant values.
/// generic parameters must not be used inside of non-trivial constant values.
///
/// This error is only emitted when using `min_const_generics`.
ParamInNonTrivialAnonConst { name: Symbol, is_type: bool },

View File

@ -518,7 +518,7 @@ declare_lint! {
/// ### Example
///
/// ```rust
/// #![macro_export]
/// #![ignore]
/// ```
///
/// {{produces}}

View File

@ -11,6 +11,7 @@
//! This API is completely unstable and subject to change.
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(array_value_iter)]
#![feature(bool_to_option)]
#![feature(box_patterns)]
#![feature(drain_filter)]

View File

@ -1907,6 +1907,11 @@ impl<'a, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'a, 'tcx> {
ObligationCauseCode::BuiltinDerivedObligation(ref data) => {
let parent_trait_ref = self.resolve_vars_if_possible(&data.parent_trait_ref);
let ty = parent_trait_ref.skip_binder().self_ty();
if parent_trait_ref.references_error() {
err.cancel();
return;
}
err.note(&format!("required because it appears within the type `{}`", ty));
obligated_types.push(ty);

View File

@ -24,6 +24,7 @@ use rustc_span::symbol::Symbol;
use rustc_span::Span;
use smallvec::SmallVec;
use std::array;
use std::iter;
pub use crate::traits::{MethodViolationCode, ObjectSafetyViolation};
@ -652,8 +653,7 @@ fn receiver_is_dispatchable<'tcx>(
let caller_bounds: Vec<Predicate<'tcx>> = param_env
.caller_bounds()
.iter()
.chain(iter::once(unsize_predicate))
.chain(iter::once(trait_predicate))
.chain(array::IntoIter::new([unsize_predicate, trait_predicate]))
.collect();
ty::ParamEnv::new(tcx.intern_predicates(&caller_bounds), param_env.reveal())

View File

@ -562,7 +562,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
.args
.iter()
.filter_map(|arg| match arg {
GenericArg::Type(_) => Some(arg.span()),
GenericArg::Type(_) | GenericArg::Const(_) => Some(arg.span()),
_ => None,
})
.collect::<Vec<_>>();

View File

@ -35,8 +35,8 @@ use rustc_trait_selection::traits::error_reporting::report_object_safety_error;
use rustc_trait_selection::traits::wf::object_region_bounds;
use smallvec::SmallVec;
use std::array;
use std::collections::BTreeSet;
use std::iter;
use std::slice;
#[derive(Debug)]
@ -1346,7 +1346,7 @@ impl<'o, 'tcx> dyn AstConv<'tcx> + 'o {
debug!("one_bound_for_assoc_type: bound2 = {:?}", bound2);
let is_equality = is_equality();
let bounds = iter::once(bound).chain(iter::once(bound2)).chain(matching_candidates);
let bounds = array::IntoIter::new([bound, bound2]).chain(matching_candidates);
let mut err = if is_equality.is_some() {
// More specific Error Index entry.
struct_span_err!(

View File

@ -222,6 +222,7 @@ impl Visitor<'tcx> for CollectItemTypesVisitor<'tcx> {
hir::GenericParamKind::Const { .. } => {
let def_id = self.tcx.hir().local_def_id(param.hir_id);
self.tcx.ensure().type_of(def_id);
// FIXME(const_generics:defaults)
}
}
}

View File

@ -56,6 +56,7 @@ This API is completely unstable and subject to change.
*/
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/nightly-rustc/")]
#![feature(array_value_iter)]
#![feature(bool_to_option)]
#![feature(box_syntax)]
#![feature(crate_visibility_modifier)]

View File

@ -9,11 +9,8 @@
// struct Node<K, V, height: usize> {
// keys: [K; 2 * B - 1],
// vals: [V; 2 * B - 1],
// edges: if height > 0 {
// [Box<Node<K, V, height - 1>>; 2 * B]
// } else { () },
// parent: Option<NonNull<Node<K, V, height + 1>>>,
// parent_idx: u16,
// edges: [if height > 0 { Box<Node<K, V, height - 1>> } else { () }; 2 * B],
// parent: Option<(NonNull<Node<K, V, height + 1>>, u16)>,
// len: u16,
// }
// ```
@ -28,8 +25,8 @@
//
// - Trees must have uniform depth/height. This means that every path down to a leaf from a
// given node has exactly the same length.
// - A node of length `n` has `n` keys, `n` values, and (in an internal node) `n + 1` edges.
// This implies that even an empty internal node has at least one edge.
// - A node of length `n` has `n` keys, `n` values, and `n + 1` edges.
// This implies that even an empty node has at least one edge.
use core::cmp::Ordering;
use core::marker::PhantomData;
@ -298,9 +295,8 @@ impl<'a, K, V> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
}
impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
/// Finds the length of the node. This is the number of keys or values. In an
/// internal node, the number of edges is `len() + 1`.
/// For any node, the number of possible edge handles is also `len() + 1`.
/// Finds the length of the node. This is the number of keys or values.
/// The number of edges is `len() + 1`.
/// Note that, despite being safe, calling this function can have the side effect
/// of invalidating mutable references that unsafe code has created.
pub fn len(&self) -> usize {
@ -321,9 +317,6 @@ impl<BorrowType, K, V, Type> NodeRef<BorrowType, K, V, Type> {
}
/// Exposes the leaf portion of any leaf or internal node.
/// If the node is a leaf, this function simply opens up its data.
/// If the node is an internal node, so not a leaf, it does have all the data a leaf has
/// (header, keys and values), and this function exposes that.
///
/// Returns a raw ptr to avoid invalidating other references to this node,
/// which is possible when BorrowType is marker::ValMut.
@ -471,9 +464,6 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
}
/// Exposes the leaf portion of any leaf or internal node for writing.
/// If the node is a leaf, this function simply opens up its data.
/// If the node is an internal node, so not a leaf, it does have all the data a leaf has
/// (header, keys and values), and this function exposes that.
///
/// We don't need to return a raw ptr because we have unique access to the entire node.
fn as_leaf_mut(&mut self) -> &'a mut LeafNode<K, V> {
@ -484,7 +474,7 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
///
/// # Safety
/// The node has more than `idx` initialized elements.
pub unsafe fn key_mut_at(&mut self, idx: usize) -> &mut K {
unsafe fn key_mut_at(&mut self, idx: usize) -> &mut K {
unsafe { self.reborrow_mut().into_key_mut_at(idx) }
}
@ -492,7 +482,7 @@ impl<'a, K, V, Type> NodeRef<marker::Mut<'a>, K, V, Type> {
///
/// # Safety
/// The node has more than `idx` initialized elements.
pub unsafe fn val_mut_at(&mut self, idx: usize) -> &mut V {
unsafe fn val_mut_at(&mut self, idx: usize) -> &mut V {
unsafe { self.reborrow_mut().into_val_mut_at(idx) }
}
@ -655,7 +645,7 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
/// Adds a key/value pair, and an edge to go to the left of that pair,
/// to the beginning of the node.
pub fn push_front(&mut self, key: K, val: V, edge: Root<K, V>) {
fn push_front(&mut self, key: K, val: V, edge: Root<K, V>) {
assert!(edge.height == self.height - 1);
assert!(self.len() < CAPACITY);
@ -679,9 +669,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::Internal> {
}
impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
/// Removes a key/value pair from the end of this node and returns the pair.
/// If this is an internal node, also removes the edge that was to the right
/// of that pair and returns the orphaned node that this edge owned.
/// Removes a key/value pair from the end of the node and returns the pair.
/// Also removes the edge that was to the right of that pair and, if the node
/// is internal, returns the orphaned subtree that this edge owned.
fn pop(&mut self) -> (K, V, Option<Root<K, V>>) {
debug_assert!(self.len() > 0);
@ -705,9 +695,9 @@ impl<'a, K: 'a, V: 'a> NodeRef<marker::Mut<'a>, K, V, marker::LeafOrInternal> {
}
}
/// Removes a key/value pair from the beginning of this node and returns the pair.
/// If this is an internal node, also removes the edge that was to the left
/// of that pair and returns the orphaned node that this edge owned.
/// Removes a key/value pair from the beginning of the node and returns the pair.
/// Also removes the edge that was to the left of that pair and, if the node is
/// internal, returns the orphaned subtree that this edge owned.
fn pop_front(&mut self) -> (K, V, Option<Root<K, V>>) {
debug_assert!(self.len() > 0);
@ -1011,18 +1001,18 @@ impl<'a, K: 'a, V: 'a> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>,
let (middle_kv_idx, insertion) = splitpoint(self.idx);
let middle = unsafe { Handle::new_kv(self.node, middle_kv_idx) };
let (mut left, k, v, mut right) = middle.split();
match insertion {
let mut insertion_edge = match insertion {
InsertionPlace::Left(insert_idx) => unsafe {
Handle::new_edge(left.reborrow_mut(), insert_idx).insert_fit(key, val, edge);
Handle::new_edge(left.reborrow_mut(), insert_idx)
},
InsertionPlace::Right(insert_idx) => unsafe {
Handle::new_edge(
right.node_as_mut().cast_unchecked::<marker::Internal>(),
insert_idx,
)
.insert_fit(key, val, edge);
},
}
};
insertion_edge.insert_fit(key, val, edge);
InsertResult::Split(SplitResult { left: left.forget_type(), k, v, right })
}
}

View File

@ -9,10 +9,11 @@
// ignore-tidy-filelength
use core::array;
use core::cmp::{self, Ordering};
use core::fmt;
use core::hash::{Hash, Hasher};
use core::iter::{once, repeat_with, FromIterator, FusedIterator};
use core::iter::{repeat_with, FromIterator, FusedIterator};
use core::mem::{self, replace, ManuallyDrop};
use core::ops::{Index, IndexMut, Range, RangeBounds, Try};
use core::ptr::{self, NonNull};
@ -99,7 +100,7 @@ impl<'a, 'b, T> PairSlices<'a, 'b, T> {
}
fn remainder(self) -> impl Iterator<Item = &'b [T]> {
once(self.b0).chain(once(self.b1))
array::IntoIter::new([self.b0, self.b1])
}
}

View File

@ -77,6 +77,7 @@
#![cfg_attr(test, feature(new_uninit))]
#![feature(allocator_api)]
#![feature(array_chunks)]
#![feature(array_value_iter)]
#![feature(array_windows)]
#![feature(allow_internal_unstable)]
#![feature(arbitrary_self_types)]

View File

@ -102,7 +102,7 @@ pub struct Error;
/// library. The [`write!`] macro accepts an instance of [`io::Write`], and the
/// [`io::Write`] trait is favored over implementing this trait.
///
/// [`write!`]: ../../std/macro.write.html
/// [`write!`]: crate::write!
/// [`io::Write`]: ../../std/io/trait.Write.html
#[stable(feature = "rust1", since = "1.0.0")]
pub trait Write {
@ -1058,7 +1058,7 @@ pub trait UpperExp {
/// assert_eq!(output, "Hello world!");
/// ```
///
/// [`write!`]: ../../std/macro.write.html
/// [`write!`]: crate::write!
#[stable(feature = "rust1", since = "1.0.0")]
pub fn write(output: &mut dyn Write, args: Arguments<'_>) -> Result {
let mut formatter = Formatter {
@ -1886,7 +1886,7 @@ impl<'a> Formatter<'a> {
/// assert_eq!(format!("{:?}", Foo(vec![10, 11])), "{10, 11}");
/// ```
///
/// [`format_args!`]: ../../std/macro.format_args.html
/// [`format_args!`]: crate::format_args
///
/// In this more complex example, we use [`format_args!`] and `.debug_set()`
/// to build a list of match arms:

View File

@ -1365,6 +1365,8 @@ pub(crate) mod builtin {
}
/// Attribute macro applied to a static to register it as a global allocator.
///
/// See also [`std::alloc::GlobalAlloc`](../std/alloc/trait.GlobalAlloc.html).
#[stable(feature = "global_allocator", since = "1.28.0")]
#[allow_internal_unstable(rustc_attrs)]
#[rustc_builtin_macro]

View File

@ -623,19 +623,27 @@ impl fmt::Display for SocketAddrV6 {
// Fast path: if there's no alignment stuff, write to the output
// buffer directly
if f.precision().is_none() && f.width().is_none() {
write!(f, "[{}]:{}", self.ip(), self.port())
match self.scope_id() {
0 => write!(f, "[{}]:{}", self.ip(), self.port()),
scope_id => write!(f, "[{}%{}]:{}", self.ip(), scope_id, self.port()),
}
} else {
const IPV6_SOCKET_BUF_LEN: usize = (4 * 8) // The address
+ 7 // The colon separators
+ 2 // The brackets
+ 1 + 10 // The scope id
+ 1 + 5; // The port
let mut buf = [0; IPV6_SOCKET_BUF_LEN];
let mut buf_slice = &mut buf[..];
match self.scope_id() {
0 => write!(buf_slice, "[{}]:{}", self.ip(), self.port()),
scope_id => write!(buf_slice, "[{}%{}]:{}", self.ip(), scope_id, self.port()),
}
// Unwrap is fine because writing to a sufficiently-sized
// buffer is infallible
write!(buf_slice, "[{}]:{}", self.ip(), self.port()).unwrap();
.unwrap();
let len = IPV6_SOCKET_BUF_LEN - buf_slice.len();
// This unsafe is OK because we know what is being written to the buffer

View File

@ -178,13 +178,21 @@ fn socket_v4_to_str() {
#[test]
fn socket_v6_to_str() {
let socket: SocketAddrV6 = "[2a02:6b8:0:1::1]:53".parse().unwrap();
let mut socket = SocketAddrV6::new(Ipv6Addr::new(0x2a02, 0x6b8, 0, 1, 0, 0, 0, 1), 53, 0, 0);
assert_eq!(format!("{}", socket), "[2a02:6b8:0:1::1]:53");
assert_eq!(format!("{:<24}", socket), "[2a02:6b8:0:1::1]:53 ");
assert_eq!(format!("{:>24}", socket), " [2a02:6b8:0:1::1]:53");
assert_eq!(format!("{:^24}", socket), " [2a02:6b8:0:1::1]:53 ");
assert_eq!(format!("{:.15}", socket), "[2a02:6b8:0:1::");
socket.set_scope_id(5);
assert_eq!(format!("{}", socket), "[2a02:6b8:0:1::1%5]:53");
assert_eq!(format!("{:<24}", socket), "[2a02:6b8:0:1::1%5]:53 ");
assert_eq!(format!("{:>24}", socket), " [2a02:6b8:0:1::1%5]:53");
assert_eq!(format!("{:^24}", socket), " [2a02:6b8:0:1::1%5]:53 ");
assert_eq!(format!("{:.18}", socket), "[2a02:6b8:0:1::1%5");
}
#[test]

View File

@ -477,7 +477,7 @@ impl<'a> Builder<'a> {
install::Src,
install::Rustc
),
Kind::Run => describe!(run::ExpandYamlAnchors,),
Kind::Run => describe!(run::ExpandYamlAnchors, run::BuildManifest,),
}
}

View File

@ -46,7 +46,7 @@ pub fn pkgname(builder: &Builder<'_>, component: &str) -> String {
}
}
fn distdir(builder: &Builder<'_>) -> PathBuf {
pub(crate) fn distdir(builder: &Builder<'_>) -> PathBuf {
builder.out.join("dist")
}
@ -2371,6 +2371,7 @@ impl Step for HashSign {
cmd.arg(addr);
cmd.arg(&builder.config.channel);
cmd.arg(&builder.src);
cmd.env("BUILD_MANIFEST_LEGACY", "1");
builder.create_dir(&distdir(builder));

View File

@ -1,5 +1,7 @@
use crate::builder::{Builder, RunConfig, ShouldRun, Step};
use crate::dist::distdir;
use crate::tool::Tool;
use build_helper::output;
use std::process::Command;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
@ -41,3 +43,43 @@ fn try_run(builder: &Builder<'_>, cmd: &mut Command) -> bool {
}
true
}
#[derive(Debug, PartialOrd, Ord, Copy, Clone, Hash, PartialEq, Eq)]
pub struct BuildManifest;
impl Step for BuildManifest {
type Output = ();
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
run.path("src/tools/build-manifest")
}
fn make_run(run: RunConfig<'_>) {
run.builder.ensure(BuildManifest);
}
fn run(self, builder: &Builder<'_>) {
// This gets called by `promote-release`
// (https://github.com/rust-lang/promote-release).
let mut cmd = builder.tool_cmd(Tool::BuildManifest);
let sign = builder.config.dist_sign_folder.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.sign-folder` in `config.toml`\n\n")
});
let addr = builder.config.dist_upload_addr.as_ref().unwrap_or_else(|| {
panic!("\n\nfailed to specify `dist.upload-addr` in `config.toml`\n\n")
});
let today = output(Command::new("date").arg("+%Y-%m-%d"));
cmd.arg(sign);
cmd.arg(distdir(builder));
cmd.arg(today.trim());
cmd.arg(addr);
cmd.arg(&builder.config.channel);
cmd.arg(&builder.src);
builder.create_dir(&distdir(builder));
builder.run(&mut cmd);
}
}

View File

@ -0,0 +1,6 @@
#![feature(doc_alias)]
#![doc(alias = "crate-level-not-working")] //~ ERROR
#[doc(alias = "shouldn't work!")] //~ ERROR
pub fn foo() {}

View File

@ -0,0 +1,14 @@
error: '\'' character isn't allowed in `#[doc(alias = "...")]`
--> $DIR/doc-alias-crate-level.rs:5:7
|
LL | #[doc(alias = "shouldn't work!")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^
error: `#![doc(alias = "...")]` isn't allowed as a crate level attribute
--> $DIR/doc-alias-crate-level.rs:3:8
|
LL | #![doc(alias = "crate-level-not-working")]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to 2 previous errors

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/array-size-in-generic-struct-param.rs:9:48
|
LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
@ -6,7 +6,7 @@ LL | struct ArithArrayLen<const N: usize>([u32; 0 + N]);
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/array-size-in-generic-struct-param.rs:20:15
|
LL | arr: [u8; CFG.arr_size],

View File

@ -8,7 +8,7 @@
#[allow(dead_code)]
struct ArithArrayLen<const N: usize>([u32; 0 + N]);
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
#[derive(PartialEq, Eq)]
struct Config {
@ -19,7 +19,7 @@ struct B<const CFG: Config> {
//[min]~^ ERROR `Config` is forbidden
arr: [u8; CFG.arr_size],
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial
}
const C: Config = Config { arr_size: 5 };

View File

@ -0,0 +1,42 @@
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:8:28
|
LL | pub const fn is_zst<T: ?Sized>() -> usize {
| - this type parameter needs to be `Sized`
LL | if std::mem::size_of::<T>() == 0 {
| ^ doesn't have a size known at compile-time
|
::: $SRC_DIR/core/src/mem/mod.rs:LL:COL
|
LL | pub const fn size_of<T>() -> usize {
| - required by this bound in `std::mem::size_of`
error[E0080]: evaluation of constant value failed
--> $DIR/const-argument-if-length.rs:19:15
|
LL | pad: [u8; is_zst::<T>()],
| ^^^^^^^^^^^^^ referenced constant has errors
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:17:12
|
LL | pub struct AtLeastByte<T: ?Sized> {
| - this type parameter needs to be `Sized`
LL | value: T,
| ^ doesn't have a size known at compile-time
|
= note: only the last field of a struct may have a dynamically sized type
= help: change the field's type to have a statically known size
help: borrowed types always have a statically known size
|
LL | value: &T,
| ^
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
LL | value: Box<T>,
| ^^^^ ^
error: aborting due to 3 previous errors
Some errors have detailed explanations: E0080, E0277.
For more information about an error, try `rustc --explain E0080`.

View File

@ -0,0 +1,30 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/const-argument-if-length.rs:19:24
|
LL | pad: [u8; is_zst::<T>()],
| ^ non-trivial anonymous constants must not depend on the parameter `T`
|
= note: type parameters are currently not permitted in anonymous constants
error[E0277]: the size for values of type `T` cannot be known at compilation time
--> $DIR/const-argument-if-length.rs:17:12
|
LL | pub struct AtLeastByte<T: ?Sized> {
| - this type parameter needs to be `Sized`
LL | value: T,
| ^ doesn't have a size known at compile-time
|
= note: only the last field of a struct may have a dynamically sized type
= help: change the field's type to have a statically known size
help: borrowed types always have a statically known size
|
LL | value: &T,
| ^
help: the `Box` type always has a statically known size and allocates its contents in the heap
|
LL | value: Box<T>,
| ^^^^ ^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0277`.

View File

@ -0,0 +1,24 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
pub const fn is_zst<T: ?Sized>() -> usize {
if std::mem::size_of::<T>() == 0 {
//[full]~^ ERROR the size for values of type `T` cannot be known at compilation time
1
} else {
0
}
}
pub struct AtLeastByte<T: ?Sized> {
value: T,
//~^ ERROR the size for values of type `T` cannot be known at compilation time
pad: [u8; is_zst::<T>()],
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^ ERROR evaluation of constant value failed
}
fn main() {}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/feature-gate-const_evaluatable_checked.rs:6:33
|
LL | type Arr<const N: usize> = [u8; N - 1];

View File

@ -4,7 +4,7 @@
#![cfg_attr(min, feature(min_const_generics))]
type Arr<const N: usize> = [u8; N - 1];
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
fn test<const N: usize>() -> Arr<N> where Arr<N>: Default {
//[full]~^ ERROR constant expression depends

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/simple.rs:8:53
|
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
@ -6,7 +6,7 @@ LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/simple.rs:8:35
|
LL | fn test<const N: usize>() -> [u8; N - 1] where [u8; N - 1]: Default {

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/simple_fail.rs:7:33
|
LL | type Arr<const N: usize> = [u8; N - 1];

View File

@ -5,7 +5,7 @@
#![allow(incomplete_features)]
type Arr<const N: usize> = [u8; N - 1]; //[full]~ ERROR evaluation of constant
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
fn test<const N: usize>() -> Arr<N> where Arr<N>: Sized {
todo!()

View File

@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/generic-function-call-in-array-length.rs:9:29
|
LL | fn bar<const N: usize>() -> [u32; foo(N)] {
| ^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error

View File

@ -0,0 +1,18 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/generic-function-call-in-array-length.rs:9:39
|
LL | fn bar<const N: usize>() -> [u32; foo(N)] {
| ^ non-trivial anonymous constants must not depend on the parameter `N`
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/generic-function-call-in-array-length.rs:12:13
|
LL | [0; foo(N)]
| ^ non-trivial anonymous constants must not depend on the parameter `N`
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: aborting due to 2 previous errors

View File

@ -0,0 +1,16 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
const fn foo(n: usize) -> usize { n * 2 }
fn bar<const N: usize>() -> [u32; foo(N)] {
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^ ERROR constant expression depends on a generic parameter
[0; foo(N)]
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
}
fn main() {}

View File

@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/generic-sum-in-array-length.rs:7:45
|
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error

View File

@ -0,0 +1,18 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/generic-sum-in-array-length.rs:7:53
|
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^ non-trivial anonymous constants must not depend on the parameter `A`
|
= help: it is currently only allowed to use either `A` or `{ A }` as generic constants
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/generic-sum-in-array-length.rs:7:57
|
LL | fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
| ^ non-trivial anonymous constants must not depend on the parameter `B`
|
= help: it is currently only allowed to use either `B` or `{ B }` as generic constants
error: aborting due to 2 previous errors

View File

@ -0,0 +1,12 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
fn foo<const A: usize, const B: usize>(bar: [usize; A + B]) {}
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[min]~| ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^^ ERROR constant expression depends on a generic parameter
fn main() {}

View File

@ -0,0 +1,8 @@
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/impl-trait-with-const-arguments.rs:24:20
|
LL | assert_eq!(f::<4usize>(Usizable), 20usize);
| ^^^^^^ explicit generic argument not allowed
error: aborting due to previous error

View File

@ -0,0 +1,8 @@
error[E0632]: cannot provide explicit generic arguments when `impl Trait` is used in argument position
--> $DIR/impl-trait-with-const-arguments.rs:24:20
|
LL | assert_eq!(f::<4usize>(Usizable), 20usize);
| ^^^^^^ explicit generic argument not allowed
error: aborting due to previous error

View File

@ -0,0 +1,26 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
trait Usizer {
fn m(self) -> usize;
}
fn f<const N: usize>(u: impl Usizer) -> usize {
N + u.m()
}
struct Usizable;
impl Usizer for Usizable {
fn m(self) -> usize {
16
}
}
fn main() {
assert_eq!(f::<4usize>(Usizable), 20usize);
//~^ ERROR cannot provide explicit generic arguments when `impl Trait` is used in argument position
}

View File

@ -0,0 +1,10 @@
error: constant expression depends on a generic parameter
--> $DIR/intrinsics-type_name-as-const-argument.rs:15:8
|
LL | T: Trait<{std::intrinsics::type_name::<T>()}>
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error

View File

@ -0,0 +1,19 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/intrinsics-type_name-as-const-argument.rs:15:44
|
LL | T: Trait<{std::intrinsics::type_name::<T>()}>
| ^ non-trivial anonymous constants must not depend on the parameter `T`
|
= note: type parameters are currently not permitted in anonymous constants
error: `&'static str` is forbidden as the type of a const generic parameter
--> $DIR/intrinsics-type_name-as-const-argument.rs:10:22
|
LL | trait Trait<const S: &'static str> {}
| ^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to 2 previous errors

View File

@ -0,0 +1,22 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
#![feature(core_intrinsics)]
#![feature(const_type_name)]
trait Trait<const S: &'static str> {}
//[min]~^ ERROR `&'static str` is forbidden as the type of a const generic parameter
struct Bug<T>
where
T: Trait<{std::intrinsics::type_name::<T>()}>
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^ ERROR constant expression depends on a generic parameter
{
t: T
}
fn main() {}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-61522-array-len-succ.rs:7:45
|
LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
@ -6,7 +6,7 @@ LL | pub struct MyArray<const COUNT: usize>([u8; COUNT + 1]);
|
= help: it is currently only allowed to use either `COUNT` or `{ COUNT }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-61522-array-len-succ.rs:12:30
|
LL | fn inner(&self) -> &[u8; COUNT + 1] {

View File

@ -0,0 +1,21 @@
warning: cannot use constants which depend on generic parameters in types
--> $DIR/issue-67375.rs:9:12
|
LL | inner: [(); { [|_: &T| {}; 0].len() }],
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(const_evaluatable_unchecked)]` on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #76200 <https://github.com/rust-lang/rust/issues/76200>
error[E0392]: parameter `T` is never used
--> $DIR/issue-67375.rs:7:12
|
LL | struct Bug<T> {
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to previous error; 1 warning emitted
For more information about this error, try `rustc --explain E0392`.

View File

@ -0,0 +1,19 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-67375.rs:9:25
|
LL | inner: [(); { [|_: &T| {}; 0].len() }],
| ^ non-trivial anonymous constants must not depend on the parameter `T`
|
= note: type parameters are currently not permitted in anonymous constants
error[E0392]: parameter `T` is never used
--> $DIR/issue-67375.rs:7:12
|
LL | struct Bug<T> {
| ^ unused parameter
|
= help: consider removing `T`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0392`.

View File

@ -0,0 +1,15 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
struct Bug<T> {
//~^ ERROR parameter `T` is never used
inner: [(); { [|_: &T| {}; 0].len() }],
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^ WARN cannot use constants which depend on generic parameters in types
//[full]~^^^ WARN this was previously accepted by the compiler
}
fn main() {}

View File

@ -0,0 +1,26 @@
error[E0308]: mismatched types
--> $DIR/issue-67945-1.rs:14:20
|
LL | struct Bug<S> {
| - this type parameter
...
LL | let x: S = MaybeUninit::uninit();
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found union `MaybeUninit`
| |
| expected due to this
|
= note: expected type parameter `S`
found union `MaybeUninit<_>`
error[E0392]: parameter `S` is never used
--> $DIR/issue-67945-1.rs:11:12
|
LL | struct Bug<S> {
| ^ unused parameter
|
= help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0308, E0392.
For more information about an error, try `rustc --explain E0308`.

View File

@ -0,0 +1,27 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-67945-1.rs:14:16
|
LL | let x: S = MaybeUninit::uninit();
| ^ non-trivial anonymous constants must not depend on the parameter `S`
|
= note: type parameters are currently not permitted in anonymous constants
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-67945-1.rs:17:45
|
LL | let b = &*(&x as *const _ as *const S);
| ^ non-trivial anonymous constants must not depend on the parameter `S`
|
= note: type parameters are currently not permitted in anonymous constants
error[E0392]: parameter `S` is never used
--> $DIR/issue-67945-1.rs:11:12
|
LL | struct Bug<S> {
| ^ unused parameter
|
= help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0392`.

View File

@ -0,0 +1,23 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
use std::marker::PhantomData;
use std::mem::{self, MaybeUninit};
struct Bug<S> {
//~^ ERROR parameter `S` is never used
A: [(); {
let x: S = MaybeUninit::uninit();
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^ ERROR mismatched types
let b = &*(&x as *const _ as *const S);
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
0
}],
}
fn main() {}

View File

@ -0,0 +1,26 @@
error[E0308]: mismatched types
--> $DIR/issue-67945-2.rs:12:20
|
LL | struct Bug<S> {
| - this type parameter
...
LL | let x: S = MaybeUninit::uninit();
| - ^^^^^^^^^^^^^^^^^^^^^ expected type parameter `S`, found union `MaybeUninit`
| |
| expected due to this
|
= note: expected type parameter `S`
found union `MaybeUninit<_>`
error[E0392]: parameter `S` is never used
--> $DIR/issue-67945-2.rs:9:12
|
LL | struct Bug<S> {
| ^ unused parameter
|
= help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 2 previous errors
Some errors have detailed explanations: E0308, E0392.
For more information about an error, try `rustc --explain E0308`.

View File

@ -0,0 +1,27 @@
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-67945-2.rs:12:16
|
LL | let x: S = MaybeUninit::uninit();
| ^ non-trivial anonymous constants must not depend on the parameter `S`
|
= note: type parameters are currently not permitted in anonymous constants
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-67945-2.rs:15:45
|
LL | let b = &*(&x as *const _ as *const S);
| ^ non-trivial anonymous constants must not depend on the parameter `S`
|
= note: type parameters are currently not permitted in anonymous constants
error[E0392]: parameter `S` is never used
--> $DIR/issue-67945-2.rs:9:12
|
LL | struct Bug<S> {
| ^ unused parameter
|
= help: consider removing `S`, referring to it in a field, or using a marker such as `PhantomData`
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0392`.

View File

@ -0,0 +1,21 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
use std::mem::MaybeUninit;
struct Bug<S> {
//~^ ERROR parameter `S` is never used
A: [(); {
let x: S = MaybeUninit::uninit();
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[full]~^^ ERROR mismatched types
let b = &*(&x as *const _ as *const S);
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
0
}],
}
fn main() {}

View File

@ -0,0 +1,16 @@
error: constant expression depends on a generic parameter
--> $DIR/issue-67945-3.rs:8:8
|
LL | A: [(); {
| ________^
LL | |
LL | | let x: Option<Box<Self>> = None;
LL | |
LL | | 0
LL | | }],
| |______^
|
= note: this may fail depending on what value the parameter takes
error: aborting due to previous error

View File

@ -0,0 +1,8 @@
error: generic `Self` types are currently not permitted in anonymous constants
--> $DIR/issue-67945-3.rs:10:27
|
LL | let x: Option<Box<Self>> = None;
| ^^^^
error: aborting due to previous error

View File

@ -0,0 +1,17 @@
// revisions: full min
#![cfg_attr(full, allow(incomplete_features))]
#![cfg_attr(full, feature(const_generics))]
#![cfg_attr(min, feature(min_const_generics))]
struct Bug<S: ?Sized> {
A: [(); {
//[full]~^ ERROR constant expression depends on a generic parameter
let x: Option<Box<Self>> = None;
//[min]~^ ERROR generic `Self` types are currently not permitted in anonymous constants
0
}],
B: S
}
fn main() {}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-61747.rs:8:30
|
LL | fn successor() -> Const<{C + 1}> {

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-61935.rs:10:23
|
LL | Self:FooImpl<{N==0}>

View File

@ -9,7 +9,7 @@ impl<const N: usize> Foo for [(); N]
where
Self:FooImpl<{N==0}>
//[full]~^ERROR constant expression depends on a generic parameter
//[min]~^^ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ERROR generic parameters must not be used inside of non-trivial constant values
{}
trait FooImpl<const IS_ZERO: bool>{}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-62220.rs:8:59
|
LL | pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>;

View File

@ -6,7 +6,7 @@
pub struct Vector<T, const N: usize>([T; N]);
pub type TruncatedVector<T, const N: usize> = Vector<T, { N - 1 }>;
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
impl<T, const N: usize> Vector<T, { N }> {
/// Drop the last component and return the vector with one fewer dimension.

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-62456.rs:7:20
|
LL | let _ = [0u64; N + 1];

View File

@ -6,7 +6,7 @@
fn foo<const N: usize>() {
let _ = [0u64; N + 1];
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
}
fn main() {}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-64494.rs:16:38
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
@ -6,7 +6,7 @@ LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
|
= note: type parameters are currently not permitted in anonymous constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-64494.rs:19:38
|
LL | impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}

View File

@ -15,10 +15,10 @@ impl True for Is<{true}> {}
impl<T: Foo> MyTrait for T where Is<{T::VAL == 5}>: True {}
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
impl<T: Foo> MyTrait for T where Is<{T::VAL == 6}>: True {}
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
//[min]~| ERROR conflicting implementations of trait `MyTrait`
fn main() {}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-66205.rs:8:14
|
LL | fact::<{ N - 1 }>();

View File

@ -7,7 +7,7 @@
fn fact<const N: usize>() {
fact::<{ N - 1 }>();
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
}
fn main() {}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-67739.rs:12:30
|
LL | [0u8; mem::size_of::<Self::Associated>()];

View File

@ -11,7 +11,7 @@ pub trait Trait {
fn associated_size(&self) -> usize {
[0u8; mem::size_of::<Self::Associated>()];
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
0
}
}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-68366.rs:12:37
|
LL | impl <const N: usize> Collatz<{Some(N)}> {}

View File

@ -11,7 +11,7 @@ struct Collatz<const N: Option<usize>>;
impl <const N: usize> Collatz<{Some(N)}> {}
//~^ ERROR the const parameter
//[min]~^^ generic parameters must not be used inside of non trivial constant values
//[min]~^^ generic parameters must not be used inside of non-trivial constant values
struct Foo;

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-68977.rs:29:17
|
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
@ -6,7 +6,7 @@ LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
|
= help: it is currently only allowed to use either `INT_BITS` or `{ INT_BITS }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-68977.rs:29:28
|
LL | PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;

View File

@ -27,8 +27,8 @@ fxp_storage_impls! {
type FxpStorageHelper<const INT_BITS: u8, const FRAC_BITS: u8> =
PhantomU8<{(INT_BITS + FRAC_BITS + 7) / 8}>;
//[min]~^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~| ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^ ERROR generic parameters must not be used inside of non-trivial constant values
//[min]~| ERROR generic parameters must not be used inside of non-trivial constant values
struct Fxp<const INT_BITS: u8, const FRAC_BITS: u8>
where

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-72787.rs:11:17
|
LL | Condition<{ LHS <= RHS }>: True
@ -6,7 +6,7 @@ LL | Condition<{ LHS <= RHS }>: True
|
= help: it is currently only allowed to use either `LHS` or `{ LHS }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-72787.rs:11:24
|
LL | Condition<{ LHS <= RHS }>: True
@ -14,7 +14,7 @@ LL | Condition<{ LHS <= RHS }>: True
|
= help: it is currently only allowed to use either `RHS` or `{ RHS }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-72787.rs:26:25
|
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
@ -22,7 +22,7 @@ LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,
|
= help: it is currently only allowed to use either `I` or `{ I }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-72787.rs:26:36
|
LL | IsLessOrEqual<{ 8 - I }, { 8 - J }>: True,

View File

@ -10,8 +10,8 @@ pub trait True {}
impl<const LHS: u32, const RHS: u32> True for IsLessOrEqual<LHS, RHS> where
Condition<{ LHS <= RHS }>: True
//[full]~^ Error constant expression depends on a generic parameter
//[min]~^^ Error generic parameters must not be used inside of non trivial constant values
//[min]~| Error generic parameters must not be used inside of non trivial constant values
//[min]~^^ Error generic parameters must not be used inside of non-trivial constant values
//[min]~| Error generic parameters must not be used inside of non-trivial constant values
{
}
impl True for Condition<true> {}
@ -28,8 +28,8 @@ where
//[full]~| constant expression depends on a generic parameter
//[full]~| constant expression depends on a generic parameter
//[full]~| constant expression depends on a generic parameter
//[min]~^^^^^ Error generic parameters must not be used inside of non trivial constant values
//[min]~| Error generic parameters must not be used inside of non trivial constant values
//[min]~^^^^^ Error generic parameters must not be used inside of non-trivial constant values
//[min]~| Error generic parameters must not be used inside of non-trivial constant values
// Condition<{ 8 - I <= 8 - J }>: True,
{
fn print() {

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-72819-generic-in-const-eval.rs:9:17
|
LL | where Assert::<{N < usize::max_value() / 2}>: IsTrue,

View File

@ -8,7 +8,7 @@
struct Arr<const N: usize>
where Assert::<{N < usize::max_value() / 2}>: IsTrue,
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
{
}

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-76701-ty-param-in-const.rs:6:46
|
LL | fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] {
@ -6,7 +6,7 @@ LL | fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] {
|
= note: type parameters are currently not permitted in anonymous constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/issue-76701-ty-param-in-const.rs:12:42
|
LL | fn const_param<const N: usize>() -> [u8; N + 1] {

View File

@ -5,13 +5,13 @@
fn ty_param<T>() -> [u8; std::mem::size_of::<T>()] {
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
todo!()
}
fn const_param<const N: usize>() -> [u8; N + 1] {
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial constant values
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial constant values
todo!()
}

View File

@ -7,19 +7,19 @@ fn ok<const M: usize>() -> [u8; M] {
}
struct Break0<const N: usize>([u8; { N + 1 }]);
//~^ ERROR generic parameters must not be used inside of non trivial constant values
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
struct Break1<const N: usize>([u8; { { N } }]);
//~^ ERROR generic parameters must not be used inside of non trivial constant values
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
fn break2<const N: usize>() {
let _: [u8; N + 1];
//~^ ERROR generic parameters must not be used inside of non trivial constant values
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
}
fn break3<const N: usize>() {
let _ = [0; N + 1];
//~^ ERROR generic parameters must not be used inside of non trivial constant values
//~^ ERROR generic parameters must not be used inside of non-trivial constant values
}
trait Foo {

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/complex-expression.rs:9:38
|
LL | struct Break0<const N: usize>([u8; { N + 1 }]);
@ -6,7 +6,7 @@ LL | struct Break0<const N: usize>([u8; { N + 1 }]);
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/complex-expression.rs:12:40
|
LL | struct Break1<const N: usize>([u8; { { N } }]);
@ -14,7 +14,7 @@ LL | struct Break1<const N: usize>([u8; { { N } }]);
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/complex-expression.rs:16:17
|
LL | let _: [u8; N + 1];
@ -22,7 +22,7 @@ LL | let _: [u8; N + 1];
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/complex-expression.rs:21:17
|
LL | let _ = [0; N + 1];

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/self-ty-in-const-1.rs:4:41
|
LL | fn t1() -> [u8; std::mem::size_of::<Self>()];

View File

@ -0,0 +1,8 @@
#![feature(min_const_generics)]
fn a<const X: &'static [u32]>() {}
//~^ ERROR `&'static [u32]` is forbidden as the type of a const generic parameter
fn main() {
a::<{&[]}>();
}

View File

@ -0,0 +1,11 @@
error: `&'static [u32]` is forbidden as the type of a const generic parameter
--> $DIR/static-reference-array-const-param.rs:3:15
|
LL | fn a<const X: &'static [u32]>() {}
| ^^^^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to previous error

View File

@ -0,0 +1,12 @@
#![feature(min_const_generics)]
struct Const<const P: &'static ()>;
//~^ ERROR `&'static ()` is forbidden as the type of a const generic parameter
fn main() {
const A: &'static () = unsafe {
std::mem::transmute(10 as *const ())
};
let _ = Const::<{A}>;
}

View File

@ -0,0 +1,11 @@
error: `&'static ()` is forbidden as the type of a const generic parameter
--> $DIR/transmute-const-param-static-reference.rs:3:23
|
LL | struct Const<const P: &'static ()>;
| ^^^^^^^^^^^
|
= note: the only supported types are integers, `bool` and `char`
= note: more complex types are supported with `#[feature(const_generics)]`
error: aborting due to previous error

View File

@ -6,7 +6,7 @@ LL | struct Bar<T = [u8; N], const N: usize>(T);
|
= note: using type defaults and const parameters in the same parameter list is currently not permitted
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/params-in-ct-in-ty-param-lazy-norm.rs:7:44
|
LL | struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U);

View File

@ -6,7 +6,7 @@
struct Foo<T, U = [u8; std::mem::size_of::<T>()]>(T, U);
//[full]~^ ERROR constant values inside of type parameter defaults
//[min]~^^ ERROR generic parameters must not be used inside of non trivial
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial
// FIXME(const_generics:defaults): We still don't know how to we deal with type defaults.
struct Bar<T = [u8; N], const N: usize>(T);

View File

@ -1,4 +1,4 @@
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/wf-misc.rs:9:17
|
LL | let _: [u8; N + 1];
@ -6,7 +6,7 @@ LL | let _: [u8; N + 1];
|
= help: it is currently only allowed to use either `N` or `{ N }` as generic constants
error: generic parameters must not be used inside of non trivial constant values
error: generic parameters must not be used inside of non-trivial constant values
--> $DIR/wf-misc.rs:17:21
|
LL | let _: Const::<{N + 1}>;

View File

@ -8,7 +8,7 @@
pub fn arr_len<const N: usize>() {
let _: [u8; N + 1];
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial
}
struct Const<const N: usize>;
@ -16,7 +16,7 @@ struct Const<const N: usize>;
pub fn func_call<const N: usize>() {
let _: Const::<{N + 1}>;
//[full]~^ ERROR constant expression depends on a generic parameter
//[min]~^^ ERROR generic parameters must not be used inside of non trivial
//[min]~^^ ERROR generic parameters must not be used inside of non-trivial
}
fn main() {}

View File

@ -0,0 +1,13 @@
#![feature(unwind_attributes, const_panic)]
#[unwind(aborts)]
const fn foo() {
panic!() //~ evaluation of constant value failed
}
const _: () = foo(); //~ any use of this value will cause an error
// Ensure that the CTFE engine handles calls to `#[unwind(aborts)]` gracefully
fn main() {
let _ = foo();
}

Some files were not shown because too many files have changed in this diff Show More