authorbors <bors@rust-lang.org> 2025-06-29 07:22:39 UTC
committerbors <bors@rust-lang.org> 2025-06-29 07:22:39 UTC
log5ca574e85b67cec0a6fc3fddfe398cbe676c9c69
treec7d3e5ee81cf83ba8226119a5097b80f093d2cdd
parentdddd7ab96229ea5f2ca96afcb5984a9831393a13
parenta262c001f6fd131e2eca2d45627fa5bb7754fd6c

Auto merge of #143173 - matthiaskrgr:rollup-ieu5k05, r=matthiaskrgr

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: rollup

65 files changed, 580 insertions(+), 400 deletions(-)

compiler/rustc_abi/src/lib.rs+20-11
......@@ -1592,24 +1592,33 @@ pub enum TagEncoding<VariantIdx: Idx> {
15921592 /// (so converting the tag to the discriminant can require sign extension).
15931593 Direct,
15941594
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 ///
15971599 /// 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`.
16021609 ///
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.
16061614 ///
16071615 /// Other variants that are not `untagged_variant` and that are outside the `niche_variants`
16081616 /// range cannot be represented; they must be uninhabited.
1617 /// Nonetheless, uninhabited variants can also fall into the range of `niche_variants`.
16091618 Niche {
16101619 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.
16131622 niche_variants: RangeInclusive<VariantIdx>,
16141623 /// This is inbounds of the type of the niche field
16151624 /// (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 @@
1616#![feature(box_patterns)]
1717#![feature(if_let_guard)]
1818#![feature(macro_metavar_expr)]
19#![feature(negative_impls)]
20#![feature(never_type)]
2119#![feature(rustdoc_internals)]
22#![feature(stmt_expr_attributes)]
2320#![recursion_limit = "256"]
2421// tidy-alphabetical-end
2522
compiler/rustc_attr_data_structures/src/attributes.rs+3
......@@ -253,6 +253,9 @@ pub enum AttributeKind {
253253 /// Represents `#[inline]` and `#[rustc_force_inline]`.
254254 Inline(InlineAttr, Span),
255255
256 /// Represents `#[link_name]`.
257 LinkName { name: Symbol, span: Span },
258
256259 /// Represents `#[loop_match]`.
257260 LoopMatch(Span),
258261
compiler/rustc_attr_data_structures/src/encode_cross_crate.rs+1
......@@ -29,6 +29,7 @@ impl AttributeKind {
2929 Stability { .. } => Yes,
3030 Cold(..) => No,
3131 ConstContinue(..) => No,
32 LinkName { .. } => Yes,
3233 LoopMatch(..) => No,
3334 MayDangle(..) => No,
3435 MustUse { .. } => Yes,
compiler/rustc_attr_parsing/src/attributes/link_attrs.rs created+30
......@@ -0,0 +1,30 @@
1use rustc_attr_data_structures::AttributeKind;
2use rustc_attr_data_structures::AttributeKind::LinkName;
3use rustc_feature::{AttributeTemplate, template};
4use rustc_span::{Symbol, sym};
5
6use crate::attributes::{AttributeOrder, OnDuplicate, SingleAttributeParser};
7use crate::context::{AcceptContext, Stage};
8use crate::parser::ArgParser;
9
10pub(crate) struct LinkNameParser;
11
12impl<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;
3131pub(crate) mod confusables;
3232pub(crate) mod deprecation;
3333pub(crate) mod inline;
34pub(crate) mod link_attrs;
3435pub(crate) mod lint_helpers;
3536pub(crate) mod loop_match;
3637pub(crate) mod must_use;
compiler/rustc_attr_parsing/src/context.rs+2
......@@ -22,6 +22,7 @@ use crate::attributes::codegen_attrs::{
2222use crate::attributes::confusables::ConfusablesParser;
2323use crate::attributes::deprecation::DeprecationParser;
2424use crate::attributes::inline::{InlineParser, RustcForceInlineParser};
25use crate::attributes::link_attrs::LinkNameParser;
2526use crate::attributes::lint_helpers::{AsPtrParser, PubTransparentParser};
2627use crate::attributes::loop_match::{ConstContinueParser, LoopMatchParser};
2728use crate::attributes::must_use::MustUseParser;
......@@ -121,6 +122,7 @@ attribute_parsers!(
121122 Single<DeprecationParser>,
122123 Single<ExportNameParser>,
123124 Single<InlineParser>,
125 Single<LinkNameParser>,
124126 Single<LoopMatchParser>,
125127 Single<MayDangleParser>,
126128 Single<MustUseParser>,
compiler/rustc_codegen_ssa/src/back/linker.rs+7-2
......@@ -1870,8 +1870,13 @@ pub(crate) fn linked_symbols(
18701870 crate_type: CrateType,
18711871) -> Vec<(String, SymbolExportKind)> {
18721872 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.
18751880 return Vec::new();
18761881 }
18771882 }
compiler/rustc_codegen_ssa/src/codegen_attrs.rs+1-1
......@@ -123,6 +123,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
123123 }
124124 AttributeKind::Naked(_) => codegen_fn_attrs.flags |= CodegenFnAttrFlags::NAKED,
125125 AttributeKind::Align { align, .. } => codegen_fn_attrs.alignment = Some(*align),
126 AttributeKind::LinkName { name, .. } => codegen_fn_attrs.link_name = Some(*name),
126127 AttributeKind::NoMangle(attr_span) => {
127128 if tcx.opt_item_name(did.to_def_id()).is_some() {
128129 codegen_fn_attrs.flags |= CodegenFnAttrFlags::NO_MANGLE;
......@@ -262,7 +263,6 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
262263 }
263264 }
264265 }
265 sym::link_name => codegen_fn_attrs.link_name = attr.value_str(),
266266 sym::link_ordinal => {
267267 link_ordinal_span = Some(attr.span());
268268 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> {
479479 _ => (tag_imm, bx.cx().immediate_backend_type(tag_op.layout)),
480480 };
481481
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
483483 // 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 );
493484
494485 let relative_max = niche_variants.end().as_u32() - niche_variants.start().as_u32();
495486
compiler/rustc_error_messages/src/lib.rs-1
......@@ -3,7 +3,6 @@
33#![doc(rust_logo)]
44#![feature(rustc_attrs)]
55#![feature(rustdoc_internals)]
6#![feature(type_alias_impl_trait)]
76// tidy-alphabetical-end
87
98use std::borrow::Cow;
compiler/rustc_feature/src/accepted.rs+2-2
......@@ -341,7 +341,7 @@ declare_features! (
341341 (accepted, pattern_parentheses, "1.31.0", Some(51087)),
342342 /// Allows `use<'a, 'b, A, B>` in `impl Trait + use<...>` for precise capture of generic args.
343343 (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.
345345 (accepted, precise_capturing_in_traits, "1.87.0", Some(130044)),
346346 /// Allows procedural macros in `proc-macro` crates.
347347 (accepted, proc_macro, "1.29.0", Some(38356)),
......@@ -388,7 +388,7 @@ declare_features! (
388388 (accepted, self_struct_ctor, "1.32.0", Some(51994)),
389389 /// Allows use of x86 SHA512, SM3 and SM4 target-features and intrinsics
390390 (accepted, sha512_sm_x86, "CURRENT_RUSTC_VERSION", Some(126624)),
391 /// Shortern the tail expression lifetime
391 /// Shorten the tail expression lifetime
392392 (accepted, shorter_tail_lifetimes, "1.84.0", Some(123739)),
393393 /// Allows using subslice patterns, `[a, .., b]` and `[a, xs @ .., b]`.
394394 (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.
6565#![feature(debug_closure_helpers)]
6666#![feature(gen_blocks)]
6767#![feature(if_let_guard)]
68#![feature(iter_from_coroutine)]
6968#![feature(iter_intersperse)]
7069#![feature(never_type)]
7170#![feature(rustdoc_internals)]
compiler/rustc_lint/src/foreign_modules.rs+7-2
......@@ -1,4 +1,5 @@
11use rustc_abi::FIRST_VARIANT;
2use rustc_attr_data_structures::{AttributeKind, find_attr};
23use rustc_data_structures::stack::ensure_sufficient_stack;
34use rustc_data_structures::unord::{UnordMap, UnordSet};
45use rustc_hir as hir;
......@@ -6,7 +7,7 @@ use rustc_hir::def::DefKind;
67use rustc_middle::query::Providers;
78use rustc_middle::ty::{self, AdtDef, Instance, Ty, TyCtxt};
89use rustc_session::declare_lint;
9use rustc_span::{Span, Symbol, sym};
10use rustc_span::{Span, Symbol};
1011use tracing::{debug, instrument};
1112
1213use crate::lints::{BuiltinClashingExtern, BuiltinClashingExternSub};
......@@ -182,7 +183,11 @@ fn name_of_extern_decl(tcx: TyCtxt<'_>, fi: hir::OwnerId) -> SymbolName {
182183 // information, we could have codegen_fn_attrs also give span information back for
183184 // where the attribute was defined. However, until this is found to be a
184185 // 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 )
186191 })
187192 {
188193 SymbolName::Link(overridden_link_name, overridden_link_name_span)
compiler/rustc_metadata/src/lib.rs-1
......@@ -7,7 +7,6 @@
77#![feature(file_buffered)]
88#![feature(gen_blocks)]
99#![feature(if_let_guard)]
10#![feature(iter_from_coroutine)]
1110#![feature(macro_metavar_expr)]
1211#![feature(min_specialization)]
1312#![feature(never_type)]
compiler/rustc_middle/src/lib.rs-1
......@@ -48,7 +48,6 @@
4848#![feature(gen_blocks)]
4949#![feature(if_let_guard)]
5050#![feature(intra_doc_pointers)]
51#![feature(iter_from_coroutine)]
5251#![feature(min_specialization)]
5352#![feature(negative_impls)]
5453#![feature(never_type)]
compiler/rustc_middle/src/mir/syntax.rs+9-9
......@@ -284,15 +284,15 @@ pub enum FakeBorrowKind {
284284 ///
285285 /// This is used when lowering deref patterns, where shallow borrows wouldn't prevent something
286286 /// 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 /// ```
296296 Deep,
297297}
298298
compiler/rustc_parse/src/parser/ty.rs+1-1
......@@ -1071,7 +1071,7 @@ impl<'a> Parser<'a> {
10711071 && self.look_ahead(1, |t| t.is_keyword(kw::Const))
10721072 && self.look_ahead(2, |t| *t == token::CloseBracket)
10731073 {
1074 let start = self.prev_token.span;
1074 let start = self.token.span;
10751075 self.bump();
10761076 self.expect_keyword(exp!(Const)).unwrap();
10771077 self.bump();
compiler/rustc_parse/src/validate_attr.rs+1
......@@ -302,6 +302,7 @@ fn emit_malformed_attribute(
302302 | sym::no_mangle
303303 | sym::must_use
304304 | sym::track_caller
305 | sym::link_name
305306 ) {
306307 return;
307308 }
compiler/rustc_passes/src/check_attr.rs+20-20
......@@ -191,6 +191,9 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
191191 Attribute::Parsed(AttributeKind::AsPtr(attr_span)) => {
192192 self.check_applied_to_fn_or_method(hir_id, *attr_span, span, target)
193193 }
194 Attribute::Parsed(AttributeKind::LinkName { span: attr_span, name }) => {
195 self.check_link_name(hir_id, *attr_span, *name, span, target)
196 }
194197 Attribute::Parsed(AttributeKind::MayDangle(attr_span)) => {
195198 self.check_may_dangle(hir_id, *attr_span)
196199 }
......@@ -283,7 +286,6 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
283286 [sym::ffi_const, ..] => self.check_ffi_const(attr.span(), target),
284287 [sym::link_ordinal, ..] => self.check_link_ordinal(attr, span, target),
285288 [sym::link, ..] => self.check_link(hir_id, attr, span, target),
286 [sym::link_name, ..] => self.check_link_name(hir_id, attr, span, target),
287289 [sym::link_section, ..] => self.check_link_section(hir_id, attr, span, target),
288290 [sym::macro_use, ..] | [sym::macro_escape, ..] => {
289291 self.check_macro_use(hir_id, attr, target)
......@@ -1604,7 +1606,14 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
16041606 }
16051607
16061608 /// 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 ) {
16081617 match target {
16091618 Target::ForeignFn | Target::ForeignStatic => {}
16101619 // FIXME(#80564): We permit struct fields, match arms and macro defs to have an
......@@ -1612,27 +1621,18 @@ impl<'tcx> CheckAttrVisitor<'tcx> {
16121621 // erroneously allowed it and some crates used it accidentally, to be compatible
16131622 // with crates depending on them, we can't throw an error here.
16141623 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");
16161625 }
16171626 _ => {
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
16191628 // 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 );
16361636 }
16371637 }
16381638 }
compiler/rustc_passes/src/errors.rs+1-1
......@@ -502,7 +502,7 @@ pub(crate) struct Link {
502502#[warning]
503503pub(crate) struct LinkName<'a> {
504504 #[help]
505 pub attr_span: Option<Span>,
505 pub help_span: Option<Span>,
506506 #[label]
507507 pub span: Span,
508508 pub value: &'a str,
compiler/rustc_resolve/src/imports.rs+8-1
......@@ -174,7 +174,14 @@ pub(crate) struct ImportData<'ra> {
174174
175175 pub parent_scope: ParentScope<'ra>,
176176 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` | - |
178185 pub imported_module: Cell<Option<ModuleOrUniformRoot<'ra>>>,
179186 pub vis: ty::Visibility,
180187}
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
277277 if !variant.is_uninhabited() {
278278 assert!(idx == *untagged_variant || niche_variants.contains(&idx));
279279 }
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 );
280286 }
281287 }
282288 for variant in variants.iter() {
library/std/src/os/unix/fs.rs+5-7
......@@ -408,24 +408,22 @@ pub trait OpenOptionsExt {
408408 /// Pass custom flags to the `flags` argument of `open`.
409409 ///
410410 /// 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.
412412 ///
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.
415415 ///
416416 /// # Examples
417417 ///
418418 /// ```no_run
419 /// # #![feature(rustc_private)]
419 /// # mod libc { pub const O_NOFOLLOW: i32 = 0; }
420420 /// use std::fs::OpenOptions;
421421 /// use std::os::unix::fs::OpenOptionsExt;
422422 ///
423423 /// # fn main() {
424424 /// let mut options = OpenOptions::new();
425425 /// options.write(true);
426 /// if cfg!(unix) {
427 /// options.custom_flags(libc::O_NOFOLLOW);
428 /// }
426 /// options.custom_flags(libc::O_NOFOLLOW);
429427 /// let file = options.open("foo.txt");
430428 /// # }
431429 /// ```
src/doc/rustc/src/lints/levels.md+102-1
......@@ -330,4 +330,105 @@ $
330330
331331This feature is used heavily by Cargo; it will pass `--cap-lints allow` when
332332compiling your dependencies, so that if they have any warnings, they do not
333pollute the output of your build.
333pollute 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
337Rust 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
342Here’s how these different lint controls interact:
343
3441. [`--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
3682. [`--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
3963. [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
4214. 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
434In 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"
88path = "lib.rs"
99
1010[dependencies]
11# tidy-alphabetical-start
1112arrayvec = { version = "0.7", default-features = false }
1213askama = { version = "0.14", default-features = false, features = ["alloc", "config", "derive"] }
1314base64 = "0.21.7"
14itertools = "0.12"
1515indexmap = "2"
16itertools = "0.12"
1617minifier = { version = "0.3.5", default-features = false }
1718pulldown-cmark-escape = { version = "0.11.0", features = ["simd"] }
1819regex = "1"
1920rustdoc-json-types = { path = "../rustdoc-json-types" }
20serde_json = "1.0"
2121serde = { version = "1.0", features = ["derive"] }
22serde_json = "1.0"
2223smallvec = "1.8.1"
2324tempfile = "3"
25threadpool = "1.8.1"
2426tracing = "0.1"
2527tracing-tree = "0.3.0"
26threadpool = "1.8.1"
2728unicode-segmentation = "1.9"
29# tidy-alphabetical-end
2830
2931[dependencies.tracing-subscriber]
3032version = "0.3.3"
src/librustdoc/lib.rs+3-9
......@@ -1,8 +1,8 @@
1// tidy-alphabetical-start
12#![doc(
23 html_root_url = "https://doc.rust-lang.org/nightly/",
34 html_playground_url = "https://play.rust-lang.org/"
45)]
5#![feature(rustc_private)]
66#![feature(ascii_char)]
77#![feature(ascii_char_variants)]
88#![feature(assert_matches)]
......@@ -11,18 +11,12 @@
1111#![feature(file_buffered)]
1212#![feature(format_args_nl)]
1313#![feature(if_let_guard)]
14#![feature(impl_trait_in_assoc_type)]
1514#![feature(iter_intersperse)]
16#![feature(never_type)]
1715#![feature(round_char_boundary)]
16#![feature(rustc_private)]
1817#![feature(test)]
19#![feature(type_alias_impl_trait)]
20#![feature(type_ascription)]
21#![recursion_limit = "256"]
2218#![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
2620
2721extern crate thin_vec;
2822
tests/run-make/used-proc-macro/dep.rs created+4
......@@ -0,0 +1,4 @@
1#![crate_type = "lib"]
2
3#[used]
4static 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
3extern 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
8use run_make_support::{dynamic_lib_name, llvm_readobj, rustc};
9
10fn 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
23extern crate empty;
tests/ui/consts/fn_trait_refs.stderr+30-30
......@@ -5,145 +5,145 @@ LL | #![feature(const_fn_trait_ref_impls)]
55 | ^^^^^^^^^^^^^^^^^^^^^^^^
66
77error: `[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
99 |
1010LL | T: [const] Fn<()> + [const] Destruct,
11 | ^^^^^^^^^ can't be applied to `Fn`
11 | ^^^^^^^ can't be applied to `Fn`
1212 |
1313note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1414 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
1515
1616error: `[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
1818 |
1919LL | T: [const] Fn<()> + [const] Destruct,
20 | ^^^^^^^^^ can't be applied to `Fn`
20 | ^^^^^^^ can't be applied to `Fn`
2121 |
2222note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2323 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
2424 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2525
2626error: `[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
2828 |
2929LL | T: [const] Fn<()> + [const] Destruct,
30 | ^^^^^^^^^ can't be applied to `Fn`
30 | ^^^^^^^ can't be applied to `Fn`
3131 |
3232note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
3333 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
3434 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3535
3636error: `[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
3838 |
3939LL | T: [const] FnMut<()> + [const] Destruct,
40 | ^^^^^^^^^ can't be applied to `FnMut`
40 | ^^^^^^^ can't be applied to `FnMut`
4141 |
4242note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
4343 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
4444
4545error: `[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
4747 |
4848LL | T: [const] FnMut<()> + [const] Destruct,
49 | ^^^^^^^^^ can't be applied to `FnMut`
49 | ^^^^^^^ can't be applied to `FnMut`
5050 |
5151note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
5252 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
5353 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5454
5555error: `[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
5757 |
5858LL | T: [const] FnMut<()> + [const] Destruct,
59 | ^^^^^^^^^ can't be applied to `FnMut`
59 | ^^^^^^^ can't be applied to `FnMut`
6060 |
6161note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
6262 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
6363 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6464
6565error: `[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
6767 |
6868LL | T: [const] FnOnce<()>,
69 | ^^^^^^^^^ can't be applied to `FnOnce`
69 | ^^^^^^^ can't be applied to `FnOnce`
7070 |
7171note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
7272 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
7373
7474error: `[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
7676 |
7777LL | T: [const] FnOnce<()>,
78 | ^^^^^^^^^ can't be applied to `FnOnce`
78 | ^^^^^^^ can't be applied to `FnOnce`
7979 |
8080note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
8181 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
8282 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
8383
8484error: `[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
8686 |
8787LL | T: [const] FnOnce<()>,
88 | ^^^^^^^^^ can't be applied to `FnOnce`
88 | ^^^^^^^ can't be applied to `FnOnce`
8989 |
9090note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
9191 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
9292 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
9393
9494error: `[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
9696 |
9797LL | T: [const] Fn<()> + [const] Destruct,
98 | ^^^^^^^^^ can't be applied to `Fn`
98 | ^^^^^^^ can't be applied to `Fn`
9999 |
100100note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
101101 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
102102
103103error: `[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
105105 |
106106LL | T: [const] Fn<()> + [const] Destruct,
107 | ^^^^^^^^^ can't be applied to `Fn`
107 | ^^^^^^^ can't be applied to `Fn`
108108 |
109109note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
110110 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
111111 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
112112
113113error: `[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
115115 |
116116LL | T: [const] Fn<()> + [const] Destruct,
117 | ^^^^^^^^^ can't be applied to `Fn`
117 | ^^^^^^^ can't be applied to `Fn`
118118 |
119119note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
120120 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
121121 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
122122
123123error: `[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
125125 |
126126LL | T: [const] FnMut<()> + [const] Destruct,
127 | ^^^^^^^^^ can't be applied to `FnMut`
127 | ^^^^^^^ can't be applied to `FnMut`
128128 |
129129note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
130130 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
131131
132132error: `[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
134134 |
135135LL | T: [const] FnMut<()> + [const] Destruct,
136 | ^^^^^^^^^ can't be applied to `FnMut`
136 | ^^^^^^^ can't be applied to `FnMut`
137137 |
138138note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
139139 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
140140 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
141141
142142error: `[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
144144 |
145145LL | T: [const] FnMut<()> + [const] Destruct,
146 | ^^^^^^^^^ can't be applied to `FnMut`
146 | ^^^^^^^ can't be applied to `FnMut`
147147 |
148148note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
149149 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
tests/ui/consts/unstable-const-fn-in-libcore.stderr+4-4
......@@ -1,17 +1,17 @@
11error: `[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
33 |
44LL | 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`
66 |
77note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | 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`
1515 |
1616note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
tests/ui/extern/issue-47725.rs+1-4
......@@ -17,12 +17,9 @@ extern "C" {
1717#[link_name]
1818//~^ ERROR malformed `link_name` attribute input
1919//~| 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 = "..."
2321extern "C" {
2422 fn bar() -> u32;
2523}
26//~^^^ NOTE not a foreign function or static
2724
2825fn main() {}
tests/ui/extern/issue-47725.stderr+7-21
......@@ -1,8 +1,11 @@
1error: malformed `link_name` attribute input
1error[E0539]: malformed `link_name` attribute input
22 --> $DIR/issue-47725.rs:17:1
33 |
44LL | #[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"]`
69
710warning: attribute should be applied to a foreign function or static
811 --> $DIR/issue-47725.rs:3:1
......@@ -38,23 +41,6 @@ help: try `#[link(name = "foobar")]` instead
3841LL | #[link_name = "foobar"]
3942 | ^^^^^^^^^^^^^^^^^^^^^^^
4043
41warning: attribute should be applied to a foreign function or static
42 --> $DIR/issue-47725.rs:17:1
43 |
44LL | #[link_name]
45 | ^^^^^^^^^^^^
46...
47LL | / extern "C" {
48LL | | fn bar() -> u32;
49LL | | }
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!
53help: try `#[link(name = "...")]` instead
54 --> $DIR/issue-47725.rs:17:1
55 |
56LL | #[link_name]
57 | ^^^^^^^^^^^^
58
59error: aborting due to 1 previous error; 3 warnings emitted
44error: aborting due to 1 previous error; 2 warnings emitted
6045
46For 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()]
387387 |
388388 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
389389
390warning: attribute should be applied to a foreign function or static
391 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1
392 |
393LL | #![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
398390warning: attribute should be applied to a function or static
399391 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:69:1
400392 |
......@@ -411,6 +403,14 @@ LL | #![cold]
411403 |
412404 = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
413405
406warning: attribute should be applied to a foreign function or static
407 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:66:1
408 |
409LL | #![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
414414warning: `#[must_use]` has no effect when applied to a module
415415 --> $DIR/issue-43106-gating-of-builtin-attrs.rs:72:1
416416 |
tests/ui/impl-trait/normalize-tait-in-const.stderr+4-4
......@@ -1,17 +1,17 @@
11error: `[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
33 |
44LL | 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`
66 |
77note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | 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`
1515 |
1616note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $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
8989LL | #[automatically_derived]
9090 | ^^^^^^^^^^^^^^^^^^^^^^^^
9191
92error: unused attribute
93 --> $DIR/unused-attr-duplicate.rs:86:5
94 |
95LL | #[link_name = "this_does_not_exist"]
96 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
97 |
98note: attribute also specified here
99 --> $DIR/unused-attr-duplicate.rs:88:5
100 |
101LL | #[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
10592error: unused attribute
10693 --> $DIR/unused-attr-duplicate.rs:14:1
10794 |
......@@ -252,6 +239,19 @@ note: attribute also specified here
252239LL | #[track_caller]
253240 | ^^^^^^^^^^^^^^^
254241
242error: unused attribute
243 --> $DIR/unused-attr-duplicate.rs:86:5
244 |
245LL | #[link_name = "this_does_not_exist"]
246 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this attribute
247 |
248note: attribute also specified here
249 --> $DIR/unused-attr-duplicate.rs:88:5
250 |
251LL | #[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
255255error: unused attribute
256256 --> $DIR/unused-attr-duplicate.rs:92:1
257257 |
tests/ui/parser/bounds-type.stderr+2-2
......@@ -21,10 +21,10 @@ LL | T: [const] ?Tr,
2121 | there is not a well-defined meaning for a `[const] ?` trait
2222
2323error: `[const]` may only modify trait bounds, not lifetime bounds
24 --> $DIR/bounds-type.rs:16:6
24 --> $DIR/bounds-type.rs:16:8
2525 |
2626LL | T: [const] 'a,
27 | ^^^^^^^^^
27 | ^^^^^^^
2828
2929error: `const` may only modify trait bounds, not lifetime bounds
3030 --> $DIR/bounds-type.rs:17:8
tests/ui/specialization/const_trait_impl.stderr+12-12
......@@ -1,55 +1,55 @@
11error: `[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
33 |
44LL | impl<T: [const] Default> const A for T {
5 | ^^^^^^^^^ can't be applied to `Default`
5 | ^^^^^^^ can't be applied to `Default`
66 |
77note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/default.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | impl<T: [const] Default + [const] Sup> const A for T {
14 | ^^^^^^^^^ can't be applied to `Default`
14 | ^^^^^^^ can't be applied to `Default`
1515 |
1616note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $SRC_DIR/core/src/default.rs:LL:COL
1818
1919error: `[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
2121 |
2222LL | impl<T: [const] Default + [const] Sub> const A for T {
23 | ^^^^^^^^^ can't be applied to `Default`
23 | ^^^^^^^ can't be applied to `Default`
2424 |
2525note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2626 --> $SRC_DIR/core/src/default.rs:LL:COL
2727
2828error: `[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
3030 |
3131LL | impl<T: [const] Default + [const] Sup> const A for T {
32 | ^^^^^^^^^ can't be applied to `Default`
32 | ^^^^^^^ can't be applied to `Default`
3333 |
3434note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
3535 --> $SRC_DIR/core/src/default.rs:LL:COL
3636 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3737
3838error: `[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
4040 |
4141LL | impl<T: [const] Default> const A for T {
42 | ^^^^^^^^^ can't be applied to `Default`
42 | ^^^^^^^ can't be applied to `Default`
4343 |
4444note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
4545 --> $SRC_DIR/core/src/default.rs:LL:COL
4646 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4747
4848error: `[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
5050 |
5151LL | impl<T: [const] Default + [const] Sub> const A for T {
52 | ^^^^^^^^^ can't be applied to `Default`
52 | ^^^^^^^ can't be applied to `Default`
5353 |
5454note: `Default` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
5555 --> $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 @@
11error: `[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
33 |
44LL | fn add<A: [const] Add42>(self) -> Foo<{ A::add(N) }> {
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this function is not `const`, so it cannot have `[const]` trait bounds
88 --> $DIR/conditionally-const-and-const-params.rs:8:8
......@@ -11,10 +11,10 @@ LL | fn add<A: [const] Add42>(self) -> Foo<{ A::add(N) }> {
1111 | ^^^
1212
1313error: `[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
1515 |
1616LL | fn bar<A: [const] Add42, const N: usize>(_: Foo<N>) -> Foo<{ A::add(N) }> {
17 | ^^^^^^^^^
17 | ^^^^^^^
1818 |
1919note: this function is not `const`, so it cannot have `[const]` trait bounds
2020 --> $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 @@
11error: `[const]` is not allowed here
2 --> $DIR/conditionally-const-invalid-places.rs:7:24
2 --> $DIR/conditionally-const-invalid-places.rs:7:26
33 |
44LL | fn non_const_function<T: [const] Trait>() {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this function is not `const`, so it cannot have `[const]` trait bounds
88 --> $DIR/conditionally-const-invalid-places.rs:7:4
......@@ -11,66 +11,66 @@ LL | fn non_const_function<T: [const] Trait>() {}
1111 | ^^^^^^^^^^^^^^^^^^
1212
1313error: `[const]` is not allowed here
14 --> $DIR/conditionally-const-invalid-places.rs:9:16
14 --> $DIR/conditionally-const-invalid-places.rs:9:18
1515 |
1616LL | struct Struct<T: [const] Trait> { field: T }
17 | ^^^^^^^^^
17 | ^^^^^^^
1818 |
1919 = note: this item cannot have `[const]` trait bounds
2020
2121error: `[const]` is not allowed here
22 --> $DIR/conditionally-const-invalid-places.rs:10:21
22 --> $DIR/conditionally-const-invalid-places.rs:10:23
2323 |
2424LL | struct TupleStruct<T: [const] Trait>(T);
25 | ^^^^^^^^^
25 | ^^^^^^^
2626 |
2727 = note: this item cannot have `[const]` trait bounds
2828
2929error: `[const]` is not allowed here
30 --> $DIR/conditionally-const-invalid-places.rs:11:20
30 --> $DIR/conditionally-const-invalid-places.rs:11:22
3131 |
3232LL | struct UnitStruct<T: [const] Trait>;
33 | ^^^^^^^^^
33 | ^^^^^^^
3434 |
3535 = note: this item cannot have `[const]` trait bounds
3636
3737error: `[const]` is not allowed here
38 --> $DIR/conditionally-const-invalid-places.rs:14:12
38 --> $DIR/conditionally-const-invalid-places.rs:14:14
3939 |
4040LL | enum Enum<T: [const] Trait> { Variant(T) }
41 | ^^^^^^^^^
41 | ^^^^^^^
4242 |
4343 = note: this item cannot have `[const]` trait bounds
4444
4545error: `[const]` is not allowed here
46 --> $DIR/conditionally-const-invalid-places.rs:16:14
46 --> $DIR/conditionally-const-invalid-places.rs:16:16
4747 |
4848LL | union Union<T: [const] Trait> { field: T }
49 | ^^^^^^^^^
49 | ^^^^^^^
5050 |
5151 = note: this item cannot have `[const]` trait bounds
5252
5353error: `[const]` is not allowed here
54 --> $DIR/conditionally-const-invalid-places.rs:19:12
54 --> $DIR/conditionally-const-invalid-places.rs:19:14
5555 |
5656LL | type Type<T: [const] Trait> = T;
57 | ^^^^^^^^^
57 | ^^^^^^^
5858 |
5959 = note: this item cannot have `[const]` trait bounds
6060
6161error: `[const]` is not allowed here
62 --> $DIR/conditionally-const-invalid-places.rs:21:17
62 --> $DIR/conditionally-const-invalid-places.rs:21:19
6363 |
6464LL | const CONSTANT<T: [const] Trait>: () = ();
65 | ^^^^^^^^^
65 | ^^^^^^^
6666 |
6767 = note: this item cannot have `[const]` trait bounds
6868
6969error: `[const]` is not allowed here
70 --> $DIR/conditionally-const-invalid-places.rs:25:16
70 --> $DIR/conditionally-const-invalid-places.rs:25:18
7171 |
7272LL | type Type<T: [const] Trait>: [const] Trait;
73 | ^^^^^^^^^
73 | ^^^^^^^
7474 |
7575note: associated types in non-`#[const_trait]` traits cannot have `[const]` trait bounds
7676 --> $DIR/conditionally-const-invalid-places.rs:25:5
......@@ -79,10 +79,10 @@ LL | type Type<T: [const] Trait>: [const] Trait;
7979 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8080
8181error: `[const]` is not allowed here
82 --> $DIR/conditionally-const-invalid-places.rs:25:32
82 --> $DIR/conditionally-const-invalid-places.rs:25:34
8383 |
8484LL | type Type<T: [const] Trait>: [const] Trait;
85 | ^^^^^^^^^
85 | ^^^^^^^
8686 |
8787note: associated types in non-`#[const_trait]` traits cannot have `[const]` trait bounds
8888 --> $DIR/conditionally-const-invalid-places.rs:25:5
......@@ -91,10 +91,10 @@ LL | type Type<T: [const] Trait>: [const] Trait;
9191 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
9292
9393error: `[const]` is not allowed here
94 --> $DIR/conditionally-const-invalid-places.rs:28:28
94 --> $DIR/conditionally-const-invalid-places.rs:28:30
9595 |
9696LL | fn non_const_function<T: [const] Trait>();
97 | ^^^^^^^^^
97 | ^^^^^^^
9898 |
9999note: this function is not `const`, so it cannot have `[const]` trait bounds
100100 --> $DIR/conditionally-const-invalid-places.rs:28:8
......@@ -103,18 +103,18 @@ LL | fn non_const_function<T: [const] Trait>();
103103 | ^^^^^^^^^^^^^^^^^^
104104
105105error: `[const]` is not allowed here
106 --> $DIR/conditionally-const-invalid-places.rs:29:21
106 --> $DIR/conditionally-const-invalid-places.rs:29:23
107107 |
108108LL | const CONSTANT<T: [const] Trait>: ();
109 | ^^^^^^^^^
109 | ^^^^^^^
110110 |
111111 = note: this item cannot have `[const]` trait bounds
112112
113113error: `[const]` is not allowed here
114 --> $DIR/conditionally-const-invalid-places.rs:34:16
114 --> $DIR/conditionally-const-invalid-places.rs:34:18
115115 |
116116LL | type Type<T: [const] Trait> = ();
117 | ^^^^^^^^^
117 | ^^^^^^^
118118 |
119119note: associated types in non-const impls cannot have `[const]` trait bounds
120120 --> $DIR/conditionally-const-invalid-places.rs:34:5
......@@ -123,10 +123,10 @@ LL | type Type<T: [const] Trait> = ();
123123 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
124124
125125error: `[const]` is not allowed here
126 --> $DIR/conditionally-const-invalid-places.rs:36:28
126 --> $DIR/conditionally-const-invalid-places.rs:36:30
127127 |
128128LL | fn non_const_function<T: [const] Trait>() {}
129 | ^^^^^^^^^
129 | ^^^^^^^
130130 |
131131note: this function is not `const`, so it cannot have `[const]` trait bounds
132132 --> $DIR/conditionally-const-invalid-places.rs:36:8
......@@ -135,18 +135,18 @@ LL | fn non_const_function<T: [const] Trait>() {}
135135 | ^^^^^^^^^^^^^^^^^^
136136
137137error: `[const]` is not allowed here
138 --> $DIR/conditionally-const-invalid-places.rs:37:21
138 --> $DIR/conditionally-const-invalid-places.rs:37:23
139139 |
140140LL | const CONSTANT<T: [const] Trait>: () = ();
141 | ^^^^^^^^^
141 | ^^^^^^^
142142 |
143143 = note: this item cannot have `[const]` trait bounds
144144
145145error: `[const]` is not allowed here
146 --> $DIR/conditionally-const-invalid-places.rs:44:16
146 --> $DIR/conditionally-const-invalid-places.rs:44:18
147147 |
148148LL | type Type<T: [const] Trait> = ();
149 | ^^^^^^^^^
149 | ^^^^^^^
150150 |
151151note: inherent associated types cannot have `[const]` trait bounds
152152 --> $DIR/conditionally-const-invalid-places.rs:44:5
......@@ -155,10 +155,10 @@ LL | type Type<T: [const] Trait> = ();
155155 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
156156
157157error: `[const]` is not allowed here
158 --> $DIR/conditionally-const-invalid-places.rs:46:28
158 --> $DIR/conditionally-const-invalid-places.rs:46:30
159159 |
160160LL | fn non_const_function<T: [const] Trait>() {}
161 | ^^^^^^^^^
161 | ^^^^^^^
162162 |
163163note: this function is not `const`, so it cannot have `[const]` trait bounds
164164 --> $DIR/conditionally-const-invalid-places.rs:46:8
......@@ -167,18 +167,18 @@ LL | fn non_const_function<T: [const] Trait>() {}
167167 | ^^^^^^^^^^^^^^^^^^
168168
169169error: `[const]` is not allowed here
170 --> $DIR/conditionally-const-invalid-places.rs:47:21
170 --> $DIR/conditionally-const-invalid-places.rs:47:23
171171 |
172172LL | const CONSTANT<T: [const] Trait>: () = ();
173 | ^^^^^^^^^
173 | ^^^^^^^
174174 |
175175 = note: this item cannot have `[const]` trait bounds
176176
177177error: `[const]` is not allowed here
178 --> $DIR/conditionally-const-invalid-places.rs:52:13
178 --> $DIR/conditionally-const-invalid-places.rs:52:15
179179 |
180180LL | trait Child0: [const] Trait {}
181 | ^^^^^^^^^
181 | ^^^^^^^
182182 |
183183note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
184184 --> $DIR/conditionally-const-invalid-places.rs:52:1
......@@ -187,10 +187,10 @@ LL | trait Child0: [const] Trait {}
187187 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
188188
189189error: `[const]` is not allowed here
190 --> $DIR/conditionally-const-invalid-places.rs:53:24
190 --> $DIR/conditionally-const-invalid-places.rs:53:26
191191 |
192192LL | trait Child1 where Self: [const] Trait {}
193 | ^^^^^^^^^
193 | ^^^^^^^
194194 |
195195note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
196196 --> $DIR/conditionally-const-invalid-places.rs:53:1
......@@ -199,10 +199,10 @@ LL | trait Child1 where Self: [const] Trait {}
199199 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
200200
201201error: `[const]` is not allowed here
202 --> $DIR/conditionally-const-invalid-places.rs:56:7
202 --> $DIR/conditionally-const-invalid-places.rs:56:9
203203 |
204204LL | impl<T: [const] Trait> Trait for T {}
205 | ^^^^^^^^^
205 | ^^^^^^^
206206 |
207207note: this impl is not `const`, so it cannot have `[const]` trait bounds
208208 --> $DIR/conditionally-const-invalid-places.rs:56:1
......@@ -211,10 +211,10 @@ LL | impl<T: [const] Trait> Trait for T {}
211211 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
212212
213213error: `[const]` is not allowed here
214 --> $DIR/conditionally-const-invalid-places.rs:59:7
214 --> $DIR/conditionally-const-invalid-places.rs:59:9
215215 |
216216LL | impl<T: [const] Trait> Struct<T> {}
217 | ^^^^^^^^^
217 | ^^^^^^^
218218 |
219219note: inherent impls cannot have `[const]` trait bounds
220220 --> $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 @@
11error: `[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
33 |
44LL | fn do_something_else() where Self: [const] MyTrait;
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this function is not `const`, so it cannot have `[const]` trait bounds
88 --> $DIR/const-bound-on-not-const-associated-fn.rs:11:8
......@@ -11,10 +11,10 @@ LL | fn do_something_else() where Self: [const] MyTrait;
1111 | ^^^^^^^^^^^^^^^^^
1212
1313error: `[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
1515 |
1616LL | pub fn foo(&self) where T: [const] MyTrait {
17 | ^^^^^^^^^
17 | ^^^^^^^
1818 |
1919note: this function is not `const`, so it cannot have `[const]` trait bounds
2020 --> $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 @@
11error: `[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
33 |
44LL | const fn perform<T: [const] NonConst>() {}
5 | ^^^^^^^^^ can't be applied to `NonConst`
5 | ^^^^^^^ can't be applied to `NonConst`
66 |
77help: mark `NonConst` as `#[const_trait]` to allow it to have `const` implementations
88 |
......@@ -10,10 +10,10 @@ LL | #[const_trait] trait NonConst {}
1010 | ++++++++++++++
1111
1212error: `[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
1414 |
1515LL | const fn perform<T: [const] NonConst>() {}
16 | ^^^^^^^^^ can't be applied to `NonConst`
16 | ^^^^^^^ can't be applied to `NonConst`
1717 |
1818 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1919help: 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 @@
11error: `[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
33 |
44LL | const fn test() -> impl [const] Fn() {
5 | ^^^^^^^^^^^^ can't be applied to `Fn`
5 | ^^^^^^^ can't be applied to `Fn`
66 |
77note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | const fn test() -> impl [const] Fn() {
14 | ^^^^^^^^^^^^ can't be applied to `Fn`
14 | ^^^^^^^ can't be applied to `Fn`
1515 |
1616note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
1818 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1919
2020error: `[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
2222 |
2323LL | const fn test() -> impl [const] Fn() {
24 | ^^^^^^^^^^^^ can't be applied to `Fn`
24 | ^^^^^^^ can't be applied to `Fn`
2525 |
2626note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2727 --> $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 @@
11error: `[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
33 |
44LL | 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`
66 |
77note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | 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`
1515 |
1616note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $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 @@
11error: `[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
33 |
44LL | 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`
66 |
77note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | 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`
1515 |
1616note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
tests/ui/traits/const-traits/const-closures.stderr+16-16
......@@ -1,74 +1,74 @@
11error: `[const]` can only be applied to `#[const_trait]` traits
2 --> $DIR/const-closures.rs:8:10
2 --> $DIR/const-closures.rs:8:12
33 |
44LL | F: [const] FnOnce() -> u8,
5 | ^^^^^^^^^ can't be applied to `FnOnce`
5 | ^^^^^^^ can't be applied to `FnOnce`
66 |
77note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[const]` can only be applied to `#[const_trait]` traits
11 --> $DIR/const-closures.rs:9:10
11 --> $DIR/const-closures.rs:9:12
1212 |
1313LL | F: [const] FnMut() -> u8,
14 | ^^^^^^^^^ can't be applied to `FnMut`
14 | ^^^^^^^ can't be applied to `FnMut`
1515 |
1616note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
1818
1919error: `[const]` can only be applied to `#[const_trait]` traits
20 --> $DIR/const-closures.rs:10:10
20 --> $DIR/const-closures.rs:10:12
2121 |
2222LL | F: [const] Fn() -> u8,
23 | ^^^^^^^^^ can't be applied to `Fn`
23 | ^^^^^^^ can't be applied to `Fn`
2424 |
2525note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2626 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
2727
2828error: `[const]` can only be applied to `#[const_trait]` traits
29 --> $DIR/const-closures.rs:8:10
29 --> $DIR/const-closures.rs:8:12
3030 |
3131LL | F: [const] FnOnce() -> u8,
32 | ^^^^^^^^^ can't be applied to `FnOnce`
32 | ^^^^^^^ can't be applied to `FnOnce`
3333 |
3434note: `FnOnce` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
3535 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
3636 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3737
3838error: `[const]` can only be applied to `#[const_trait]` traits
39 --> $DIR/const-closures.rs:9:10
39 --> $DIR/const-closures.rs:9:12
4040 |
4141LL | F: [const] FnMut() -> u8,
42 | ^^^^^^^^^ can't be applied to `FnMut`
42 | ^^^^^^^ can't be applied to `FnMut`
4343 |
4444note: `FnMut` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
4545 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
4646 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4747
4848error: `[const]` can only be applied to `#[const_trait]` traits
49 --> $DIR/const-closures.rs:10:10
49 --> $DIR/const-closures.rs:10:12
5050 |
5151LL | F: [const] Fn() -> u8,
52 | ^^^^^^^^^ can't be applied to `Fn`
52 | ^^^^^^^ can't be applied to `Fn`
5353 |
5454note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
5555 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
5656 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5757
5858error: `[const]` can only be applied to `#[const_trait]` traits
59 --> $DIR/const-closures.rs:23:18
59 --> $DIR/const-closures.rs:23:20
6060 |
6161LL | const fn answer<F: [const] Fn() -> u8>(f: &F) -> u8 {
62 | ^^^^^^^^^ can't be applied to `Fn`
62 | ^^^^^^^ can't be applied to `Fn`
6363 |
6464note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
6565 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
6666
6767error: `[const]` can only be applied to `#[const_trait]` traits
68 --> $DIR/const-closures.rs:23:18
68 --> $DIR/const-closures.rs:23:20
6969 |
7070LL | const fn answer<F: [const] Fn() -> u8>(f: &F) -> u8 {
71 | ^^^^^^^^^ can't be applied to `Fn`
71 | ^^^^^^^ can't be applied to `Fn`
7272 |
7373note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
7474 --> $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;
55 | ^^^^^^^^^^^
66
77error: `[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
99 |
1010LL | let _: &dyn [const] Trait;
11 | ^^^^^^^^^^^
11 | ^^^^^^^
1212 |
1313 = note: trait objects cannot have `[const]` trait bounds
1414
......@@ -19,10 +19,10 @@ LL | const fn handle(_: &dyn const NonConst) {}
1919 | ^^^^^^^^^^^^^^
2020
2121error: `[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
2323 |
2424LL | const fn take(_: &dyn [const] NonConst) {}
25 | ^^^^^^^^^^^
25 | ^^^^^^^
2626 |
2727 = note: trait objects cannot have `[const]` trait bounds
2828
tests/ui/traits/const-traits/feature-gate.stock.stderr+4-4
......@@ -9,10 +9,10 @@ LL | impl const T for S {}
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
1111error[E0658]: const trait impls are experimental
12 --> $DIR/feature-gate.rs:13:13
12 --> $DIR/feature-gate.rs:13:15
1313 |
1414LL | const fn f<A: [const] T>() {}
15 | ^^^^^^^^^
15 | ^^^^^^^
1616 |
1717 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
1818 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
......@@ -29,10 +29,10 @@ LL | fn g<A: const T>() {}
2929 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030
3131error[E0658]: const trait impls are experimental
32 --> $DIR/feature-gate.rs:18:12
32 --> $DIR/feature-gate.rs:18:17
3333 |
3434LL | discard! { impl [const] T }
35 | ^^^^^^^^^^^^
35 | ^^^^^^^
3636 |
3737 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
3838 = 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 || {
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
1111error: `[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
1313 |
1414LL | const fn test() -> impl [const] Fn() {
15 | ^^^^^^^^^^^^ can't be applied to `Fn`
15 | ^^^^^^^ can't be applied to `Fn`
1616 |
1717note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1818 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
1919
2020error: `[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
2222 |
2323LL | const fn test() -> impl [const] Fn() {
24 | ^^^^^^^^^^^^ can't be applied to `Fn`
24 | ^^^^^^^ can't be applied to `Fn`
2525 |
2626note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
2727 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
2828 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
2929
3030error: `[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
3232 |
3333LL | const fn test() -> impl [const] Fn() {
34 | ^^^^^^^^^^^^ can't be applied to `Fn`
34 | ^^^^^^^ can't be applied to `Fn`
3535 |
3636note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
3737 --> $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 @@
11error: `[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
33 |
44LL | const fn with_positive<F: [const] Fn()>() {}
5 | ^^^^^^^^^ can't be applied to `Fn`
5 | ^^^^^^^ can't be applied to `Fn`
66 |
77note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/ops/function.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | const fn with_positive<F: [const] Fn()>() {}
14 | ^^^^^^^^^ can't be applied to `Fn`
14 | ^^^^^^^ can't be applied to `Fn`
1515 |
1616note: `Fn` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $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 @@
11error: `[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
33 |
44LL | 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`
66 |
77note: `From` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
88 --> $SRC_DIR/core/src/convert/mod.rs:LL:COL
99
1010error: `[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
1212 |
1313LL | 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`
1515 |
1616note: `From` can't be used with `[const]` because it isn't annotated with `#[const_trait]`
1717 --> $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 @@
11error: `[const]` is not allowed here
2 --> $DIR/super-traits-fail-2.rs:11:10
2 --> $DIR/super-traits-fail-2.rs:11:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
88 --> $DIR/super-traits-fail-2.rs:11:1
......@@ -11,10 +11,10 @@ LL | trait Bar: [const] Foo {}
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error: `[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
1515 |
1616LL | trait Bar: [const] Foo {}
17 | ^^^^^^^^^ can't be applied to `Foo`
17 | ^^^^^^^ can't be applied to `Foo`
1818 |
1919help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
2020 |
......@@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo {
2222 | ++++++++++++++
2323
2424error: `[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
2626 |
2727LL | trait Bar: [const] Foo {}
28 | ^^^^^^^^^ can't be applied to `Foo`
28 | ^^^^^^^ can't be applied to `Foo`
2929 |
3030 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3131help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo {
3434 | ++++++++++++++
3535
3636error: `[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
3838 |
3939LL | trait Bar: [const] Foo {}
40 | ^^^^^^^^^ can't be applied to `Foo`
40 | ^^^^^^^ can't be applied to `Foo`
4141 |
4242 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4343help: 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 @@
11error: `[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
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^ can't be applied to `Foo`
5 | ^^^^^^^ can't be applied to `Foo`
66 |
77help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
88 |
......@@ -10,10 +10,10 @@ LL | #[const_trait] trait Foo {
1010 | ++++++++++++++
1111
1212error: `[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
1414 |
1515LL | trait Bar: [const] Foo {}
16 | ^^^^^^^^^ can't be applied to `Foo`
16 | ^^^^^^^ can't be applied to `Foo`
1717 |
1818 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1919help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo {
2222 | ++++++++++++++
2323
2424error: `[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
2626 |
2727LL | trait Bar: [const] Foo {}
28 | ^^^^^^^^^ can't be applied to `Foo`
28 | ^^^^^^^ can't be applied to `Foo`
2929 |
3030 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3131help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo {
3434 | ++++++++++++++
3535
3636error: `[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
3838 |
3939LL | trait Bar: [const] Foo {}
40 | ^^^^^^^^^ can't be applied to `Foo`
40 | ^^^^^^^ can't be applied to `Foo`
4141 |
4242 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4343help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -46,10 +46,10 @@ LL | #[const_trait] trait Foo {
4646 | ++++++++++++++
4747
4848error: `[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
5050 |
5151LL | trait Bar: [const] Foo {}
52 | ^^^^^^^^^ can't be applied to `Foo`
52 | ^^^^^^^ can't be applied to `Foo`
5353 |
5454 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5555help: 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 @@
11error: `[const]` is not allowed here
2 --> $DIR/super-traits-fail-2.rs:11:10
2 --> $DIR/super-traits-fail-2.rs:11:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
88 --> $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 @@
11error: `[const]` is not allowed here
2 --> $DIR/super-traits-fail-3.rs:23:10
2 --> $DIR/super-traits-fail-3.rs:23:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
88 --> $DIR/super-traits-fail-3.rs:23:1
......@@ -11,30 +11,30 @@ LL | trait Bar: [const] Foo {}
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error[E0658]: const trait impls are experimental
14 --> $DIR/super-traits-fail-3.rs:23:10
14 --> $DIR/super-traits-fail-3.rs:23:12
1515 |
1616LL | trait Bar: [const] Foo {}
17 | ^^^^^^^^^
17 | ^^^^^^^
1818 |
1919 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
2020 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2121 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2222
2323error[E0658]: const trait impls are experimental
24 --> $DIR/super-traits-fail-3.rs:32:15
24 --> $DIR/super-traits-fail-3.rs:32:17
2525 |
2626LL | const fn foo<T: [const] Bar>(x: &T) {
27 | ^^^^^^^^^
27 | ^^^^^^^
2828 |
2929 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
3030 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
3131 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3232
3333error: `[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
3535 |
3636LL | trait Bar: [const] Foo {}
37 | ^^^^^^^^^ can't be applied to `Foo`
37 | ^^^^^^^ can't be applied to `Foo`
3838 |
3939help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
4040 |
......@@ -42,10 +42,10 @@ LL | #[const_trait] trait Foo {
4242 | ++++++++++++++
4343
4444error: `[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
4646 |
4747LL | trait Bar: [const] Foo {}
48 | ^^^^^^^^^ can't be applied to `Foo`
48 | ^^^^^^^ can't be applied to `Foo`
4949 |
5050 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5151help: 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 {
5454 | ++++++++++++++
5555
5656error: `[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
5858 |
5959LL | trait Bar: [const] Foo {}
60 | ^^^^^^^^^ can't be applied to `Foo`
60 | ^^^^^^^ can't be applied to `Foo`
6161 |
6262 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6363help: 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 {
6666 | ++++++++++++++
6767
6868error: `[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
7070 |
7171LL | const fn foo<T: [const] Bar>(x: &T) {
72 | ^^^^^^^^^ can't be applied to `Bar`
72 | ^^^^^^^ can't be applied to `Bar`
7373 |
7474help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
7575 |
......@@ -77,10 +77,10 @@ LL | #[const_trait] trait Bar: [const] Foo {}
7777 | ++++++++++++++
7878
7979error: `[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
8181 |
8282LL | const fn foo<T: [const] Bar>(x: &T) {
83 | ^^^^^^^^^ can't be applied to `Bar`
83 | ^^^^^^^ can't be applied to `Bar`
8484 |
8585 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
8686help: 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 @@
11error: `[const]` is not allowed here
2 --> $DIR/super-traits-fail-3.rs:23:10
2 --> $DIR/super-traits-fail-3.rs:23:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
88 --> $DIR/super-traits-fail-3.rs:23:1
......@@ -11,30 +11,30 @@ LL | trait Bar: [const] Foo {}
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error[E0658]: const trait impls are experimental
14 --> $DIR/super-traits-fail-3.rs:23:10
14 --> $DIR/super-traits-fail-3.rs:23:12
1515 |
1616LL | trait Bar: [const] Foo {}
17 | ^^^^^^^^^
17 | ^^^^^^^
1818 |
1919 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
2020 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
2121 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2222
2323error[E0658]: const trait impls are experimental
24 --> $DIR/super-traits-fail-3.rs:32:15
24 --> $DIR/super-traits-fail-3.rs:32:17
2525 |
2626LL | const fn foo<T: [const] Bar>(x: &T) {
27 | ^^^^^^^^^
27 | ^^^^^^^
2828 |
2929 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
3030 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
3131 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3232
3333error: `[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
3535 |
3636LL | trait Bar: [const] Foo {}
37 | ^^^^^^^^^ can't be applied to `Foo`
37 | ^^^^^^^ can't be applied to `Foo`
3838 |
3939help: enable `#![feature(const_trait_impl)]` in your crate and mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
4040 |
......@@ -42,10 +42,10 @@ LL | #[const_trait] trait Foo {
4242 | ++++++++++++++
4343
4444error: `[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
4646 |
4747LL | trait Bar: [const] Foo {}
48 | ^^^^^^^^^ can't be applied to `Foo`
48 | ^^^^^^^ can't be applied to `Foo`
4949 |
5050 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5151help: 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 {
5454 | ++++++++++++++
5555
5656error: `[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
5858 |
5959LL | trait Bar: [const] Foo {}
60 | ^^^^^^^^^ can't be applied to `Foo`
60 | ^^^^^^^ can't be applied to `Foo`
6161 |
6262 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6363help: 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 {
6666 | ++++++++++++++
6767
6868error: `[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
7070 |
7171LL | const fn foo<T: [const] Bar>(x: &T) {
72 | ^^^^^^^^^ can't be applied to `Bar`
72 | ^^^^^^^ can't be applied to `Bar`
7373 |
7474help: enable `#![feature(const_trait_impl)]` in your crate and mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
7575 |
......@@ -77,10 +77,10 @@ LL | #[const_trait] trait Bar: [const] Foo {}
7777 | ++++++++++++++
7878
7979error: `[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
8181 |
8282LL | const fn foo<T: [const] Bar>(x: &T) {
83 | ^^^^^^^^^ can't be applied to `Bar`
83 | ^^^^^^^ can't be applied to `Bar`
8484 |
8585 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
8686help: 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 @@
11error[E0658]: const trait impls are experimental
2 --> $DIR/super-traits-fail-3.rs:23:10
2 --> $DIR/super-traits-fail-3.rs:23:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
88 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
1111error[E0658]: const trait impls are experimental
12 --> $DIR/super-traits-fail-3.rs:32:15
12 --> $DIR/super-traits-fail-3.rs:32:17
1313 |
1414LL | const fn foo<T: [const] Bar>(x: &T) {
15 | ^^^^^^^^^
15 | ^^^^^^^
1616 |
1717 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
1818 = 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 @@
11error[E0658]: const trait impls are experimental
2 --> $DIR/super-traits-fail-3.rs:23:10
2 --> $DIR/super-traits-fail-3.rs:23:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
88 = help: add `#![feature(const_trait_impl)]` to the crate attributes to enable
99 = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010
1111error[E0658]: const trait impls are experimental
12 --> $DIR/super-traits-fail-3.rs:32:15
12 --> $DIR/super-traits-fail-3.rs:32:17
1313 |
1414LL | const fn foo<T: [const] Bar>(x: &T) {
15 | ^^^^^^^^^
15 | ^^^^^^^
1616 |
1717 = note: see issue #67792 <https://github.com/rust-lang/rust/issues/67792> for more information
1818 = 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 @@
11error: `[const]` is not allowed here
2 --> $DIR/super-traits-fail-3.rs:23:10
2 --> $DIR/super-traits-fail-3.rs:23:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
88 --> $DIR/super-traits-fail-3.rs:23:1
......@@ -11,10 +11,10 @@ LL | trait Bar: [const] Foo {}
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error: `[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
1515 |
1616LL | trait Bar: [const] Foo {}
17 | ^^^^^^^^^ can't be applied to `Foo`
17 | ^^^^^^^ can't be applied to `Foo`
1818 |
1919help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
2020 |
......@@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo {
2222 | ++++++++++++++
2323
2424error: `[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
2626 |
2727LL | trait Bar: [const] Foo {}
28 | ^^^^^^^^^ can't be applied to `Foo`
28 | ^^^^^^^ can't be applied to `Foo`
2929 |
3030 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3131help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo {
3434 | ++++++++++++++
3535
3636error: `[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
3838 |
3939LL | trait Bar: [const] Foo {}
40 | ^^^^^^^^^ can't be applied to `Foo`
40 | ^^^^^^^ can't be applied to `Foo`
4141 |
4242 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4343help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -46,10 +46,10 @@ LL | #[const_trait] trait Foo {
4646 | ++++++++++++++
4747
4848error: `[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
5050 |
5151LL | const fn foo<T: [const] Bar>(x: &T) {
52 | ^^^^^^^^^ can't be applied to `Bar`
52 | ^^^^^^^ can't be applied to `Bar`
5353 |
5454help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
5555 |
......@@ -57,10 +57,10 @@ LL | #[const_trait] trait Bar: [const] Foo {}
5757 | ++++++++++++++
5858
5959error: `[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
6161 |
6262LL | const fn foo<T: [const] Bar>(x: &T) {
63 | ^^^^^^^^^ can't be applied to `Bar`
63 | ^^^^^^^ can't be applied to `Bar`
6464 |
6565 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
6666help: 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 @@
11error: `[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
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^ can't be applied to `Foo`
5 | ^^^^^^^ can't be applied to `Foo`
66 |
77help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
88 |
......@@ -10,10 +10,10 @@ LL | #[const_trait] trait Foo {
1010 | ++++++++++++++
1111
1212error: `[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
1414 |
1515LL | trait Bar: [const] Foo {}
16 | ^^^^^^^^^ can't be applied to `Foo`
16 | ^^^^^^^ can't be applied to `Foo`
1717 |
1818 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1919help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -22,10 +22,10 @@ LL | #[const_trait] trait Foo {
2222 | ++++++++++++++
2323
2424error: `[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
2626 |
2727LL | trait Bar: [const] Foo {}
28 | ^^^^^^^^^ can't be applied to `Foo`
28 | ^^^^^^^ can't be applied to `Foo`
2929 |
3030 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3131help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -34,10 +34,10 @@ LL | #[const_trait] trait Foo {
3434 | ++++++++++++++
3535
3636error: `[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
3838 |
3939LL | trait Bar: [const] Foo {}
40 | ^^^^^^^^^ can't be applied to `Foo`
40 | ^^^^^^^ can't be applied to `Foo`
4141 |
4242 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
4343help: mark `Foo` as `#[const_trait]` to allow it to have `const` implementations
......@@ -46,10 +46,10 @@ LL | #[const_trait] trait Foo {
4646 | ++++++++++++++
4747
4848error: `[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
5050 |
5151LL | trait Bar: [const] Foo {}
52 | ^^^^^^^^^ can't be applied to `Foo`
52 | ^^^^^^^ can't be applied to `Foo`
5353 |
5454 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5555help: 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 @@
11error: `[const]` is not allowed here
2 --> $DIR/super-traits-fail-3.rs:23:10
2 --> $DIR/super-traits-fail-3.rs:23:12
33 |
44LL | trait Bar: [const] Foo {}
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this trait is not a `#[const_trait]`, so it cannot have `[const]` trait bounds
88 --> $DIR/super-traits-fail-3.rs:23:1
......@@ -11,10 +11,10 @@ LL | trait Bar: [const] Foo {}
1111 | ^^^^^^^^^^^^^^^^^^^^^^^^^
1212
1313error: `[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
1515 |
1616LL | const fn foo<T: [const] Bar>(x: &T) {
17 | ^^^^^^^^^ can't be applied to `Bar`
17 | ^^^^^^^ can't be applied to `Bar`
1818 |
1919help: mark `Bar` as `#[const_trait]` to allow it to have `const` implementations
2020 |
......@@ -22,10 +22,10 @@ LL | #[const_trait] trait Bar: [const] Foo {}
2222 | ++++++++++++++
2323
2424error: `[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
2626 |
2727LL | const fn foo<T: [const] Bar>(x: &T) {
28 | ^^^^^^^^^ can't be applied to `Bar`
28 | ^^^^^^^ can't be applied to `Bar`
2929 |
3030 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
3131help: 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`
22 --> $DIR/syntactical-unstable.rs:13:20
33 |
44LL | trait Foo: [const] MyTrait {
5 | --------- ^^^^^^^
6 | |
7 | trait is not stable as const yet
5 | ------- ^^^^^^^
6 | |
7 | trait is not stable as const yet
88 |
99 = help: add `#![feature(unstable)]` to the crate attributes to enable
1010 = 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`
1313 --> $DIR/syntactical-unstable.rs:19:45
1414 |
1515LL | 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
1919 |
2020 = help: add `#![feature(unstable)]` to the crate attributes to enable
2121 = 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`
2424 --> $DIR/syntactical-unstable.rs:22:53
2525 |
2626LL | 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
3030 |
3131 = help: add `#![feature(unstable)]` to the crate attributes to enable
3232 = 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`
3535 --> $DIR/syntactical-unstable.rs:25:33
3636 |
3737LL | 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
4141 |
4242 = help: add `#![feature(unstable)]` to the crate attributes to enable
4343 = 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`
5555 --> $DIR/syntactical-unstable.rs:15:24
5656 |
5757LL | type Item: [const] MyTrait;
58 | --------- ^^^^^^^
59 | |
60 | trait is not stable as const yet
58 | ------- ^^^^^^^
59 | |
60 | trait is not stable as const yet
6161 |
6262 = help: add `#![feature(unstable)]` to the crate attributes to enable
6363 = 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 @@
11error: `[const]` is not allowed here
2 --> $DIR/trait-where-clause.rs:8:22
2 --> $DIR/trait-where-clause.rs:8:24
33 |
44LL | fn b() where Self: [const] Bar;
5 | ^^^^^^^^^
5 | ^^^^^^^
66 |
77note: this function is not `const`, so it cannot have `[const]` trait bounds
88 --> $DIR/trait-where-clause.rs:8:8
......@@ -11,10 +11,10 @@ LL | fn b() where Self: [const] Bar;
1111 | ^
1212
1313error: `[const]` is not allowed here
14 --> $DIR/trait-where-clause.rs:10:11
14 --> $DIR/trait-where-clause.rs:10:13
1515 |
1616LL | fn c<T: [const] Bar>();
17 | ^^^^^^^^^
17 | ^^^^^^^
1818 |
1919note: this function is not `const`, so it cannot have `[const]` trait bounds
2020 --> $DIR/trait-where-clause.rs:10:8