| author | bors <bors@rust-lang.org> 2025-06-29 07:22:39 UTC |
| committer | bors <bors@rust-lang.org> 2025-06-29 07:22:39 UTC |
| log | 5ca574e85b67cec0a6fc3fddfe398cbe676c9c69 |
| tree | c7d3e5ee81cf83ba8226119a5097b80f093d2cdd |
| parent | dddd7ab96229ea5f2ca96afcb5984a9831393a13 |
| parent | a262c001f6fd131e2eca2d45627fa5bb7754fd6c |
Rollup of 11 pull requests
Successful merges:
- rust-lang/rust#142021 (Doc: clarify priority of lint level sources)
- rust-lang/rust#142367 (Add regression test for rust-lang/rust#137857 to ensure that we generate intra doc links for extern crate items.)
- rust-lang/rust#142641 (Generate symbols.o for proc-macros too)
- rust-lang/rust#142889 (Clarify doc comment on unix OpenOptions)
- rust-lang/rust#143063 (explain `ImportData::imported_module`)
- rust-lang/rust#143088 (Improve documentation of `TagEncoding`)
- rust-lang/rust#143135 (fix typos on some doc comments)
- rust-lang/rust#143138 (Port `#[link_name]` to the new attribute parsing infrastructure)
- rust-lang/rust#143155 (`librustdoc` house-keeping 🧹)
- rust-lang/rust#143169 (Remove unused feature gates)
- rust-lang/rust#143171 (Fix the span of trait bound modifier `[const]`)
r? `@ghost`
`@rustbot` modify labels: rollup65 files changed, 580 insertions(+), 400 deletions(-)
compiler/rustc_abi/src/lib.rs+20-11| ... | ... | @@ -1592,24 +1592,33 @@ pub enum TagEncoding<VariantIdx: Idx> { |
| 1592 | 1592 | /// (so converting the tag to the discriminant can require sign extension). |
| 1593 | 1593 | Direct, |
| 1594 | 1594 | |
| 1595 | /// Niche (values invalid for a type) encoding the discriminant: | |
| 1596 | /// Discriminant and variant index coincide. | |
| 1595 | /// Niche (values invalid for a type) encoding the discriminant. | |
| 1596 | /// Note that for this encoding, the discriminant and variant index of each variant coincide! | |
| 1597 | /// This invariant is codified as part of [`layout_sanity_check`](../rustc_ty_utils/layout/invariant/fn.layout_sanity_check.html). | |
| 1598 | /// | |
| 1597 | 1599 | /// The variant `untagged_variant` contains a niche at an arbitrary |
| 1598 | /// offset (field `tag_field` of the enum), which for a variant with | |
| 1599 | /// discriminant `d` is set to | |
| 1600 | /// `(d - niche_variants.start).wrapping_add(niche_start)` | |
| 1601 | /// (this is wrapping arithmetic using the type of the niche field). | |
| 1600 | /// offset (field [`Variants::Multiple::tag_field`] of the enum). | |
| 1601 | /// For a variant with variant index `i`, such that `i != untagged_variant`, | |
| 1602 | /// the tag is set to `(i - niche_variants.start).wrapping_add(niche_start)` | |
| 1603 | /// (this is wrapping arithmetic using the type of the niche field, cf. the | |
| 1604 | /// [`tag_for_variant`](../rustc_const_eval/interpret/struct.InterpCx.html#method.tag_for_variant) | |
| 1605 | /// query implementation). | |
| 1606 | /// To recover the variant index `i` from a `tag`, the above formula has to be reversed, | |
| 1607 | /// i.e. `i = tag.wrapping_sub(niche_start) + niche_variants.start`. If `i` ends up outside | |
| 1608 | /// `niche_variants`, the tag must have encoded the `untagged_variant`. | |
| 1602 | 1609 | /// |
| 1603 | /// For example, `Option<(usize, &T)>` is represented such that | |
| 1604 | /// `None` has a null pointer for the second tuple field, and | |
| 1605 | /// `Some` is the identity function (with a non-null reference). | |
| 1610 | /// For example, `Option<(usize, &T)>` is represented such that the tag for | |
| 1611 | /// `None` is the null pointer in the second tuple field, and | |
| 1612 | /// `Some` is the identity function (with a non-null reference) | |
| 1613 | /// and has no additional tag, i.e. the reference being non-null uniquely identifies this variant. | |
| 1606 | 1614 | /// |
| 1607 | 1615 | /// Other variants that are not `untagged_variant` and that are outside the `niche_variants` |
| 1608 | 1616 | /// range cannot be represented; they must be uninhabited. |
| 1617 | /// Nonetheless, uninhabited variants can also fall into the range of `niche_variants`. | |
| 1609 | 1618 | Niche { |
| 1610 | 1619 | untagged_variant: VariantIdx, |
| 1611 | /// This range *may* contain `untagged_variant`; that is then just a "dead value" and | |
| 1612 | /// not used to encode anything. | |
| 1620 | /// This range *may* contain `untagged_variant` or uninhabited variants; | |
| 1621 | /// these are then just "dead values" and not used to encode anything. | |
| 1613 | 1622 | niche_variants: RangeInclusive<VariantIdx>, |
| 1614 | 1623 | /// This is inbounds of the type of the niche field |
| 1615 | 1624 | /// (not sign-extended, i.e., all bits beyond the niche field size are 0). |
compiler/rustc_ast/src/lib.rs-3| ... | ... | @@ -16,10 +16,7 @@ |
| 16 | 16 | #![feature(box_patterns)] |
| 17 | 17 | #![feature(if_let_guard)] |
| 18 | 18 | #![feature(macro_metavar_expr)] |
| 19 | #![feature(negative_impls)] | |
| 20 | #![feature(never_type)] | |
| 21 | 19 | #![feature(rustdoc_internals)] |
| 22 | #![feature(stmt_expr_attributes)] | |
| 23 | 20 | #![recursion_limit = "256"] |
| 24 | 21 | // tidy-alphabetical-end |
| 25 | 22 |
compiler/rustc_attr_data_structures/src/attributes.rs+3| ... | ... | @@ -253,6 +253,9 @@ pub enum AttributeKind { |
| 253 | 253 | /// Represents `#[inline]` and `#[rustc_force_inline]`. |
| 254 | 254 | Inline(InlineAttr, Span), |
| 255 | 255 | |
| 256 | /// Represents `#[link_name]`. | |
| 257 | LinkName { name: Symbol, span: Span }, | |
| 258 | ||
| 256 | 259 | /// Represents `#[loop_match]`. |
| 257 | 260 | LoopMatch(Span), |
| 258 | 261 |
compiler/rustc_attr_data_structures/src/encode_cross_crate.rs+1| ... | ... | @@ -29,6 +29,7 @@ impl AttributeKind { |
| 29 | 29 | Stability { .. } => Yes, |
| 30 | 30 | Cold(..) => No, |
| 31 | 31 | ConstContinue(..) => No, |
| 32 | LinkName { .. } => Yes, | |
| 32 | 33 | LoopMatch(..) => No, |
| 33 | 34 | MayDangle(..) => No, |
| 34 | 35 | MustUse { .. } => Yes, |
compiler/rustc_attr_parsing/src/attributes/link_attrs.rs created+30| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | use rustc_attr_data_structures::AttributeKind; | |
| 2 | use rustc_attr_data_structures::AttributeKind::LinkName; | |
| 3 | use rustc_feature::{AttributeTemplate, template}; | |
| 4 | use rustc_span::{Symbol, sym}; | |
| 5 | ||
| 6 | use crate::attributes::{AttributeOrder, OnDuplicate, SingleAttributeParser}; | |
| 7 | use crate::context::{AcceptContext, Stage}; | |
| 8 | use crate::parser::ArgParser; | |
| 9 | ||
| 10 | pub(crate) struct LinkNameParser; | |
| 11 | ||
| 12 | impl<S: Stage> SingleAttributeParser<S> for LinkNameParser { | |
| 13 | const PATH: &[Symbol] = &[sym::link_name]; | |
| 14 | const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepFirst; | |
| 15 | const ON_DUPLICATE: OnDuplicate<S> = OnDuplicate::WarnButFutureError; | |
| 16 | const TEMPLATE: AttributeTemplate = template!(NameValueStr: "name"); | |
| 17 | ||
| 18 | fn convert(cx: &mut AcceptContext<'_, '_, S>, args: &ArgParser<'_>) -> Option<AttributeKind> { | |
| 19 | let Some(nv) = args.name_value() else { | |
| 20 | cx.expected_name_value(cx.attr_span, None); | |
| 21 | return None; | |
| 22 | }; | |
| 23 | let Some(name) = nv.value_as_str() else { | |
| 24 | cx.expected_string_literal(nv.value_span, Some(nv.value_as_lit())); | |
| 25 | return None; | |
| 26 | }; | |
| 27 | ||
| 28 | Some(LinkName { name, span: cx.attr_span }) | |
| 29 | } | |
| 30 | } |
compiler/rustc_attr_parsing/src/attributes/mod.rs+1| ... | ... | @@ -31,6 +31,7 @@ pub(crate) mod codegen_attrs; |
| 31 | 31 | pub(crate) mod confusables; |
| 32 | 32 | pub(crate) mod deprecation; |
| 33 | 33 | pub(crate) mod inline; |
| 34 | pub(crate) mod link_attrs; | |
| 34 | 35 | pub(crate) mod lint_helpers; |
| 35 | 36 | pub(crate) mod loop_match; |
| 36 | 37 | pub(crate) mod must_use; |
compiler/rustc_attr_parsing/src/context.rs+2| ... | ... | @@ -22,6 +22,7 @@ use crate::attributes::codegen_attrs::{ |
| 22 | 22 | use crate::attributes::confusables::ConfusablesParser; |
| 23 | 23 | use crate::attributes::deprecation::DeprecationParser; |
| 24 | 24 | use crate::attributes::inline::{InlineParser, RustcForceInlineParser}; |
| 25 | use crate::attributes::link_attrs::LinkNameParser; | |
| 25 | 26 | use crate::attributes::lint_helpers::{AsPtrParser, PubTransparentParser}; |
| 26 | 27 | use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser}; |
| 27 | 28 | use crate::attributes::must_use::MustUseParser; |
| ... | ... | @@ -121,6 +122,7 @@ attribute_parsers!( |
| 121 | 122 | Single<DeprecationParser>, |
| 122 | 123 | Single<ExportNameParser>, |
| 123 | 124 | Single<InlineParser>, |
| 125 | Single<LinkNameParser>, | |
| 124 | 126 | Single<LoopMatchParser>, |
| 125 | 127 | Single<MayDangleParser>, |
| 126 | 128 | Single<MustUseParser>, |
compiler/rustc_codegen_ssa/src/back/linker.rs+7-2| ... | ... | @@ -1870,8 +1870,13 @@ pub(crate) fn linked_symbols( |
| 1870 | 1870 | crate_type: CrateType, |
| 1871 | 1871 | ) -> Vec<(String, SymbolExportKind)> { |
| 1872 | 1872 | match crate_type { |
| 1873 | CrateType::Executable | CrateType::Cdylib | CrateType::Dylib | CrateType::Sdylib => (), | |
| 1874 | CrateType::Staticlib | CrateType::ProcMacro | CrateType::Rlib => { | |
| 1873 | CrateType::Executable | |
| 1874 | | CrateType::ProcMacro | |
| 1875 | | CrateType::Cdylib | |
| 1876 | | CrateType::Dylib | |
| 1877 | | CrateType::Sdylib => (), | |
| 1878 | CrateType::Staticlib | CrateType::Rlib => { | |
| 1879 | // These are not linked, so no need to generate symbols.o for them. | |
| 1875 | 1880 | return Vec::new(); |
| 1876 | 1881 | } |
| 1877 | 1882 | } |
compiler/rustc_codegen_ssa/src/codegen_attrs.rs+1-1| ... | ... | @@ -123,6 +123,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { |
| 123 | 123 | } |
| 124 | 124 | AttributeKind::Naked(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED, |
| 125 | 125 | AttributeKind::Align { align, .. } => codegen_fn_attrs.alignment = Some(*align), |
| 126 | AttributeKind::LinkName { name, .. } => codegen_fn_attrs.link_name = Some(*name), | |
| 126 | 127 | AttributeKind::NoMangle(attr_span) => { |
| 127 | 128 | if tcx.opt_item_name(did.to_def_id()).is_some() { |
| 128 | 129 | codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE; |
| ... | ... | @@ -262,7 +263,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs { |
| 262 | 263 | } |
| 263 | 264 | } |
| 264 | 265 | } |
| 265 | sym::link_name => codegen_fn_attrs.link_name = attr.value_str(), | |
| 266 | 266 | sym::link_ordinal => { |
| 267 | 267 | link_ordinal_span = Some(attr.span()); |
| 268 | 268 | if let ordinal @ Some(_) = check_link_ordinal(tcx, attr) { |
compiler/rustc_codegen_ssa/src/mir/operand.rs+1-10| ... | ... | @@ -479,17 +479,8 @@ impl<'a, 'tcx, V: CodegenObject> OperandRef<'tcx, V> { |
| 479 | 479 | _ => (tag_imm, bx.cx().immediate_backend_type(tag_op.layout)), |
| 480 | 480 | }; |
| 481 | 481 | |
| 482 | // Layout ensures that we only get here for cases where the discriminant | |
| 482 | // `layout_sanity_check` ensures that we only get here for cases where the discriminant | |
| 483 | 483 | // value and the variant index match, since that's all `Niche` can encode. |
| 484 | // But for emphasis and debugging, let's double-check one anyway. | |
| 485 | debug_assert_eq!( | |
| 486 | self.layout | |
| 487 | .ty | |
| 488 | .discriminant_for_variant(bx.tcx(), untagged_variant) | |
| 489 | .unwrap() | |
| 490 | .val, | |
| 491 | u128::from(untagged_variant.as_u32()), | |
| 492 | ); | |
| 493 | 484 | |
| 494 | 485 | let relative_max = niche_variants.end().as_u32() - niche_variants.start().as_u32(); |
| 495 | 486 |
compiler/rustc_error_messages/src/lib.rs-1| ... | ... | @@ -3,7 +3,6 @@ |
| 3 | 3 | #![doc(rust_logo)] |
| 4 | 4 | #![feature(rustc_attrs)] |
| 5 | 5 | #![feature(rustdoc_internals)] |
| 6 | #![feature(type_alias_impl_trait)] | |
| 7 | 6 | // tidy-alphabetical-end |
| 8 | 7 | |
| 9 | 8 | use std::borrow::Cow; |
compiler/rustc_feature/src/accepted.rs+2-2| ... | ... | @@ -341,7 +341,7 @@ declare_features! ( |
| 341 | 341 | (accepted, pattern_parentheses, "1.31.0", Some(51087)), |
| 342 | 342 | /// Allows `use<'a, 'b, A, B>` in `impl Trait + use<...>` for precise capture of generic args. |
| 343 | 343 | (accepted, precise_capturing, "1.82.0", Some(123432)), |
| 344 | /// Allows `use<..>` precise capturign on impl Trait in traits. | |
| 344 | /// Allows `use<..>` precise capturing on impl Trait in traits. | |
| 345 | 345 | (accepted, precise_capturing_in_traits, "1.87.0", Some(130044)), |
| 346 | 346 | /// Allows procedural macros in `proc-macro` crates. |
| 347 | 347 | (accepted, proc_macro, "1.29.0", Some(38356)), |
| ... | ... | @@ -388,7 +388,7 @@ declare_features! ( |
| 388 | 388 | (accepted, self_struct_ctor, "1.32.0", Some(51994)), |
| 389 | 389 | /// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics |
| 390 | 390 | (accepted, sha512_sm_x86, "CURRENT_RUSTC_VERSION", Some(126624)), |
| 391 | /// Shortern the tail expression lifetime | |
| 391 | /// Shorten the tail expression lifetime | |
| 392 | 392 | (accepted, shorter_tail_lifetimes, "1.84.0", Some(123739)), |
| 393 | 393 | /// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`. |
| 394 | 394 | (accepted, slice_patterns, "1.42.0", Some(62254)), |
compiler/rustc_hir_analysis/src/lib.rs-1| ... | ... | @@ -65,7 +65,6 @@ This API is completely unstable and subject to change. |
| 65 | 65 | #![feature(debug_closure_helpers)] |
| 66 | 66 | #![feature(gen_blocks)] |
| 67 | 67 | #![feature(if_let_guard)] |
| 68 | #![feature(iter_from_coroutine)] | |
| 69 | 68 | #![feature(iter_intersperse)] |
| 70 | 69 | #![feature(never_type)] |
| 71 | 70 | #![feature(rustdoc_internals)] |
compiler/rustc_lint/src/foreign_modules.rs+7-2| ... | ... | @@ -1,4 +1,5 @@ |
| 1 | 1 | use rustc_abi::FIRST_VARIANT; |
| 2 | use rustc_attr_data_structures::{AttributeKind, find_attr}; | |
| 2 | 3 | use rustc_data_structures::stack::ensure_sufficient_stack; |
| 3 | 4 | use rustc_data_structures::unord::{UnordMap, UnordSet}; |
| 4 | 5 | use rustc_hir as hir; |
| ... | ... | @@ -6,7 +7,7 @@ use rustc_hir::def::DefKind; |
| 6 | 7 | use rustc_middle::query::Providers; |
| 7 | 8 | use rustc_middle::ty::{self, AdtDef, Instance, Ty, TyCtxt}; |
| 8 | 9 | use rustc_session::declare_lint; |
| 9 | use rustc_span::{Span, Symbol, sym}; | |
| 10 | use rustc_span::{Span, Symbol}; | |
| 10 | 11 | use tracing::{debug, instrument}; |
| 11 | 12 | |
| 12 | 13 | use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub}; |
| ... | ... | @@ -182,7 +183,11 @@ fn name_of_extern_decl(tcx: TyCtxt<'_>, fi: hir::OwnerId) -> SymbolName { |
| 182 | 183 | // information, we could have codegen_fn_attrs also give span information back for |
| 183 | 184 | // where the attribute was defined. However, until this is found to be a |
| 184 | 185 | // bottleneck, this does just fine. |
| 185 | (overridden_link_name, tcx.get_attr(fi, sym::link_name).unwrap().span()) | |
| 186 | ( | |
| 187 | overridden_link_name, | |
| 188 | find_attr!(tcx.get_all_attrs(fi), AttributeKind::LinkName {span, ..} => *span) | |
| 189 | .unwrap(), | |
| 190 | ) | |
| 186 | 191 | }) |
| 187 | 192 | { |
| 188 | 193 | SymbolName::Link(overridden_link_name, overridden_link_name_span) |
compiler/rustc_metadata/src/lib.rs-1| ... | ... | @@ -7,7 +7,6 @@ |
| 7 | 7 | #![feature(file_buffered)] |
| 8 | 8 | #![feature(gen_blocks)] |
| 9 | 9 | #![feature(if_let_guard)] |
| 10 | #![feature(iter_from_coroutine)] | |
| 11 | 10 | #![feature(macro_metavar_expr)] |
| 12 | 11 | #![feature(min_specialization)] |
| 13 | 12 | #![feature(never_type)] |
compiler/rustc_middle/src/lib.rs-1| ... | ... | @@ -48,7 +48,6 @@ |
| 48 | 48 | #![feature(gen_blocks)] |
| 49 | 49 | #![feature(if_let_guard)] |
| 50 | 50 | #![feature(intra_doc_pointers)] |
| 51 | #![feature(iter_from_coroutine)] | |
| 52 | 51 | #![feature(min_specialization)] |
| 53 | 52 | #![feature(negative_impls)] |
| 54 | 53 | #![feature(never_type)] |
compiler/rustc_middle/src/mir/syntax.rs+9-9| ... | ... | @@ -284,15 +284,15 @@ pub enum FakeBorrowKind { |
| 284 | 284 | /// |
| 285 | 285 | /// This is used when lowering deref patterns, where shallow borrows wouldn't prevent something |
| 286 | 286 | /// like: |
| 287 | // ```compile_fail | |
| 288 | // let mut b = Box::new(false); | |
| 289 | // match b { | |
| 290 | // deref!(true) => {} // not reached because `*b == false` | |
| 291 | // _ if { *b = true; false } => {} // not reached because the guard is `false` | |
| 292 | // deref!(false) => {} // not reached because the guard changed it | |
| 293 | // // UB because we reached the unreachable. | |
| 294 | // } | |
| 295 | // ``` | |
| 287 | /// ```compile_fail | |
| 288 | /// let mut b = Box::new(false); | |
| 289 | /// match b { | |
| 290 | /// deref!(true) => {} // not reached because `*b == false` | |
| 291 | /// _ if { *b = true; false } => {} // not reached because the guard is `false` | |
| 292 | /// deref!(false) => {} // not reached because the guard changed it | |
| 293 | /// // UB because we reached the unreachable. | |
| 294 | /// } | |
| 295 | /// ``` | |
| 296 | 296 | Deep, |
| 297 | 297 | } |
| 298 | 298 |
compiler/rustc_parse/src/parser/ty.rs+1-1| ... | ... | @@ -1071,7 +1071,7 @@ impl<'a> Parser<'a> { |
| 1071 | 1071 | && self.look_ahead(1, |t| t.is_keyword(kw::Const)) |
| 1072 | 1072 | && self.look_ahead(2, |t| *t == token::CloseBracket) |
| 1073 | 1073 | { |
| 1074 | let start = self.prev_token.span; | |
| 1074 | let start = self.token.span; | |
| 1075 | 1075 | self.bump(); |
| 1076 | 1076 | self.expect_keyword(exp!(Const)).unwrap(); |
| 1077 | 1077 | self.bump(); |
compiler/rustc_parse/src/validate_attr.rs+1| ... | ... | @@ -302,6 +302,7 @@ fn emit_malformed_attribute( |
| 302 | 302 | | sym::no_mangle |
| 303 | 303 | | sym::must_use |
| 304 | 304 | | sym::track_caller |
| 305 | | sym::link_name | |
| 305 | 306 | ) { |
| 306 | 307 | return; |
| 307 | 308 | } |
compiler/rustc_passes/src/check_attr.rs+20-20| ... | ... | @@ -191,6 +191,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 191 | 191 | Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => { |
| 192 | 192 | self.check_applied_to_fn_or_method(hir_id, *attr_span, span, target) |
| 193 | 193 | } |
| 194 | Attribute::Parsed(AttributeKind::LinkName { span: attr_span, name }) => { | |
| 195 | self.check_link_name(hir_id, *attr_span, *name, span, target) | |
| 196 | } | |
| 194 | 197 | Attribute::Parsed(AttributeKind::MayDangle(attr_span)) => { |
| 195 | 198 | self.check_may_dangle(hir_id, *attr_span) |
| 196 | 199 | } |
| ... | ... | @@ -283,7 +286,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 283 | 286 | [sym::ffi_const, ..] => self.check_ffi_const(attr.span(), target), |
| 284 | 287 | [sym::link_ordinal, ..] => self.check_link_ordinal(attr, span, target), |
| 285 | 288 | [sym::link, ..] => self.check_link(hir_id, attr, span, target), |
| 286 | [sym::link_name, ..] => self.check_link_name(hir_id, attr, span, target), | |
| 287 | 289 | [sym::link_section, ..] => self.check_link_section(hir_id, attr, span, target), |
| 288 | 290 | [sym::macro_use, ..] | [sym::macro_escape, ..] => { |
| 289 | 291 | self.check_macro_use(hir_id, attr, target) |
| ... | ... | @@ -1604,7 +1606,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 1604 | 1606 | } |
| 1605 | 1607 | |
| 1606 | 1608 | /// Checks if `#[link_name]` is applied to an item other than a foreign function or static. |
| 1607 | fn check_link_name(&self, hir_id: HirId, attr: &Attribute, span: Span, target: Target) { | |
| 1609 | fn check_link_name( | |
| 1610 | &self, | |
| 1611 | hir_id: HirId, | |
| 1612 | attr_span: Span, | |
| 1613 | name: Symbol, | |
| 1614 | span: Span, | |
| 1615 | target: Target, | |
| 1616 | ) { | |
| 1608 | 1617 | match target { |
| 1609 | 1618 | Target::ForeignFn | Target::ForeignStatic => {} |
| 1610 | 1619 | // FIXME(#80564): We permit struct fields, match arms and macro defs to have an |
| ... | ... | @@ -1612,27 +1621,18 @@ impl<'tcx> CheckAttrVisitor<'tcx> { |
| 1612 | 1621 | // erroneously allowed it and some crates used it accidentally, to be compatible |
| 1613 | 1622 | // with crates depending on them, we can't throw an error here. |
| 1614 | 1623 | Target::Field | Target::Arm | Target::MacroDef => { |
| 1615 | self.inline_attr_str_error_with_macro_def(hir_id, attr.span(), "link_name"); | |
| 1624 | self.inline_attr_str_error_with_macro_def(hir_id, attr_span, "link_name"); | |
| 1616 | 1625 | } |
| 1617 | 1626 | _ => { |
| 1618 | // FIXME: #[cold] was previously allowed on non-functions/statics and some crates | |
| 1627 | // FIXME: #[link_name] was previously allowed on non-functions/statics and some crates | |
| 1619 | 1628 | // used this, so only emit a warning. |
| 1620 | let attr_span = matches!(target, Target::ForeignMod).then_some(attr.span()); | |
| 1621 | if let Some(s) = attr.value_str() { | |
| 1622 | self.tcx.emit_node_span_lint( | |
| 1623 | UNUSED_ATTRIBUTES, | |
| 1624 | hir_id, | |
| 1625 | attr.span(), | |
| 1626 | errors::LinkName { span, attr_span, value: s.as_str() }, | |
| 1627 | ); | |
| 1628 | } else { | |
| 1629 | self.tcx.emit_node_span_lint( | |
| 1630 | UNUSED_ATTRIBUTES, | |
| 1631 | hir_id, | |
| 1632 | attr.span(), | |
| 1633 | errors::LinkName { span, attr_span, value: "..." }, | |
| 1634 | ); | |
| 1635 | }; | |
| 1629 | let help_span = matches!(target, Target::ForeignMod).then_some(attr_span); | |
| 1630 | self.tcx.emit_node_span_lint( | |
| 1631 | UNUSED_ATTRIBUTES, | |
| 1632 | hir_id, | |
| 1633 | attr_span, | |
| 1634 | errors::LinkName { span, help_span, value: name.as_str() }, | |
| 1635 | ); | |
| 1636 | 1636 | } |
| 1637 | 1637 | } |
| 1638 | 1638 | } |
compiler/rustc_passes/src/errors.rs+1-1| ... | ... | @@ -502,7 +502,7 @@ pub(crate) struct Link { |
| 502 | 502 | #[warning] |
| 503 | 503 | pub(crate) struct LinkName<'a> { |
| 504 | 504 | #[help] |
| 505 | pub attr_span: Option<Span>, | |
| 505 | pub help_span: Option<Span>, | |
| 506 | 506 | #[label] |
| 507 | 507 | pub span: Span, |
| 508 | 508 | pub value: &'a str, |
compiler/rustc_resolve/src/imports.rs+8-1| ... | ... | @@ -174,7 +174,14 @@ pub(crate) struct ImportData<'ra> { |
| 174 | 174 | |
| 175 | 175 | pub parent_scope: ParentScope<'ra>, |
| 176 | 176 | pub module_path: Vec<Segment>, |
| 177 | /// The resolution of `module_path`. | |
| 177 | /// The resolution of `module_path`: | |
| 178 | /// | |
| 179 | /// | `module_path` | `imported_module` | remark | | |
| 180 | /// |-|-|-| | |
| 181 | /// |`use prefix::foo`| `ModuleOrUniformRoot::Module(prefix)` | - | | |
| 182 | /// |`use ::foo` | `ModuleOrUniformRoot::ExternPrelude` | 2018+ editions | | |
| 183 | /// |`use ::foo` | `ModuleOrUniformRoot::CrateRootAndExternPrelude` | a special case in 2015 edition | | |
| 184 | /// |`use foo` | `ModuleOrUniformRoot::CurrentScope` | - | | |
| 178 | 185 | pub imported_module: Cell<Option<ModuleOrUniformRoot<'ra>>>, |
| 179 | 186 | pub vis: ty::Visibility, |
| 180 | 187 | } |
compiler/rustc_ty_utils/src/layout/invariant.rs+6| ... | ... | @@ -277,6 +277,12 @@ pub(super) fn layout_sanity_check<'tcx>(cx: &LayoutCx<'tcx>, layout: &TyAndLayou |
| 277 | 277 | if !variant.is_uninhabited() { |
| 278 | 278 | assert!(idx == *untagged_variant || niche_variants.contains(&idx)); |
| 279 | 279 | } |
| 280 | ||
| 281 | // Ensure that for niche encoded tags the discriminant coincides with the variant index. | |
| 282 | assert_eq!( | |
| 283 | layout.ty.discriminant_for_variant(tcx, idx).unwrap().val, | |
| 284 | u128::from(idx.as_u32()), | |
| 285 | ); | |
| 280 | 286 | } |
| 281 | 287 | } |
| 282 | 288 | for variant in variants.iter() { |
library/std/src/os/unix/fs.rs+5-7| ... | ... | @@ -408,24 +408,22 @@ pub trait OpenOptionsExt { |
| 408 | 408 | /// Pass custom flags to the `flags` argument of `open`. |
| 409 | 409 | /// |
| 410 | 410 | /// The bits that define the access mode are masked out with `O_ACCMODE`, to |
| 411 | /// ensure they do not interfere with the access mode set by Rusts options. | |
| 411 | /// ensure they do not interfere with the access mode set by Rust's options. | |
| 412 | 412 | /// |
| 413 | /// Custom flags can only set flags, not remove flags set by Rusts options. | |
| 414 | /// This options overwrites any previously set custom flags. | |
| 413 | /// Custom flags can only set flags, not remove flags set by Rust's options. | |
| 414 | /// This function overwrites any previously-set custom flags. | |
| 415 | 415 | /// |
| 416 | 416 | /// # Examples |
| 417 | 417 | /// |
| 418 | 418 | /// ```no_run |
| 419 | /// # #![feature(rustc_private)] | |
| 419 | /// # mod libc { pub const O_NOFOLLOW: i32 = 0; } | |
| 420 | 420 | /// use std::fs::OpenOptions; |
| 421 | 421 | /// use std::os::unix::fs::OpenOptionsExt; |
| 422 | 422 | /// |
| 423 | 423 | /// # fn main() { |
| 424 | 424 | /// let mut options = OpenOptions::new(); |
| 425 | 425 | /// options.write(true); |
| 426 | /// if cfg!(unix) { | |
| 427 | /// options.custom_flags(libc::O_NOFOLLOW); | |
| 428 | /// } | |
| 426 | /// options.custom_flags(libc::O_NOFOLLOW); | |
| 429 | 427 | /// let file = options.open("foo.txt"); |
| 430 | 428 | /// # } |
| 431 | 429 | /// ``` |
src/doc/rustc/src/lints/levels.md+102-1| ... | ... | @@ -330,4 +330,105 @@ $ |
| 330 | 330 | |
| 331 | 331 | This feature is used heavily by Cargo; it will pass `--cap-lints allow` when |
| 332 | 332 | compiling your dependencies, so that if they have any warnings, they do not |
| 333 | pollute the output of your build. | |
| 333 | pollute the output of your build. However, note that `--cap-lints allow` does **not** override lints marked as `force-warn`. | |
| 334 | ||
| 335 | ## Priority of lint level sources | |
| 336 | ||
| 337 | Rust allows setting lint levels (`allow`, `warn`, `deny`, `forbid`, `force-warn`) through various sources: | |
| 338 | ||
| 339 | - **Attributes**: `#[allow(...)]`, `#![deny(...)]`, etc. | |
| 340 | - **Command-line options**: `--cap-lints`, `--force-warn`, `-A`, `-W`, `-D`, `-F` | |
| 341 | ||
| 342 | Here’s how these different lint controls interact: | |
| 343 | ||
| 344 | 1. [`--force-warn`](#force-warn) forces a lint to warning level, and takes precedence over attributes and all other CLI flags. | |
| 345 | ||
| 346 | ```rust,compile_fail | |
| 347 | #[forbid(unused_variables)] | |
| 348 | fn main() { | |
| 349 | let x = 42; | |
| 350 | } | |
| 351 | ``` | |
| 352 | ||
| 353 | Compiled with: | |
| 354 | ||
| 355 | ```bash | |
| 356 | $ rustc --force-warn unused_variables lib.rs | |
| 357 | warning: unused variable: `x` | |
| 358 | --> lib.rs:3:9 | |
| 359 | | | |
| 360 | 3 | let x = 42; | |
| 361 | | ^ help: if this is intentional, prefix it with an underscore: `_x` | |
| 362 | | | |
| 363 | = note: requested on the command line with `--force-warn unused-variables` | |
| 364 | ||
| 365 | warning: 1 warning emitted | |
| 366 | ``` | |
| 367 | ||
| 368 | 2. [`--cap-lints`](#capping-lints) sets the maximum level of a lint, and takes precedence over attributes as well as the `-D`, `-W`, and `-F` CLI flags. | |
| 369 | ||
| 370 | ```rust,compile_fail | |
| 371 | #[deny(unused_variables)] | |
| 372 | fn main() { | |
| 373 | let x = 42; | |
| 374 | } | |
| 375 | ``` | |
| 376 | ||
| 377 | Compiled with: | |
| 378 | ||
| 379 | ```bash | |
| 380 | $ rustc --cap-lints=warn lib.rs | |
| 381 | warning: unused variable: `x` | |
| 382 | --> test1.rs:3:9 | |
| 383 | | | |
| 384 | 3 | let x = 42; | |
| 385 | | ^ help: if this is intentional, prefix it with an underscore: `_x` | |
| 386 | | | |
| 387 | note: the lint level is defined here | |
| 388 | --> test1.rs:1:8 | |
| 389 | | | |
| 390 | 1 | #[deny(unused_variables)] | |
| 391 | | ^^^^^^^^^^^^^^^^ | |
| 392 | ||
| 393 | warning: 1 warning emitted | |
| 394 | ``` | |
| 395 | ||
| 396 | 3. [CLI level flags](#via-compiler-flag) take precedence over attributes. | |
| 397 | ||
| 398 | The order of the flags matter; flags on the right take precedence over earlier flags. | |
| 399 | ||
| 400 | ```rust | |
| 401 | fn main() { | |
| 402 | let x = 42; | |
| 403 | } | |
| 404 | ``` | |
| 405 | ||
| 406 | Compiled with: | |
| 407 | ||
| 408 | ```bash | |
| 409 | $ rustc -A unused_variables -D unused_variables lib.rs | |
| 410 | error: unused variable: `x` | |
| 411 | --> test1.rs:2:9 | |
| 412 | | | |
| 413 | 2 | let x = 42; | |
| 414 | | ^ help: if this is intentional, prefix it with an underscore: `_x` | |
| 415 | | | |
| 416 | = note: requested on the command line with `-D unused-variables` | |
| 417 | ||
| 418 | error: aborting due to 1 previous error | |
| 419 | ``` | |
| 420 | ||
| 421 | 4. Within the source, [attributes](#via-an-attribute) at a lower-level in the syntax tree take precedence over attributes at a higher level, or from a previous attribute on the same entity as listed in left-to-right source order. | |
| 422 | ||
| 423 | ```rust | |
| 424 | #![deny(unused_variables)] | |
| 425 | ||
| 426 | #[allow(unused_variables)] | |
| 427 | fn main() { | |
| 428 | let x = 42; // Allow wins | |
| 429 | } | |
| 430 | ``` | |
| 431 | ||
| 432 | - The exception is once a lint is set to "forbid", it is an error to try to change its level except for `deny`, which is allowed inside a forbid context, but is ignored. | |
| 433 | ||
| 434 | In terms of priority, [lint groups](groups.md) are treated as-if they are expanded to a list of all of the lints they contain. The exception is the `warnings` group which ignores attribute and CLI order and applies to all lints that would otherwise warn within the entity. |
src/librustdoc/Cargo.toml+5-3| ... | ... | @@ -8,23 +8,25 @@ build = "build.rs" |
| 8 | 8 | path = "lib.rs" |
| 9 | 9 | |
| 10 | 10 | [dependencies] |
| 11 | # tidy-alphabetical-start | |
| 11 | 12 | arrayvec = { version = "0.7", default-features = false } |
| 12 | 13 | askama = { version = "0.14", default-features = false, features = ["alloc", "config", "derive"] } |
| 13 | 14 | base64 = "0.21.7" |
| 14 | itertools = "0.12" | |
| 15 | 15 | indexmap = "2" |
| 16 | itertools = "0.12" | |
| 16 | 17 | minifier = { version = "0.3.5", default-features = false } |
| 17 | 18 | pulldown-cmark-escape = { version = "0.11.0", features = ["simd"] } |
| 18 | 19 | regex = "1" |
| 19 | 20 | rustdoc-json-types = { path = "../rustdoc-json-types" } |
| 20 | serde_json = "1.0" | |
| 21 | 21 | serde = { version = "1.0", features = ["derive"] } |
| 22 | serde_json = "1.0" | |
| 22 | 23 | smallvec = "1.8.1" |
| 23 | 24 | tempfile = "3" |
| 25 | threadpool = "1.8.1" | |
| 24 | 26 | tracing = "0.1" |
| 25 | 27 | tracing-tree = "0.3.0" |
| 26 | threadpool = "1.8.1" | |
| 27 | 28 | unicode-segmentation = "1.9" |
| 29 | # tidy-alphabetical-end | |
| 28 | 30 | |
| 29 | 31 | [dependencies.tracing-subscriber] |
| 30 | 32 | version = "0.3.3" |
src/librustdoc/lib.rs+3-9| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | // tidy-alphabetical-start | |
| 1 | 2 | #![doc( |
| 2 | 3 | html_root_url = "https://doc.rust-lang.org/nightly/", |
| 3 | 4 | html_playground_url = "https://play.rust-lang.org/" |
| 4 | 5 | )] |
| 5 | #![feature(rustc_private)] | |
| 6 | 6 | #![feature(ascii_char)] |
| 7 | 7 | #![feature(ascii_char_variants)] |
| 8 | 8 | #![feature(assert_matches)] |
| ... | ... | @@ -11,18 +11,12 @@ |
| 11 | 11 | #![feature(file_buffered)] |
| 12 | 12 | #![feature(format_args_nl)] |
| 13 | 13 | #![feature(if_let_guard)] |
| 14 | #![feature(impl_trait_in_assoc_type)] | |
| 15 | 14 | #![feature(iter_intersperse)] |
| 16 | #![feature(never_type)] | |
| 17 | 15 | #![feature(round_char_boundary)] |
| 16 | #![feature(rustc_private)] | |
| 18 | 17 | #![feature(test)] |
| 19 | #![feature(type_alias_impl_trait)] | |
| 20 | #![feature(type_ascription)] | |
| 21 | #![recursion_limit = "256"] | |
| 22 | 18 | #![warn(rustc::internal)] |
| 23 | #![allow(clippy::collapsible_if, clippy::collapsible_else_if)] | |
| 24 | #![allow(rustc::diagnostic_outside_of_impl)] | |
| 25 | #![allow(rustc::untranslatable_diagnostic)] | |
| 19 | // tidy-alphabetical-end | |
| 26 | 20 | |
| 27 | 21 | extern crate thin_vec; |
| 28 | 22 |
tests/run-make/used-proc-macro/dep.rs created+4| ... | ... | @@ -0,0 +1,4 @@ |
| 1 | #![crate_type = "lib"] | |
| 2 | ||
| 3 | #[used] | |
| 4 | static VERY_IMPORTANT_SYMBOL: u32 = 12345; |
tests/run-make/used-proc-macro/proc_macro.rs created+3| ... | ... | @@ -0,0 +1,3 @@ |
| 1 | #![crate_type = "proc-macro"] | |
| 2 | ||
| 3 | extern crate dep as _; |
tests/run-make/used-proc-macro/rmake.rs created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | // Test that #[used] statics are included in the final dylib for proc-macros too. | |
| 2 | ||
| 3 | //@ ignore-cross-compile | |
| 4 | //@ ignore-windows llvm-readobj --all doesn't show local symbols on Windows | |
| 5 | //@ needs-crate-type: proc-macro | |
| 6 | //@ ignore-musl (FIXME: can't find `-lunwind`) | |
| 7 | ||
| 8 | use run_make_support::{dynamic_lib_name, llvm_readobj, rustc}; | |
| 9 | ||
| 10 | fn main() { | |
| 11 | rustc().input("dep.rs").run(); | |
| 12 | rustc().input("proc_macro.rs").run(); | |
| 13 | llvm_readobj() | |
| 14 | .input(dynamic_lib_name("proc_macro")) | |
| 15 | .arg("--all") | |
| 16 | .run() | |
| 17 | .assert_stdout_contains("VERY_IMPORTANT_SYMBOL"); | |
| 18 | } |
tests/rustdoc/intra-doc/deps.rs created+23| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | // Checks that links to crates are correctly generated and only existing crates | |
| 2 | // have a link generated. | |
| 3 | // Regression test for <https://github.com/rust-lang/rust/issues/137857>. | |
| 4 | ||
| 5 | //@ compile-flags: --document-private-items -Z unstable-options | |
| 6 | //@ compile-flags: --extern-html-root-url=empty=https://empty.example/ | |
| 7 | // This one is to ensure that we don't link to any item we see which has | |
| 8 | // an external html root URL unless it actually exists. | |
| 9 | //@ compile-flags: --extern-html-root-url=non_existant=https://non-existant.example/ | |
| 10 | //@ aux-build: empty.rs | |
| 11 | ||
| 12 | #![crate_name = "foo"] | |
| 13 | #![expect(rustdoc::broken_intra_doc_links)] | |
| 14 | ||
| 15 | //@ has 'foo/index.html' | |
| 16 | //@ has - '//a[@href="https://empty.example/empty/index.html"]' 'empty' | |
| 17 | // There should only be one intra doc links, we should not link `non_existant`. | |
| 18 | //@ count - '//*[@class="docblock"]//a' 1 | |
| 19 | //! [`empty`] | |
| 20 | //! | |
| 21 | //! [`non_existant`] | |
| 22 | ||
| 23 | extern crate empty; |
tests/ui/consts/fn_trait_refs.stderr+30-30| ... | ... | @@ -5,145 +5,145 @@ LL | #![feature(const_fn_trait_ref_impls)] |
| 5 | 5 | | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 8 | --> $DIR/fn_trait_refs.rs:14:6 | |
| 8 | --> $DIR/fn_trait_refs.rs:14:8 | |
| 9 | 9 | | |
| 10 | 10 | LL | T: [const] Fn<()> + [const] Destruct, |
| 11 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 11 | | ^^^^^^^ can't be applied to `Fn` | |
| 12 | 12 | | |
| 13 | 13 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 14 | 14 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 15 | 15 | |
| 16 | 16 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 17 | --> $DIR/fn_trait_refs.rs:14:6 | |
| 17 | --> $DIR/fn_trait_refs.rs:14:8 | |
| 18 | 18 | | |
| 19 | 19 | LL | T: [const] Fn<()> + [const] Destruct, |
| 20 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 20 | | ^^^^^^^ can't be applied to `Fn` | |
| 21 | 21 | | |
| 22 | 22 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 23 | 23 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 24 | 24 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 25 | 25 | |
| 26 | 26 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 27 | --> $DIR/fn_trait_refs.rs:14:6 | |
| 27 | --> $DIR/fn_trait_refs.rs:14:8 | |
| 28 | 28 | | |
| 29 | 29 | LL | T: [const] Fn<()> + [const] Destruct, |
| 30 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 30 | | ^^^^^^^ can't be applied to `Fn` | |
| 31 | 31 | | |
| 32 | 32 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 33 | 33 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 34 | 34 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 35 | 35 | |
| 36 | 36 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 37 | --> $DIR/fn_trait_refs.rs:21:6 | |
| 37 | --> $DIR/fn_trait_refs.rs:21:8 | |
| 38 | 38 | | |
| 39 | 39 | LL | T: [const] FnMut<()> + [const] Destruct, |
| 40 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 40 | | ^^^^^^^ can't be applied to `FnMut` | |
| 41 | 41 | | |
| 42 | 42 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 43 | 43 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 44 | 44 | |
| 45 | 45 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 46 | --> $DIR/fn_trait_refs.rs:21:6 | |
| 46 | --> $DIR/fn_trait_refs.rs:21:8 | |
| 47 | 47 | | |
| 48 | 48 | LL | T: [const] FnMut<()> + [const] Destruct, |
| 49 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 49 | | ^^^^^^^ can't be applied to `FnMut` | |
| 50 | 50 | | |
| 51 | 51 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 52 | 52 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 53 | 53 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 54 | 54 | |
| 55 | 55 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 56 | --> $DIR/fn_trait_refs.rs:21:6 | |
| 56 | --> $DIR/fn_trait_refs.rs:21:8 | |
| 57 | 57 | | |
| 58 | 58 | LL | T: [const] FnMut<()> + [const] Destruct, |
| 59 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 59 | | ^^^^^^^ can't be applied to `FnMut` | |
| 60 | 60 | | |
| 61 | 61 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 62 | 62 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 63 | 63 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 64 | 64 | |
| 65 | 65 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 66 | --> $DIR/fn_trait_refs.rs:28:6 | |
| 66 | --> $DIR/fn_trait_refs.rs:28:8 | |
| 67 | 67 | | |
| 68 | 68 | LL | T: [const] FnOnce<()>, |
| 69 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 69 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 70 | 70 | | |
| 71 | 71 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 72 | 72 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 73 | 73 | |
| 74 | 74 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 75 | --> $DIR/fn_trait_refs.rs:28:6 | |
| 75 | --> $DIR/fn_trait_refs.rs:28:8 | |
| 76 | 76 | | |
| 77 | 77 | LL | T: [const] FnOnce<()>, |
| 78 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 78 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 79 | 79 | | |
| 80 | 80 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 81 | 81 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 82 | 82 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 83 | 83 | |
| 84 | 84 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 85 | --> $DIR/fn_trait_refs.rs:28:6 | |
| 85 | --> $DIR/fn_trait_refs.rs:28:8 | |
| 86 | 86 | | |
| 87 | 87 | LL | T: [const] FnOnce<()>, |
| 88 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 88 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 89 | 89 | | |
| 90 | 90 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 91 | 91 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 92 | 92 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 93 | 93 | |
| 94 | 94 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 95 | --> $DIR/fn_trait_refs.rs:35:6 | |
| 95 | --> $DIR/fn_trait_refs.rs:35:8 | |
| 96 | 96 | | |
| 97 | 97 | LL | T: [const] Fn<()> + [const] Destruct, |
| 98 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 98 | | ^^^^^^^ can't be applied to `Fn` | |
| 99 | 99 | | |
| 100 | 100 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 101 | 101 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 102 | 102 | |
| 103 | 103 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 104 | --> $DIR/fn_trait_refs.rs:35:6 | |
| 104 | --> $DIR/fn_trait_refs.rs:35:8 | |
| 105 | 105 | | |
| 106 | 106 | LL | T: [const] Fn<()> + [const] Destruct, |
| 107 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 107 | | ^^^^^^^ can't be applied to `Fn` | |
| 108 | 108 | | |
| 109 | 109 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 110 | 110 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 111 | 111 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 112 | 112 | |
| 113 | 113 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 114 | --> $DIR/fn_trait_refs.rs:35:6 | |
| 114 | --> $DIR/fn_trait_refs.rs:35:8 | |
| 115 | 115 | | |
| 116 | 116 | LL | T: [const] Fn<()> + [const] Destruct, |
| 117 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 117 | | ^^^^^^^ can't be applied to `Fn` | |
| 118 | 118 | | |
| 119 | 119 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 120 | 120 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 121 | 121 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 122 | 122 | |
| 123 | 123 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 124 | --> $DIR/fn_trait_refs.rs:49:6 | |
| 124 | --> $DIR/fn_trait_refs.rs:49:8 | |
| 125 | 125 | | |
| 126 | 126 | LL | T: [const] FnMut<()> + [const] Destruct, |
| 127 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 127 | | ^^^^^^^ can't be applied to `FnMut` | |
| 128 | 128 | | |
| 129 | 129 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 130 | 130 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 131 | 131 | |
| 132 | 132 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 133 | --> $DIR/fn_trait_refs.rs:49:6 | |
| 133 | --> $DIR/fn_trait_refs.rs:49:8 | |
| 134 | 134 | | |
| 135 | 135 | LL | T: [const] FnMut<()> + [const] Destruct, |
| 136 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 136 | | ^^^^^^^ can't be applied to `FnMut` | |
| 137 | 137 | | |
| 138 | 138 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 139 | 139 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 140 | 140 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 141 | 141 | |
| 142 | 142 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 143 | --> $DIR/fn_trait_refs.rs:49:6 | |
| 143 | --> $DIR/fn_trait_refs.rs:49:8 | |
| 144 | 144 | | |
| 145 | 145 | LL | T: [const] FnMut<()> + [const] Destruct, |
| 146 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 146 | | ^^^^^^^ can't be applied to `FnMut` | |
| 147 | 147 | | |
| 148 | 148 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 149 | 149 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/consts/unstable-const-fn-in-libcore.stderr+4-4| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/unstable-const-fn-in-libcore.rs:19:30 | |
| 2 | --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn unwrap_or_else<F: [const] FnOnce() -> T>(self, f: F) -> T { |
| 5 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 5 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 6 | 6 | | |
| 7 | 7 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/unstable-const-fn-in-libcore.rs:19:30 | |
| 11 | --> $DIR/unstable-const-fn-in-libcore.rs:19:32 | |
| 12 | 12 | | |
| 13 | 13 | LL | const fn unwrap_or_else<F: [const] FnOnce() -> T>(self, f: F) -> T { |
| 14 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 14 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 15 | 15 | | |
| 16 | 16 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/extern/issue-47725.rs+1-4| ... | ... | @@ -17,12 +17,9 @@ extern "C" { |
| 17 | 17 | #[link_name] |
| 18 | 18 | //~^ ERROR malformed `link_name` attribute input |
| 19 | 19 | //~| HELP must be of the form |
| 20 | //~| WARN attribute should be applied to a foreign function or static [unused_attributes] | |
| 21 | //~| WARN this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 22 | //~| HELP try `#[link(name = "...")]` instead | |
| 20 | //~| NOTE expected this to be of the form `link_name = "..." | |
| 23 | 21 | extern "C" { |
| 24 | 22 | fn bar() -> u32; |
| 25 | 23 | } |
| 26 | //~^^^ NOTE not a foreign function or static | |
| 27 | 24 | |
| 28 | 25 | fn main() {} |
tests/ui/extern/issue-47725.stderr+7-21| ... | ... | @@ -1,8 +1,11 @@ |
| 1 | error: malformed `link_name` attribute input | |
| 1 | error[E0539]: malformed `link_name` attribute input | |
| 2 | 2 | --> $DIR/issue-47725.rs:17:1 |
| 3 | 3 | | |
| 4 | 4 | LL | #[link_name] |
| 5 | | ^^^^^^^^^^^^ help: must be of the form: `#[link_name = "name"]` | |
| 5 | | ^^^^^^^^^^^^ | |
| 6 | | | | |
| 7 | | expected this to be of the form `link_name = "..."` | |
| 8 | | help: must be of the form: `#[link_name = "name"]` | |
| 6 | 9 | |
| 7 | 10 | warning: attribute should be applied to a foreign function or static |
| 8 | 11 | --> $DIR/issue-47725.rs:3:1 |
| ... | ... | @@ -38,23 +41,6 @@ help: try `#[link(name = "foobar")]` instead |
| 38 | 41 | LL | #[link_name = "foobar"] |
| 39 | 42 | | ^^^^^^^^^^^^^^^^^^^^^^^ |
| 40 | 43 | |
| 41 | warning: attribute should be applied to a foreign function or static | |
| 42 | --> $DIR/issue-47725.rs:17:1 | |
| 43 | | | |
| 44 | LL | #[link_name] | |
| 45 | | ^^^^^^^^^^^^ | |
| 46 | ... | |
| 47 | LL | / extern "C" { | |
| 48 | LL | | fn bar() -> u32; | |
| 49 | LL | | } | |
| 50 | | |_- not a foreign function or static | |
| 51 | | | |
| 52 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 53 | help: try `#[link(name = "...")]` instead | |
| 54 | --> $DIR/issue-47725.rs:17:1 | |
| 55 | | | |
| 56 | LL | #[link_name] | |
| 57 | | ^^^^^^^^^^^^ | |
| 58 | ||
| 59 | error: aborting due to 1 previous error; 3 warnings emitted | |
| 44 | error: aborting due to 1 previous error; 2 warnings emitted | |
| 60 | 45 | |
| 46 | For more information about this error, try `rustc --explain E0539`. |
tests/ui/feature-gates/issue-43106-gating-of-builtin-attrs.stderr+8-8| ... | ... | @@ -387,14 +387,6 @@ LL | #![link()] |
| 387 | 387 | | |
| 388 | 388 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 389 | 389 | |
| 390 | warning: attribute should be applied to a foreign function or static | |
| 391 | --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 | |
| 392 | | | |
| 393 | LL | #![link_name = "1900"] | |
| 394 | | ^^^^^^^^^^^^^^^^^^^^^^ not a foreign function or static | |
| 395 | | | |
| 396 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 397 | ||
| 398 | 390 | warning: attribute should be applied to a function or static |
| 399 | 391 | --> $DIR/issue-43106-gating-of-builtin-attrs.rs:69:1 |
| 400 | 392 | | |
| ... | ... | @@ -411,6 +403,14 @@ LL | #![cold] |
| 411 | 403 | | |
| 412 | 404 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! |
| 413 | 405 | |
| 406 | warning: attribute should be applied to a foreign function or static | |
| 407 | --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1 | |
| 408 | | | |
| 409 | LL | #![link_name = "1900"] | |
| 410 | | ^^^^^^^^^^^^^^^^^^^^^^ not a foreign function or static | |
| 411 | | | |
| 412 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 413 | ||
| 414 | 414 | warning: `#[must_use]` has no effect when applied to a module |
| 415 | 415 | --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1 |
| 416 | 416 | | |
tests/ui/impl-trait/normalize-tait-in-const.stderr+4-4| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/normalize-tait-in-const.rs:27:33 | |
| 2 | --> $DIR/normalize-tait-in-const.rs:27:35 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>(fun: F) { |
| 5 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 5 | | ^^^^^^^ can't be applied to `Fn` | |
| 6 | 6 | | |
| 7 | 7 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/normalize-tait-in-const.rs:27:33 | |
| 11 | --> $DIR/normalize-tait-in-const.rs:27:35 | |
| 12 | 12 | | |
| 13 | 13 | LL | const fn with_positive<F: for<'a> [const] Fn(&'a Alias<'a>) + [const] Destruct>(fun: F) { |
| 14 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 14 | | ^^^^^^^ can't be applied to `Fn` | |
| 15 | 15 | | |
| 16 | 16 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/lint/unused/unused-attr-duplicate.stderr+13-13| ... | ... | @@ -89,19 +89,6 @@ note: attribute also specified here |
| 89 | 89 | LL | #[automatically_derived] |
| 90 | 90 | | ^^^^^^^^^^^^^^^^^^^^^^^^ |
| 91 | 91 | |
| 92 | error: unused attribute | |
| 93 | --> $DIR/unused-attr-duplicate.rs:86:5 | |
| 94 | | | |
| 95 | LL | #[link_name = "this_does_not_exist"] | |
| 96 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | |
| 97 | | | |
| 98 | note: attribute also specified here | |
| 99 | --> $DIR/unused-attr-duplicate.rs:88:5 | |
| 100 | | | |
| 101 | LL | #[link_name = "rust_dbg_extern_identity_u32"] | |
| 102 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 103 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 104 | ||
| 105 | 92 | error: unused attribute |
| 106 | 93 | --> $DIR/unused-attr-duplicate.rs:14:1 |
| 107 | 94 | | |
| ... | ... | @@ -252,6 +239,19 @@ note: attribute also specified here |
| 252 | 239 | LL | #[track_caller] |
| 253 | 240 | | ^^^^^^^^^^^^^^^ |
| 254 | 241 | |
| 242 | error: unused attribute | |
| 243 | --> $DIR/unused-attr-duplicate.rs:86:5 | |
| 244 | | | |
| 245 | LL | #[link_name = "this_does_not_exist"] | |
| 246 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute | |
| 247 | | | |
| 248 | note: attribute also specified here | |
| 249 | --> $DIR/unused-attr-duplicate.rs:88:5 | |
| 250 | | | |
| 251 | LL | #[link_name = "rust_dbg_extern_identity_u32"] | |
| 252 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
| 253 | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! | |
| 254 | ||
| 255 | 255 | error: unused attribute |
| 256 | 256 | --> $DIR/unused-attr-duplicate.rs:92:1 |
| 257 | 257 | | |
tests/ui/parser/bounds-type.stderr+2-2| ... | ... | @@ -21,10 +21,10 @@ LL | T: [const] ?Tr, |
| 21 | 21 | | there is not a well-defined meaning for a `[const] ?` trait |
| 22 | 22 | |
| 23 | 23 | error: `[const]` may only modify trait bounds, not lifetime bounds |
| 24 | --> $DIR/bounds-type.rs:16:6 | |
| 24 | --> $DIR/bounds-type.rs:16:8 | |
| 25 | 25 | | |
| 26 | 26 | LL | T: [const] 'a, |
| 27 | | ^^^^^^^^^ | |
| 27 | | ^^^^^^^ | |
| 28 | 28 | |
| 29 | 29 | error: `const` may only modify trait bounds, not lifetime bounds |
| 30 | 30 | --> $DIR/bounds-type.rs:17:8 |
tests/ui/specialization/const_trait_impl.stderr+12-12| ... | ... | @@ -1,55 +1,55 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const_trait_impl.rs:34:7 | |
| 2 | --> $DIR/const_trait_impl.rs:34:9 | |
| 3 | 3 | | |
| 4 | 4 | LL | impl<T: [const] Default> const A for T { |
| 5 | | ^^^^^^^^^ can't be applied to `Default` | |
| 5 | | ^^^^^^^ can't be applied to `Default` | |
| 6 | 6 | | |
| 7 | 7 | note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/default.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/const_trait_impl.rs:40:7 | |
| 11 | --> $DIR/const_trait_impl.rs:40:9 | |
| 12 | 12 | | |
| 13 | 13 | LL | impl<T: [const] Default + [const] Sup> const A for T { |
| 14 | | ^^^^^^^^^ can't be applied to `Default` | |
| 14 | | ^^^^^^^ can't be applied to `Default` | |
| 15 | 15 | | |
| 16 | 16 | note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/default.rs:LL:COL |
| 18 | 18 | |
| 19 | 19 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 20 | --> $DIR/const_trait_impl.rs:46:7 | |
| 20 | --> $DIR/const_trait_impl.rs:46:9 | |
| 21 | 21 | | |
| 22 | 22 | LL | impl<T: [const] Default + [const] Sub> const A for T { |
| 23 | | ^^^^^^^^^ can't be applied to `Default` | |
| 23 | | ^^^^^^^ can't be applied to `Default` | |
| 24 | 24 | | |
| 25 | 25 | note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 26 | 26 | --> $SRC_DIR/core/src/default.rs:LL:COL |
| 27 | 27 | |
| 28 | 28 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 29 | --> $DIR/const_trait_impl.rs:40:7 | |
| 29 | --> $DIR/const_trait_impl.rs:40:9 | |
| 30 | 30 | | |
| 31 | 31 | LL | impl<T: [const] Default + [const] Sup> const A for T { |
| 32 | | ^^^^^^^^^ can't be applied to `Default` | |
| 32 | | ^^^^^^^ can't be applied to `Default` | |
| 33 | 33 | | |
| 34 | 34 | note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 35 | 35 | --> $SRC_DIR/core/src/default.rs:LL:COL |
| 36 | 36 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 37 | 37 | |
| 38 | 38 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 39 | --> $DIR/const_trait_impl.rs:34:7 | |
| 39 | --> $DIR/const_trait_impl.rs:34:9 | |
| 40 | 40 | | |
| 41 | 41 | LL | impl<T: [const] Default> const A for T { |
| 42 | | ^^^^^^^^^ can't be applied to `Default` | |
| 42 | | ^^^^^^^ can't be applied to `Default` | |
| 43 | 43 | | |
| 44 | 44 | note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 45 | 45 | --> $SRC_DIR/core/src/default.rs:LL:COL |
| 46 | 46 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 47 | 47 | |
| 48 | 48 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 49 | --> $DIR/const_trait_impl.rs:46:7 | |
| 49 | --> $DIR/const_trait_impl.rs:46:9 | |
| 50 | 50 | | |
| 51 | 51 | LL | impl<T: [const] Default + [const] Sub> const A for T { |
| 52 | | ^^^^^^^^^ can't be applied to `Default` | |
| 52 | | ^^^^^^^ can't be applied to `Default` | |
| 53 | 53 | | |
| 54 | 54 | note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 55 | 55 | --> $SRC_DIR/core/src/default.rs:LL:COL |
tests/ui/traits/const-traits/conditionally-const-and-const-params.stderr+4-4| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/conditionally-const-and-const-params.rs:8:13 | |
| 2 | --> $DIR/conditionally-const-and-const-params.rs:8:15 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn add<A: [const] Add42>(self) -> Foo<{ A::add(N) }> { |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/conditionally-const-and-const-params.rs:8:8 |
| ... | ... | @@ -11,10 +11,10 @@ LL | fn add<A: [const] Add42>(self) -> Foo<{ A::add(N) }> { |
| 11 | 11 | | ^^^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` is not allowed here |
| 14 | --> $DIR/conditionally-const-and-const-params.rs:26:9 | |
| 14 | --> $DIR/conditionally-const-and-const-params.rs:26:11 | |
| 15 | 15 | | |
| 16 | 16 | LL | fn bar<A: [const] Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> { |
| 17 | | ^^^^^^^^^ | |
| 17 | | ^^^^^^^ | |
| 18 | 18 | | |
| 19 | 19 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 20 | 20 | --> $DIR/conditionally-const-and-const-params.rs:26:4 |
tests/ui/traits/const-traits/conditionally-const-invalid-places.stderr+44-44| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/conditionally-const-invalid-places.rs:7:24 | |
| 2 | --> $DIR/conditionally-const-invalid-places.rs:7:26 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn non_const_function<T: [const] Trait>() {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/conditionally-const-invalid-places.rs:7:4 |
| ... | ... | @@ -11,66 +11,66 @@ LL | fn non_const_function<T: [const] Trait>() {} |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` is not allowed here |
| 14 | --> $DIR/conditionally-const-invalid-places.rs:9:16 | |
| 14 | --> $DIR/conditionally-const-invalid-places.rs:9:18 | |
| 15 | 15 | | |
| 16 | 16 | LL | struct Struct<T: [const] Trait> { field: T } |
| 17 | | ^^^^^^^^^ | |
| 17 | | ^^^^^^^ | |
| 18 | 18 | | |
| 19 | 19 | = note: this item cannot have `[const]` trait bounds |
| 20 | 20 | |
| 21 | 21 | error: `[const]` is not allowed here |
| 22 | --> $DIR/conditionally-const-invalid-places.rs:10:21 | |
| 22 | --> $DIR/conditionally-const-invalid-places.rs:10:23 | |
| 23 | 23 | | |
| 24 | 24 | LL | struct TupleStruct<T: [const] Trait>(T); |
| 25 | | ^^^^^^^^^ | |
| 25 | | ^^^^^^^ | |
| 26 | 26 | | |
| 27 | 27 | = note: this item cannot have `[const]` trait bounds |
| 28 | 28 | |
| 29 | 29 | error: `[const]` is not allowed here |
| 30 | --> $DIR/conditionally-const-invalid-places.rs:11:20 | |
| 30 | --> $DIR/conditionally-const-invalid-places.rs:11:22 | |
| 31 | 31 | | |
| 32 | 32 | LL | struct UnitStruct<T: [const] Trait>; |
| 33 | | ^^^^^^^^^ | |
| 33 | | ^^^^^^^ | |
| 34 | 34 | | |
| 35 | 35 | = note: this item cannot have `[const]` trait bounds |
| 36 | 36 | |
| 37 | 37 | error: `[const]` is not allowed here |
| 38 | --> $DIR/conditionally-const-invalid-places.rs:14:12 | |
| 38 | --> $DIR/conditionally-const-invalid-places.rs:14:14 | |
| 39 | 39 | | |
| 40 | 40 | LL | enum Enum<T: [const] Trait> { Variant(T) } |
| 41 | | ^^^^^^^^^ | |
| 41 | | ^^^^^^^ | |
| 42 | 42 | | |
| 43 | 43 | = note: this item cannot have `[const]` trait bounds |
| 44 | 44 | |
| 45 | 45 | error: `[const]` is not allowed here |
| 46 | --> $DIR/conditionally-const-invalid-places.rs:16:14 | |
| 46 | --> $DIR/conditionally-const-invalid-places.rs:16:16 | |
| 47 | 47 | | |
| 48 | 48 | LL | union Union<T: [const] Trait> { field: T } |
| 49 | | ^^^^^^^^^ | |
| 49 | | ^^^^^^^ | |
| 50 | 50 | | |
| 51 | 51 | = note: this item cannot have `[const]` trait bounds |
| 52 | 52 | |
| 53 | 53 | error: `[const]` is not allowed here |
| 54 | --> $DIR/conditionally-const-invalid-places.rs:19:12 | |
| 54 | --> $DIR/conditionally-const-invalid-places.rs:19:14 | |
| 55 | 55 | | |
| 56 | 56 | LL | type Type<T: [const] Trait> = T; |
| 57 | | ^^^^^^^^^ | |
| 57 | | ^^^^^^^ | |
| 58 | 58 | | |
| 59 | 59 | = note: this item cannot have `[const]` trait bounds |
| 60 | 60 | |
| 61 | 61 | error: `[const]` is not allowed here |
| 62 | --> $DIR/conditionally-const-invalid-places.rs:21:17 | |
| 62 | --> $DIR/conditionally-const-invalid-places.rs:21:19 | |
| 63 | 63 | | |
| 64 | 64 | LL | const CONSTANT<T: [const] Trait>: () = (); |
| 65 | | ^^^^^^^^^ | |
| 65 | | ^^^^^^^ | |
| 66 | 66 | | |
| 67 | 67 | = note: this item cannot have `[const]` trait bounds |
| 68 | 68 | |
| 69 | 69 | error: `[const]` is not allowed here |
| 70 | --> $DIR/conditionally-const-invalid-places.rs:25:16 | |
| 70 | --> $DIR/conditionally-const-invalid-places.rs:25:18 | |
| 71 | 71 | | |
| 72 | 72 | LL | type Type<T: [const] Trait>: [const] Trait; |
| 73 | | ^^^^^^^^^ | |
| 73 | | ^^^^^^^ | |
| 74 | 74 | | |
| 75 | 75 | note: associated types in non-`#[const_trait]` traits cannot have `[const]` trait bounds |
| 76 | 76 | --> $DIR/conditionally-const-invalid-places.rs:25:5 |
| ... | ... | @@ -79,10 +79,10 @@ LL | type Type<T: [const] Trait>: [const] Trait; |
| 79 | 79 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 80 | 80 | |
| 81 | 81 | error: `[const]` is not allowed here |
| 82 | --> $DIR/conditionally-const-invalid-places.rs:25:32 | |
| 82 | --> $DIR/conditionally-const-invalid-places.rs:25:34 | |
| 83 | 83 | | |
| 84 | 84 | LL | type Type<T: [const] Trait>: [const] Trait; |
| 85 | | ^^^^^^^^^ | |
| 85 | | ^^^^^^^ | |
| 86 | 86 | | |
| 87 | 87 | note: associated types in non-`#[const_trait]` traits cannot have `[const]` trait bounds |
| 88 | 88 | --> $DIR/conditionally-const-invalid-places.rs:25:5 |
| ... | ... | @@ -91,10 +91,10 @@ LL | type Type<T: [const] Trait>: [const] Trait; |
| 91 | 91 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 92 | 92 | |
| 93 | 93 | error: `[const]` is not allowed here |
| 94 | --> $DIR/conditionally-const-invalid-places.rs:28:28 | |
| 94 | --> $DIR/conditionally-const-invalid-places.rs:28:30 | |
| 95 | 95 | | |
| 96 | 96 | LL | fn non_const_function<T: [const] Trait>(); |
| 97 | | ^^^^^^^^^ | |
| 97 | | ^^^^^^^ | |
| 98 | 98 | | |
| 99 | 99 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 100 | 100 | --> $DIR/conditionally-const-invalid-places.rs:28:8 |
| ... | ... | @@ -103,18 +103,18 @@ LL | fn non_const_function<T: [const] Trait>(); |
| 103 | 103 | | ^^^^^^^^^^^^^^^^^^ |
| 104 | 104 | |
| 105 | 105 | error: `[const]` is not allowed here |
| 106 | --> $DIR/conditionally-const-invalid-places.rs:29:21 | |
| 106 | --> $DIR/conditionally-const-invalid-places.rs:29:23 | |
| 107 | 107 | | |
| 108 | 108 | LL | const CONSTANT<T: [const] Trait>: (); |
| 109 | | ^^^^^^^^^ | |
| 109 | | ^^^^^^^ | |
| 110 | 110 | | |
| 111 | 111 | = note: this item cannot have `[const]` trait bounds |
| 112 | 112 | |
| 113 | 113 | error: `[const]` is not allowed here |
| 114 | --> $DIR/conditionally-const-invalid-places.rs:34:16 | |
| 114 | --> $DIR/conditionally-const-invalid-places.rs:34:18 | |
| 115 | 115 | | |
| 116 | 116 | LL | type Type<T: [const] Trait> = (); |
| 117 | | ^^^^^^^^^ | |
| 117 | | ^^^^^^^ | |
| 118 | 118 | | |
| 119 | 119 | note: associated types in non-const impls cannot have `[const]` trait bounds |
| 120 | 120 | --> $DIR/conditionally-const-invalid-places.rs:34:5 |
| ... | ... | @@ -123,10 +123,10 @@ LL | type Type<T: [const] Trait> = (); |
| 123 | 123 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 124 | 124 | |
| 125 | 125 | error: `[const]` is not allowed here |
| 126 | --> $DIR/conditionally-const-invalid-places.rs:36:28 | |
| 126 | --> $DIR/conditionally-const-invalid-places.rs:36:30 | |
| 127 | 127 | | |
| 128 | 128 | LL | fn non_const_function<T: [const] Trait>() {} |
| 129 | | ^^^^^^^^^ | |
| 129 | | ^^^^^^^ | |
| 130 | 130 | | |
| 131 | 131 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 132 | 132 | --> $DIR/conditionally-const-invalid-places.rs:36:8 |
| ... | ... | @@ -135,18 +135,18 @@ LL | fn non_const_function<T: [const] Trait>() {} |
| 135 | 135 | | ^^^^^^^^^^^^^^^^^^ |
| 136 | 136 | |
| 137 | 137 | error: `[const]` is not allowed here |
| 138 | --> $DIR/conditionally-const-invalid-places.rs:37:21 | |
| 138 | --> $DIR/conditionally-const-invalid-places.rs:37:23 | |
| 139 | 139 | | |
| 140 | 140 | LL | const CONSTANT<T: [const] Trait>: () = (); |
| 141 | | ^^^^^^^^^ | |
| 141 | | ^^^^^^^ | |
| 142 | 142 | | |
| 143 | 143 | = note: this item cannot have `[const]` trait bounds |
| 144 | 144 | |
| 145 | 145 | error: `[const]` is not allowed here |
| 146 | --> $DIR/conditionally-const-invalid-places.rs:44:16 | |
| 146 | --> $DIR/conditionally-const-invalid-places.rs:44:18 | |
| 147 | 147 | | |
| 148 | 148 | LL | type Type<T: [const] Trait> = (); |
| 149 | | ^^^^^^^^^ | |
| 149 | | ^^^^^^^ | |
| 150 | 150 | | |
| 151 | 151 | note: inherent associated types cannot have `[const]` trait bounds |
| 152 | 152 | --> $DIR/conditionally-const-invalid-places.rs:44:5 |
| ... | ... | @@ -155,10 +155,10 @@ LL | type Type<T: [const] Trait> = (); |
| 155 | 155 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 156 | 156 | |
| 157 | 157 | error: `[const]` is not allowed here |
| 158 | --> $DIR/conditionally-const-invalid-places.rs:46:28 | |
| 158 | --> $DIR/conditionally-const-invalid-places.rs:46:30 | |
| 159 | 159 | | |
| 160 | 160 | LL | fn non_const_function<T: [const] Trait>() {} |
| 161 | | ^^^^^^^^^ | |
| 161 | | ^^^^^^^ | |
| 162 | 162 | | |
| 163 | 163 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 164 | 164 | --> $DIR/conditionally-const-invalid-places.rs:46:8 |
| ... | ... | @@ -167,18 +167,18 @@ LL | fn non_const_function<T: [const] Trait>() {} |
| 167 | 167 | | ^^^^^^^^^^^^^^^^^^ |
| 168 | 168 | |
| 169 | 169 | error: `[const]` is not allowed here |
| 170 | --> $DIR/conditionally-const-invalid-places.rs:47:21 | |
| 170 | --> $DIR/conditionally-const-invalid-places.rs:47:23 | |
| 171 | 171 | | |
| 172 | 172 | LL | const CONSTANT<T: [const] Trait>: () = (); |
| 173 | | ^^^^^^^^^ | |
| 173 | | ^^^^^^^ | |
| 174 | 174 | | |
| 175 | 175 | = note: this item cannot have `[const]` trait bounds |
| 176 | 176 | |
| 177 | 177 | error: `[const]` is not allowed here |
| 178 | --> $DIR/conditionally-const-invalid-places.rs:52:13 | |
| 178 | --> $DIR/conditionally-const-invalid-places.rs:52:15 | |
| 179 | 179 | | |
| 180 | 180 | LL | trait Child0: [const] Trait {} |
| 181 | | ^^^^^^^^^ | |
| 181 | | ^^^^^^^ | |
| 182 | 182 | | |
| 183 | 183 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 184 | 184 | --> $DIR/conditionally-const-invalid-places.rs:52:1 |
| ... | ... | @@ -187,10 +187,10 @@ LL | trait Child0: [const] Trait {} |
| 187 | 187 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 188 | 188 | |
| 189 | 189 | error: `[const]` is not allowed here |
| 190 | --> $DIR/conditionally-const-invalid-places.rs:53:24 | |
| 190 | --> $DIR/conditionally-const-invalid-places.rs:53:26 | |
| 191 | 191 | | |
| 192 | 192 | LL | trait Child1 where Self: [const] Trait {} |
| 193 | | ^^^^^^^^^ | |
| 193 | | ^^^^^^^ | |
| 194 | 194 | | |
| 195 | 195 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 196 | 196 | --> $DIR/conditionally-const-invalid-places.rs:53:1 |
| ... | ... | @@ -199,10 +199,10 @@ LL | trait Child1 where Self: [const] Trait {} |
| 199 | 199 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 200 | 200 | |
| 201 | 201 | error: `[const]` is not allowed here |
| 202 | --> $DIR/conditionally-const-invalid-places.rs:56:7 | |
| 202 | --> $DIR/conditionally-const-invalid-places.rs:56:9 | |
| 203 | 203 | | |
| 204 | 204 | LL | impl<T: [const] Trait> Trait for T {} |
| 205 | | ^^^^^^^^^ | |
| 205 | | ^^^^^^^ | |
| 206 | 206 | | |
| 207 | 207 | note: this impl is not `const`, so it cannot have `[const]` trait bounds |
| 208 | 208 | --> $DIR/conditionally-const-invalid-places.rs:56:1 |
| ... | ... | @@ -211,10 +211,10 @@ LL | impl<T: [const] Trait> Trait for T {} |
| 211 | 211 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 212 | 212 | |
| 213 | 213 | error: `[const]` is not allowed here |
| 214 | --> $DIR/conditionally-const-invalid-places.rs:59:7 | |
| 214 | --> $DIR/conditionally-const-invalid-places.rs:59:9 | |
| 215 | 215 | | |
| 216 | 216 | LL | impl<T: [const] Trait> Struct<T> {} |
| 217 | | ^^^^^^^^^ | |
| 217 | | ^^^^^^^ | |
| 218 | 218 | | |
| 219 | 219 | note: inherent impls cannot have `[const]` trait bounds |
| 220 | 220 | --> $DIR/conditionally-const-invalid-places.rs:59:1 |
tests/ui/traits/const-traits/const-bound-on-not-const-associated-fn.stderr+4-4| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/const-bound-on-not-const-associated-fn.rs:11:38 | |
| 2 | --> $DIR/const-bound-on-not-const-associated-fn.rs:11:40 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn do_something_else() where Self: [const] MyTrait; |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/const-bound-on-not-const-associated-fn.rs:11:8 |
| ... | ... | @@ -11,10 +11,10 @@ LL | fn do_something_else() where Self: [const] MyTrait; |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` is not allowed here |
| 14 | --> $DIR/const-bound-on-not-const-associated-fn.rs:22:30 | |
| 14 | --> $DIR/const-bound-on-not-const-associated-fn.rs:22:32 | |
| 15 | 15 | | |
| 16 | 16 | LL | pub fn foo(&self) where T: [const] MyTrait { |
| 17 | | ^^^^^^^^^ | |
| 17 | | ^^^^^^^ | |
| 18 | 18 | | |
| 19 | 19 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 20 | 20 | --> $DIR/const-bound-on-not-const-associated-fn.rs:22:12 |
tests/ui/traits/const-traits/const-bounds-non-const-trait.stderr+4-4| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const-bounds-non-const-trait.rs:6:19 | |
| 2 | --> $DIR/const-bounds-non-const-trait.rs:6:21 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn perform<T: [const] NonConst>() {} |
| 5 | | ^^^^^^^^^ can't be applied to `NonConst` | |
| 5 | | ^^^^^^^ can't be applied to `NonConst` | |
| 6 | 6 | | |
| 7 | 7 | help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations |
| 8 | 8 | | |
| ... | ... | @@ -10,10 +10,10 @@ LL | #[const_trait] trait NonConst {} |
| 10 | 10 | | ++++++++++++++ |
| 11 | 11 | |
| 12 | 12 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 13 | --> $DIR/const-bounds-non-const-trait.rs:6:19 | |
| 13 | --> $DIR/const-bounds-non-const-trait.rs:6:21 | |
| 14 | 14 | | |
| 15 | 15 | LL | const fn perform<T: [const] NonConst>() {} |
| 16 | | ^^^^^^^^^ can't be applied to `NonConst` | |
| 16 | | ^^^^^^^ can't be applied to `NonConst` | |
| 17 | 17 | | |
| 18 | 18 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 19 | 19 | help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/const-closure-parse-not-item.stderr+6-6| ... | ... | @@ -1,27 +1,27 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const-closure-parse-not-item.rs:7:20 | |
| 2 | --> $DIR/const-closure-parse-not-item.rs:7:25 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn test() -> impl [const] Fn() { |
| 5 | | ^^^^^^^^^^^^ can't be applied to `Fn` | |
| 5 | | ^^^^^^^ can't be applied to `Fn` | |
| 6 | 6 | | |
| 7 | 7 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/const-closure-parse-not-item.rs:7:20 | |
| 11 | --> $DIR/const-closure-parse-not-item.rs:7:25 | |
| 12 | 12 | | |
| 13 | 13 | LL | const fn test() -> impl [const] Fn() { |
| 14 | | ^^^^^^^^^^^^ can't be applied to `Fn` | |
| 14 | | ^^^^^^^ can't be applied to `Fn` | |
| 15 | 15 | | |
| 16 | 16 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 18 | 18 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 19 | 19 | |
| 20 | 20 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 21 | --> $DIR/const-closure-parse-not-item.rs:7:20 | |
| 21 | --> $DIR/const-closure-parse-not-item.rs:7:25 | |
| 22 | 22 | | |
| 23 | 23 | LL | const fn test() -> impl [const] Fn() { |
| 24 | | ^^^^^^^^^^^^ can't be applied to `Fn` | |
| 24 | | ^^^^^^^ can't be applied to `Fn` | |
| 25 | 25 | | |
| 26 | 26 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 27 | 27 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/traits/const-traits/const-closure-trait-method-fail.stderr+4-4| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const-closure-trait-method-fail.rs:14:30 | |
| 2 | --> $DIR/const-closure-trait-method-fail.rs:14:32 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn need_const_closure<T: [const] FnOnce(()) -> i32>(x: T) -> i32 { |
| 5 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 5 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 6 | 6 | | |
| 7 | 7 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/const-closure-trait-method-fail.rs:14:30 | |
| 11 | --> $DIR/const-closure-trait-method-fail.rs:14:32 | |
| 12 | 12 | | |
| 13 | 13 | LL | const fn need_const_closure<T: [const] FnOnce(()) -> i32>(x: T) -> i32 { |
| 14 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 14 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 15 | 15 | | |
| 16 | 16 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/traits/const-traits/const-closure-trait-method.stderr+4-4| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const-closure-trait-method.rs:14:30 | |
| 2 | --> $DIR/const-closure-trait-method.rs:14:32 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn need_const_closure<T: [const] FnOnce(()) -> i32>(x: T) -> i32 { |
| 5 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 5 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 6 | 6 | | |
| 7 | 7 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/const-closure-trait-method.rs:14:30 | |
| 11 | --> $DIR/const-closure-trait-method.rs:14:32 | |
| 12 | 12 | | |
| 13 | 13 | LL | const fn need_const_closure<T: [const] FnOnce(()) -> i32>(x: T) -> i32 { |
| 14 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 14 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 15 | 15 | | |
| 16 | 16 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/traits/const-traits/const-closures.stderr+16-16| ... | ... | @@ -1,74 +1,74 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/const-closures.rs:8:10 | |
| 2 | --> $DIR/const-closures.rs:8:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | F: [const] FnOnce() -> u8, |
| 5 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 5 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 6 | 6 | | |
| 7 | 7 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/const-closures.rs:9:10 | |
| 11 | --> $DIR/const-closures.rs:9:12 | |
| 12 | 12 | | |
| 13 | 13 | LL | F: [const] FnMut() -> u8, |
| 14 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 14 | | ^^^^^^^ can't be applied to `FnMut` | |
| 15 | 15 | | |
| 16 | 16 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 18 | 18 | |
| 19 | 19 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 20 | --> $DIR/const-closures.rs:10:10 | |
| 20 | --> $DIR/const-closures.rs:10:12 | |
| 21 | 21 | | |
| 22 | 22 | LL | F: [const] Fn() -> u8, |
| 23 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 23 | | ^^^^^^^ can't be applied to `Fn` | |
| 24 | 24 | | |
| 25 | 25 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 26 | 26 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 27 | 27 | |
| 28 | 28 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 29 | --> $DIR/const-closures.rs:8:10 | |
| 29 | --> $DIR/const-closures.rs:8:12 | |
| 30 | 30 | | |
| 31 | 31 | LL | F: [const] FnOnce() -> u8, |
| 32 | | ^^^^^^^^^ can't be applied to `FnOnce` | |
| 32 | | ^^^^^^^ can't be applied to `FnOnce` | |
| 33 | 33 | | |
| 34 | 34 | note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 35 | 35 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 36 | 36 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 37 | 37 | |
| 38 | 38 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 39 | --> $DIR/const-closures.rs:9:10 | |
| 39 | --> $DIR/const-closures.rs:9:12 | |
| 40 | 40 | | |
| 41 | 41 | LL | F: [const] FnMut() -> u8, |
| 42 | | ^^^^^^^^^ can't be applied to `FnMut` | |
| 42 | | ^^^^^^^ can't be applied to `FnMut` | |
| 43 | 43 | | |
| 44 | 44 | note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 45 | 45 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 46 | 46 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 47 | 47 | |
| 48 | 48 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 49 | --> $DIR/const-closures.rs:10:10 | |
| 49 | --> $DIR/const-closures.rs:10:12 | |
| 50 | 50 | | |
| 51 | 51 | LL | F: [const] Fn() -> u8, |
| 52 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 52 | | ^^^^^^^ can't be applied to `Fn` | |
| 53 | 53 | | |
| 54 | 54 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 55 | 55 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 56 | 56 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 57 | 57 | |
| 58 | 58 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 59 | --> $DIR/const-closures.rs:23:18 | |
| 59 | --> $DIR/const-closures.rs:23:20 | |
| 60 | 60 | | |
| 61 | 61 | LL | const fn answer<F: [const] Fn() -> u8>(f: &F) -> u8 { |
| 62 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 62 | | ^^^^^^^ can't be applied to `Fn` | |
| 63 | 63 | | |
| 64 | 64 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 65 | 65 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 66 | 66 | |
| 67 | 67 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 68 | --> $DIR/const-closures.rs:23:18 | |
| 68 | --> $DIR/const-closures.rs:23:20 | |
| 69 | 69 | | |
| 70 | 70 | LL | const fn answer<F: [const] Fn() -> u8>(f: &F) -> u8 { |
| 71 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 71 | | ^^^^^^^ can't be applied to `Fn` | |
| 72 | 72 | | |
| 73 | 73 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 74 | 74 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/traits/const-traits/const-trait-bounds-trait-objects.stderr+4-4| ... | ... | @@ -5,10 +5,10 @@ LL | let _: &dyn const Trait; |
| 5 | 5 | | ^^^^^^^^^^^ |
| 6 | 6 | |
| 7 | 7 | error: `[const]` is not allowed here |
| 8 | --> $DIR/const-trait-bounds-trait-objects.rs:10:13 | |
| 8 | --> $DIR/const-trait-bounds-trait-objects.rs:10:17 | |
| 9 | 9 | | |
| 10 | 10 | LL | let _: &dyn [const] Trait; |
| 11 | | ^^^^^^^^^^^ | |
| 11 | | ^^^^^^^ | |
| 12 | 12 | | |
| 13 | 13 | = note: trait objects cannot have `[const]` trait bounds |
| 14 | 14 | |
| ... | ... | @@ -19,10 +19,10 @@ LL | const fn handle(_: &dyn const NonConst) {} |
| 19 | 19 | | ^^^^^^^^^^^^^^ |
| 20 | 20 | |
| 21 | 21 | error: `[const]` is not allowed here |
| 22 | --> $DIR/const-trait-bounds-trait-objects.rs:17:19 | |
| 22 | --> $DIR/const-trait-bounds-trait-objects.rs:17:23 | |
| 23 | 23 | | |
| 24 | 24 | LL | const fn take(_: &dyn [const] NonConst) {} |
| 25 | | ^^^^^^^^^^^ | |
| 25 | | ^^^^^^^ | |
| 26 | 26 | | |
| 27 | 27 | = note: trait objects cannot have `[const]` trait bounds |
| 28 | 28 |
tests/ui/traits/const-traits/feature-gate.stock.stderr+4-4| ... | ... | @@ -9,10 +9,10 @@ LL | impl const T for S {} |
| 9 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 10 | 10 | |
| 11 | 11 | error[E0658]: const trait impls are experimental |
| 12 | --> $DIR/feature-gate.rs:13:13 | |
| 12 | --> $DIR/feature-gate.rs:13:15 | |
| 13 | 13 | | |
| 14 | 14 | LL | const fn f<A: [const] T>() {} |
| 15 | | ^^^^^^^^^ | |
| 15 | | ^^^^^^^ | |
| 16 | 16 | | |
| 17 | 17 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 18 | 18 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| ... | ... | @@ -29,10 +29,10 @@ LL | fn g<A: const T>() {} |
| 29 | 29 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 30 | 30 | |
| 31 | 31 | error[E0658]: const trait impls are experimental |
| 32 | --> $DIR/feature-gate.rs:18:12 | |
| 32 | --> $DIR/feature-gate.rs:18:17 | |
| 33 | 33 | | |
| 34 | 34 | LL | discard! { impl [const] T } |
| 35 | | ^^^^^^^^^^^^ | |
| 35 | | ^^^^^^^ | |
| 36 | 36 | | |
| 37 | 37 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 38 | 38 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
tests/ui/traits/const-traits/ice-112822-expected-type-for-param.stderr+6-6| ... | ... | @@ -9,29 +9,29 @@ LL | const move || { |
| 9 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 10 | 10 | |
| 11 | 11 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 12 | --> $DIR/ice-112822-expected-type-for-param.rs:3:20 | |
| 12 | --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | |
| 13 | 13 | | |
| 14 | 14 | LL | const fn test() -> impl [const] Fn() { |
| 15 | | ^^^^^^^^^^^^ can't be applied to `Fn` | |
| 15 | | ^^^^^^^ can't be applied to `Fn` | |
| 16 | 16 | | |
| 17 | 17 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 18 | 18 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 19 | 19 | |
| 20 | 20 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 21 | --> $DIR/ice-112822-expected-type-for-param.rs:3:20 | |
| 21 | --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | |
| 22 | 22 | | |
| 23 | 23 | LL | const fn test() -> impl [const] Fn() { |
| 24 | | ^^^^^^^^^^^^ can't be applied to `Fn` | |
| 24 | | ^^^^^^^ can't be applied to `Fn` | |
| 25 | 25 | | |
| 26 | 26 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 27 | 27 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 28 | 28 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 29 | 29 | |
| 30 | 30 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 31 | --> $DIR/ice-112822-expected-type-for-param.rs:3:20 | |
| 31 | --> $DIR/ice-112822-expected-type-for-param.rs:3:25 | |
| 32 | 32 | | |
| 33 | 33 | LL | const fn test() -> impl [const] Fn() { |
| 34 | | ^^^^^^^^^^^^ can't be applied to `Fn` | |
| 34 | | ^^^^^^^ can't be applied to `Fn` | |
| 35 | 35 | | |
| 36 | 36 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 37 | 37 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/traits/const-traits/ice-123664-unexpected-bound-var.stderr+4-4| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/ice-123664-unexpected-bound-var.rs:4:25 | |
| 2 | --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | |
| 3 | 3 | | |
| 4 | 4 | LL | const fn with_positive<F: [const] Fn()>() {} |
| 5 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 5 | | ^^^^^^^ can't be applied to `Fn` | |
| 6 | 6 | | |
| 7 | 7 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/ice-123664-unexpected-bound-var.rs:4:25 | |
| 11 | --> $DIR/ice-123664-unexpected-bound-var.rs:4:27 | |
| 12 | 12 | | |
| 13 | 13 | LL | const fn with_positive<F: [const] Fn()>() {} |
| 14 | | ^^^^^^^^^ can't be applied to `Fn` | |
| 14 | | ^^^^^^^ can't be applied to `Fn` | |
| 15 | 15 | | |
| 16 | 16 | note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/ops/function.rs:LL:COL |
tests/ui/traits/const-traits/non-const-op-in-closure-in-const.stderr+4-4| ... | ... | @@ -1,17 +1,17 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/non-const-op-in-closure-in-const.rs:10:42 | |
| 2 | --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | |
| 3 | 3 | | |
| 4 | 4 | LL | impl<A, B> const Convert<B> for A where B: [const] From<A> { |
| 5 | | ^^^^^^^^^ can't be applied to `From` | |
| 5 | | ^^^^^^^ can't be applied to `From` | |
| 6 | 6 | | |
| 7 | 7 | note: `From` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 8 | 8 | --> $SRC_DIR/core/src/convert/mod.rs:LL:COL |
| 9 | 9 | |
| 10 | 10 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 11 | --> $DIR/non-const-op-in-closure-in-const.rs:10:42 | |
| 11 | --> $DIR/non-const-op-in-closure-in-const.rs:10:44 | |
| 12 | 12 | | |
| 13 | 13 | LL | impl<A, B> const Convert<B> for A where B: [const] From<A> { |
| 14 | | ^^^^^^^^^ can't be applied to `From` | |
| 14 | | ^^^^^^^ can't be applied to `From` | |
| 15 | 15 | | |
| 16 | 16 | note: `From` can't be used with `[const]` because it isn't annotated with `#[const_trait]` |
| 17 | 17 | --> $SRC_DIR/core/src/convert/mod.rs:LL:COL |
tests/ui/traits/const-traits/super-traits-fail-2.nn.stderr+8-8| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 2 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/super-traits-fail-2.rs:11:1 |
| ... | ... | @@ -11,10 +11,10 @@ LL | trait Bar: [const] Foo {} |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 14 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 14 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 15 | 15 | | |
| 16 | 16 | LL | trait Bar: [const] Foo {} |
| 17 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 17 | | ^^^^^^^ can't be applied to `Foo` | |
| 18 | 18 | | |
| 19 | 19 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| 20 | 20 | | |
| ... | ... | @@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo { |
| 22 | 22 | | ++++++++++++++ |
| 23 | 23 | |
| 24 | 24 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 25 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 25 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 26 | 26 | | |
| 27 | 27 | LL | trait Bar: [const] Foo {} |
| 28 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 28 | | ^^^^^^^ can't be applied to `Foo` | |
| 29 | 29 | | |
| 30 | 30 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 31 | 31 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo { |
| 34 | 34 | | ++++++++++++++ |
| 35 | 35 | |
| 36 | 36 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 37 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 37 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 38 | 38 | | |
| 39 | 39 | LL | trait Bar: [const] Foo {} |
| 40 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 40 | | ^^^^^^^ can't be applied to `Foo` | |
| 41 | 41 | | |
| 42 | 42 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 43 | 43 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/super-traits-fail-2.ny.stderr+10-10| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 2 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 5 | | ^^^^^^^ can't be applied to `Foo` | |
| 6 | 6 | | |
| 7 | 7 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| 8 | 8 | | |
| ... | ... | @@ -10,10 +10,10 @@ LL | #[const_trait] trait Foo { |
| 10 | 10 | | ++++++++++++++ |
| 11 | 11 | |
| 12 | 12 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 13 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 13 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 14 | 14 | | |
| 15 | 15 | LL | trait Bar: [const] Foo {} |
| 16 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 16 | | ^^^^^^^ can't be applied to `Foo` | |
| 17 | 17 | | |
| 18 | 18 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 19 | 19 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo { |
| 22 | 22 | | ++++++++++++++ |
| 23 | 23 | |
| 24 | 24 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 25 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 25 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 26 | 26 | | |
| 27 | 27 | LL | trait Bar: [const] Foo {} |
| 28 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 28 | | ^^^^^^^ can't be applied to `Foo` | |
| 29 | 29 | | |
| 30 | 30 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 31 | 31 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo { |
| 34 | 34 | | ++++++++++++++ |
| 35 | 35 | |
| 36 | 36 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 37 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 37 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 38 | 38 | | |
| 39 | 39 | LL | trait Bar: [const] Foo {} |
| 40 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 40 | | ^^^^^^^ can't be applied to `Foo` | |
| 41 | 41 | | |
| 42 | 42 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 43 | 43 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -46,10 +46,10 @@ LL | #[const_trait] trait Foo { |
| 46 | 46 | | ++++++++++++++ |
| 47 | 47 | |
| 48 | 48 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 49 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 49 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 50 | 50 | | |
| 51 | 51 | LL | trait Bar: [const] Foo {} |
| 52 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 52 | | ^^^^^^^ can't be applied to `Foo` | |
| 53 | 53 | | |
| 54 | 54 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 55 | 55 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/super-traits-fail-2.yn.stderr+2-2| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/super-traits-fail-2.rs:11:10 | |
| 2 | --> $DIR/super-traits-fail-2.rs:11:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/super-traits-fail-2.rs:11:1 |
tests/ui/traits/const-traits/super-traits-fail-3.nnn.stderr+16-16| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/super-traits-fail-3.rs:23:1 |
| ... | ... | @@ -11,30 +11,30 @@ LL | trait Bar: [const] Foo {} |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error[E0658]: const trait impls are experimental |
| 14 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 14 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 15 | 15 | | |
| 16 | 16 | LL | trait Bar: [const] Foo {} |
| 17 | | ^^^^^^^^^ | |
| 17 | | ^^^^^^^ | |
| 18 | 18 | | |
| 19 | 19 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 20 | 20 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| 21 | 21 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 22 | 22 | |
| 23 | 23 | error[E0658]: const trait impls are experimental |
| 24 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 24 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 25 | 25 | | |
| 26 | 26 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 27 | | ^^^^^^^^^ | |
| 27 | | ^^^^^^^ | |
| 28 | 28 | | |
| 29 | 29 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 30 | 30 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| 31 | 31 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 32 | 32 | |
| 33 | 33 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 34 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 34 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 35 | 35 | | |
| 36 | 36 | LL | trait Bar: [const] Foo {} |
| 37 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 37 | | ^^^^^^^ can't be applied to `Foo` | |
| 38 | 38 | | |
| 39 | 39 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| 40 | 40 | | |
| ... | ... | @@ -42,10 +42,10 @@ LL | #[const_trait] trait Foo { |
| 42 | 42 | | ++++++++++++++ |
| 43 | 43 | |
| 44 | 44 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 45 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 45 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 46 | 46 | | |
| 47 | 47 | LL | trait Bar: [const] Foo {} |
| 48 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 48 | | ^^^^^^^ can't be applied to `Foo` | |
| 49 | 49 | | |
| 50 | 50 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 51 | 51 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -54,10 +54,10 @@ LL | #[const_trait] trait Foo { |
| 54 | 54 | | ++++++++++++++ |
| 55 | 55 | |
| 56 | 56 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 57 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 57 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 58 | 58 | | |
| 59 | 59 | LL | trait Bar: [const] Foo {} |
| 60 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 60 | | ^^^^^^^ can't be applied to `Foo` | |
| 61 | 61 | | |
| 62 | 62 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 63 | 63 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -66,10 +66,10 @@ LL | #[const_trait] trait Foo { |
| 66 | 66 | | ++++++++++++++ |
| 67 | 67 | |
| 68 | 68 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 69 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 69 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 70 | 70 | | |
| 71 | 71 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 72 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 72 | | ^^^^^^^ can't be applied to `Bar` | |
| 73 | 73 | | |
| 74 | 74 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
| 75 | 75 | | |
| ... | ... | @@ -77,10 +77,10 @@ LL | #[const_trait] trait Bar: [const] Foo {} |
| 77 | 77 | | ++++++++++++++ |
| 78 | 78 | |
| 79 | 79 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 80 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 80 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 81 | 81 | | |
| 82 | 82 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 83 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 83 | | ^^^^^^^ can't be applied to `Bar` | |
| 84 | 84 | | |
| 85 | 85 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 86 | 86 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/super-traits-fail-3.nny.stderr+16-16| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/super-traits-fail-3.rs:23:1 |
| ... | ... | @@ -11,30 +11,30 @@ LL | trait Bar: [const] Foo {} |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error[E0658]: const trait impls are experimental |
| 14 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 14 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 15 | 15 | | |
| 16 | 16 | LL | trait Bar: [const] Foo {} |
| 17 | | ^^^^^^^^^ | |
| 17 | | ^^^^^^^ | |
| 18 | 18 | | |
| 19 | 19 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 20 | 20 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| 21 | 21 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 22 | 22 | |
| 23 | 23 | error[E0658]: const trait impls are experimental |
| 24 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 24 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 25 | 25 | | |
| 26 | 26 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 27 | | ^^^^^^^^^ | |
| 27 | | ^^^^^^^ | |
| 28 | 28 | | |
| 29 | 29 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 30 | 30 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| 31 | 31 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 32 | 32 | |
| 33 | 33 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 34 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 34 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 35 | 35 | | |
| 36 | 36 | LL | trait Bar: [const] Foo {} |
| 37 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 37 | | ^^^^^^^ can't be applied to `Foo` | |
| 38 | 38 | | |
| 39 | 39 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| 40 | 40 | | |
| ... | ... | @@ -42,10 +42,10 @@ LL | #[const_trait] trait Foo { |
| 42 | 42 | | ++++++++++++++ |
| 43 | 43 | |
| 44 | 44 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 45 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 45 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 46 | 46 | | |
| 47 | 47 | LL | trait Bar: [const] Foo {} |
| 48 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 48 | | ^^^^^^^ can't be applied to `Foo` | |
| 49 | 49 | | |
| 50 | 50 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 51 | 51 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -54,10 +54,10 @@ LL | #[const_trait] trait Foo { |
| 54 | 54 | | ++++++++++++++ |
| 55 | 55 | |
| 56 | 56 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 57 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 57 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 58 | 58 | | |
| 59 | 59 | LL | trait Bar: [const] Foo {} |
| 60 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 60 | | ^^^^^^^ can't be applied to `Foo` | |
| 61 | 61 | | |
| 62 | 62 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 63 | 63 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -66,10 +66,10 @@ LL | #[const_trait] trait Foo { |
| 66 | 66 | | ++++++++++++++ |
| 67 | 67 | |
| 68 | 68 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 69 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 69 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 70 | 70 | | |
| 71 | 71 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 72 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 72 | | ^^^^^^^ can't be applied to `Bar` | |
| 73 | 73 | | |
| 74 | 74 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
| 75 | 75 | | |
| ... | ... | @@ -77,10 +77,10 @@ LL | #[const_trait] trait Bar: [const] Foo {} |
| 77 | 77 | | ++++++++++++++ |
| 78 | 78 | |
| 79 | 79 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 80 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 80 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 81 | 81 | | |
| 82 | 82 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 83 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 83 | | ^^^^^^^ can't be applied to `Bar` | |
| 84 | 84 | | |
| 85 | 85 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 86 | 86 | help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/super-traits-fail-3.nyn.stderr+4-4| ... | ... | @@ -1,18 +1,18 @@ |
| 1 | 1 | error[E0658]: const trait impls are experimental |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 8 | 8 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| 9 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 10 | 10 | |
| 11 | 11 | error[E0658]: const trait impls are experimental |
| 12 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 12 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 13 | 13 | | |
| 14 | 14 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 15 | | ^^^^^^^^^ | |
| 15 | | ^^^^^^^ | |
| 16 | 16 | | |
| 17 | 17 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 18 | 18 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
tests/ui/traits/const-traits/super-traits-fail-3.nyy.stderr+4-4| ... | ... | @@ -1,18 +1,18 @@ |
| 1 | 1 | error[E0658]: const trait impls are experimental |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 8 | 8 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
| 9 | 9 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| 10 | 10 | |
| 11 | 11 | error[E0658]: const trait impls are experimental |
| 12 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 12 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 13 | 13 | | |
| 14 | 14 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 15 | | ^^^^^^^^^ | |
| 15 | | ^^^^^^^ | |
| 16 | 16 | | |
| 17 | 17 | = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information |
| 18 | 18 | = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable |
tests/ui/traits/const-traits/super-traits-fail-3.ynn.stderr+12-12| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/super-traits-fail-3.rs:23:1 |
| ... | ... | @@ -11,10 +11,10 @@ LL | trait Bar: [const] Foo {} |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 14 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 14 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 15 | 15 | | |
| 16 | 16 | LL | trait Bar: [const] Foo {} |
| 17 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 17 | | ^^^^^^^ can't be applied to `Foo` | |
| 18 | 18 | | |
| 19 | 19 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| 20 | 20 | | |
| ... | ... | @@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo { |
| 22 | 22 | | ++++++++++++++ |
| 23 | 23 | |
| 24 | 24 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 25 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 25 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 26 | 26 | | |
| 27 | 27 | LL | trait Bar: [const] Foo {} |
| 28 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 28 | | ^^^^^^^ can't be applied to `Foo` | |
| 29 | 29 | | |
| 30 | 30 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 31 | 31 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo { |
| 34 | 34 | | ++++++++++++++ |
| 35 | 35 | |
| 36 | 36 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 37 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 37 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 38 | 38 | | |
| 39 | 39 | LL | trait Bar: [const] Foo {} |
| 40 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 40 | | ^^^^^^^ can't be applied to `Foo` | |
| 41 | 41 | | |
| 42 | 42 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 43 | 43 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -46,10 +46,10 @@ LL | #[const_trait] trait Foo { |
| 46 | 46 | | ++++++++++++++ |
| 47 | 47 | |
| 48 | 48 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 49 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 49 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 50 | 50 | | |
| 51 | 51 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 52 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 52 | | ^^^^^^^ can't be applied to `Bar` | |
| 53 | 53 | | |
| 54 | 54 | help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
| 55 | 55 | | |
| ... | ... | @@ -57,10 +57,10 @@ LL | #[const_trait] trait Bar: [const] Foo {} |
| 57 | 57 | | ++++++++++++++ |
| 58 | 58 | |
| 59 | 59 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 60 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 60 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 61 | 61 | | |
| 62 | 62 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 63 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 63 | | ^^^^^^^ can't be applied to `Bar` | |
| 64 | 64 | | |
| 65 | 65 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 66 | 66 | help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/super-traits-fail-3.yny.stderr+10-10| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 5 | | ^^^^^^^ can't be applied to `Foo` | |
| 6 | 6 | | |
| 7 | 7 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| 8 | 8 | | |
| ... | ... | @@ -10,10 +10,10 @@ LL | #[const_trait] trait Foo { |
| 10 | 10 | | ++++++++++++++ |
| 11 | 11 | |
| 12 | 12 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 13 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 13 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 14 | 14 | | |
| 15 | 15 | LL | trait Bar: [const] Foo {} |
| 16 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 16 | | ^^^^^^^ can't be applied to `Foo` | |
| 17 | 17 | | |
| 18 | 18 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 19 | 19 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo { |
| 22 | 22 | | ++++++++++++++ |
| 23 | 23 | |
| 24 | 24 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 25 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 25 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 26 | 26 | | |
| 27 | 27 | LL | trait Bar: [const] Foo {} |
| 28 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 28 | | ^^^^^^^ can't be applied to `Foo` | |
| 29 | 29 | | |
| 30 | 30 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 31 | 31 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo { |
| 34 | 34 | | ++++++++++++++ |
| 35 | 35 | |
| 36 | 36 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 37 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 37 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 38 | 38 | | |
| 39 | 39 | LL | trait Bar: [const] Foo {} |
| 40 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 40 | | ^^^^^^^ can't be applied to `Foo` | |
| 41 | 41 | | |
| 42 | 42 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 43 | 43 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
| ... | ... | @@ -46,10 +46,10 @@ LL | #[const_trait] trait Foo { |
| 46 | 46 | | ++++++++++++++ |
| 47 | 47 | |
| 48 | 48 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 49 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 49 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 50 | 50 | | |
| 51 | 51 | LL | trait Bar: [const] Foo {} |
| 52 | | ^^^^^^^^^ can't be applied to `Foo` | |
| 52 | | ^^^^^^^ can't be applied to `Foo` | |
| 53 | 53 | | |
| 54 | 54 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 55 | 55 | help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/super-traits-fail-3.yyn.stderr+6-6| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/super-traits-fail-3.rs:23:10 | |
| 2 | --> $DIR/super-traits-fail-3.rs:23:12 | |
| 3 | 3 | | |
| 4 | 4 | LL | trait Bar: [const] Foo {} |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/super-traits-fail-3.rs:23:1 |
| ... | ... | @@ -11,10 +11,10 @@ LL | trait Bar: [const] Foo {} |
| 11 | 11 | | ^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 14 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 14 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 15 | 15 | | |
| 16 | 16 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 17 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 17 | | ^^^^^^^ can't be applied to `Bar` | |
| 18 | 18 | | |
| 19 | 19 | help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
| 20 | 20 | | |
| ... | ... | @@ -22,10 +22,10 @@ LL | #[const_trait] trait Bar: [const] Foo {} |
| 22 | 22 | | ++++++++++++++ |
| 23 | 23 | |
| 24 | 24 | error: `[const]` can only be applied to `#[const_trait]` traits |
| 25 | --> $DIR/super-traits-fail-3.rs:32:15 | |
| 25 | --> $DIR/super-traits-fail-3.rs:32:17 | |
| 26 | 26 | | |
| 27 | 27 | LL | const fn foo<T: [const] Bar>(x: &T) { |
| 28 | | ^^^^^^^^^ can't be applied to `Bar` | |
| 28 | | ^^^^^^^ can't be applied to `Bar` | |
| 29 | 29 | | |
| 30 | 30 | = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no` |
| 31 | 31 | help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations |
tests/ui/traits/const-traits/syntactical-unstable.stderr+15-15| ... | ... | @@ -2,9 +2,9 @@ error[E0658]: use of unstable const library feature `unstable` |
| 2 | 2 | --> $DIR/syntactical-unstable.rs:13:20 |
| 3 | 3 | | |
| 4 | 4 | LL | trait Foo: [const] MyTrait { |
| 5 | | --------- ^^^^^^^ | |
| 6 | | | | |
| 7 | | trait is not stable as const yet | |
| 5 | | ------- ^^^^^^^ | |
| 6 | | | | |
| 7 | | trait is not stable as const yet | |
| 8 | 8 | | |
| 9 | 9 | = help: add `#![feature(unstable)]` to the crate attributes to enable |
| 10 | 10 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| ... | ... | @@ -13,9 +13,9 @@ error[E0658]: use of unstable const library feature `unstable` |
| 13 | 13 | --> $DIR/syntactical-unstable.rs:19:45 |
| 14 | 14 | | |
| 15 | 15 | LL | const fn where_clause<T>() where T: [const] MyTrait {} |
| 16 | | --------- ^^^^^^^ | |
| 17 | | | | |
| 18 | | trait is not stable as const yet | |
| 16 | | ------- ^^^^^^^ | |
| 17 | | | | |
| 18 | | trait is not stable as const yet | |
| 19 | 19 | | |
| 20 | 20 | = help: add `#![feature(unstable)]` to the crate attributes to enable |
| 21 | 21 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| ... | ... | @@ -24,9 +24,9 @@ error[E0658]: use of unstable const library feature `unstable` |
| 24 | 24 | --> $DIR/syntactical-unstable.rs:22:53 |
| 25 | 25 | | |
| 26 | 26 | LL | const fn nested<T>() where T: Deref<Target: [const] MyTrait> {} |
| 27 | | --------- ^^^^^^^ | |
| 28 | | | | |
| 29 | | trait is not stable as const yet | |
| 27 | | ------- ^^^^^^^ | |
| 28 | | | | |
| 29 | | trait is not stable as const yet | |
| 30 | 30 | | |
| 31 | 31 | = help: add `#![feature(unstable)]` to the crate attributes to enable |
| 32 | 32 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| ... | ... | @@ -35,9 +35,9 @@ error[E0658]: use of unstable const library feature `unstable` |
| 35 | 35 | --> $DIR/syntactical-unstable.rs:25:33 |
| 36 | 36 | | |
| 37 | 37 | LL | const fn rpit() -> impl [const] MyTrait { Local } |
| 38 | | ------------ ^^^^^^^ | |
| 39 | | | | |
| 40 | | trait is not stable as const yet | |
| 38 | | ------- ^^^^^^^ | |
| 39 | | | | |
| 40 | | trait is not stable as const yet | |
| 41 | 41 | | |
| 42 | 42 | = help: add `#![feature(unstable)]` to the crate attributes to enable |
| 43 | 43 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
| ... | ... | @@ -55,9 +55,9 @@ error[E0658]: use of unstable const library feature `unstable` |
| 55 | 55 | --> $DIR/syntactical-unstable.rs:15:24 |
| 56 | 56 | | |
| 57 | 57 | LL | type Item: [const] MyTrait; |
| 58 | | --------- ^^^^^^^ | |
| 59 | | | | |
| 60 | | trait is not stable as const yet | |
| 58 | | ------- ^^^^^^^ | |
| 59 | | | | |
| 60 | | trait is not stable as const yet | |
| 61 | 61 | | |
| 62 | 62 | = help: add `#![feature(unstable)]` to the crate attributes to enable |
| 63 | 63 | = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date |
tests/ui/traits/const-traits/trait-where-clause.stderr+4-4| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | error: `[const]` is not allowed here |
| 2 | --> $DIR/trait-where-clause.rs:8:22 | |
| 2 | --> $DIR/trait-where-clause.rs:8:24 | |
| 3 | 3 | | |
| 4 | 4 | LL | fn b() where Self: [const] Bar; |
| 5 | | ^^^^^^^^^ | |
| 5 | | ^^^^^^^ | |
| 6 | 6 | | |
| 7 | 7 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 8 | 8 | --> $DIR/trait-where-clause.rs:8:8 |
| ... | ... | @@ -11,10 +11,10 @@ LL | fn b() where Self: [const] Bar; |
| 11 | 11 | | ^ |
| 12 | 12 | |
| 13 | 13 | error: `[const]` is not allowed here |
| 14 | --> $DIR/trait-where-clause.rs:10:11 | |
| 14 | --> $DIR/trait-where-clause.rs:10:13 | |
| 15 | 15 | | |
| 16 | 16 | LL | fn c<T: [const] Bar>(); |
| 17 | | ^^^^^^^^^ | |
| 17 | | ^^^^^^^ | |
| 18 | 18 | | |
| 19 | 19 | note: this function is not `const`, so it cannot have `[const]` trait bounds |
| 20 | 20 | --> $DIR/trait-where-clause.rs:10:8 |