Skip to content

Possible back-compat hazard from empty structs in std #22949

Closed
@huonw

Description

@huonw
$ git grep 'pub struct [^(]*;' -- src/libcore src/libcollections/ src/libstd/ src/libunicode/
src/libcore/fmt/mod.rs:55:pub struct Error;
src/libcore/fmt/num.rs:87:pub struct UpperHex;
src/libcore/marker.rs:222:pub struct NoCopy;
src/libcore/marker.rs:230:pub struct Managed;
src/libcore/marker.rs:368:pub struct PhantomData<T:?Sized>;
src/libcore/marker.rs:383:pub struct ContravariantLifetime<'a>;
src/libcore/marker.rs:389:pub struct CovariantLifetime<'a>;
src/libcore/marker.rs:395:pub struct InvariantLifetime<'a>;
src/libcore/marker.rs:401:pub struct ContravariantType<T>;
src/libcore/marker.rs:407:pub struct CovariantType<T>;
src/libcore/marker.rs:413:pub struct InvariantType<T>;
src/libcore/ops.rs:970:pub struct RangeFull;
src/libstd/net/parser.rs:330:pub struct ParseError;
src/libstd/old_io/buffered.rs:437:    pub struct NullStream;
src/libstd/old_io/net/ip.rs:373:pub struct ParseError;
src/libstd/old_io/util.rs:82:pub struct NullWriter;
src/libstd/old_io/util.rs:91:pub struct ZeroReader;
src/libstd/old_io/util.rs:112:pub struct NullReader;
src/libstd/old_path/posix.rs:101:pub struct ParsePathError;
src/libstd/old_path/windows.rs:128:pub struct ParsePathError;
src/libstd/rt/unwind.rs:394:    pub struct EXCEPTION_RECORD;
src/libstd/rt/unwind.rs:396:    pub struct CONTEXT;
src/libstd/rt/unwind.rs:398:    pub struct DISPATCHER_CONTEXT;
src/libstd/sync/mpsc/mod.rs:395:pub struct RecvError;
src/libstd/sys/unix/os.rs:156:pub struct JoinPathsError;
src/libstd/sys/windows/os.rs:197:pub struct JoinPathsError;

These are the pub structs that have no data fields at all. Once stabilised these cannot ever have anything added to them, since they can currently be publicly constructed by just writing their name. We should make sure that this is the intended behaviour for each. (I'm sure many of those are not intending to be #[stable] for 1.0, so this is probably a fairly quick audit.)

cc @aturon

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions