Skip to content

Commit

Permalink
Auto merge of rust-lang#92352 - matthiaskrgr:rollup-19fbq7u, r=matthi…
Browse files Browse the repository at this point in the history
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#92076 (Ignore other `PredicateKind`s in rustdoc auto trait finder)
 - rust-lang#92219 (Remove VCVARS_BAT)
 - rust-lang#92238 (Add a test suite for stringify macro)
 - rust-lang#92330 (Add myself to .mailmap)
 - rust-lang#92333 (Tighten span when suggesting lifetime on path)
 - rust-lang#92335 (Document units for `std::column`)
 - rust-lang#92344 (:arrow_up: rust-analyzer)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
  • Loading branch information
bors committed Dec 28, 2021
2 parents 442248d + 11c71d2 commit 83b15bf
Show file tree
Hide file tree
Showing 12 changed files with 993 additions and 11 deletions.
1 change: 0 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,6 @@ jobs:
env:
SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-msvc --enable-lld"
VCVARS_BAT: vcvars64.bat
os: windows-latest-xl
- name: x86_64-msvc-tools
env:
Expand Down
1 change: 1 addition & 0 deletions .mailmap
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ Ulrik Sverdrup <bluss@users.noreply.github.com> Ulrik Sverdrup <root@localhost>
Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
Vadim Petrochenkov <vadim.petrochenkov@gmail.com> petrochenkov <vadim.petrochenkov@gmail.com>
Vitali Haravy <HumaneProgrammer@gmail.com> Vitali Haravy <humaneprogrammer@gmail.com>
Wesley Wiser <wwiser@gmail.com> <wesleywiser@microsoft.com>
whitequark <whitequark@whitequark.org>
William Ting <io@williamting.com> <william.h.ting@gmail.com>
Xuefeng Wu <benewu@gmail.com> Xuefeng Wu <xfwu@thoughtworks.com>
Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_ast_lowering/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
// See rustc_resolve::late::lifetimes::LifetimeContext::add_missing_lifetime_specifiers_label
let elided_lifetime_span = if generic_args.span.is_empty() {
// If there are no brackets, use the identifier span.
path_span
// HACK: we use find_ancestor_inside to properly suggest elided spans in paths
// originating from macros, since the segment's span might be from a macro arg.
segment.ident.span.find_ancestor_inside(path_span).unwrap_or(path_span)
} else if generic_args.is_empty() {
// If there are brackets, but not generic arguments, then use the opening bracket
generic_args.span.with_hi(generic_args.span.lo() + BytePos(1))
Expand Down
9 changes: 6 additions & 3 deletions compiler/rustc_resolve/src/late/diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2115,10 +2115,13 @@ impl<'tcx> LifetimeContext<'_, 'tcx> {
let spans_suggs: Vec<_> = formatters
.into_iter()
.zip(spans_with_counts.iter())
.filter_map(|(fmt, (span, _))| {
if let Some(formatter) = fmt { Some((formatter, span)) } else { None }
.filter_map(|(formatter, (span, _))| {
if let Some(formatter) = formatter {
Some((*span, formatter(name)))
} else {
None
}
})
.map(|(formatter, span)| (*span, formatter(name)))
.collect();
if spans_suggs.is_empty() {
// If all the spans come from macros, we cannot extract snippets and then
Expand Down
12 changes: 11 additions & 1 deletion compiler/rustc_trait_selection/src/traits/auto_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,17 @@ impl<'tcx> AutoTraitFinder<'tcx> {
_ => return false,
}
}
_ => panic!("Unexpected predicate {:?} {:?}", ty, predicate),
// There's not really much we can do with these predicates -
// we start out with a `ParamEnv` with no inference variables,
// and these don't correspond to adding any new bounds to
// the `ParamEnv`.
ty::PredicateKind::WellFormed(..)
| ty::PredicateKind::ObjectSafe(..)
| ty::PredicateKind::ClosureKind(..)
| ty::PredicateKind::Subtype(..)
| ty::PredicateKind::ConstEvaluatable(..)
| ty::PredicateKind::Coerce(..)
| ty::PredicateKind::TypeWellFormedFromEnv(..) => {}
};
}
true
Expand Down
12 changes: 12 additions & 0 deletions library/core/src/macros/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,6 +1065,18 @@ pub(crate) mod builtin {
/// let current_col = column!();
/// println!("defined on column: {}", current_col);
/// ```
///
/// `column!` counts Unicode code points, not bytes or graphemes. As a result, the first two
/// invocations return the same value, but the third does not.
///
/// ```
/// let a = ("foobar", column!()).1;
/// let b = ("人之初性本善", column!()).1;
/// let c = ("f̅o̅o̅b̅a̅r̅", column!()).1; // Uses combining overline (U+0305)
///
/// assert_eq!(a, b);
/// assert_ne!(b, c);
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_builtin_macro]
#[macro_export]
Expand Down
1 change: 0 additions & 1 deletion src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,6 @@ jobs:
env:
SCRIPT: python x.py --stage 2 test src/tools/cargotest src/tools/cargo
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-msvc --enable-lld
VCVARS_BAT: vcvars64.bat
<<: *job-windows-xl

- name: x86_64-msvc-tools
Expand Down
34 changes: 34 additions & 0 deletions src/test/ui/in-band-lifetimes/missing-lifetime-in-alias.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#![feature(generic_associated_types)]
#![allow(unused)]

trait Trait<'a> {
type Foo;

type Bar<'b>
//~^ NOTE associated type defined here, with 1 lifetime parameter
//~| NOTE
where
Self: 'b;
}

