Some external interrupts not working on STM32F103C8T6

I have the following code that is supposed to enable interrupts on PB8 of the STM32F103C8T6. Hitting the button connected to PB8 prints out changes in the pin level from main but the interrupt handler is not being executed. What may be the issue?

// std and main are not available for bare metal software
#![no_std]
#![no_main]

extern crate panic_halt;

use core::cell::RefCell;
// use core::sync::atomic::{AtomicUsize, Ordering};
use cortex_m::interrupt as cortex_m_interrupt;

use cortex_m_rt;
use stm32f1;

use cortex_m_semihosting::hprintln;

use cortex_m_rt::entry;
use stm32f1::stm32f103;
use stm32f1::stm32f103::interrupt;

// static Y: AtomicUsize = AtomicUsize::new(0);
// static X: AtomicUsize = AtomicUsize::new(0);

static EXTI: cortex_m_interrupt::Mutex<RefCell<Option<stm32f103::EXTI>>> =
    cortex_m_interrupt::Mutex::new(RefCell::new(None));

#[interrupt]
fn ADC1_2() -> ! {
    hprintln!("ADC interrupt!").unwrap();
}

#[interrupt]
fn EXTI3() -> ! {
    hprintln!("Click nterrupt!").unwrap();
    cortex_m_interrupt::free(|cs| {
        EXTI.borrow(cs)
            .borrow()
            .as_ref()
            .unwrap()
            .pr
            .write(|w| w.pr8().set_bit());
    });
}

fn configure_joystick(peripherals: &stm32f103::Peripherals) {
    // configure  PB8 and an input
    peripherals.RCC.apb2enr.write(|w| w.iopben().set_bit());
    peripherals.GPIOB.crh.write(|w| unsafe {
        w.mode8().bits(0b00);
        w.cnf8().bits(0b10)
    });
    // enable pull-up resistors on PB8
    peripherals.GPIOB.bsrr.write(|w| w.br8().set_bit());
    // set MR12 in IMR
    peripherals.EXTI.imr.write(|w| w.mr8().set_bit());
    // set MR12 in RTMR
    peripherals.EXTI.rtsr.write(|w| w.tr8().set_bit());
    // set the interrupt source as PB8 pin
    peripherals
        .AFIO
        .exticr3
        .write(|w| unsafe { w.exti8().bits(0b0001) });
}

// use `main` as the entry point of this application
#[entry]
fn main() -> ! {
    // get handles to the hardware
    let peripherals = stm32f103::Peripherals::take().unwrap();
    configure_joystick(&peripherals);
    let exti = peripherals.EXTI;
    // initialize PR reference before enabling interrupts
    cortex_m_interrupt::free(|cs| EXTI.borrow(cs).replace(Some(exti)));
    // enable EXTI3 interrupts
    let mut core_peripherals = stm32f103::CorePeripherals::take().unwrap();
    core_peripherals.NVIC.enable(stm32f103::Interrupt::EXTI3);
    loop {
        match peripherals.GPIOB.idr.read().idr8() {
            stm32f103::gpioa::idr::IDR0R::HIGH => {
                let _res = hprintln!("A1 = HIGH");
            }
            stm32f103::gpioa::idr::IDR0R::LOW => {
                let _res = hprintln!("A1 = LOW");
            }
        };
        cortex_m::asm::delay(2000000);
    }
}