E0273

A call of read_to_string, list_dir, write, or create_dir on Fs, FsRead, or FsWrite, whether written read.read_to_string(path), qualified as FsRead.read_to_string(read, path), or taken as a value. These types only attenuate, so a file is read or written through a directory capability (restrict_to) or a file capability (restrict_to_file). The message shows the shape of the fix, such as fs.restrict_to("<root>").read_to_string(path). The root is the programmer's to choose, so there is no machine fix. Spans the call.

Machine-applicable fix: none.

Example

This program fails with E0273.

fn count(fs: FsRead, path: Path) -> Result<Int, IoError> {
    Ok(fs.read_to_string(path)?.len())
}

Fixed

The same program, fixed.

fn count(fs: FsRead, path: Path) -> Result<Int, IoError> {
    Ok(fs.restrict_to("/srv/app").read_to_string(path)?.len())
}

Listed in the checker notes. oskac explain E0273 prints this entry offline.

All error codes