struct Impl<'a>(&'a ());

impl<'a> Trait<'a> for Impl<'a> {
type Foo = &'a ();
type Bar<'b> = &'b ();
}

type A<'a> = Impl<'a>;

type B<'a> = <A<'a> as Trait>::Foo;
//~^ ERROR missing lifetime specifier
//~| NOTE expected named lifetime parameter

type C<'a, 'b> = <A<'a> as Trait>::Bar;
//~^ ERROR missing lifetime specifier
//~| ERROR missing generics for associated type
//~| NOTE expected named lifetime parameter
//~| NOTE these named lifetimes are available to use
//~| NOTE expected 1 lifetime argument

fn main() {}
43 changes: 43 additions & 0 deletions src/test/ui/in-band-lifetimes/missing-lifetime-in-alias.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-in-alias.rs:23:24
|
LL | type B<'a> = <A<'a> as Trait>::Foo;
| ^^^^^ expected named lifetime parameter
|
help: consider using the `'a` lifetime
|
LL | type B<'a> = <A<'a> as Trait<'a>>::Foo;
| ~~~~~~~~~

error[E0106]: missing lifetime specifier
--> $DIR/missing-lifetime-in-alias.rs:27:28
|
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar;
| ^^^^^ expected named lifetime parameter
|
note: these named lifetimes are available to use
--> $DIR/missing-lifetime-in-alias.rs:27:8
|
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar;
| ^^ ^^

error[E0107]: missing generics for associated type `Trait::Bar`
--> $DIR/missing-lifetime-in-alias.rs:27:36
|
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar;
| ^^^ expected 1 lifetime argument
|
note: associated type defined here, with 1 lifetime parameter: `'b`
--> $DIR/missing-lifetime-in-alias.rs:7:10
|
LL | type Bar<'b>
| ^^^ --
help: add missing lifetime argument
|
LL | type C<'a, 'b> = <A<'a> as Trait>::Bar<'a>;
| ~~~~~~~

error: aborting due to 3 previous errors

Some errors have detailed explanations: E0106, E0107.
For more information about an error, try `rustc --explain E0106`.
6 changes: 3 additions & 3 deletions src/test/ui/lint/reasons.stderr
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
warning: hidden lifetime parameters in types are deprecated
--> $DIR/reasons.rs:20:29
--> $DIR/reasons.rs:20:34
|
LL | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
| ^^^^^^^^^^^^^^ expected named lifetime parameter
| ^^^^^^^^^ expected named lifetime parameter
|
= note: explicit anonymous lifetimes aid reasoning about ownership
note: the lint level is defined here
Expand All @@ -13,7 +13,7 @@ LL | #![warn(elided_lifetimes_in_paths,
help: consider using the `'_` lifetime
|
LL | fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
| ~~~~~~~~~~~~~~~~~~
| ~~~~~~~~~~~~~

warning: variable `Social_exchange_psychology` should have a snake case name
--> $DIR/reasons.rs:30:9
Expand Down
Loading

0 comments on commit 83b15bf

Please sign in to comment.