about summary refs log tree commit diff
path: root/src/librustc_lint/builtin.rs
AgeCommit message (Collapse)AuthorLines
2020-08-30mv compiler to compiler/mark-2422/+0
2020-08-30Rollup merge of #75885 - ↵Dylan DPC-0/+35
jumbatm:issue75739-clashing-extern-declarations-transparent-nonzero, r=lcnr Fix another clashing_extern_declarations false positive. Fixes #75739. Fix another clashing_extern_declarations false positive, this time for transparent newtype with a non-zero member. r? @lcnr
2020-08-27Fix ICE on unwrap of unknown layout.jumbatm-10/+24
2020-08-26Remove unnecessary assert.jumbatm-5/+6
2020-08-26Use same name as attr.jumbatm-1/+1
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-08-25Also handle transparent single-variant enumsjumbatm-9/+11
2020-08-25Fix clashing_extern_declarations false positive.jumbatm-0/+32
Fixes a false positive for transparent newtype with a non-zero member.
2020-08-19Rollup merge of #75554 - jumbatm:fix-clashing-extern-decl-overflow, r=lcnrYuki Okushi-102/+132
Fix clashing_extern_declarations stack overflow for recursive types. Fixes #75512. Adds a seen set to `structurally_same_type` to avoid recursing indefinitely for types which contain values of the same type through a pointer or reference.
2020-08-17Auto merge of #75120 - JulianKnodt:rm_reps, r=oli-obkbors-3/+3
rust_ast::ast => rustc_ast Rework of #71199 which is a rework #70621 Still working on this but just made the PR to track progress r? @Dylan-DPC
2020-08-17rust_ast::ast => rustc_astUjjwal Sharma-3/+3
2020-08-18Wrap recursion in `ensure_sufficient_stack`.jumbatm-88/+91
2020-08-18Also accept Refs for is_primitive_or_pointerjumbatm-4/+5
2020-08-18Avoid double hashset lookup.jumbatm-2/+1
Co-authored-by: Bastian Kauschke <bastian_kauschke@hotmail.de>
2020-08-18Don't memoize seen types.jumbatm-51/+9
That cache is unlikely to be particularly useful within a single invocation of structurally_same_type, especially compared to memoizing results across _all_ invocations of that function.
2020-08-18Reduce indentation by replacing match arm w/ early return.jumbatm-125/+118
2020-08-18Remove structural equiv check for Array const.jumbatm-3/+0
2020-08-18Remove unnecessary rebinding of def ids.jumbatm-11/+5
2020-08-18Fix stack overflow for recursive types.jumbatm-102/+187
Adds a seen set to structurally_same_type to avoid recursing indefinitely when a reference or pointer member introduces a cycle in the visited types.
2020-08-16hir: introduce `QPath::LangItem`David Wood-1/+1
This commit introduces `QPath::LangItem` to the HIR and uses it in AST lowering instead of constructing a `hir::Path` from a slice of symbols. This might be better for performance, but is also much cleaner as the previous approach is fragile. In addition, it resolves a bug (#61019) where an extern crate imported as "std" would result in the paths created during AST lowering being resolved incorrectly (or not at all). Co-authored-by: Matthew Jasper <mjjasper1@gmail.com> Signed-off-by: David Wood <david@davidtw.co>
2020-08-15replaced log with tracingGurpreet Singh-1/+1
2020-08-13merge `as_local_hir_id` with `local_def_id_to_hir_id`Bastian Kauschke-2/+2
2020-08-08Eliminate the `SessionGlobals` from `librustc_ast`.Nicholas Nethercote-16/+17
By moving `{known,used}_attrs` from `SessionGlobals` to `Session`. This means they are accessed via the `Session`, rather than via TLS. A few `Attr` methods and `librustc_ast` functions are now methods of `Session`. All of this required passing a `Session` to lots of functions that didn't already have one. Some of these functions also had arguments removed, because those arguments could be accessed directly via the `Session` argument. `contains_feature_attr()` was dead, and is removed. Some functions were moved from `librustc_ast` elsewhere because they now need to access `Session`, which isn't available in that crate. - `entry_point_type()` --> `librustc_builtin_macros` - `global_allocator_spans()` --> `librustc_metadata` - `is_proc_macro_attr()` --> `Session`
2020-08-04rustc_ast: `(Nested)MetaItem::check_name` -> `has_name`Vadim Petrochenkov-1/+1
For consistency with `Attribute::has_name` which doesn't mark the attribute as used either. Replace all uses of `check_name` with `has_name` outside of rustc
2020-07-31fix part of comparison that would always evaluate to "true", probably an ↵Matthias Krüger-1/+1
oversight
2020-07-30Fix missed same-sized member clash in ClashingExternDeclarations.jumbatm-5/+32
2020-07-30Address code review comments.jumbatm-63/+46
- Make `is_repr_nullable_ptr` freestanding again to avoid usage of ImproperCTypesVisitor in ClashingExternDeclarations (and don't accidentally revert the ParamEnv::reveal_all() fix from a week earlier) - Revise match condition for 1 Adt, 1 primitive - Generalise check for non-null type so that it would also work for ranges which exclude any single value (all bits set, for example) - Make is_repr_nullable_ptr return the representable type instead of just a boolean, to avoid adding an additional, independent "source of truth" about the FFI-compatibility of Option-like enums. Also, rename to `repr_nullable_ptr`.
2020-07-30Apply suggested wording changes from code review.jumbatm-1/+1
Co-authored-by: Teymour Aldridge <42674621+teymour-aldridge@users.noreply.github.com>
2020-07-30Don't emit clashing decl lint for FFI-safe enums.jumbatm-9/+60
An example of an FFI-safe enum conversion is when converting Option<NonZeroUsize> to usize. Because the Some value must be non-zero, rustc can use 0 to represent the None variant, making this conversion is safe. Furthermore, it can be relied on (and removing this optimisation already would be a breaking change).
2020-07-27fix rebaseBastian Kauschke-2/+0
2020-07-27introduce PredicateAtomBastian Kauschke-7/+6
2020-07-27this might be unqualified, but at least it's now quantifiedBastian Kauschke-3/+3
2020-07-27split ignore_qualifiersBastian Kauschke-17/+7
2020-07-27`PredicateKint` -> `PredicateKind`, the beginning of the endBastian Kauschke-18/+24
2020-07-27progressBastian Kauschke-2/+5
2020-07-17Rollup merge of #74438 - RalfJung:uninit-lint, r=davidtwcoManish Goregaokar-5/+23
warn about uninitialized multi-variant enums Fixes https://github.com/rust-lang/rust/issues/73608
2020-07-17warn about uninit multi-variant enumsRalf Jung-5/+23
2020-07-17Rename TypeckTables to TypeckResults.Valentin Lazureanu-6/+6
2020-07-03Use 'tcx for references to AccessLevels wherever possible.Eduard-Mihai Burtescu-61/+53
2020-07-02rustc_lint: avoid using TypeckTables::empty for LateContext.Eduard-Mihai Burtescu-5/+4
2020-06-30change `skip_binder` to use T by valueBastian Kauschke-1/+1
2020-06-28Rename the lint to clashing_extern_declarations.jumbatm-9/+9
Also, run RustFmt on the clashing_extern_fn test case and update stderrs.
2020-06-26rustc_lint: only query `typeck_tables_of` when a lint needs it.Eduard-Mihai Burtescu-10/+10
2020-06-21Make is_freeze and is_copy_modulo_regions take TyCtxtAtRalf Jung-1/+1
2020-06-20Add ClashingExternDecl lint.jumbatm-5/+226
This lint checks that all declarations for extern fns of the same name are declared with the same types.
2020-06-15Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakisbors-0/+4
Clean up type alias impl trait implementation - Removes special case for top-level impl trait - Removes associated opaque types - Forbid lifetime elision in let position impl trait. This is consistent with the behavior for inferred types. - Handle lifetimes in type alias impl trait more uniformly with other parameters cc #69323 cc #63063 Closes #57188 Closes #62988 Closes #69136 Closes #73061
2020-06-11Rename `TyKind::Def` to `OpaqueDef`Matthew Jasper-1/+1
2020-06-11Stop special casing top level TAITMatthew Jasper-0/+4
2020-06-10Track span of function in method calls, and use this in #[track_caller]Aaron Hill-1/+1
Fixes #69977 When we parse a chain of method calls like `foo.a().b().c()`, each `MethodCallExpr` gets assigned a span that starts at the beginning of the call chain (`foo`). While this is useful for diagnostics, it means that `Location::caller` will return the same location for every call in a call chain. This PR makes us separately record the span of the function name and arguments for a method call (e.g. `b()` in `foo.a().b().c()`). This `Span` is passed through HIR lowering and MIR building to `TerminatorKind::Call`, where it is used in preference to `Terminator.source_info.span` when determining `Location::caller`. This new span is also useful for diagnostics where we want to emphasize a particular method call - for an example, see https://github.com/rust-lang/rust/pull/72389#discussion_r436035990
2020-05-20introduce newtype'd `Predicate<'tcx>`Bastian Kauschke-3/+3
2020-05-20rename `Predicate` to `PredicateKind`, introduce aliasBastian Kauschke-3/+3