提交 5a71e123 编写于 作者: E est31

Fix a byte/char confusion issue in the error emitter

Fixes #44078. Fixes #44023.

The start_col member is given in chars,
while the code previously assumed it was given in bytes.

The more basic issue #44080 doesn't get fixed.
上级 32b50e28
......@@ -311,7 +311,9 @@ fn render_source_line(&self,
if line.annotations.len() == 1 {
if let Some(ref ann) = line.annotations.get(0) {
if let AnnotationType::MultilineStart(depth) = ann.annotation_type {
if source_string[0..ann.start_col].trim() == "" {
if source_string.chars()
.take(ann.start_col)
.all(|c| c.is_whitespace()) {
let style = if ann.is_primary {
Style::UnderlinePrimary
} else {
......
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
#![feature(non_ascii_idents)]
pub fn main () {}
fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
}
error[E0308]: mismatched types
--> $DIR/issue-44023.rs:15:42
|
15 | fn საჭმელად_გემრიელი_სადილი ( ) -> isize {
| __________________________________________^
16 | | }
| |_^ expected isize, found ()
|
= note: expected type `isize`
found type `()`
error: aborting due to previous error
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
fn main() {
"😊"";
}
error: unterminated double quote string
--> $DIR/issue-44078.rs:12:8
|
12 | "😊"";
| ________^
13 | | }
| |__^
error: aborting due to previous error
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册