Auto merge of #128761 - matthiaskrgr:rollup-5p1mlqq, r=matthiaskrgr
Rollup of 9 pull requests Successful merges: - #124944 (On trait bound mismatch, detect multiple crate versions in dep tree) - #125048 (PinCoerceUnsized trait into core) - #128406 (implement BufReader::peek) - #128539 (Forbid unused unsafe in vxworks-specific std modules) - #128687 (interpret: refactor function call handling to be better-abstracted) - #128692 (Add a triagebot mention for `library/Cargo.lock`) - #128710 (Don't ICE when getting an input file name's stem fails) - #128718 (Consider `cfg_attr` checked by `CheckAttrVisitor`) - #128751 (std:🧵 set_name implementation proposal for vxWorks.) r? `@ghost` `@rustbot` modify labels: rollup
This commit is contained in:
commit
6696447f78
58 changed files with 2069 additions and 1386 deletions
68
tests/ui/attributes/check-cfg_attr-ice.rs
Normal file
68
tests/ui/attributes/check-cfg_attr-ice.rs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
//! I missed a `cfg_attr` match in #128581, it should have had the same treatment as `cfg`. If
|
||||
//! an invalid attribute starting with `cfg_attr` is passed, then it would trigger an ICE because
|
||||
//! it was not considered "checked" (e.g. `#[cfg_attr::skip]` or `#[cfg_attr::no_such_thing]`).
|
||||
//!
|
||||
//! This test is not exhaustive, there's too many possible positions to check, instead it just does
|
||||
//! a basic smoke test in a few select positions to make sure we don't ICE for e.g.
|
||||
//! `#[cfg_attr::no_such_thing]`.
|
||||
//!
|
||||
//! issue: rust-lang/rust#128716
|
||||
#![crate_type = "lib"]
|
||||
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
mod we_are_no_strangers_to_love {}
|
||||
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
struct YouKnowTheRules {
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
and_so_do_i: u8,
|
||||
}
|
||||
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
fn a_full_commitment() {
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
let is_what_i_am_thinking_of = ();
|
||||
}
|
||||
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
union AnyOtherGuy {
|
||||
owo: ()
|
||||
}
|
||||
struct This;
|
||||
|
||||
#[cfg_attr(FALSE, doc = "you wouldn't get this")]
|
||||
impl From<AnyOtherGuy> for This {
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This {
|
||||
//~^ ERROR failed to resolve
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR attributes on expressions are experimental
|
||||
//~| ERROR failed to resolve
|
||||
unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
enum NeverGonna {
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
GiveYouUp(#[cfg_attr::no_such_thing] u8),
|
||||
//~^ ERROR failed to resolve
|
||||
LetYouDown {
|
||||
#![cfg_attr::no_such_thing]
|
||||
//~^ ERROR an inner attribute is not permitted in this context
|
||||
never_gonna: (),
|
||||
round_around: (),
|
||||
#[cfg_attr::no_such_thing]
|
||||
//~^ ERROR failed to resolve
|
||||
and_desert_you: (),
|
||||
},
|
||||
}
|
||||
101
tests/ui/attributes/check-cfg_attr-ice.stderr
Normal file
101
tests/ui/attributes/check-cfg_attr-ice.stderr
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
error: an inner attribute is not permitted in this context
|
||||
--> $DIR/check-cfg_attr-ice.rs:60:9
|
||||
|
|
||||
LL | #![cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
|
||||
= note: outer attributes, like `#[test]`, annotate the item following them
|
||||
|
||||
error[E0658]: attributes on expressions are experimental
|
||||
--> $DIR/check-cfg_attr-ice.rs:45:9
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
|
||||
= help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:52:3
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:55:7
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:57:17
|
||||
|
|
||||
LL | GiveYouUp(#[cfg_attr::no_such_thing] u8),
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:64:11
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:41:7
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:43:15
|
||||
|
|
||||
LL | fn from(#[cfg_attr::no_such_thing] any_other_guy: AnyOtherGuy) -> This {
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:45:11
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:32:3
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:24:3
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:27:7
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:16:3
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:19:7
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error[E0433]: failed to resolve: use of undeclared crate or module `cfg_attr`
|
||||
--> $DIR/check-cfg_attr-ice.rs:12:3
|
||||
|
|
||||
LL | #[cfg_attr::no_such_thing]
|
||||
| ^^^^^^^^ use of undeclared crate or module `cfg_attr`
|
||||
|
||||
error: aborting due to 15 previous errors
|
||||
|
||||
Some errors have detailed explanations: E0433, E0658.
|
||||
For more information about an error, try `rustc --explain E0433`.
|
||||
Loading…
Add table
Add a link
Reference in a new issue