Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: #[cfg(accessible(..) / version(..))] #2523

Merged
merged 50 commits into from Sep 26, 2019
Merged
Changes from 1 commit
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
ab8d6b3
rfc, cfg-path-version: initial version.
Centril Aug 10, 2018
4670370
rfc, cfg-path-version: fix unbalanced parens.
Centril Aug 10, 2018
e0f0fea
rfc, cfg-path-version: fix typo.
Centril Aug 10, 2018
d564d75
rfc, cfg-path-version: fix incorrect summary.
Centril Aug 10, 2018
091e470
rfc, cfg-path-version: fix typos.
Centril Aug 11, 2018
8477b57
rfc, cfg-path-version: use semver caret requirements.
Centril Aug 11, 2018
d44a484
rfc, cfg-path-version: bnf consistency.
Centril Aug 11, 2018
c06eb95
rfc, cfg-path-version: use version = '..' and motivate it.
Centril Aug 11, 2018
eb3ec27
rfc, cfg-path-version: define 'nightly' in terms of #![feature(..)]
Centril Aug 11, 2018
65dd139
rfc, cfg-path-version: note that path_exists only sees public things …
Centril Aug 11, 2018
144ff93
rfc, cfg-path-version: use path_exists = '..'.
Centril Aug 11, 2018
13bdfac
rfc, cfg-path-version: note on canary builds.
Centril Aug 11, 2018
c54db7f
rfc, cfg-path-version: meta grammar changes..
Centril Aug 11, 2018
a5f69b9
rfc, cfg-path-version: optional dependencies are out of scope.
Centril Aug 11, 2018
8832ea4
rfc, cfg-path-version: note use case of working around compiler bugs.
Centril Aug 11, 2018
fb30214
rfc, cfg-path-version: talk about the lint.
Centril Aug 11, 2018
7201651
rfc, cfg-path-version: crater stuff not a drawback.
Centril Aug 11, 2018
2fce9e6
rfc, cfg-path-version: clarify re. old versions using this.
Centril Aug 11, 2018
fdf3ed7
rfc, cfg-path-version: implementation questions re. path_exists.
Centril Aug 11, 2018
6442367
rfc, cfg-path-version: justify meta grammar changes.
Centril Aug 11, 2018
de60af4
rfc, cfg-path-version: justify preventing relative paths.
Centril Aug 11, 2018
72ee5fa
rfc, cfg-path-version: justify nightly instead of if_possible_feature.
Centril Aug 11, 2018
77bf1d6
rfc, cfg-path-version: path_exists -> accessible + talk about fields.
Centril Aug 12, 2018
8c9858a
rfc, cfg-path-version: refresh start date.
Centril Aug 12, 2018
09f23a8
rfc, cfg-path-version: fix typo
Centril Aug 12, 2018
7ca8a5f
rfc, cfg-path-version: reword a bit
Centril Aug 12, 2018
c4d7c2c
rfc, cfg-path-version: remove abnf highlighting
Centril Aug 12, 2018
9cedd5a
rfc, cfg-path-version: fix typo.
Centril Aug 14, 2018
3abb76f
rfc, cfg-path-version: talk about SomeFeature
Centril Aug 14, 2018
4601f1c
rfc, cfg-path-version: add `usable` to bikeshed.
Centril Aug 19, 2018
4cad91d
rfc, cfg-path-version: version = '..' => version(..)
Centril Aug 19, 2018
457da19
rfc, cfg-path-version: fix eddybs review comments.
Centril Aug 19, 2018
e7840f4
rfc, cfg-path-version: remove #[cfg(nightly)] from proposal.
Centril Aug 19, 2018
1cf87f6
rfc, inferred-type-aliases: discuss semantics of version(..) in depth.
Centril Aug 19, 2018
210e909
rfc, cfg-path-version: fix bugs.
Centril Aug 31, 2018
592de81
rfc, cfg-path-version: talk more about relative paths.
Centril Aug 31, 2018
7aa9cef
rfc, cfg-path-version: more rigorous bikeshed wrt. accessible.
Centril Aug 31, 2018
63b4eac
rfc, cfg-path-version: clang as prior art.
Centril Aug 31, 2018
f0dc1e6
rfc, cfg-path-version: discuss rust_feature.
Centril Aug 31, 2018
c6d47e7
rfc, cfg-path-version: elaborate on reachable.
Centril Aug 31, 2018
0b12c54
rfc, cfg-path-version: add error-chain#101 as an example.
Centril Aug 31, 2018
16ef0b2
rfc, cfg-path-version: discuss has_attr as future work.
Centril Aug 31, 2018
3333882
rfc, cfg-path-version: fix word wrap.
Centril Aug 31, 2018
e0de3bb
rfc, cfg-path-version: highlight the risks of unstable.
Centril Nov 29, 2018
96ec9e7
rfc, cfg-path-version: consider attributes & macros.
Centril Nov 29, 2018
40bc0f5
rfc, cfg-path-version: fix wording in motivation.
Centril Jan 11, 2019
4618306
rfc, cfg-path-version: fix formal grammar to correspond to guide.
Centril Jan 11, 2019
ca5a92b
rfc, cfg-path-version: mention target_has_atomic in rationale.
Centril Jan 11, 2019
5b4b21a
rfc, cfg-path-version: clarify stability policy re. accessible(..).
Centril Feb 17, 2019
e488a3a
RFC 2523
Centril Sep 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 28 additions & 1 deletion text/0000-cfg-path-version.md
Expand Up @@ -423,30 +423,57 @@ meta : path ( named_value | meta_list )? ;
One might consider other names for the flag instead of `accessible`.
Some contenders are:

