if let hir::ExprKind::Closure { .. } = expr.kind {
let def_id = self.tcx.hir().local_def_id(expr.hir_id);
self.tcx.ensure().generics_of(def_id);
+ self.tcx.ensure().codegen_fn_attrs(def_id);
// We do not call `type_of` for closures here as that
// depends on typecheck and would therefore hide
// any further errors in case one typeck fails.
tcx.ensure().type_of(item.owner_id);
tcx.ensure().predicates_of(item.owner_id);
match item.kind {
- hir::ForeignItemKind::Fn(..) => tcx.ensure().fn_sig(item.owner_id),
+ hir::ForeignItemKind::Fn(..) => {
+ tcx.ensure().codegen_fn_attrs(item.owner_id);
+ tcx.ensure().fn_sig(item.owner_id)
+ }
hir::ForeignItemKind::Static(..) => {
+ tcx.ensure().codegen_fn_attrs(item.owner_id);
let mut visitor = HirPlaceholderCollector::default();
visitor.visit_foreign_item(item);
placeholder_type_error(
tcx.ensure().type_of(def_id);
tcx.ensure().predicates_of(def_id);
tcx.ensure().fn_sig(def_id);
+ tcx.ensure().codegen_fn_attrs(def_id);
}
}
}
match trait_item.kind {
hir::TraitItemKind::Fn(..) => {
+ tcx.ensure().codegen_fn_attrs(def_id);
tcx.ensure().type_of(def_id);
tcx.ensure().fn_sig(def_id);
}
let impl_item = tcx.hir().impl_item(impl_item_id);
match impl_item.kind {
hir::ImplItemKind::Fn(..) => {
+ tcx.ensure().codegen_fn_attrs(def_id);
tcx.ensure().fn_sig(def_id);
}
hir::ImplItemKind::Type(_) => {
return;
}
- // FIXME(@lcnr): this doesn't belong here.
- if matches!(
- target,
- Target::Closure
- | Target::Fn
- | Target::Method(_)
- | Target::ForeignFn
- | Target::ForeignStatic
- ) {
- self.tcx.ensure().codegen_fn_attrs(self.tcx.hir().local_def_id(hir_id));
- }
-
self.check_repr(attrs, span, target, item, hir_id);
self.check_used(attrs, target);
}
#[lang = "phantom_data"]
//~^ ERROR `phantom_data` language item must be applied to a struct with 1 generic argument
struct MyPhantomData<T, U>;
-//~^ ERROR parameter `T` is never used
-//~| ERROR parameter `U` is never used
#[lang = "owned_box"]
//~^ ERROR `owned_box` language item must be applied to a struct with at least 1 generic argument
| ------ this struct has 2 generic arguments
error[E0718]: `owned_box` language item must be applied to a struct with at least 1 generic argument
- --> $DIR/lang-item-generic-requirements.rs:28:1
+ --> $DIR/lang-item-generic-requirements.rs:26:1
|
LL | #[lang = "owned_box"]
| ^^^^^^^^^^^^^^^^^^^^^
| - this struct has 0 generic arguments
error[E0718]: `start` language item must be applied to a function with 1 generic argument
- --> $DIR/lang-item-generic-requirements.rs:34:1
+ --> $DIR/lang-item-generic-requirements.rs:32:1
|
LL | #[lang = "start"]
| ^^^^^^^^^^^^^^^^^
LL | fn start(_: *const u8, _: isize, _: *const *const u8) -> isize {
| - this function has 0 generic arguments
-error[E0392]: parameter `T` is never used
- --> $DIR/lang-item-generic-requirements.rs:24:22
- |
-LL | struct MyPhantomData<T, U>;
- | ^ unused parameter
- |
- = help: consider removing `T` or referring to it in a field
- = help: if you intended `T` to be a const parameter, use `const T: usize` instead
-
-error[E0392]: parameter `U` is never used
- --> $DIR/lang-item-generic-requirements.rs:24:25
- |
-LL | struct MyPhantomData<T, U>;
- | ^ unused parameter
- |
- = help: consider removing `U` or referring to it in a field
- = help: if you intended `U` to be a const parameter, use `const U: usize` instead
-
-error: aborting due to 8 previous errors
+error: aborting due to 6 previous errors
-Some errors have detailed explanations: E0392, E0718.
-For more information about an error, try `rustc --explain E0392`.
+For more information about this error, try `rustc --explain E0718`.
.map(
#[target_feature(enable = "")]
//~^ ERROR: attribute should be applied to a function
+ //~| ERROR: feature named `` is not valid
+ //~| NOTE: `` is not valid for this target
#[track_caller]
+ //~^ ERROR: `#[track_caller]` on closures is currently unstable
+ //~| NOTE: see issue #87417
|_| (),
//~^ NOTE: not a function
)
LL | |_| (),
| ------ not a function definition
-error: aborting due to previous error
+error: the feature named `` is not valid for this target
+ --> $DIR/issue-68060.rs:4:30
+ |
+LL | #[target_feature(enable = "")]
+ | ^^^^^^^^^^^ `` is not valid for this target
+
+error[E0658]: `#[track_caller]` on closures is currently unstable
+ --> $DIR/issue-68060.rs:8:13
+ |
+LL | #[track_caller]
+ | ^^^^^^^^^^^^^^^
+ |
+ = note: see issue #87417 <https://github.com/rust-lang/rust/issues/87417> for more information
+ = help: add `#![feature(closure_track_caller)]` to the crate attributes to enable
+
+error: aborting due to 3 previous errors
+For more information about this error, try `rustc --explain E0658`.
= note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
= note: second definition in the local crate (`panic_handler_std`)
-error: argument should be `&PanicInfo`
- --> $DIR/panic-handler-std.rs:8:16
- |
-LL | fn panic(info: PanicInfo) -> ! {
- | ^^^^^^^^^
-
-error: aborting due to 2 previous errors
+error: aborting due to previous error
For more information about this error, try `rustc --explain E0152`.
-// error-pattern: `#[panic_handler]` function required, but not found
-
// Regression test for #54505 - range borrowing suggestion had
// incorrect syntax (missing parentheses).
#[lang = "eh_catch_typeinfo"]
static EH_CATCH_TYPEINFO: u8 = 0;
+#[panic_handler]
+fn panic_handler() {}
+//~^ ERROR return type should be `!`
+//~| ERROR function should have one argument
// take a reference to any built-in range
fn take_range(_r: &impl RangeBounds<i8>) {}
-error: `#[panic_handler]` function required, but not found
+error: return type should be `!`
+ --> $DIR/issue-54505-no-std.rs:20:20
+ |
+LL | fn panic_handler() {}
+ | ^
+
+error: function should have one argument
+ --> $DIR/issue-54505-no-std.rs:20:1
+ |
+LL | fn panic_handler() {}
+ | ^^^^^^^^^^^^^^^^^^
error[E0308]: mismatched types
- --> $DIR/issue-54505-no-std.rs:27:16
+ --> $DIR/issue-54505-no-std.rs:29:16
|
LL | take_range(0..1);
| ---------- ^^^^
= note: expected reference `&_`
found struct `Range<{integer}>`
note: function defined here
- --> $DIR/issue-54505-no-std.rs:23:4
+ --> $DIR/issue-54505-no-std.rs:25:4
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
error[E0308]: mismatched types
- --> $DIR/issue-54505-no-std.rs:32:16
+ --> $DIR/issue-54505-no-std.rs:34:16
|
LL | take_range(1..);
| ---------- ^^^
= note: expected reference `&_`
found struct `RangeFrom<{integer}>`
note: function defined here
- --> $DIR/issue-54505-no-std.rs:23:4
+ --> $DIR/issue-54505-no-std.rs:25:4
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
error[E0308]: mismatched types
- --> $DIR/issue-54505-no-std.rs:37:16
+ --> $DIR/issue-54505-no-std.rs:39:16
|
LL | take_range(..);
| ---------- ^^
= note: expected reference `&_`
found struct `RangeFull`
note: function defined here
- --> $DIR/issue-54505-no-std.rs:23:4
+ --> $DIR/issue-54505-no-std.rs:25:4
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
error[E0308]: mismatched types
- --> $DIR/issue-54505-no-std.rs:42:16
+ --> $DIR/issue-54505-no-std.rs:44:16
|
LL | take_range(0..=1);
| ---------- ^^^^^
= note: expected reference `&_`
found struct `RangeInclusive<{integer}>`
note: function defined here
- --> $DIR/issue-54505-no-std.rs:23:4
+ --> $DIR/issue-54505-no-std.rs:25:4
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
error[E0308]: mismatched types
- --> $DIR/issue-54505-no-std.rs:47:16
+ --> $DIR/issue-54505-no-std.rs:49:16
|
LL | take_range(..5);
| ---------- ^^^
= note: expected reference `&_`
found struct `RangeTo<{integer}>`
note: function defined here
- --> $DIR/issue-54505-no-std.rs:23:4
+ --> $DIR/issue-54505-no-std.rs:25:4
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
error[E0308]: mismatched types
- --> $DIR/issue-54505-no-std.rs:52:16
+ --> $DIR/issue-54505-no-std.rs:54:16
|
LL | take_range(..=42);
| ---------- ^^^^^
= note: expected reference `&_`
found struct `RangeToInclusive<{integer}>`
note: function defined here
- --> $DIR/issue-54505-no-std.rs:23:4
+ --> $DIR/issue-54505-no-std.rs:25:4
|
LL | fn take_range(_r: &impl RangeBounds<i8>) {}
| ^^^^^^^^^^ -------------------------
-error: aborting due to 7 previous errors
+error: aborting due to 8 previous errors
For more information about this error, try `rustc --explain E0308`.
LL | #[target_feature = "+sse2"]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: must be of the form: `#[target_feature(enable = "name")]`
-error: the feature named `foo` is not valid for this target
- --> $DIR/invalid-attribute.rs:19:18
- |
-LL | #[target_feature(enable = "foo")]
- | ^^^^^^^^^^^^^^ `foo` is not valid for this target
-
-error: malformed `target_feature` attribute input
- --> $DIR/invalid-attribute.rs:22:18
- |
-LL | #[target_feature(bar)]
- | ^^^ help: must be of the form: `enable = ".."`
-
-error: malformed `target_feature` attribute input
- --> $DIR/invalid-attribute.rs:24:18
- |
-LL | #[target_feature(disable = "baz")]
- | ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."`
-
-error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
- --> $DIR/invalid-attribute.rs:28:1
- |
-LL | #[target_feature(enable = "sse2")]
- | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-...
-LL | fn bar() {}
- | -------- not an `unsafe` function
- |
- = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
- = help: add `#![feature(target_feature_11)]` to the crate attributes to enable
-
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:34:1
|
LL | trait Baz {}
| ------------ not a function definition
-error: cannot use `#[inline(always)]` with `#[target_feature]`
- --> $DIR/invalid-attribute.rs:67:1
- |
-LL | #[inline(always)]
- | ^^^^^^^^^^^^^^^^^
-
error: attribute should be applied to a function definition
--> $DIR/invalid-attribute.rs:85:5
|
LL | || {};
| ----- not a function definition
+error: the feature named `foo` is not valid for this target
+ --> $DIR/invalid-attribute.rs:19:18
+ |
+LL | #[target_feature(enable = "foo")]
+ | ^^^^^^^^^^^^^^ `foo` is not valid for this target
+
+error: malformed `target_feature` attribute input
+ --> $DIR/invalid-attribute.rs:22:18
+ |
+LL | #[target_feature(bar)]
+ | ^^^ help: must be of the form: `enable = ".."`
+
+error: malformed `target_feature` attribute input
+ --> $DIR/invalid-attribute.rs:24:18
+ |
+LL | #[target_feature(disable = "baz")]
+ | ^^^^^^^^^^^^^^^ help: must be of the form: `enable = ".."`
+
+error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
+ --> $DIR/invalid-attribute.rs:28:1
+ |
+LL | #[target_feature(enable = "sse2")]
+ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+...
+LL | fn bar() {}
+ | -------- not an `unsafe` function
+ |
+ = note: see issue #69098 <https://github.com/rust-lang/rust/issues/69098> for more information
+ = help: add `#![feature(target_feature_11)]` to the crate attributes to enable
+
+error: cannot use `#[inline(always)]` with `#[target_feature]`
+ --> $DIR/invalid-attribute.rs:67:1
+ |
+LL | #[inline(always)]
+ | ^^^^^^^^^^^^^^^^^
+
error[E0658]: `#[target_feature(..)]` can only be applied to `unsafe` functions
--> $DIR/invalid-attribute.rs:77:5
|
fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
//~^ ERROR `self` parameter is only allowed in associated functions
//~| ERROR cannot find type `Struct` in this scope
- //~| ERROR mismatched types
let x = x << 1;
- //~^ ERROR the size for values of type `{integer}` cannot be known at compilation time
- //~| ERROR cannot find value `x` in this scope
+ //~^ ERROR cannot find value `x` in this scope
}
fn main() {}
| ^^^^^^ not found in this scope
error[E0425]: cannot find value `x` in this scope
- --> $DIR/issue-102989.rs:11:13
+ --> $DIR/issue-102989.rs:10:13
|
LL | let x = x << 1;
| ^ help: a local variable with a similar name exists: `f`
= note: first definition in `core` loaded from SYSROOT/libcore-*.rlib
= note: second definition in the local crate (`issue_102989`)
-error[E0277]: the size for values of type `{integer}` cannot be known at compilation time
- --> $DIR/issue-102989.rs:11:15
- |
-LL | let x = x << 1;
- | ^^ doesn't have a size known at compile-time
- |
- = help: the trait `std::marker::Sized` is not implemented for `{integer}`
-
-error[E0308]: mismatched types
- --> $DIR/issue-102989.rs:7:42
- |
-LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
- | ---------- ^^^^ expected `&u32`, found `()`
- | |
- | implicitly returns `()` as its body has no tail or `return` expression
- |
-note: consider returning one of these bindings
- --> $DIR/issue-102989.rs:7:30
- |
-LL | fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
- | ^
-...
-LL | let x = x << 1;
- | ^
-
-error: aborting due to 6 previous errors
+error: aborting due to 4 previous errors
-Some errors have detailed explanations: E0152, E0277, E0308, E0412, E0425.
+Some errors have detailed explanations: E0152, E0412, E0425.
For more information about an error, try `rustc --explain E0152`.