Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #110746

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f7581d8
Suggest using integration tests for proc-macros
clubby789 Apr 12, 2023
1467877
Remove find_map_relevant_impl
compiler-errors Apr 19, 2023
41e3cc4
Add some tests around (lack of) object safety of associated types and…
oli-obk Apr 20, 2023
adb5ded
add known-bug test for unsound issue 25860
whtahy Apr 18, 2023
2fb2098
add known-bug test for unsound issue 49206
whtahy Apr 18, 2023
232d685
add known-bug test for unsound issue 57893
whtahy Apr 19, 2023
fbfb620
add known-bug test for unsound issue 84366
whtahy Apr 19, 2023
cac62ab
add known-bug test for unsound issue 84533
whtahy Apr 19, 2023
be68c69
add known-bug test for unsound issue 84591
whtahy Apr 19, 2023
3c5de9a
add known-bug test for unsound issue 85099
whtahy Apr 20, 2023
0e68cbd
Remove useless special case.
cjgillot Apr 15, 2023
629cdb4
Move eval_discriminant.
cjgillot Apr 15, 2023
dd452ae
Simplify logic.
cjgillot Apr 15, 2023
dd78b99
Reduce rightward drift.
cjgillot Apr 15, 2023
3141262
add known-bug test for unsound issue 98117
whtahy Apr 22, 2023
cff6c0e
add known-bug test for unsound issue 100041
whtahy Apr 22, 2023
6f6550f
add known-bug test for unsound issue 100051
whtahy Apr 22, 2023
ebe61ce
add known-bug test for unsound issue 104005
whtahy Apr 22, 2023
95e8b6a
Group entire build steps in the gha logs
oli-obk Apr 21, 2023
7410960
format panic message only once
Apr 23, 2023
9fb920c
Rollup merge of #110255 - clubby789:proc-macro-test-help, r=jackh726
matthiaskrgr Apr 24, 2023
533a21a
Rollup merge of #110480 - whtahy:105107/known-bug-tests-for-unsound-i…
matthiaskrgr Apr 24, 2023
2753cab
Rollup merge of #110514 - compiler-errors:remove-find_map_relevant_im…
matthiaskrgr Apr 24, 2023
f07a69e
Rollup merge of #110590 - oli-obk:object_safe_assoc_types, r=jackh726
matthiaskrgr Apr 24, 2023
48c34fa
Rollup merge of #110637 - oli-obk:gha, r=jyn514
matthiaskrgr Apr 24, 2023
1a73464
Rollup merge of #110685 - cjgillot:clean-dcp, r=oli-obk
matthiaskrgr Apr 24, 2023
9b6bdf3
Rollup merge of #110721 - lukas-code:panic-fmt, r=Amanieu
matthiaskrgr Apr 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions compiler/rustc_resolve/messages.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,6 @@ resolve_remove_surrounding_derive =
resolve_add_as_non_derive =
add as non-Derive macro
`#[{$macro_path}]`

resolve_proc_macro_same_crate = can't use a procedural macro from the same crate that defines it
.help = you can define integration tests in a directory named `tests`
9 changes: 9 additions & 0 deletions compiler/rustc_resolve/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,12 @@ pub(crate) struct RemoveSurroundingDerive {
pub(crate) struct AddAsNonDerive<'a> {
pub(crate) macro_path: &'a str,
}

#[derive(Diagnostic)]
#[diag(resolve_proc_macro_same_crate)]
pub(crate) struct ProcMacroSameCrate {
#[primary_span]
pub(crate) span: Span,
#[help]
pub(crate) is_test: bool,
}
10 changes: 5 additions & 5 deletions compiler/rustc_resolve/src/macros.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! A bunch of methods and structures more or less related to resolving macros and
//! interface provided by `Resolver` to macro expander.

use crate::errors::{AddAsNonDerive, MacroExpectedFound, RemoveSurroundingDerive};
use crate::errors::{self, AddAsNonDerive, MacroExpectedFound, RemoveSurroundingDerive};
use crate::Namespace::*;
use crate::{BuiltinMacroState, Determinacy};
use crate::{DeriveData, Finalize, ParentScope, ResolutionError, Resolver, ScopeSet};
Expand Down Expand Up @@ -513,10 +513,10 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
if let Some(def_id) = def_id.as_local() {
self.unused_macros.remove(&def_id);
if self.proc_macro_stubs.contains(&def_id) {
self.tcx.sess.span_err(
path.span,
"can't use a procedural macro from the same crate that defines it",
);
self.tcx.sess.emit_err(errors::ProcMacroSameCrate {
span: path.span,
is_test: self.tcx.sess.is_test_crate(),
});
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions tests/ui/proc-macro/test-same-crate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// compile-flags: --test
#![crate_type = "proc-macro"]

extern crate proc_macro;
use proc_macro::TokenStream;

#[proc_macro]
pub fn mac(input: TokenStream) -> TokenStream { loop {} }

#[cfg(test)]
mod test {
#[test]
fn t() { crate::mac!(A) }
//~^ ERROR can't use a procedural macro from the same crate that defines it
//~| HELP you can define integration tests in a directory named `tests`
}
10 changes: 10 additions & 0 deletions tests/ui/proc-macro/test-same-crate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: can't use a procedural macro from the same crate that defines it
--> $DIR/test-same-crate.rs:13:14
|
LL | fn t() { crate::mac!(A) }
| ^^^^^^^^^^
|
= help: you can define integration tests in a directory named `tests`

error: aborting due to previous error