+ `reachable`
+ `path_accessible`
+ `usable`
+ `can_use`
+ `path_exists`
+ `have_path`
+ `have_path` (or `has_path`)
+ `have`
+ `have_item`
+ `path_reachable`
+ `item_reachable`
+ `item_exists`

#### `accessible`

Currently `accessible` is the choice because it clearly signals the intent
while also being short enough to remain ergonomic to use.
In particular, while `path_accessible` might be somewhat more unambiguous,
we argue that from the context of seeing `accessible(::std::foo::bar)`
it is clear that it is paths we are talking about because the argument
is a path and not something else.

#### `reachable`

The word `reachable` is also a synonym of `accessible` and is one character
shorter. However, it tends to have a different meaning in code wherefore we
Centril marked this conversation as resolved.
Show resolved Hide resolved
have chosen to go with `accessible` instead as the more intuitive option.

#### `usable`

While `can_use` and `usable` are also strong contenders, we reject these options
because they may imply to the user that only things that you may `use $path;` can
go in there. Meanwhile, you may `#[cfg(accessible(::foo::MyTrait::my_method))`
which is *not* possible as `use ::foo::MyTrait::my_method;`. This also applies
to other associated items and inherent methods as well as `struct` fields.
Centril marked this conversation as resolved.
Show resolved Hide resolved

#### `has_path`

Another strong contender is `has_path` or `have_path`.

However, this variant is vague with respect to what "having" something means.
In other words, it does not say whether it refers to being accessible and public,
or whether it is usable, and so on. As we previously noted, having `path` in the
name is also somewhat redundant because it is clear that `::std::bar` is a path.
Another small wrinkle is that it is unclear whether it should be `have` or `has`.
That choice depends on what one things the subject is. For example, if one
considers a module to be an "it", then it should probably be `has`.

One upside to `has_path` is that it has precedent from the `clang` compiler.
For example, a user may write: `#if __has_feature(cxx_rvalue_references)`
or `__has_feature(c_generic_selections)`.

## `#[cfg(version(..))`

When it comes to `version(..)`, it is needed to support conditional compilation
Expand Down