| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2020-07-11 | Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJung | Manish Goregaokar | -9/+1 | |
| Stabilize `transmute` in constants and statics but not const fn cc #53605 (leaving issue open so we can add `transmute` to `const fn` later) Previous attempt: #64011 r? @RalfJung cc @rust-lang/wg-const-eval | ||||
| 2020-07-11 | Stabilize `transmute` in constants and statics but not const fn | Oliver Scherer | -9/+1 | |
| 2020-07-10 | Avoid "whitelist" | Tamir Duberstein | -20/+20 | |
| Other terms are more inclusive and precise. | ||||
| 2020-07-07 | Auto merge of #74117 - Manishearth:rollup-ds7z0kx, r=Manishearth | bors | -1/+1 | |
| Rollup of 14 pull requests Successful merges: - #70563 ([rustdoc] Page hash handling) - #73856 (Edit librustc_lexer top-level docs) - #73870 (typeck: adding type information to projection) - #73953 (Audit hidden/short code suggestions) - #73962 (libstd/net/tcp.rs: #![deny(unsafe_op_in_unsafe_fn)]) - #73969 (mir: mark mir construction temporaries as internal) - #73974 (Move A|Rc::as_ptr from feature(weak_into_raw) to feature(rc_as_ptr)) - #74067 (rustdoc: Restore underline text decoration on hover for FQN in header) - #74074 (Fix the return type of Windows' `OpenOptionsExt::security_qos_flags`.) - #74078 (Always resolve type@primitive as a primitive, not a module) - #74089 (Add rust-analyzer to the build manifest) - #74090 (Remove unused RUSTC_DEBUG_ASSERTIONS) - #74102 (Fix const prop ICE) - #74112 (Expand abbreviation in core::ffi description) Failed merges: r? @ghost | ||||
| 2020-07-06 | Rollup merge of #73870 - sexxi-goose:projection-ty, r=nikomatsakis | Manish Goregaokar | -1/+1 | |
| typeck: adding type information to projection This commit modifies the Place as follow: * remove 'ty' from ProjectionKind * add type information into to Projection * replace 'ty' in Place with 'base_ty' * introduce 'ty()' in `Place` to return the final type of the `Place` * introduce `ty_before_projection()` in `Place` to return the type of a `Place` before i'th projection is applied Closes https://github.com/rust-lang/project-rfc-2229/issues/5 | ||||
| 2020-07-06 | Auto merge of #73978 - Mark-Simulacrum:shrink-paramenv, r=nnethercote | bors | -1/+1 | |
| Shrink ParamEnv to 16 bytes r? @nnethercote x.py check passes but I haven't tried running perf or tests | ||||
| 2020-07-05 | Shrink ParamEnv to 16 bytes | Mark Rousskov | -1/+1 | |
| 2020-07-03 | Use 'tcx for references to AccessLevels wherever possible. | Eduard-Mihai Burtescu | -1041/+966 | |
| 2020-07-02 | rustc_lint: avoid using TypeckTables::empty for LateContext. | Eduard-Mihai Burtescu | -69/+70 | |
| 2020-06-29 | typeck: adding type information to projection | Azhng | -1/+1 | |
| This commit modifies the Place as follow: * remove 'ty' from ProjectionKind * add type information into to Projection * replace 'ty' in Place with 'base_ty' * introduce 'ty()' in `Place` to return the final type of the `Place` * introduce `ty_before_projection()` in `Place` to return the type of a `Place` before i'th projection is applied Closes https://github.com/rust-lang/project-rfc-2229/issues/5 | ||||
| 2020-06-28 | Update tests | Dylan MacKenzie | -42/+34 | |
| 2020-06-26 | Auto merge of #73756 - Manishearth:rollup-aehswb2, r=Manishearth | bors | -1/+1 | |
| Rollup of 13 pull requests Successful merges: - #72620 (Omit DW_AT_linkage_name when it is the same as DW_AT_name) - #72967 (Don't move cursor in search box when using arrows to navigate results) - #73102 (proc_macro: Stop flattening groups with dummy spans) - #73297 (Support configurable deny-warnings for all in-tree crates.) - #73507 (Cleanup MinGW LLVM linkage workaround) - #73588 (Fix handling of reserved registers for ARM inline asm) - #73597 (Record span of `const` kw in GenericParamKind) - #73629 (Make AssocOp Copy) - #73681 (Update Chalk to 0.14) - #73707 (Fix links in `SliceIndex` documentation) - #73719 (emitter: column width defaults to 140) - #73729 (disable collectionbenches for android) - #73748 (Add code block to code in documentation of `List::rebase_onto`) Failed merges: r? @ghost | ||||
| 2020-06-26 | Rollup merge of #73597 - ayazhafiz:i/const-span, r=ecstatic-morse | Manish Goregaokar | -1/+1 | |
| Record span of `const` kw in GenericParamKind Context: this is needed for a fix of https://github.com/rust-lang/rustfmt/issues/4263, which currently records the span of a const generic param incorrectly because the location of the `const` kw is not known. I am not sure how to add tests for this; any guidance in how to do so would be appreciated :slightly_smiling_face: | ||||
| 2020-06-26 | rustc_lint: only query `typeck_tables_of` when a lint needs it. | Eduard-Mihai Burtescu | -366/+361 | |
| 2020-06-23 | Record span of `const` kw in GenericParamKind | Ayaz Hafiz | -1/+1 | |
| Context: this is needed to fix https://github.com/rust-lang/rustfmt/issues/4263, which currently records the span of a const generic param incorrectly because the location of the `const` kw is not known. I am not sure how to add tests for this; any guidance in how to do so would be appreciated :slightly_smiling_face: | ||||
| 2020-06-23 | Merge commit 'c2c07fa9d095931eb5684a42942a7b573a0c5238' into clippyup | flip1995 | -293/+1077 | |
| 2020-06-23 | Rollup merge of #73578 - RalfJung:ty-ctxt-at, r=jonas-schievink | Dylan DPC | -7/+6 | |
| Make is_freeze and is_copy_modulo_regions take TyCtxtAt Make is_freeze and is_copy_modulo_regions take TyCtxtAt instead of separately taking TyCtxt and Span. This is consistent with is_sized. | ||||
| 2020-06-22 | Stop using old version of `syn` in `rustc-workspace-hack` | Aaron Hill | -1/+3 | |
| None of the tools seem to need syn 0.15.35, so we can just build syn 1.0. This was causing an issue with clippy's `compile-test` program: since multiple versions of `syn` would exist in the build directory, we would non-deterministically pick one based on filesystem iteration order. If the pre-1.0 version of `syn` was picked, a strange build error would occur (see https://github.com/rust-lang/rust/pull/73594#issuecomment-647671463) To prevent this kind of issue from happening again, we now panic if we find multiple versions of a crate in the build directly, instead of silently picking the first version we find. | ||||
| 2020-06-21 | Make is_freeze and is_copy_modulo_regions take TyCtxtAt | Ralf Jung | -7/+6 | |
| 2020-06-18 | Refactor hir::Place | Aman Arora | -36/+38 | |
| For the following code ```rust let c = || bar(foo.x, foo.x) ``` We generate two different `hir::Place`s for both `foo.x`. Handling this adds overhead for analysis we need to do for RFC 2229. We also want to store type information at each Projection to support analysis as part of the RFC. This resembles what we have for `mir::Place` This commit modifies the Place as follows: - Rename to `PlaceWithHirId`, where there `hir_id` is that of the expressioin. - Move any other information that describes the access out to another struct now called `Place`. - Removed `Span`, it can be accessed using the [hir API](https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/hir/map/struct.Map.html#method.span) - Modify `Projection` to be a strucutre of its own, that currently only contains the `ProjectionKind`. Adding type information to projections wil be completed as part of https://github.com/rust-lang/project-rfc-2229/issues/5 Closes https://github.com/rust-lang/project-rfc-2229/issues/3 Co-authored-by: Aman Arora <me@aman-arora.com> Co-authored-by: Roxane Fruytier <roxane.fruytier@hotmail.com> | ||||
| 2020-06-15 | Rollup merge of #72938 - lzutao:stabilize_option_zip, r=dtolnay | Ralf Jung | -10/+5 | |
| Stabilize Option::zip This PR stabilizes the following API: ```rust impl<T> Option<T> { pub fn zip<U>(self, other: Option<U>) -> Option<(T, U)>; } ``` This API has real world usage as seen in <https://grep.app/search?q=-%3E%20Option%3C%5C%28T%2C%5Cs%3FU%5C%29%3E®exp=true&filter[lang][0]=Rust>. The `zip_with` method is left unstably as this API is kinda niche and it hasn't received much usage in Rust repositories on GitHub. cc #70086 | ||||
| 2020-06-15 | Auto merge of #72080 - matthewjasper:uniform-impl-trait, r=nikomatsakis | bors | -6/+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-13 | Stabilize Option::zip | Lzu Tao | -10/+5 | |
| 2020-06-12 | Rollup merge of #72906 - lzutao:migrate-numeric-assoc-consts, r=dtolnay | Dylan DPC | -51/+51 | |
| Migrate to numeric associated consts The deprecation PR is #72885 cc #68490 cc rust-lang/rfcs#2700 | ||||
| 2020-06-11 | Remove ImplItemKind::OpaqueTy from clippy | Matthew Jasper | -3/+1 | |
| 2020-06-11 | Remove associated opaque types | Matthew Jasper | -3/+3 | |
| They're unused now. | ||||
| 2020-06-10 | Clippy fixes | Aaron Hill | -5/+5 | |
| 2020-06-10 | Update Clippy for MethodCall changes | Aaron Hill | -89/+89 | |
| 2020-06-10 | Migrate to numeric associated consts | Lzu Tao | -51/+51 | |
| 2020-06-09 | Merge commit 'ff0993c5e9162ddaea78e83d0f0161e68bd4ea73' into clippy | Lzu Tao | -914/+3943 | |
| 2020-06-06 | Rollup merge of #72508 - ecstatic-morse:poly-self-ty, r=nikomatsakis | Ralf Jung | -1/+1 | |
| Make `PolyTraitRef::self_ty` return `Binder<Ty>` This came up during review of #71618. The current implementation is the same as a call to `skip_binder` but harder to audit. Make it preserve binding levels and add a call to `skip_binder` at all use sites so they can be audited as part of #72507. | ||||
| 2020-06-06 | Auto merge of #72927 - petrochenkov:rustc, r=Mark-Simulacrum | bors | -3/+3 | |
| Rename all remaining compiler crates to use the `rustc_foo` pattern libarena -> librustc_arena libfmt_macros -> librustc_parse_format libgraphviz -> librustc_graphviz libserialize -> librustc_serialize Closes https://github.com/rust-lang/rust/issues/71177 in particular. | ||||
| 2020-06-03 | Bump to 1.46 | Mark Rousskov | -4/+4 | |
| 2020-06-03 | Update fulldeps tests and clippy | Vadim Petrochenkov | -2/+2 | |
| 2020-06-02 | Rename the crates in source code | Vadim Petrochenkov | -1/+1 | |
| 2020-06-01 | Call `skip_binder` or `no_bound_vars` before `self_ty` | Dylan MacKenzie | -1/+1 | |
| 2020-05-30 | Return early to avoid ICE | Yuki Okushi | -0/+5 | |
| 2020-05-29 | Auto merge of #72671 - flip1995:clippyup, r=Xanewok | bors | -433/+1553 | |
| Update Clippy, RLS, and rustfmt r? @Dylan-DPC This makes Clippy test-pass again: 3089c3b Otherwise this includes bugfixes and a few new lints. Fixes #72231 Fixes #72232 | ||||
| 2020-05-29 | Rollup merge of #72466 - lzutao:stabilize_str-strip, r=dtolnay | Dylan DPC | -1/+0 | |
| Stabilize str_strip feature This PR stabilizes these APIs: ```rust impl str { /// Returns a string slice with the prefix removed. /// /// If the string starts with the pattern `prefix`, `Some` is returned with the substring where /// the prefix is removed. Unlike `trim_start_matches`, this method removes the prefix exactly /// once. pub fn strip_prefix<'a, P: Pattern<'a>>(&'a self, prefix: P) -> Option<&'a str>; /// Returns a string slice with the suffix removed. /// /// If the string ends with the pattern `suffix`, `Some` is returned with the substring where /// the suffix is removed. Unlike `trim_end_matches`, this method removes the suffix exactly /// once. pub fn strip_suffix<'a, P>(&'a self, suffix: P) -> Option<&'a str> where P: Pattern<'a>, <P as Pattern<'a>>::Searcher: ReverseSearcher<'a>; } ``` Closes #67302 | ||||
| 2020-05-28 | Temp fix: don't run cargo lint tests in rustc test suite | flip1995 | -0/+3 | |
| 2020-05-28 | Merge commit '7ea7cd165ad6705603852771bf82cc2fd6560db5' into clippyup2 | flip1995 | -433/+1550 | |
| 2020-05-23 | iterate List by value | Bastian Kauschke | -2/+1 | |
| 2020-05-22 | Use `OnceCell` instead of `Once` | Dylan MacKenzie | -1/+1 | |
| 2020-05-22 | Stabilize str_strip feature | Lzu Tao | -1/+0 | |
| 2020-05-20 | introduce newtype'd `Predicate<'tcx>` | Bastian Kauschke | -6/+6 | |
| 2020-05-20 | rename `Predicate` to `PredicateKind`, introduce alias | Bastian Kauschke | -5/+5 | |
| 2020-05-19 | Auto merge of #69171 - Amanieu:new-asm, r=nagisa,nikomatsakis | bors | -7/+104 | |
| Implement new asm! syntax from RFC 2850 This PR implements the new `asm!` syntax proposed in https://github.com/rust-lang/rfcs/pull/2850. # Design A large part of this PR revolves around taking an `asm!` macro invocation and plumbing it through all of the compiler layers down to LLVM codegen. Throughout the various stages, an `InlineAsm` generally consists of 3 components: - The template string, which is stored as an array of `InlineAsmTemplatePiece`. Each piece represents either a literal or a placeholder for an operand (just like format strings). ```rust pub enum InlineAsmTemplatePiece { String(String), Placeholder { operand_idx: usize, modifier: Option<char>, span: Span }, } ``` - The list of operands to the `asm!` (`in`, `[late]out`, `in[late]out`, `sym`, `const`). These are represented differently at each stage of lowering, but follow a common pattern: - `in`, `out` and `inout` all have an associated register class (`reg`) or explicit register (`"eax"`). - `inout` has 2 forms: one with a single expression that is both read from and written to, and one with two separate expressions for the input and output parts. - `out` and `inout` have a `late` flag (`lateout` / `inlateout`) to indicate that the register allocator is allowed to reuse an input register for this output. - `out` and the split variant of `inout` allow `_` to be specified for an output, which means that the output is discarded. This is used to allocate scratch registers for assembly code. - `sym` is a bit special since it only accepts a path expression, which must point to a `static` or a `fn`. - The options set at the end of the `asm!` macro. The only one that is particularly of interest to rustc is `NORETURN` which makes `asm!` return `!` instead of `()`. ```rust bitflags::bitflags! { pub struct InlineAsmOptions: u8 { const PURE = 1 << 0; const NOMEM = 1 << 1; const READONLY = 1 << 2; const PRESERVES_FLAGS = 1 << 3; const NORETURN = 1 << 4; const NOSTACK = 1 << 5; } } ``` ## AST `InlineAsm` is represented as an expression in the AST: ```rust pub struct InlineAsm { pub template: Vec<InlineAsmTemplatePiece>, pub operands: Vec<(InlineAsmOperand, Span)>, pub options: InlineAsmOptions, } pub enum InlineAsmRegOrRegClass { Reg(Symbol), RegClass(Symbol), } pub enum InlineAsmOperand { In { reg: InlineAsmRegOrRegClass, expr: P<Expr>, }, Out { reg: InlineAsmRegOrRegClass, late: bool, expr: Option<P<Expr>>, }, InOut { reg: InlineAsmRegOrRegClass, late: bool, expr: P<Expr>, }, SplitInOut { reg: InlineAsmRegOrRegClass, late: bool, in_expr: P<Expr>, out_expr: Option<P<Expr>>, }, Const { expr: P<Expr>, }, Sym { expr: P<Expr>, }, } ``` The `asm!` macro is implemented in librustc_builtin_macros and outputs an `InlineAsm` AST node. The template string is parsed using libfmt_macros, positional and named operands are resolved to explicit operand indicies. Since target information is not available to macro invocations, validation of the registers and register classes is deferred to AST lowering. ## HIR `InlineAsm` is represented as an expression in the HIR: ```rust pub struct InlineAsm<'hir> { pub template: &'hir [InlineAsmTemplatePiece], pub operands: &'hir [InlineAsmOperand<'hir>], pub options: InlineAsmOptions, } pub enum InlineAsmRegOrRegClass { Reg(InlineAsmReg), RegClass(InlineAsmRegClass), } pub enum InlineAsmOperand<'hir> { In { reg: InlineAsmRegOrRegClass, expr: Expr<'hir>, }, Out { reg: InlineAsmRegOrRegClass, late: bool, expr: Option<Expr<'hir>>, }, InOut { reg: InlineAsmRegOrRegClass, late: bool, expr: Expr<'hir>, }, SplitInOut { reg: InlineAsmRegOrRegClass, late: bool, in_expr: Expr<'hir>, out_expr: Option<Expr<'hir>>, }, Const { expr: Expr<'hir>, }, Sym { expr: Expr<'hir>, }, } ``` AST lowering is where `InlineAsmRegOrRegClass` is converted from `Symbol`s to an actual register or register class. If any modifiers are specified for a template string placeholder, these are validated against the set allowed for that operand type. Finally, explicit registers for inputs and outputs are checked for conflicts (same register used for different operands). ## Type checking Each register class has a whitelist of types that it may be used with. After the types of all operands have been determined, the `intrinsicck` pass will check that these types are in the whitelist. It also checks that split `inout` operands have compatible types and that `const` operands are integers or floats. Suggestions are emitted where needed if a template modifier should be used for an operand based on the type that was passed into it. ## HAIR `InlineAsm` is represented as an expression in the HAIR: ```rust crate enum ExprKind<'tcx> { // [..] InlineAsm { template: &'tcx [InlineAsmTemplatePiece], operands: Vec<InlineAsmOperand<'tcx>>, options: InlineAsmOptions, }, } crate enum InlineAsmOperand<'tcx> { In { reg: InlineAsmRegOrRegClass, expr: ExprRef<'tcx>, }, Out { reg: InlineAsmRegOrRegClass, late: bool, expr: Option<ExprRef<'tcx>>, }, InOut { reg: InlineAsmRegOrRegClass, late: bool, expr: ExprRef<'tcx>, }, SplitInOut { reg: InlineAsmRegOrRegClass, late: bool, in_expr: ExprRef<'tcx>, out_expr: Option<ExprRef<'tcx>>, }, Const { expr: ExprRef<'tcx>, }, SymFn { expr: ExprRef<'tcx>, }, SymStatic { expr: ExprRef<'tcx>, }, } ``` The only significant change compared to HIR is that `Sym` has been lowered to either a `SymFn` whose `expr` is a `Literal` ZST of the `fn`, or a `SymStatic` whose `expr` is a `StaticRef`. ## MIR `InlineAsm` is represented as a `Terminator` in the MIR: ```rust pub enum TerminatorKind<'tcx> { // [..] /// Block ends with an inline assembly block. This is a terminator since /// inline assembly is allowed to diverge. InlineAsm { /// The template for the inline assembly, with placeholders. template: &'tcx [InlineAsmTemplatePiece], /// The operands for the inline assembly, as `Operand`s or `Place`s. operands: Vec<InlineAsmOperand<'tcx>>, /// Miscellaneous options for the inline assembly. options: InlineAsmOptions, /// Destination block after the inline assembly returns, unless it is /// diverging (InlineAsmOptions::NORETURN). destination: Option<BasicBlock>, }, } pub enum InlineAsmOperand<'tcx> { In { reg: InlineAsmRegOrRegClass, value: Operand<'tcx>, }, Out { reg: InlineAsmRegOrRegClass, late: bool, place: Option<Place<'tcx>>, }, InOut { reg: InlineAsmRegOrRegClass, late: bool, in_value: Operand<'tcx>, out_place: Option<Place<'tcx>>, }, Const { value: Operand<'tcx>, }, SymFn { value: Box<Constant<'tcx>>, }, SymStatic { value: Box<Constant<'tcx>>, }, } ``` As part of HAIR lowering, `InOut` and `SplitInOut` operands are lowered to a split form with a separate `in_value` and `out_place`. Semantically, the `InlineAsm` terminator is similar to the `Call` terminator except that it has multiple output places where a `Call` only has a single return place output. The constant promotion pass is used to ensure that `const` operands are actually constants (using the same logic as `#[rustc_args_required_const]`). ## Codegen Operands are lowered one more time before being passed to LLVM codegen: ```rust pub enum InlineAsmOperandRef<'tcx, B: BackendTypes + ?Sized> { In { reg: InlineAsmRegOrRegClass, value: OperandRef<'tcx, B::Value>, }, Out { reg: InlineAsmRegOrRegClass, late: bool, place: Option<PlaceRef<'tcx, B::Value>>, }, InOut { reg: InlineAsmRegOrRegClass, late: bool, in_value: OperandRef<'tcx, B::Value>, out_place: Option<PlaceRef<'tcx, B::Value>>, }, Const { string: String, }, SymFn { instance: Instance<'tcx>, }, SymStatic { def_id: DefId, }, } ``` The operands are lowered to LLVM operands and constraint codes as follow: - `out` and the output part of `inout` operands are added first, as required by LLVM. Late output operands have a `=` prefix added to their constraint code, non-late output operands have a `=&` prefix added to their constraint code. - `in` operands are added normally. - `inout` operands are tied to the matching output operand. - `sym` operands are passed as function pointers or pointers, using the `"s"` constraint. - `const` operands are formatted to a string and directly inserted in the template string. The template string is converted to LLVM form: - `$` characters are escaped as `$$`. - `const` operands are converted to strings and inserted directly. - Placeholders are formatted as `${X:M}` where `X` is the operand index and `M` is the modifier character. Modifiers are converted from the Rust form to the LLVM form. The various options are converted to clobber constraints or LLVM attributes, refer to the [RFC](https://github.com/Amanieu/rfcs/blob/inline-asm/text/0000-inline-asm.md#mapping-to-llvm-ir) for more details. Note that LLVM is sometimes rather picky about what types it accepts for certain constraint codes so we sometimes need to insert conversions to/from a supported type. See the target-specific ISelLowering.cpp files in LLVM for details. # Adding support for new architectures Adding inline assembly support to an architecture is mostly a matter of defining the registers and register classes for that architecture. All the definitions for register classes are located in `src/librustc_target/asm/`. Additionally you will need to implement lowering of these register classes to LLVM constraint codes in `src/librustc_codegen_llvm/asm.rs`. | ||||
| 2020-05-19 | Auto merge of #68717 - petrochenkov:stabexpat, r=varkor | bors | -3/+2 | |
| Stabilize fn-like proc macros in expression, pattern and statement positions I.e. all the positions in which stable `macro_rules` macros are supported. Depends on https://github.com/rust-lang/rust/pull/68716 ("Stabilize `Span::mixed_site`"). cc https://github.com/rust-lang/rust/issues/54727 cc https://github.com/rust-lang/rust/issues/54727#issuecomment-580647446 Stabilization report: https://github.com/rust-lang/rust/pull/68717#issuecomment-623197503. | ||||
| 2020-05-18 | Handle InlineAsm in clippy | Amanieu d'Antras | -7/+104 | |
| 2020-05-17 | Merge commit 'e214ea82ad0a751563acf67e1cd9279cf302db3a' into clippyup | flip1995 | -1102/+1770 | |
