about summary refs log tree commit diff
path: root/src/librustc
AgeCommit message (Collapse)AuthorLines
2019-11-11suggest to add a constraint except asyn-fn without explicit outputcsmoe-16/+22
2019-11-10Move lock into CodeStatsMark Rousskov-13/+15
Prevent accidental too-long borrows by ensuring only encapsulated locking.
2019-11-10Auto merge of #66070 - petrochenkov:regattr, r=matthewjasperbors-3/+20
Support registering inert attributes and attribute tools using crate-level attributes And remove `#[feature(custom_attribute)]`. (`rustc_plugin::Registry::register_attribute` is not removed yet, I'll do it in a follow up PR.) ```rust #![register_attr(my_attr)] #![register_tool(my_tool)] #[my_attr] // OK #[my_tool::anything] // OK fn main() {} ``` --- Some tools (`rustfmt` and `clippy`) used in tool attributes are hardcoded in the compiler. We need some way to introduce them without hardcoding as well. This PR introduces a way to do it with a crate level attribute. The previous attempt to introduce them through command line (https://github.com/rust-lang/rust/pull/57921) met some resistance. This probably needs to go through an RFC before stabilization. However, I'd prefer to land *this* PR without an RFC to able to remove `#[feature(custom_attribute)]` and `Registry::register_attribute` while also providing a replacement. --- `register_attr` is a direct replacement for `#![feature(custom_attribute)]` (https://github.com/rust-lang/rust/issues/29642), except it doesn't rely on implicit fallback from unresolved attributes to custom attributes (which was always hacky and is the primary reason for the removal of `custom_attribute`) and requires registering the attribute explicitly. It's not clear whether it should go through stabilization or not. It's quite possible that all the uses should migrate to `#![register_tool]` (https://github.com/rust-lang/rust/issues/66079) instead. --- Details: - The naming is `register_attr`/`register_tool` rather than some `register_attributes` (plural, no abbreviation) for consistency with already existing attributes like `cfg_attr`, or `feature`, etc. --- Previous attempt: https://github.com/rust-lang/rust/pull/57921 cc https://github.com/rust-lang/rust/issues/44690 Tracking issues: #66079 (`register_tool`), #66080 (`register_attr`) Closes https://github.com/rust-lang/rust/issues/29642
2019-11-10Improve coherence errors for wrong type orderOhad Ravid-2/+10
2019-11-10Auto merge of #65324 - Centril:organize-syntax, r=petrochenkovbors-2/+14
Split libsyntax apart In this PR the general idea is to separate the AST, parser, and friends by a more data / logic structure (tho not fully realized!) by separating out the parser and macro expansion code from libsyntax. Specifically have now three crates instead of one (libsyntax): - libsyntax: - concrete syntax tree (`syntax::ast`) - definition of tokens and token-streams (`syntax::{token, tokenstream}`) -- used by `syntax::ast` - visitors (`syntax::visit`, `syntax::mut_visit`) - shared definitions between `libsyntax_expand` - feature gating (`syntax::feature_gate`) -- we could possibly move this out to its own crater later. - attribute and meta item utilities, including used-marking (`syntax::attr`) - pretty printer (`syntax::print`) -- this should possibly be moved out later. For now I've reduced down the dependencies to a single essential one which could be broken via `ParseSess`. This entails that e.g. `Debug` impls for `Path` cannot reference the pretty printer. - definition of `ParseSess` (`syntax::sess`) -- this is used by `syntax::{attr, print, feature_gate}` and is a common definition used by the parser and other things like librustc. - the `syntax::source_map` -- this includes definitions used by `syntax::ast` and other things but could ostensibly be moved `syntax_pos` since that is more related to this module. - a smattering of misc utilities not sufficiently important to itemize -- some of these could be moved to where they are used (often a single place) but I wanted to limit the scope of this PR. - librustc_parse: - parser (`rustc_parse::parser`) -- reading a file and such are defined in the crate root tho. - lexer (`rustc_parse::lexer`) - validation of meta grammar (post-expansion) in (`rustc_parse::validate_attr`) - libsyntax_expand -- this defines the infra for macro expansion and conditional compilation but this is not libsyntax_ext; we might want to merge them later but currently libsyntax_expand is depended on by librustc_metadata which libsyntax_ext is not. - conditional compilation (`syntax_expand::config`) -- moved from `syntax::config` to here - the bulk of this crate is made up of the old `syntax::ext` r? @estebank
2019-11-10Fix tidy.Camille GILLOT-1/+2
2019-11-10Merge hir::ImplPolarity into ast::ImplPolarity.Camille GILLOT-27/+3
2019-11-10Merge hir::IsAuto into ast::IsAuto.Camille GILLOT-16/+3
2019-11-10Merge hir::CaptureClause into ast::CaptureBy.Camille GILLOT-23/+8
2019-11-10Merge hir::GeneratorMovability into ast::Movability.Camille GILLOT-29/+15
2019-11-10Merge hir::Unsafety into ast::Unsafety.Camille GILLOT-37/+5
2019-11-10Merge hir::Constness into ast::Constness.Camille GILLOT-16/+3
2019-11-10Merge hir::Mutability into ast::Mutability.Camille GILLOT-104/+65
2019-11-10Auto merge of #66072 - Mark-Simulacrum:next-node-id, r=nikomatsakisbors-30/+235
Move next node ID to Resolver This moves the `next_node_id` method(s) and related tracking information to the resolver. By doing so, we also remove the OneThread and Cell on next_node_id in Session in this move, which means that the new code is simpler and less "interesting" as it doesn't tie itself to a single thread. This required moving some of the pretty-printing logic around, but this was just copying the code without any semantic changes, so it's just a second commit instead of a separate PR; I can polish it up a bit more if desired.
2019-11-10move config.rs to libsyntax_expandMazdak Farrokhzad-2/+14
2019-11-10Rollup merge of #65831 - matthewjasper:array-ptr-cast, r=oli-obkYuki Okushi-0/+3
Don't cast directly from &[T; N] to *const T Split out from #64588 r? @oli-obk
2019-11-09Update cc, git2, num_cpus.Eric Huss-4/+0
2019-11-09Move pretty parsing into Session optionsMark Rousskov-0/+220
This allows us to query whether PpmEveryBodyLoops is set during expansion and run the everybody loops pass.
2019-11-09Move next_node_id to ResolverMark Rousskov-30/+15
This doesn't migrate the pretty-printing everybody loops, which will be done in the next few commits.
2019-11-09Address review commentsVadim Petrochenkov-0/+17
2019-11-09Remove `#[feature(custom_attribute)]`Vadim Petrochenkov-3/+0
2019-11-09Support registering attributes and attribute tools using crate-level attributesVadim Petrochenkov-0/+3
2019-11-09Auto merge of #66242 - Centril:rollup-h73ztr1, r=Centrilbors-19/+105
Rollup of 6 pull requests Successful merges: - #65949 (Move promotion into its own pass) - #65994 (Point at where clauses where the associated item was restricted) - #66050 (Fix C aggregate-passing ABI on powerpc) - #66134 (Point at formatting descriptor string when it is invalid) - #66172 (Stabilize @file command line arguments) - #66226 (add link to unstable book for asm! macro) Failed merges: r? @ghost
2019-11-09Rollup merge of #65994 - estebank:where-bound, r=nikomatsakisMazdak Farrokhzad-17/+104
Point at where clauses where the associated item was restricted CC #57663. r? @nikomatsakis
2019-11-09Auto merge of #65879 - ohadravid:stabilize-re-rebalance-coherence, ↵bors-106/+40
r=nikomatsakis Stabilize the `re_rebalance_coherence` feature This PR stabilizes [RFC 2451](https://rust-lang.github.io/rfcs/2451-re-rebalancing-coherence.html), re-rebalance coherence. Changes include removing the attribute from tests which tested both the old and new behavior, moving the feature to `accepted` and removing the old logic. I'll also open a [PR](https://github.com/rust-lang-nursery/reference/pull/703) against the reference, updating it with the content of the RFC. Closes #63599 r? @nikomatsakis
2019-11-08Stop returning promotables from `mir_const_qualif`Dylan MacKenzie-2/+1
2019-11-08Rollup merge of #66188 - Centril:fnsig, r=davidtwcoMazdak Farrokhzad-75/+66
`MethodSig` -> `FnSig` & Use it in `ItemKind::Fn` In both AST & HIR, rename `MethodSig` to `FnSig` and then proceed to use it in `ItemKind::Fn` so that the overall structure is more regular. r? @davidtwco
2019-11-08Rollup merge of #66154 - RalfJung:to_usize, r=oli-obkMazdak Farrokhzad-6/+6
miri: Rename to_{u,i}size to to_machine_{u,i}size Having a function `to_usize` that does not return a (host) usize is somewhat confusing, so let's rename it. r? @oli-obk
2019-11-08Rollup merge of #65785 - Centril:compat-to-error-2, r=oli-obkMazdak Farrokhzad-112/+11
Transition future compat lints to {ERROR, DENY} - Take 2 Follow up to https://github.com/rust-lang/rust/pull/63247 implementing https://github.com/rust-lang/rust/pull/63247#issuecomment-536295992. - `legacy_ctor_visibility` (ERROR) -- closes #39207 - `legacy_directory_ownership` (ERROR) -- closes #37872 - `safe_extern_static` (ERROR) -- closes #36247 - `parenthesized_params_in_types_and_modules` (ERROR) -- closes #42238 - `duplicate_macro_exports` (ERROR) - `nested_impl_trait` (ERROR) -- closes #59014 - `ill_formed_attribute_input` (DENY) -- transitions #57571 - `patterns_in_fns_without_body` (DENY) -- transitions #35203 r? @varkor cc @petrochenkov
2019-11-08ast::ItemKind::Fn: use ast::FnSigMazdak Farrokhzad-10/+5
2019-11-08ast::MethodSig -> ast::FnSigMazdak Farrokhzad-2/+2
2019-11-08hir::MethodSig -> hir::FnSigMazdak Farrokhzad-16/+17
2019-11-08hir::ItemKind::Fn: use hir::MethodSigMazdak Farrokhzad-49/+44
2019-11-08miri: Rename to_{u,i}size to to_machine_{u,i}sizeRalf Jung-6/+6
Having a function `to_usize` that does not return a usize is somewhat confusing
2019-11-08Rollup merge of #66190 - eddyb:primflt, r=CentrilYuki Okushi-9/+9
rustc_target: inline abi::FloatTy into abi::Primitive. This effectively undoes a small part of @oli-obk's #50967, now that the rest of the compiler doesn't use the `FloatTy` definition from `rustc_target`, post-#65884.
2019-11-08Auto merge of #64882 - ehuss:stabilize-bare-extern, r=eddybbors-14/+3
Stabilize --extern flag without a path. This stabilizes the `--extern` flag without a path, implemented in #54116. This flag is used to add a crate that may be found in the search path to the extern prelude. The intent of stabilizing this now is to change Cargo to emit this flag for `proc_macro` when building a proc-macro crate. This will allow the ability to elide `extern crate proc_macro;` for proc-macros, one of the few places where it is still necessary. It is intended that Cargo may also use this flag for other cases in the future as part of the [std-aware work](https://github.com/rust-lang/wg-cargo-std-aware/). There will likely be some kind of syntax where users may declare dependencies on other crates (such as `alloc`), and Cargo will use this flag so that they may be used like any other crate. At this time there are no short-term plans to use it for anything other than proc-macro. This will not help for non-proc-macro crates that use `proc_macro`, which I believe is not too common? An alternate approach for proc-macro is to use the `meta` crate, but from my inquiries there doesn't appear to be anyone interested in pushing that forward. The `meta` crate also doesn't help with things like `alloc` or `test`. cc #57288
2019-11-07rustc_target: inline abi::FloatTy into abi::Primitive.Eduard-Mihai Burtescu-9/+9
2019-11-07Update for unstable option refactoring.Eric Huss-6/+2
2019-11-07Update built-in help for --extern.Eric Huss-1/+1
2019-11-07Stabilize --extern flag without a path.Eric Huss-7/+0
2019-11-07Rollup merge of #65916 - Centril:split-syntax-3, r=davidtwcoMazdak Farrokhzad-4/+4
syntax: move stuff around Part of https://github.com/rust-lang/rust/pull/65324. r? @davidtwco cc @estebank @petrochenkov
2019-11-07Rollup merge of #63793 - oli-obk:🧹, r=dtolnayMazdak Farrokhzad-0/+3
Have tidy ensure that we document all `unsafe` blocks in libcore cc @rust-lang/libs I documented a few and added ignore flags on the other files. We can incrementally document the files, but won't regress any files this way.
2019-11-07syntax::parser::token -> syntax::tokenMazdak Farrokhzad-4/+4
2019-11-07Add long error explanation for E0623Guillaume Gomez-1/+43
2019-11-07Rollup merge of #65884 - Centril:non-hardcoded-abis, r=petrochenkovMazdak Farrokhzad-30/+49
syntax: ABI-oblivious grammar This PR has the following effects: 1. `extern $lit` is now legal where `$lit:literal` and `$lit` is substituted for a string literal. 2. `extern "abi_that_does_not_exist"` is now *syntactically* legal whereas before, the set of ABI strings was hard-coded into the grammar of the language. With this PR, the set of ABIs are instead validated and translated during lowering. That seems more appropriate. 3. `ast::FloatTy` is now distinct from `rustc_target::abi::FloatTy`. The former is used substantially more and the translation between them is only necessary in a single place. 4. As a result of 2-3, libsyntax no longer depends on librustc_target, which should improve pipe-lining somewhat. cc @rust-lang/lang -- the points 1-2 slightly change the definition of the language but in a way which seems consistent with our general principles (in particular wrt. the discussions of turning things into semantic errors). I expect this to be uncontroversial but it's worth letting y'all know. :) r? @varkor
2019-11-07Rollup merge of #65752 - estebank:sugg, r=CentrilMazdak Farrokhzad-19/+22
Use structured suggestions for missing associated items When encountering an `impl` that is missing associated items required by its `trait`, use structured suggestions at an appropriate place in the `impl`.
2019-11-07syntax: use distinct FloatTy from rustc_target.Mazdak Farrokhzad-27/+24
We also sever syntax's dependency on rustc_target as a result. This should slightly improve pipe-lining. Moreover, some cleanup is done in related code.
2019-11-07parser: don't hardcode ABIs into grammarMazdak Farrokhzad-3/+25
2019-11-07Auto merge of #66175 - JohnTitor:rollup-ihqk5vn, r=JohnTitorbors-4/+16
Rollup of 12 pull requests Successful merges: - #65794 (gate rustc_on_unimplemented under rustc_attrs) - #65945 (Optimize long-linker-command-line test) - #66044 (Improve uninit/zeroed lint) - #66076 (HIR docs: mention how to resolve method paths) - #66084 (Do not require extra LLVM backends for `x.py test` to pass) - #66111 (improve from_raw_parts docs) - #66114 (Improve std::thread::Result documentation) - #66117 (Fixed PhantomData markers in Arc and Rc) - #66146 (Remove unused parameters in `__thread_local_inner`) - #66147 (Miri: Refactor to_scalar_ptr out of existence) - #66162 (Fix broken link in README) - #66171 (Update link on CONTRIBUTING.md) Failed merges: r? @ghost
2019-11-07Rollup merge of #66171 - JohnTitor:update-link, r=ehussYuki Okushi-1/+1
Update link on CONTRIBUTING.md This is a lost article of #66162 Follow-up for rust-lang/rustc-guide#491 CC: @mark-i-m