about summary refs log tree commit diff
path: root/src
AgeCommit message (Collapse)AuthorLines
2019-11-07syntax: use distinct FloatTy from rustc_target.Mazdak Farrokhzad-155/+123
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-07test that extern lits accept raw strings annd escapesMazdak Farrokhzad-0/+26
2019-11-07test that parser is oblivious to set of ABIsMazdak Farrokhzad-0/+17
2019-11-07parser: allow ABIs from literal macro fragmentsMazdak Farrokhzad-26/+63
2019-11-07cleanup can_begin_const_argMazdak Farrokhzad-3/+1
2019-11-07parser: don't hardcode ABIs into grammarMazdak Farrokhzad-285/+296
2019-11-07Auto merge of #65750 - nnethercote:cheaper-doc-comments, r=petrochenkovbors-151/+234
Cheaper doc comments This PR implements the idea from #60935: represent doc comments more cheaply, rather than converting them into `#[doc="..."]` attribute form. Unlike #60936 (which is about coalescing doc comments to reduce their number), this approach does not have any backwards compatibility concerns, and it eliminates about 80-90% of the current cost of doc comments (as estimated using the numbers in #60930, which eliminated the cost of doc comments entirely by treating them as normal comments). r? @petrochenkov
2019-11-06Auto merge of #65728 - ecstatic-morse:promotion-const-proj, r=eddybbors-19/+22
Fix promotion in a `const` when projections are present Resolves #65727. This marks the entire local as "needs promotion" when only a projection of that local appears in a promotable context. This should only affect promotion in a `const` or `static`, not in a `fn` or `const fn`, which is handled in `promote_consts.rs`. r? @eddyb
2019-11-06Auto merge of #65134 - davidtwco:issue-19834-improper-ctypes-in-extern-C-fn, ↵bors-37/+521
r=rkruppe improper_ctypes: `extern "C"` fns cc #19834. Fixes #65867. This pull request implements the change [described in this comment](https://github.com/rust-lang/rust/issues/19834#issuecomment-466671572). cc @rkruppe @varkor @shepmaster
2019-11-06Make doc comments cheaper with `AttrKind`.Nicholas Nethercote-147/+233
`AttrKind` is a new type with two variants, `Normal` and `DocComment`. It's a big performance win (over 10% in some cases) because `DocComment` lets doc comments (which are common) be represented very cheaply. `Attribute` gets some new helper methods to ease the transition: - `has_name()`: check if the attribute name matches a single `Symbol`; for `DocComment` variants it succeeds if the symbol is `sym::doc`. - `is_doc_comment()`: check if it has a `DocComment` kind. - `{get,unwrap}_normal_item()`: extract the item from a `Normal` variant; panic otherwise. Fixes #60935.
2019-11-06Remove unnecessary `Deref` impl for `Attribute`.Nicholas Nethercote-44/+41
This kind of thing just makes the code harder to read.
2019-11-06Auto merge of #65830 - Quantumplation:master, r=davidtwco,estebankbors-109/+139
Use ident.span instead of def_span in dead-code pass Hello! First time contributor! :) This should fix #58729. According to @estebank in the duplicate #63064, def_span scans forward on the line until it finds a {, and if it can't find one, falls back to the span for the whole item. This was apparently written before the identifier span was explicitly tracked on each node. This means that if an unused function signature spans multiple lines, the entire function (potentially hundreds of lines) gets flagged as dead code. This could, for example, cause IDEs to add error squiggly's to the whole function. By using the span from the ident instead, we narrow the scope of this in most cases. In a wider sense, it's probably safe to use ident.span instead of def_span in most locations throughout the whole code base, but since this is my first contribution, I kept it small. Some interesting points that came up while I was working on this: - I reorganized the tests a bit to bring some of the dead code ones all into the same location - A few tests were for things unrelated to dead code (like the path-lookahead for parens), so I added #![allow(dead_code)] and cleaned up the stderr file to reduce noise in the future - The same fix doesn't apply to const and static declarations. I tried adding these cases to the match expression, but that created a much wider change to tests and error messages, so I left it off until I could get some code review to validate the approach.
2019-11-06Rollup merge of #66139 - euclio:pluralize, r=nagisaMazdak Farrokhzad-57/+57
use American spelling for `pluralize!`
2019-11-06Rollup merge of #66133 - alexcrichton:update-wasi-libc, r=Mark-SimulacrumMazdak Farrokhzad-7/+7
Update the bundled `wasi-libc` repository This updates the libc that the `wasm32-wasi` target links against to the latest revision, mostly just bringing in minor bug fixes and minor wasm size improvements.
2019-11-06Rollup merge of #66103 - smaeul:patch/thumb-musl, r=nagisaMazdak Farrokhzad-0/+38
Add target thumbv7neon-unknown-linux-musleabihf This is a copy of thumbv7neon-unknown-linux-gnueabihf with musl changes merged from armv7-unknown-linux-musleabihf. This appears to have been missed when adding the other ARMv7-A thumb targets.
2019-11-06Rollup merge of #66092 - niacat:master, r=nagisaMazdak Farrokhzad-1/+2
Use KERN_ARND syscall for random numbers on NetBSD, same as FreeBSD. This system call is present on all supported NetBSD versions and provides an endless stream of non-blocking random data from the kernel's ChaCha20-based CSPRNG. It doesn't require a file like `/dev/urandom` to be opened. The system call is documented here (under kern.arandom): https://netbsd.gw.com/cgi-bin/man-cgi?sysctl+7+NetBSD-7.0 And defined here: https://nxr.netbsd.org/xref/src/sys/sys/sysctl.h#273 The semantics are the same as FreeBSD so reading 256 bytes per call is fine. Similar change for getrandom crate: rust-random/getrandom#115
2019-11-06Rollup merge of #66086 - RalfJung:smallvec, r=nagisaMazdak Farrokhzad-22/+22
bump smallvec to 1.0 This includes https://github.com/servo/rust-smallvec/pull/162, fixing an unsoundness in smallvec. See https://github.com/servo/rust-smallvec/pull/175 for the 1.0 release announcement. Cc @mbrubeck @emilio
2019-11-06Rollup merge of #66062 - smaeul:patch/pic-level, r=estebankMazdak Farrokhzad-0/+9
Configure LLVM module PIC level As of LLVM 9, this is required for 32-bit PowerPC to properly generate PLT references. Previously, only BigPIC was supported; now LLVM supports both BigPIC and SmallPIC, and there is no default value provided.
2019-11-06Rollup merge of #66015 - popzxc:refactor-librustc_parser, r=matkladMazdak Farrokhzad-122/+159
librustc_lexer: Refactor the module This PR introduces a refactoring of the `librustc_lexer` in order to improve readability. All the changes performed are only cosmetic and do not introduce any changes the lexer logic or performance. Newly introduced modules `literal`, `token` and `utils` are just copy-pasted from the `lib.rs` and do not contain even cosmetic changes (I decided to do so so it'll be easier to review changes looking only on diff). r? @petrochenkov cc @Centril @matklad
2019-11-06Rollup merge of #65973 - eddyb:caller-location-panic, r=petrochenkovMazdak Farrokhzad-33/+51
caller_location: point to macro invocation sites, like file!/line!, and use in core::panic!. The main change here is to `core::panic!`, trying to fix this remaining regression: https://github.com/rust-lang/rust/pull/65927#issuecomment-547625147 However, in order for `caller_location` to be usable from macros the same way `file!()`/`line!()` are, it needs to have the same behavior (of extracting the macro invocation site `Span` and using that). Arguably we would've had to do this at some point anyway, if we want to use `#[track_caller]` to replace the `file!()`/`line!()` uses from macros, but I'm not sure the RFC mentions this at all. r? @petrochenkov cc @anp @nnethercote
2019-11-06Rollup merge of #65776 - nnethercote:rename-LocalInternedString-and-more, ↵Mazdak Farrokhzad-114/+103
r=estebank Rename `LocalInternedString` and more This PR renames `LocalInternedString` as `SymbolStr`, removes an unnecessary `impl` from it, improves comments, and cleans up some `SymbolStr` uses. r? @estebank
2019-11-06Rollup merge of #66115 - eddyb:global-meta-what, r=michaelwoeristerMazdak Farrokhzad-201/+116
rustc: remove "GlobalMetaData" dead code from hir::map::definitions. Spotted while refactoring uses of `DefIndex` and/or `LocalDefId`. r? @michaelwoerister
2019-11-06Rollup merge of #66106 - JOE1994:master, r=GuillaumeGomezMazdak Farrokhzad-1/+1
Fix typo in explanation of `E0080` Handling issue #66105 in Rust repo. `evaluate an constant expression` to `evaluate a constant expression`
2019-11-06Rollup merge of #66101 - estebank:break-tail-e0308, r=CentrilMazdak Farrokhzad-10/+44
Tweak type mismatch caused by break on tail expr When `break;` has a type mismatch because the `Destination` points at a tail expression with an obligation flowing from a return type, point at the return type. Fix #39968.
2019-11-06Rollup merge of #66098 - estebank:path-asciption-typo, r=CentrilMazdak Farrokhzad-4/+30
Detect `::` -> `:` typo when involving turbofish Fix #65569.
2019-11-06Rollup merge of #66093 - estebank:fmt-ice, r=CentrilMazdak Farrokhzad-5/+23
Do not ICE with a precision flag in formatting str and no format arguments Fix #66065.
2019-11-06Rollup merge of #66081 - RalfJung:ptr-offset, r=zackmdavisMazdak Farrokhzad-6/+13
let caller of check_ptr_access_align control the error message This is needed for https://github.com/rust-lang/miri/pull/1031
2019-11-06Rollup merge of #66068 - euclio:null-emitter, r=estebankMazdak Farrokhzad-79/+19
use silent emitter for rustdoc highlighting pass Partially addresses #63284.
2019-11-06Rollup merge of #66054 - petrochenkov:delspan, r=estebankMazdak Farrokhzad-46/+46
syntax: Avoid span arithmetic for delimiter tokens The +/-1 logic is from the time where the whole group had a single span and the delimiter spans had to be calculated from it. Now the delimiters have their own spans which are constructed by lexer or proc macro API and can be used directly. If those spans are not perfect, then it should be fixed by tweaking the corresponding lexer logic rather than by trying to add or substract `1` from the span boundaries. Fixes https://github.com/rust-lang/rust/issues/62524 r? @estebank
2019-11-06Rollup merge of #66027 - Mark-Simulacrum:panic-handler-query, r=alexcrichtonMazdak Farrokhzad-11/+6
Move has_panic_handler to query Moves us off of a global Once instead re-querying the lang item each time. The conditions on when we set it to true change a little (previously we'd make sure a few more lang items were `Some`) but I think they in practice don't matter, we won't compile later on if we don't have them.
2019-11-06Rollup merge of #66014 - dkadashev:47319-type-param-def-location, r=estebankMazdak Farrokhzad-44/+141
Show type parameter name and definition in type mismatch error messages Fixes #47319 r? estebank
2019-11-06Rollup merge of #65892 - pnkfelix:trim-special-derives, r=petrochenkovMazdak Farrokhzad-59/+14
Remove `PartialEq` and `Eq` from the `SpecialDerives`. Now that PR #65519 landed, this is the follow-on work of removing `PartialEq` and `Eq` from the set of `SpecialDerives` .
2019-11-05Use source_callee().is_some() to detect macrosPi Lanningham-4/+5
macro_backtrace() allocates a vector, whereas source_callee() doesn't but indicates the same thing. Suggested by @estebank
2019-11-05Tweak type mismatch caused by break on tail exprEsteban Küber-10/+44
When `break;` has a type mismatch because the `Destination` points at a tail expression with an obligation flowing from a return type, point at the return type. Fix #39968.
2019-11-05Auto merge of #66121 - pietroalbini:rollup-8zrwe7l, r=pietroalbinibors-102/+266
Rollup of 8 pull requests Successful merges: - #65948 (Improve MaybeUninit::get_{ref,mut} documentation) - #65953 (Allow specifying LLVM's MCTargetOptions::ABIName in target specification files) - #66012 (De-querify `trivial_dropck_outlives`.) - #66025 (`Span` cannot represent `span.hi < span.lo`) - #66047 (Don't double-count `simd_shuffle` promotion candidates) - #66053 (when Miri tests are not passing, do not add Miri component) - #66082 (clean highlightSourceLines code) - #66091 (Implemented the home_dir for VxWorks) Failed merges: r? @ghost
2019-11-05use American spelling for `pluralize!`Andy Russell-57/+57
2019-11-05Update the bundled `wasi-libc` repositoryAlex Crichton-7/+7
This updates the libc that the `wasm32-wasi` target links against to the latest revision, mostly just bringing in minor bug fixes and minor wasm size improvements.
2019-11-05Do not ICE whith a precision flag in formatting str and no format argumentsEsteban Küber-5/+23
2019-11-05rustc: remove "GlobalMetaData" dead code from hir::map::definitions.Eduard-Mihai Burtescu-201/+116
2019-11-05Account for typo in turbofish and suggest `::`Esteban Küber-5/+11
2019-11-05Detect if item.span is in a macro, and fall backPi Lanningham-5/+18
If item.span is part of a macro invocation, this has several downstream implications. To name two that were found while working on this: - The dead-code error gets annotated with a "in this macro invocation" - Some errors get canceled if they refer to remote crates Ideally, we should annotate item.ident.span with the same macro info, but this is a larger change (see: #66095), so for now we just fall back to the old behavior if this item was generated by a macro. I use span.macro_backtrace().len() to detect if it's part of a macro, because that (among other things) is what is used by the code which adds the "in this macro invocation" annotations mentioned above.
2019-11-05Review feedback: alpha-rename field from `copy_derives` to ↵Felix S. Klock II-4/+4
`containers_derving_copy`.
2019-11-05Review feedback: Remove more stuff! Simplify simplify simplify!Felix S. Klock II-41/+13
2019-11-05Remove `PartialEq` and `Eq` from the `SpecialDerives`.Felix S. Klock II-18/+1
2019-11-05Rollup merge of #66091 - Wind-River:master_xyz, r=cramertjPietro Albini-1/+2
Implemented the home_dir for VxWorks Use HOME's value if it is set; otherwise return NONE.
2019-11-05Rollup merge of #66082 - GuillaumeGomez:cleanup-highlightsourcelines, r=kinnisonPietro Albini-42/+54
clean highlightSourceLines code This is the first part of https://github.com/rust-lang/rust/issues/66046. Now that I've splitted the hashchange stuff and the source code lines highlighting, I'll be able to fix the whole issue once and for all. r? @kinnison
2019-11-05Rollup merge of #66053 - RalfJung:miri-toolstate, r=pietroalbiniPietro Albini-1/+23
when Miri tests are not passing, do not add Miri component Second attempt, this time based on the JSON files that exist since https://github.com/rust-lang/rust/pull/65274. Fixes https://github.com/rust-lang/rust/issues/60301 r? @pietroalbini @alexcrichton
2019-11-05Rollup merge of #66047 - ecstatic-morse:issue-66016, r=eddybPietro Albini-0/+2
Don't double-count `simd_shuffle` promotion candidates Resolves #66016. The `#[rustc_args_required_const]` attribute was added to `simd_shuffle*` in rust-lang/stdarch#825. This caused `promote_consts` to double-count its second argument when recording promotion candidates, which caused the promotion candidate compatibility check to fail. Once `stdarch` is updated in-tree to include rust-lang/stdarch#825, all special logic around `simd_shuffle` can and should be removed.
2019-11-05Rollup merge of #66025 - petrochenkov:lohi, r=eddybPietro Albini-25/+6
`Span` cannot represent `span.hi < span.lo` So we can remove the corresponding checks from various code
2019-11-05Rollup merge of #66012 - nnethercote:dequery-trivial_dropck_outlives, ↵Pietro Albini-22/+8
r=michaelwoerister De-querify `trivial_dropck_outlives`. It's sufficiently simple and fast that memoizing it is a slight pessimization. r? @michaelwoerister