about summary refs log tree commit diff
path: root/src/librustc/middle
AgeCommit message (Collapse)AuthorLines
2018-09-08Rollup merge of #53315 - nikomatsakis:newtype-index, r=Mark-Simulacrumkennytm-4/+6
use `NonZeroU32` in `newtype_index!`macro, change syntax Various improvements to the `newtype_index!` macro: - Use `NonZeroU32` so that `Option<T>` is cheap - More ergonomic helper method, no need to import `Idx` trait all the time - Improve syntax to use `struct` keyword so that ripgrep works to find type def'n Fixes https://github.com/rust-lang/rust/issues/50337 I'm curious to see if this passes tests =)
2018-09-07change from tuple struct to brace structNiko Matsakis-1/+1
2018-09-07make field always private, add `From` implsNiko Matsakis-1/+2
2018-09-07change syntax of `newtype_index` to look like a struct declNiko Matsakis-3/+4
2018-09-06resolve_lifetime: types are not late-bound regions =)Niko Matsakis-0/+7
2018-09-01Auto merge of #53815 - F001:if-let-guard, r=petrochenkovbors-4/+13
refactor match guard This is the first step to implement RFC 2294: if-let-guard. Tracking issue: https://github.com/rust-lang/rust/issues/51114 The second step should be introducing another variant `IfLet` in the Guard enum. I separated them into 2 PRs for the convenience of reviewers. r? @petrochenkov
2018-08-31Implement the `min_const_fn` feature gateOliver Schneider-1/+1
2018-08-30introduce Guard enumF001-4/+13
2018-08-28Use FxHash{Map,Set} instead of the default Hash{Map,Set} everywhere in rustc.Eduard-Mihai Burtescu-3/+2
2018-08-27Rename hir::map::NodeKind to hir::Nodevarkor-49/+49
2018-08-27Remove path prefixes from NodeKindvarkor-45/+48
2018-08-27Rename hir::map::Node to hir::map::NodeKindvarkor-42/+42
2018-08-26rustc: Continue to tweak "std internal symbols"Alex Crichton-2/+5
In investigating [an issue][1] with `panic_implementation` defined in an executable that's optimized I once again got to rethinking a bit about the `rustc_std_internal_symbol` attribute as well as weak lang items. We've sort of been non-stop tweaking these items ever since their inception, and this continues to the trend. The crux of the bug was that in the reachability we have a [different branch][2] for non-library builds which meant that weak lang items (and std internal symbols) weren't considered reachable, causing them to get eliminiated by ThinLTO passes. The fix was to basically tweak that branch to consider these symbols to ensure that they're propagated all the way to the linker. Along the way I've attempted to erode the distinction between std internal symbols and weak lang items by having weak lang items automatically configure fields of `CodegenFnAttrs`. That way most code no longer even considers weak lang items and they're simply considered normal functions with attributes about the ABI. In the end this fixes the final comment of #51342 [1]: https://github.com/rust-lang/rust/issues/51342#issuecomment-414368019 [2]: https://github.com/rust-lang/rust/blob/35bf1ae25799a4e62131159f052e0a3cbd27c960/src/librustc/middle/reachable.rs#L225-L238
2018-08-26Auto merge of #53619 - japaric:panic-handler, r=SimonSapinbors-3/+7
add #[panic_handler]; deprecate #[panic_implementation] r? @SimonSapin cc #44489
2018-08-24Rollup merge of #53545 - FelixMcFelix:fix-50865-beta, r=petrochenkovkennytm-1/+5
Fix #50865: ICE on impl-trait returning functions reaching private items Adds a test case as suggested in #50865, and implements @petrochenkov's suggestion. Fixes #50865. Impl-trait-returning functions are marked under a new (low) access level, which they propagate rather than `AccessLevels::Reachable`. `AccessLevels::is_reachable` returns false for such items (leaving stability analysis unaffected), these items may still be visible to the lints phase however.
2018-08-23add #[panic_handler]; deprecate #[panic_implementation]Jorge Aparicio-3/+7
2018-08-22Auto merge of #52011 - ↵bors-0/+2
oli-obk:dont_you_hate_it_too_when_everything_panics_constantly, r=eddyb Allow panicking with string literal messages inside constants r? @eddyb cc https://github.com/rust-lang/rust/issues/51999 we can't implement things like `panic!("foo: {}", x)` right now because we can't call trait methods (most notably `Display::fmt`) inside constants. Also most of these impls probably have loops and conditions, so it's messy anyway. But hey `panic!("foo")` works at least. cc @japaric got any test ideas for `#![no_std]`?
2018-08-22Allow panicking with string literal messages inside constantsOliver Schneider-0/+2
2018-08-22Rename Def::{Param, Foreign} to Def::{TyParam, TyForeign}varkor-1/+1
2018-08-22Remove unnecessary TyKind::svarkor-1/+1
2018-08-22Remove Ty prefix from Ty{Foreign|Param}varkor-1/+1
2018-08-22Remove Ty prefix from ↵varkor-23/+23
Ty{Adt|Array|Slice|RawPtr|Ref|FnDef|FnPtr|Dynamic|Closure|Generator|GeneratorWitness|Never|Tuple|Projection|Anon|Infer|Error}
2018-08-22Rename ty::TyVariants to ty::TyKindvarkor-1/+1
2018-08-21Auto merge of #53444 - varkor:lib_features-conditional, r=michaelwoeristerbors-12/+27
Only fetch lib_features when there are unknown feature attributes An attempt to win back some of the performance lost in https://github.com/rust-lang/rust/pull/52644#issuecomment-413761127. cc @nnethercote
2018-08-21Auto merge of #53530 - kennytm:rollup, r=kennytmbors-7/+1
Rollup of 17 pull requests Successful merges: - #53030 (Updated RELEASES.md for 1.29.0) - #53104 (expand the documentation on the `Unpin` trait) - #53213 (Stabilize IP associated constants) - #53296 (When closure with no arguments was expected, suggest wrapping) - #53329 (Replace usages of ptr::offset with ptr::{add,sub}.) - #53363 (add individual docs to `core::num::NonZero*`) - #53370 (Stabilize macro_vis_matcher) - #53393 (Mark libserialize functions as inline) - #53405 (restore the page title after escaping out of a search) - #53452 (Change target triple used to check for lldb in build-manifest) - #53462 (Document Box::into_raw returns non-null ptr) - #53465 (Remove LinkMeta struct) - #53492 (update lld submodule to include RISCV patch) - #53496 (Fix typos found by codespell.) - #53521 (syntax: Optimize some literal parsing) - #53540 (Moved issue-53157.rs into src/test/ui/consts/const-eval/) - #53551 (Avoid some Place clones.) Failed merges: r? @ghost
2018-08-21Rollup merge of #53465 - bjorn3:remove_link_meta_struct, r=varkorkennytm-7/+1
Remove LinkMeta struct Fixes #53291
2018-08-21Iterate through all crates in stability.rs rather than lib_features.rsvarkor-12/+27
2018-08-21Fixes for code review.Kyle Simpson-1/+0
2018-08-21New AccessLevel and accompanying propagation.Kyle Simpson-2/+3
2018-08-20Mark impl Trait Functions as reachable. (Fixes #50865)Kyle Simpson-0/+4
2018-08-20Auto merge of #51880 - varkor:generics-hir-generalisation-followup, r=eddybbors-18/+5
The Great Generics Generalisation: HIR Followup Addresses the final comments in #48149. r? @eddyb, but there are a few things I have yet to clean up. Making the PR now to more easily see when things break. cc @yodaldevoid
2018-08-19mv codemap() source_map()Donato Sciarra-6/+6
2018-08-19mv (mod) codemap source_mapDonato Sciarra-8/+12
2018-08-19Fix tidy checkvarkor-1/+1
2018-08-19Replace generics_require_inlining with generics.requires_monomorphizationvarkor-17/+4
2018-08-18Use the new Entry::or_default method where possible.Eduard-Mihai Burtescu-15/+11
2018-08-18Remove LinkMeta structbjorn3-7/+1
2018-08-16Auto merge of #53397 - varkor:feature-collector-expand-visitor, r=nikomatsakisbors-55/+39
Visit all attributes for feature collection Previously feature attributes were just collected on item-like "things" as well as exported macros and crate attributes. This ignored some places feature attributes could be specified, such as on enum variants. Fixes https://github.com/rust-lang/rust/issues/53391.
2018-08-15Visit all attributes for feature collectionvarkor-55/+39
2018-08-15Auto merge of #52928 - Mark-Simulacrum:borrowck-cleanup, r=cramertjbors-686/+0
(old) borrowck cleanup Primarily moves dataflow code based on CFG to borrowck; this is mostly so we don't forget to delete it once it becomes unused after we fully move to MIR borrowck.
2018-08-09Move SVH structure to data structuresMark Rousskov-1/+1
2018-08-08Auto merge of #52993 - alexcrichton:fix-some-vis, r=michaelwoeristerbors-4/+7
rustc: Tweak visibility of some lang items This commit tweaks the linker-level visibility of some lang items that rustc uses and defines. Notably this means that `#[panic_implementation]` and `#[alloc_error_handler]` functions are never marked as `internal`. It's up to the linker to eliminate these, not rustc. Additionally `#[global_allocator]` generated symbols are no longer forced to `Default` visibility (fully exported), but rather they're relaxed to `Hidden` visibility). This symbols are *not* needed across DLL boundaries, only as a local implementation detail of the compiler-injected allocator symbols, so `Hidden` should suffice. Closes #51342 Closes #52795
2018-08-07Add HirId to VisibilityKind::RestrictedMark Rousskov-3/+4
2018-08-07rustc: Tweak visibility of some lang itemsAlex Crichton-4/+7
This commit tweaks the linker-level visibility of some lang items that rustc uses and defines. Notably this means that `#[panic_implementation]` and `#[alloc_error_handler]` functions are never marked as `internal`. It's up to the linker to eliminate these, not rustc. Additionally `#[global_allocator]` generated symbols are no longer forced to `Default` visibility (fully exported), but rather they're relaxed to `Hidden` visibility). This symbols are *not* needed across DLL boundaries, only as a local implementation detail of the compiler-injected allocator symbols, so `Hidden` should suffice. Closes #51342 Closes #52795
2018-08-06Auto merge of #52644 - varkor:lib-feature-gate-2, r=withoutboatsbors-33/+244
Add errors for unknown, stable and duplicate feature attributes - Adds an error for unknown (lang and lib) features. - Extends the lint for unnecessary feature attributes for stable features to libs features (this already exists for lang features). - Adds an error for duplicate (lang and lib) features. ```rust #![feature(fake_feature)] //~ ERROR unknown feature `fake_feature` #![feature(i128_type)] //~ WARNING the feature `i128_type` has been stable since 1.26.0 #![feature(non_exhaustive)] #![feature(non_exhaustive)] //~ ERROR duplicate `non_exhaustive` feature attribute ``` Fixes #52053, fixes #53032 and address some of the problems noted in #44232 (though not unused features). There are a few outstanding problems, that I haven't narrowed down yet: - [x] Stability attributes on macros do not seem to be taken into account. - [x] Stability attributes behind `cfg` attributes are not taken into account. - [x] There are failing incremental tests.
2018-08-06Special-case "test" featurevarkor-0/+4
2018-08-06Auto merge of #52332 - ↵bors-1/+5
zackmdavis:dead_code_lint_should_say_2_electric_boogaloo, r=pnkfelix dead-code lint: say "constructed" for structs Respectively. This is a sequel to November 2017's #46103 / 1a9dc2e9. It had been reported (more than once—at least #19140, #44083, and #44565) that the "never used" language was confusing for enum variants that were "used" as match patterns, so the wording was changed to say never "constructed" specifically for enum variants. More recently, the same issue was raised for structs (#52325). It seems consistent to say "constructed" here, too, for the same reasons. ~~While we're here, we can also use more specific word "called" for unused functions and methods. (We declined to do this in #46103, but the rationale given in the commit message doesn't actually make sense.)~~ This resolves #52325.
2018-08-05Improve query efficiencyvarkor-4/+6
2018-08-05Add special support for libcvarkor-5/+3
2018-08-05Add support for feature attributes on macrosvarkor-4/+3