File tree Expand file tree Collapse file tree 3 files changed +40
-0
lines changed
compiler/rustc_hir_analysis/src/hir_ty_lowering
tests/ui/cmse-nonsecure/cmse-nonsecure-call Expand file tree Collapse file tree 3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ fn is_valid_cmse_inputs<'tcx>(
128
128
129
129
// this type is only used for layout computation, which does not rely on regions
130
130
let fn_sig = tcx. instantiate_bound_regions_with_erased ( fn_sig) ;
131
+ let fn_sig = tcx. erase_and_anonymize_regions ( fn_sig) ;
131
132
132
133
for ( index, ty) in fn_sig. inputs ( ) . iter ( ) . enumerate ( ) {
133
134
let layout = tcx. layout_of ( ty:: TypingEnv :: fully_monomorphized ( ) . as_query_input ( * ty) ) ?;
Original file line number Diff line number Diff line change
1
+ //@ add-core-stubs
2
+ //@ compile-flags: --target thumbv8m.main-none-eabi --crate-type lib -Cincremental=true
3
+ //@ needs-llvm-components: arm
4
+ #![ feature( abi_cmse_nonsecure_call, no_core) ]
5
+ #![ no_core]
6
+
7
+ extern crate minicore;
8
+ use minicore:: * ;
9
+
10
+ // A regression test for https://github.com/rust-lang/rust/issues/131639.
11
+ // NOTE: -Cincremental=true was required for triggering the bug.
12
+
13
+ fn foo ( ) {
14
+ id :: < extern "cmse-nonsecure-call" fn ( & ' a ( ) ) > ( PhantomData ) ;
15
+ //~^ ERROR use of undeclared lifetime name `'a`
16
+ }
17
+
18
+ fn id < T > ( x : PhantomData < T > ) -> PhantomData < T > {
19
+ x
20
+ }
Original file line number Diff line number Diff line change
1
+ error[E0261]: use of undeclared lifetime name `'a`
2
+ --> $DIR/undeclared-lifetime.rs:14:43
3
+ |
4
+ LL | id::<extern "cmse-nonsecure-call" fn(&'a ())>(PhantomData);
5
+ | ^^ undeclared lifetime
6
+ |
7
+ = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
8
+ help: consider making the type lifetime-generic with a new `'a` lifetime
9
+ |
10
+ LL | id::<for<'a> extern "cmse-nonsecure-call" fn(&'a ())>(PhantomData);
11
+ | +++++++
12
+ help: consider introducing lifetime `'a` here
13
+ |
14
+ LL | fn foo<'a>() {
15
+ | ++++
16
+
17
+ error: aborting due to 1 previous error
18
+
19
+ For more information about this error, try `rustc --explain E0261`.
You can’t perform that action at this time.
0 commit comments