2022-07-21 16:19:22 +01:00
|
|
|
#![feature(stmt_expr_attributes)]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
#![no_std]
|
|
|
|
|
|
|
|
// Test that the `#[collapse_debuginfo]` attribute can only be used on macro definitions.
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
extern crate std;
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
use std::collections::HashMap;
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
static FOO: u32 = 3;
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
const BAR: u32 = 3;
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
fn foo() {
|
2024-02-09 15:39:25 +03:00
|
|
|
let _ = #[collapse_debuginfo(yes)] || { };
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
let _ = 3;
|
2024-02-09 15:39:25 +03:00
|
|
|
let _ = #[collapse_debuginfo(yes)] 3;
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
match (3, 4) {
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
_ => (),
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
mod bar {
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
type Map = HashMap<u32, u32>;
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
enum Foo {
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
Variant,
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
struct Bar {
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
field: u32,
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
union Qux {
|
|
|
|
a: u32,
|
|
|
|
b: u16
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
trait Foobar {
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
type Bar;
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
type AFoobar = impl Foobar;
|
|
|
|
|
|
|
|
impl Foobar for Bar {
|
|
|
|
type Bar = u32;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn constraining() -> AFoobar {
|
|
|
|
Bar { field: 3 }
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
impl Bar {
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
const FOO: u32 = 3;
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
//~^ ERROR `collapse_debuginfo` attribute should be applied to macro definitions
|
|
|
|
fn bar(&self) {}
|
|
|
|
}
|
|
|
|
|
2024-02-09 15:39:25 +03:00
|
|
|
#[collapse_debuginfo(yes)]
|
2022-07-21 16:19:22 +01:00
|
|
|
macro_rules! finally {
|
|
|
|
($e:expr) => { $e }
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|