diff options
| author | León Orell Valerian Liehr <me@fmease.dev> | 2024-07-10 17:38:52 +0200 |
|---|---|---|
| committer | León Orell Valerian Liehr <me@fmease.dev> | 2025-02-15 16:47:30 +0100 |
| commit | 9b6fd35738965ef3f246018fddc743b5e5cd8d2c (patch) | |
| tree | 955710be2b114b379217abfe9c79362d99b37bbe /compiler/rustc_expand/src/module.rs | |
| parent | 46d53a68aa1b10833ec25178171f34e29e71f1f1 (diff) | |
| download | rust-9b6fd35738965ef3f246018fddc743b5e5cd8d2c.tar.gz rust-9b6fd35738965ef3f246018fddc743b5e5cd8d2c.zip | |
Reject macro calls inside of `#![crate_name]`
Diffstat (limited to 'compiler/rustc_expand/src/module.rs')
| -rw-r--r-- | compiler/rustc_expand/src/module.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/rustc_expand/src/module.rs b/compiler/rustc_expand/src/module.rs index 9c35b26772b..e925052c607 100644 --- a/compiler/rustc_expand/src/module.rs +++ b/compiler/rustc_expand/src/module.rs @@ -183,12 +183,12 @@ pub(crate) fn mod_file_path_from_attr( let first_path = attrs.iter().find(|at| at.has_name(sym::path))?; let Some(path_sym) = first_path.value_str() else { // This check is here mainly to catch attempting to use a macro, - // such as #[path = concat!(...)]. This isn't currently supported - // because otherwise the InvocationCollector would need to defer - // loading a module until the #[path] attribute was expanded, and - // it doesn't support that (and would likely add a bit of - // complexity). Usually bad forms are checked in AstValidator (via - // `check_builtin_attribute`), but by the time that runs the macro + // such as `#[path = concat!(...)]`. This isn't supported because + // otherwise the `InvocationCollector` would need to defer loading + // a module until the `#[path]` attribute was expanded, and it + // doesn't support that (and would likely add a bit of complexity). + // Usually bad forms are checked during semantic analysis via + // `TyCtxt::check_mod_attrs`), but by the time that runs the macro // is expanded, and it doesn't give an error. validate_attr::emit_fatal_malformed_builtin_attribute(&sess.psess, first_path, sym::path); }; |
