Sphinx does not need the .rst extension in the .rst directive. Assuming that toctree is in something like index.rst and that bar.rst is in the same directory, try replacing foo.rst and bar.rst in the toctree directive with foo and bar respectively.
Otherwise, make sure that bar.rst is in the correct directory (and not in the parent or subdirectory).
source share