about summary refs log tree commit diff
path: root/src/test
AgeCommit message (Collapse)AuthorLines
2020-11-28Auto merge of #79469 - rust-lang:revert-77467-query-docs, r=jyn514bors-0/+1
Revert "Normalize `<X as Y>::T` for rustdoc" Reverts rust-lang/rust#77467 by disabling normalization. See https://github.com/rust-lang/rust/issues/79459; I intend to reland normalization once that's fixed. r? `@Aaron1011` cc `@oli-obk` `@GuillaumeGomez`
2020-11-27Auto merge of #79372 - jyn514:more-cleanup, r=GuillaumeGomezbors-2/+1
Cleanup more of rustdoc - Use `Item::from_def_id` for StructField - Use `from_def_id_and_parts` for primitives and keywords - Take `String` instead of `Symbol` in `from_def_id` - this avoids having to intern then immediately stringify the existing string. - Remove unused `get_stability` and `get_deprecation` - Remove unused `attrs` field from `primitives` - Remove unused `attrs` field from `keywords` This will probably conflict with https://github.com/rust-lang/rust/pull/79335 and I would prefer for that PR to land first - I'm anxious for https://github.com/rust-lang/rust/pull/77467 to land :) Makes https://github.com/rust-lang/rust/issues/76998 easier to add. r? `@GuillaumeGomez`
2020-11-27Revert the effect of #77467 by disabling normalization in rustdocoli-0/+1
2020-11-27Auto merge of #79318 - cjgillot:fitem, r=lcnrbors-104/+79
Store HIR ForeignItem in a side table In a similar fashion to Item, ImplItem and TraitItem.
2020-11-27Auto merge of #79266 - b-naber:gat_trait_path_parser, r=petrochenkovbors-32/+346
Generic Associated Types in Trait Paths - Ast part The Ast part of https://github.com/rust-lang/rust/pull/78978 r? `@petrochenkov`
2020-11-26Auto merge of #79338 - Aaron1011:fix/token-reparse-cache, r=petrochenkovbors-0/+50
Cache pretty-print/retokenize result to avoid compile time blowup Fixes #79242 If a `macro_rules!` recursively builds up a nested nonterminal (passing it to a proc-macro at each step), we will end up repeatedly pretty-printing/retokenizing the same nonterminals. Unfortunately, the 'probable equality' check we do has a non-trivial cost, which leads to a blowup in compilation time. As a workaround, we cache the result of the 'probable equality' check, which eliminates the compilation time blowup for the linked issue. This commit only touches a single file (other than adding tests), so it should be easy to backport. The proper solution is to remove the pretty-print/retokenize hack entirely. However, this will almost certainly break a large number of crates that were relying on hygiene bugs created by using the reparsed `TokenStream`. As a result, we will definitely not want to backport such a change.
2020-11-26Bless test.Camille GILLOT-8/+8
2020-11-26Update test.Camille GILLOT-78/+53
2020-11-26Store ForeignItem in a side table.Camille GILLOT-18/+18
2020-11-26Update coverage output now that primitives have proper spansJoshua Nelson-2/+1
2020-11-26Auto merge of #77467 - jyn514:query-docs, r=oli-obkbors-0/+80
Normalize `<X as Y>::T` for rustdoc - Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved The first commit is a pure refactor and should probably be reviewed by `@GuillaumeGomez.` I recommend reviewing the second commit on its own. Fixes https://github.com/rust-lang/rust/issues/77459. r? `@eddyb` cc `@danielhenrymantilla` , `@lcnr`
2020-11-26Auto merge of #79441 - jonas-schievink:rollup-l9v00bl, r=jonas-schievinkbors-42/+138
Rollup of 10 pull requests Successful merges: - #77758 (suggest turbofish syntax for uninferred const arguments) - #79000 (Move lev_distance to rustc_ast, make non-generic) - #79362 (Lower patterns before using the bound variable) - #79365 (Upgrades the coverage map to Version 4) - #79402 (Fix typos) - #79412 (Clean up rustdoc tests by removing unnecessary features) - #79413 (Fix persisted doctests on Windows / when using workspaces) - #79420 (Fixes a word typo in librustdoc) - #79421 (Fix docs formatting for `thir::pattern::_match`) - #79428 (Fixup compiler docs) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-26Rollup merge of #79412 - GuillaumeGomez:cleanup-rustdoc-tests, r=jyn514Jonas Schievink-36/+15
Clean up rustdoc tests by removing unnecessary features r? ``@jyn514``
2020-11-26Rollup merge of #79365 - richkadel:llvm-cov-map-version-4, r=wesleywiserJonas Schievink-3/+40
Upgrades the coverage map to Version 4 Changes the coverage map injected into binaries compiled with `-Zinstrument-coverage` to LLVM Coverage Mapping Format, Version 4 (from Version 3). Note, binaries compiled with this version will require LLVM tools from at least LLVM Version 11. r? ``@wesleywiser``
2020-11-26Rollup merge of #77758 - Stupremee:turbofish-help-for-const, r=varkorJonas Schievink-3/+83
suggest turbofish syntax for uninferred const arguments When not providing a const generic value, and it can not be inferred, the following suggestion is suggested: ![image](https://user-images.githubusercontent.com/39732259/95616180-af127b80-0a69-11eb-8877-551c815f9627.png) Resolves #76737 r? ``@varkor``
2020-11-26Auto merge of #79427 - Aaron1011:fix/const-array-index, r=oli-obkbors-0/+11
Resolve inference variables before trying to remove overloaded indexing Fixes #79152 This code was already set up to handle indexing an array. However, it appears that we never end up with an inference variable for the slice case, so the missing call to `resolve_vars_if_possible` had no effect until now.
2020-11-25Resolve inference variables before trying to remove overloaded indexingAaron Hill-0/+11
Fixes #79152 This code was already set up to handle indexing an array. However, it appears that we never end up with an inference variable for the slice case, so the missing call to `resolve_vars_if_possible` had no effect until now.
2020-11-25Auto merge of #79411 - tmiasko:naked-params, r=Amanieubors-49/+100
Validate use of parameters in naked functions * Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings. Closes issues below by considering input to be ill-formed. Closes #75922. Closes #77848. Closes #79350.
2020-11-25add testsb-naber-32/+346
2020-11-25Auto merge of #79326 - Aaron1011:fix/builtin-macro-stmt, r=petrochenkovbors-4/+524
Always invoke statement attributes on the statement itself This is preparation for PR #78296, which will require us to handle statement items in addition to normal items.
2020-11-25Clean up rustdoc tests by removing unnecessary featuresGuillaume Gomez-36/+15
2020-11-25Auto merge of #79388 - tmiasko:naked-def-only, r=lcnrbors-13/+94
Validate that `#[naked]` is applied to a function definition
2020-11-25Auto merge of #79336 - camelid:rename-feature-oibit-to-auto, r=oli-obkbors-56/+56
Rename `optin_builtin_traits` to `auto_traits` They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>. r? `@oli-obk` (feel free to re-assign if you're not the right reviewer for this)
2020-11-24Apply suggestions from code reviewRich Kadel-1/+1
Co-authored-by: Wesley Wiser <wwiser@gmail.com>
2020-11-24Use the name "auto traits" everywhere in the compilerCamelid-17/+17
Goodbye, OIBIT!
2020-11-25Validate use of parameters in naked functionsTomasz Miąsko-49/+100
* Reject use of parameters inside naked function body. * Reject use of patterns inside function parameters, to emphasize role of parameters a signature declaration (mirroring existing behaviour for function declarations) and avoid generating code introducing specified bindings.
2020-11-24Invoke attributes on the statement for statement itemsAaron Hill-4/+524
2020-11-24Check for LLVM 11+ when using `-Z instrument-coverage`Rich Kadel-2/+30
* `rustc` should now compile under LLVM 9 or 10 * Compiler generates an error if `-Z instrument-coverage` is specified but LLVM version is less than 11 * Coverage tests that require `-Z instrument-coverage` and run codegen should be skipped if LLVM version is less than 11
2020-11-24Track `ParamEnv`s properlyJoshua Nelson-1/+6
This uses the same `with_param_env` pattern that late lints use. Thanks to all the doctree refactors, this was very easy to add.
2020-11-24Normalize `<X as Y>::T` for rustdocJoshua Nelson-0/+75
- Only run for `QPath::Resolved` with `Some` self parameter (`<X as Y>::T`) - Fall back to the previous behavior if the path can't be resolved - Show what the behavior is if the type can't be normalized - Run `resolve_vars_if_possible` It's not clear whether or not this is necessary. See https://github.com/rust-lang/rust/pull/77616 for more context. - Add a test for cross-crate re-exports - Use the same code for both `hir::Ty` and `Ty`
2020-11-24Get rid of doctree::FunctionJoshua Nelson-8/+8
2020-11-24Rollup merge of #79374 - mendess:const-param-expr-diagnostic, r=lcnrJonas Schievink-53/+111
Add note to use nightly when using expr in const generics As recommended by `@Icnr` in #73899 and in zulip, I've added a note saying that const expressions can be used in nightly. ``` error: generic parameters may not be used in const operations --> $DIR/issue-61935.rs:10:23 | 6 | Self:FooImpl<{N==0}> | ^ cannot perform const operation using `N` | = help: const parameters may only be used as standalone arguments, i.e. `N` = note: use feature(const_generics) and feature(const_evaluatable_checked) to enable this error: aborting due to previous error ``` I hope the note is well written :sweat_smile:
2020-11-24Rollup merge of #79346 - tmiasko:more-names, r=jonas-schievinkJonas Schievink-0/+20
Allow using `-Z fewer-names=no` to retain value names Change `-Z fewer-names` into an optional boolean flag and allow using it to either discard value names when true or retain them when false, regardless of other settings.
2020-11-24Rollup merge of #79321 - camelid:intra-doc-bang, r=ManishearthJonas Schievink-0/+3
Accept '!' in intra-doc links This will allow linking to things like `Result<T, !>`. *See <https://github.com/rust-lang/rust/pull/77832#discussion_r528409079>.* r? ``@jyn514``
2020-11-24Rollup merge of #79312 - jyn514:doctree-impl, r=GuillaumeGomezJonas Schievink-9/+9
Get rid of `doctree::Impl` Follow-up to https://github.com/rust-lang/rust/pull/79264, continues breaking up https://github.com/rust-lang/rust/pull/78082. At some point I want to introduce `MaybeInlined`, but I think I'll wait until I need `MaybeInlined::InlinedWithOriginal` because it's not very useful in other situations. r? ``@GuillaumeGomez``
2020-11-24Swap note for helpmendess-111/+111
2020-11-24Requested changesmendess-40/+58
2020-11-24Add note to use nightly when using expr in const genericsmendess-0/+40
2020-11-24Auto merge of #79294 - petrochenkov:determ, r=varkorbors-88/+95
resolve: Do not put macros into `module.unexpanded_invocations` unless necessary Macro invocations in modules <sup>(*)</sup> need to be tracked because they can produce named items when expanded. We cannot give definite answer to queries like "does this module declare name `n`?" until all macro calls in that module are expanded. Previously we marked too many macros as potentially producing named items. E.g. in this example ```rust mod m { const C: u32 = line!(); } ``` `line!()` cannot emit any items into module `m`, but it was still marked. This PR fixes that and marks macro calls as "unexpanded in module" only if they can actually emit named items into that module. Diagnostics in UI test outputs have different order now because this change affects macro expansion order. <sup>*</sup> Any containers for named items are called modules in resolve (that includes blocks, traits and enums in addition to `mod` items).
2020-11-24Validate that `#[naked]` is applied to a function definitionTomasz Miąsko-13/+94
2020-11-23Upgrades the coverage map to Version 4Rich Kadel-1/+10
Changes the coverage map injected into binaries compiled with `-Zinstrument-coverage` to LLVM Coverage Mapping Format, Version 4 (from Version 3). Note, binaries compiled with this version will require LLVM tools from at least LLVM Version 11.
2020-11-23Rename `optin_builtin_traits` to `auto_traits`Camelid-39/+39
They were originally called "opt-in, built-in traits" (OIBITs), but people realized that the name was too confusing and a mouthful, and so they were renamed to just "auto traits". The feature flag's name wasn't updated, though, so that's what this PR does. There are some other spots in the compiler that still refer to OIBITs, but I don't think changing those now is worth it since they are internal and not particularly relevant to this PR. Also see <https://rust-lang.zulipchat.com/#narrow/stream/131828-t-compiler/topic/opt-in.2C.20built-in.20traits.20(auto.20traits).20feature.20name>.
2020-11-23Auto merge of #78343 - camelid:macros-qualify-panic, r=m-ou-sebors-467/+445
Qualify `panic!` as `core::panic!` in non-built-in `core` macros Fixes #78333. ----- Otherwise code like this #![no_implicit_prelude] fn main() { ::std::todo!(); ::std::unimplemented!(); } will fail to compile, which is unfortunate and presumably unintended. This changes many invocations of `panic!` in a `macro_rules!` definition to invocations of `$crate::panic!`, which makes the invocations hygienic. Note that this does not make the built-in macro `assert!` hygienic.
2020-11-23Qualify `panic!` as `core::panic!` in non-built-in `core` macrosCamelid-467/+445
Otherwise code like this #![no_implicit_prelude] fn main() { ::std::todo!(); ::std::unimplemented!(); } will fail to compile, which is unfortunate and presumably unintended. This changes many invocations of `panic!` in a `macro_rules!` definition to invocations of `$crate::panic!`, which makes the invocations hygienic. Note that this does not make the built-in macro `assert!` hygienic.
2020-11-23Auto merge of #78439 - lzutao:rm-clouldabi, r=Mark-Simulacrumbors-180/+75
Drop support for all cloudabi targets `cloudabi` is a tier-3 target, and [it is no longer being maintained upstream][no]. This PR drops supports for cloudabi targets. Those targets are: * aarch64-unknown-cloudabi * armv7-unknown-cloudabi * i686-unknown-cloudabi * x86_64-unknown-cloudabi Since this drops supports for a target, I'd like somebody to tag `relnotes` label to this PR. Some other issues: * The tidy exception for `cloudabi` crate is still remained because * `parking_lot v0.9.0` and `parking_lot v0.10.2` depends on `cloudabi v0.0.3`. * `parking_lot v0.11.0` depends on `cloudabi v0.1.0`. [no]: https://github.com/NuxiNL/cloudabi#note-this-project-is-unmaintained
2020-11-23Auto merge of #79345 - jonas-schievink:rollup-1yhhzx9, r=jonas-schievinkbors-1/+144
Rollup of 10 pull requests Successful merges: - #76829 (stabilize const_int_pow) - #79080 (MIR visitor: Don't treat debuginfo field access as a use of the struct) - #79236 (const_generics: assert resolve hack causes an error) - #79287 (Allow using generic trait methods in `const fn`) - #79324 (Use Option::and_then instead of open-coding it) - #79325 (Reduce boilerplate with the `?` operator) - #79330 (Fix typo in comment) - #79333 (doc typo) - #79337 (Use Option::map instead of open coding it) - #79343 (Add my (`@flip1995)` work mail to the mailmap) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2020-11-23Rollup merge of #79287 - jonas-schievink:const-trait-impl, r=oli-obkJonas Schievink-0/+144
Allow using generic trait methods in `const fn` Next step for https://github.com/rust-lang/rust/issues/67792, this now also allows code like the following: ```rust struct S; impl const PartialEq for S { fn eq(&self, _: &S) -> bool { true } } const fn equals_self<T: PartialEq>(t: &T) -> bool { *t == *t } pub const EQ: bool = equals_self(&S); ``` This works by threading const-ness of trait predicates through trait selection, in particular through `ParamCandidate`, and exposing it in the resulting `ImplSource`. Since this change makes two bounds `T: Trait` and `T: ?const Trait` that only differ in their const-ness be treated like different bounds, candidate winnowing has been changed to drop the `?const` candidate in favor of the const candidate, to avoid ambiguities when both a const and a non-const bound is present.
2020-11-23Rollup merge of #76829 - tspiteri:const-int-pow, r=oli-obkJonas Schievink-1/+0
stabilize const_int_pow This also requires stabilizing constctlz for const ctlz_nonzero.
2020-11-23Auto merge of #79186 - JulianKnodt:str_from, r=Mark-Simulacrumbors-0/+10
Change slice::to_vec to not use extend_from_slice I saw this [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/String.3A.3Afrom%28.26str%29.20wonky.20codegen/near/216164455), and didn't see any update from it, so I thought I'd try to fix it. This converts `to_vec` to no longer use `extend_from_slice`, but relies on knowing that the allocated capacity is the same size as the input. [Godbolt new v1](https://rust.godbolt.org/z/1bcWKG) [Godbolt new v2 w/ drop guard](https://rust.godbolt.org/z/5jn76K) [Godbolt old version](https://rust.godbolt.org/z/e4ePav) After some amount of iteration, there are now two specializations for `to_vec`, one for `Copy` types that use memcpy, and one for clone types which is the original from this PR. This is then used inside of `impl<T: Clone> FromIterator<Iter::Slice<T>> for Vec<T>` which is essentially equivalent to `&[T] -> Vec<T>`, instead of previous specialization of the `extend` function. This is because extend has to reason more about existing capacity by calling `reserve` on an existing vec, and thus produces worse asm. Downsides: This allocates the exact capacity, so I think if many items are added to this `Vec` after, it might need to allocate whereas extending may not. I also noticed the number of faults went up in the benchmarks, but not sure where from exactly.
2020-11-23Cache pretty-print/retokenize result to avoid compile time blowupAaron Hill-0/+50
Fixes #79242 If a `macro_rules!` recursively builds up a nested nonterminal (passing it to a proc-macro at each step), we will end up repeatedly pretty-printing/retokenizing the same nonterminals. Unfortunately, the 'probable equality' check we do has a non-trivial cost, which leads to a blowup in compilation time. As a workaround, we cache the result of the 'probable equality' check, which eliminates the compilation time blowup for the linked issue. This commit only touches a single file (other than adding tests), so it should be easy to backport. The proper solution is to remove the pretty-print/retokenize hack entirely. However, this will almost certainly break a large number of crates that were relying on hygiene bugs created by using the reparsed `TokenStream`. As a result, we will definitely not want to backport such a change.